diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-15 05:57:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-15 05:57:53 +0000 |
commit | 79fa37152a81f338b94b93ec0d08f45a5812d6b9 (patch) | |
tree | 24b866960c73fcf3a5744bbbf51b6583da7864d9 /llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp | |
parent | 9e7d8c031323cd9ad89db69f0138ba6f979e47cb (diff) | |
download | bcm5719-llvm-79fa37152a81f338b94b93ec0d08f45a5812d6b9.tar.gz bcm5719-llvm-79fa37152a81f338b94b93ec0d08f45a5812d6b9.zip |
split call operands out to their own encoding class, simplifying
code in the JIT. Use this to form the first fixup for the PPC backend,
giving us stuff like this:
bl L_foo$stub ; encoding: [0b010010AA,A,A,0bAAAAAA01]
; fixup A - offset: 0, value: L_foo$stub, kind: fixup_ppc_br24
llvm-svn: 119123
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp b/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp index bbadcb07918..67ab66537a4 100644 --- a/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp +++ b/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp @@ -14,6 +14,7 @@ #define DEBUG_TYPE "mccodeemitter" #include "PPC.h" #include "PPCRegisterInfo.h" +#include "PPCFixupKinds.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCInst.h" #include "llvm/ADT/Statistic.h" @@ -37,12 +38,12 @@ public: ~PPCMCCodeEmitter() {} - unsigned getNumFixupKinds() const { return 0 /*PPC::NumTargetFixupKinds*/; } + unsigned getNumFixupKinds() const { return PPC::NumTargetFixupKinds; } const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { const static MCFixupKindInfo Infos[] = { // name offset bits flags - { "fixup_arm_pcrel_12", 2, 12, MCFixupKindInfo::FKF_IsPCRel } + { "fixup_ppc_br24", 6, 24, MCFixupKindInfo::FKF_IsPCRel } #if 0 { "fixup_arm_vfp_pcrel_12", 3, 8, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_arm_branch", 1, 24, MCFixupKindInfo::FKF_IsPCRel }, @@ -57,6 +58,9 @@ public: return Infos[Kind - FirstTargetFixupKind]; } + unsigned getCallTargetEncoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl<MCFixup> &Fixups) const; + unsigned get_crbitm_encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl<MCFixup> &Fixups) const; @@ -92,6 +96,18 @@ MCCodeEmitter *llvm::createPPCMCCodeEmitter(const Target &, TargetMachine &TM, } unsigned PPCMCCodeEmitter:: +getCallTargetEncoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl<MCFixup> &Fixups) const { + const MCOperand &MO = MI.getOperand(OpNo); + if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups); + + // Add a fixup for the branch target. + Fixups.push_back(MCFixup::Create(0, MO.getExpr(), + (MCFixupKind)PPC::fixup_ppc_br24)); + return 0; +} + +unsigned PPCMCCodeEmitter:: get_crbitm_encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl<MCFixup> &Fixups) const { const MCOperand &MO = MI.getOperand(OpNo); |