summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-19 10:43:23 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-19 10:43:23 +0000
commiteaa367f5aebeecb9a06e0e09a4da6613ebdf8e30 (patch)
tree7b086367098afd054ae86464414adde5fa59d8f4 /llvm/lib
parent1bd7171c95a4a2e39fa1f32e6ed316197ebb5e55 (diff)
downloadbcm5719-llvm-eaa367f5aebeecb9a06e0e09a4da6613ebdf8e30.tar.gz
bcm5719-llvm-eaa367f5aebeecb9a06e0e09a4da6613ebdf8e30.zip
MCCodeEmitter: Add target independent fixup flag for is-pc-relative.
llvm-svn: 98954
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp16
-rw-r--r--llvm/lib/MC/MCCodeEmitter.cpp8
-rw-r--r--llvm/lib/Target/X86/X86MCCodeEmitter.cpp8
3 files changed, 12 insertions, 20 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 4d8cc6a763c..74876a501dc 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -10,6 +10,7 @@
#define DEBUG_TYPE "assembler"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCAsmLayout.h"
+#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSymbol.h"
@@ -37,17 +38,6 @@ STATISTIC(EmittedFragments, "Number of emitted assembler fragments");
// object file, which may truncate it. We should detect that truncation where
// invalid and report errors back.
-static bool isFixupKindPCRel(unsigned Kind) {
- switch (Kind) {
- default:
- return false;
- case X86::reloc_pcrel_1byte:
- case X86::reloc_pcrel_4byte:
- case X86::reloc_riprel_4byte:
- return true;
- }
-}
-
/* *** */
MCFragment::MCFragment() : Kind(FragmentType(~0)) {
@@ -258,7 +248,9 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout, MCAsmFixup &Fixup,
Value = Target.getConstant();
- bool IsResolved = true, IsPCRel = isFixupKindPCRel(Fixup.Kind);
+ bool IsPCRel =
+ Emitter.getFixupKindInfo(Fixup.Kind).Flags & MCFixupKindInfo::FKF_IsPCRel;
+ bool IsResolved = true;
if (const MCSymbolRefExpr *A = Target.getSymA()) {
if (A->getSymbol().isDefined())
Value += getSymbolData(A->getSymbol()).getAddress();
diff --git a/llvm/lib/MC/MCCodeEmitter.cpp b/llvm/lib/MC/MCCodeEmitter.cpp
index accb06c8af5..d5132378554 100644
--- a/llvm/lib/MC/MCCodeEmitter.cpp
+++ b/llvm/lib/MC/MCCodeEmitter.cpp
@@ -19,10 +19,10 @@ MCCodeEmitter::~MCCodeEmitter() {
const MCFixupKindInfo &MCCodeEmitter::getFixupKindInfo(MCFixupKind Kind) const {
static const MCFixupKindInfo Builtins[] = {
- { "FK_Data_1", 0, 8 },
- { "FK_Data_2", 0, 16 },
- { "FK_Data_4", 0, 32 },
- { "FK_Data_8", 0, 64 }
+ { "FK_Data_1", 0, 8, 0 },
+ { "FK_Data_2", 0, 16, 0 },
+ { "FK_Data_4", 0, 32, 0 },
+ { "FK_Data_8", 0, 64, 0 }
};
assert(Kind <= 3 && "Unknown fixup kind");
diff --git a/llvm/lib/Target/X86/X86MCCodeEmitter.cpp b/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
index 5afbe704e4f..a9681e6670f 100644
--- a/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
+++ b/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
@@ -43,10 +43,10 @@ public:
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
const static MCFixupKindInfo Infos[] = {
- { "reloc_pcrel_4byte", 0, 4 * 8 },
- { "reloc_pcrel_1byte", 0, 1 * 8 },
- { "reloc_riprel_4byte", 0, 4 * 8 },
- { "reloc_riprel_4byte_movq_load", 0, 4 * 8 }
+ { "reloc_pcrel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel },
+ { "reloc_pcrel_1byte", 0, 1 * 8, MCFixupKindInfo::FKF_IsPCRel },
+ { "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel },
+ { "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel }
};
if (Kind < FirstTargetFixupKind)
OpenPOWER on IntegriCloud