summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86CodeEmitter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-02-09 22:59:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-02-09 22:59:55 +0000
commitb311a6b3aef7f5badb60529ab5d5f7939b2b6822 (patch)
tree502b1f737bb1743d7a02af7f1fa6e19df324d4ca /llvm/lib/Target/X86/X86CodeEmitter.cpp
parentbf02536262e484f3c44f7db8d7c584f4588ccaa2 (diff)
downloadbcm5719-llvm-b311a6b3aef7f5badb60529ab5d5f7939b2b6822.tar.gz
bcm5719-llvm-b311a6b3aef7f5badb60529ab5d5f7939b2b6822.zip
MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
llvm-svn: 95708
Diffstat (limited to 'llvm/lib/Target/X86/X86CodeEmitter.cpp')
-rw-r--r--llvm/lib/Target/X86/X86CodeEmitter.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86CodeEmitter.cpp b/llvm/lib/Target/X86/X86CodeEmitter.cpp
index 0cfb0cbb0b3..7ee22230b72 100644
--- a/llvm/lib/Target/X86/X86CodeEmitter.cpp
+++ b/llvm/lib/Target/X86/X86CodeEmitter.cpp
@@ -944,6 +944,24 @@ public:
delete DummyF;
}
+ unsigned getNumFixupKinds() const {
+ return 5;
+ }
+
+ MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
+ static MCFixupKindInfo Infos[] = {
+ { "reloc_pcrel_word", 0, 4 * 8 },
+ { "reloc_picrel_word", 0, 4 * 8 },
+ { "reloc_absolute_word", 0, 4 * 8 },
+ { "reloc_absolute_word_sext", 0, 4 * 8 },
+ { "reloc_absolute_dword", 0, 8 * 8 }
+ };
+
+ assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind &&
+ "Invalid kind!");
+ return Infos[Kind - FirstTargetFixupKind];
+ }
+
bool AddRegToInstr(const MCInst &MI, MachineInstr *Instr,
unsigned Start) const {
if (Start + 1 > MI.getNumOperands())
@@ -997,7 +1015,8 @@ public:
AddRegToInstr(MI, Instr, Start + 4));
}
- void EncodeInstruction(const MCInst &MI, raw_ostream &OS) const {
+ void EncodeInstruction(const MCInst &MI, raw_ostream &OS,
+ SmallVectorImpl<MCFixup> &Fixups) const {
// Don't look yet!
// Convert the MCInst to a MachineInstr so we can (ab)use the regular
OpenPOWER on IntegriCloud