blob: 53960e7980aee70d9a299133714177cdf236dd58 [file] [log] [blame]
Evan Cheng78c10ee2011-07-25 23:24:55 +00001//===-- MCAsmBackend.cpp - Target MC Assembly Backend ----------------------==//
Daniel Dunbare7bd8862010-02-21 21:53:53 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Evan Cheng78c10ee2011-07-25 23:24:55 +000010#include "llvm/MC/MCAsmBackend.h"
Craig Topperf1d0f772012-03-26 06:58:25 +000011#include "llvm/MC/MCFixupKindInfo.h"
Daniel Dunbare7bd8862010-02-21 21:53:53 +000012using namespace llvm;
13
Evan Cheng78c10ee2011-07-25 23:24:55 +000014MCAsmBackend::MCAsmBackend()
Jim Grosbachb4316022012-10-01 22:20:54 +000015 : HasReliableSymbolDifference(false), HasDataInCodeSupport(false) {}
Daniel Dunbare7bd8862010-02-21 21:53:53 +000016
Jim Grosbachb4316022012-10-01 22:20:54 +000017MCAsmBackend::~MCAsmBackend() {}
Daniel Dunbar2761fc42010-12-16 03:20:06 +000018
19const MCFixupKindInfo &
Evan Cheng78c10ee2011-07-25 23:24:55 +000020MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
Daniel Dunbar2761fc42010-12-16 03:20:06 +000021 static const MCFixupKindInfo Builtins[] = {
Akira Hatanaka84bfc2f2011-11-23 22:18:04 +000022 { "FK_Data_1", 0, 8, 0 },
23 { "FK_Data_2", 0, 16, 0 },
24 { "FK_Data_4", 0, 32, 0 },
25 { "FK_Data_8", 0, 64, 0 },
26 { "FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel },
Daniel Dunbar2761fc42010-12-16 03:20:06 +000027 { "FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
Rafael Espindola3a83c402010-12-27 00:36:05 +000028 { "FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel },
Akira Hatanaka84bfc2f2011-11-23 22:18:04 +000029 { "FK_PCRel_8", 0, 64, MCFixupKindInfo::FKF_IsPCRel },
30 { "FK_GPRel_1", 0, 8, 0 },
31 { "FK_GPRel_2", 0, 16, 0 },
32 { "FK_GPRel_4", 0, 32, 0 },
Rafael Espindolace618af2011-12-24 14:47:52 +000033 { "FK_GPRel_8", 0, 64, 0 },
34 { "FK_SecRel_1", 0, 8, 0 },
35 { "FK_SecRel_2", 0, 16, 0 },
36 { "FK_SecRel_4", 0, 32, 0 },
37 { "FK_SecRel_8", 0, 64, 0 }
Daniel Dunbar2761fc42010-12-16 03:20:06 +000038 };
Jim Grosbach2684d9e2012-05-11 01:41:30 +000039
Benjamin Kramere21083a2010-12-28 13:52:52 +000040 assert((size_t)Kind <= sizeof(Builtins) / sizeof(Builtins[0]) &&
Daniel Dunbar2761fc42010-12-16 03:20:06 +000041 "Unknown fixup kind");
42 return Builtins[Kind];
43}