diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-15 06:12:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-15 06:12:22 +0000 |
commit | 85e37684bf49721f3435eb1647a43a568ef7264b (patch) | |
tree | e49340f2e60cc1d77b8d6b95f8d5bfcb78946747 /llvm/lib/Target/PowerPC | |
parent | 0e3461e417150fc499d99e7fc69cd19d8d200ccf (diff) | |
download | bcm5719-llvm-85e37684bf49721f3435eb1647a43a568ef7264b.tar.gz bcm5719-llvm-85e37684bf49721f3435eb1647a43a568ef7264b.zip |
add a fixup for conditional branches, giving us output like this:
beq cr0, LBB0_4 ; encoding: [0x41,0x82,A,0bAAAAAA00]
; fixup A - offset: 0, value: LBB0_4, kind: fixup_ppc_brcond14
llvm-svn: 119126
Diffstat (limited to 'llvm/lib/Target/PowerPC')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCFixupKinds.h | 7 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCFixupKinds.h b/llvm/lib/Target/PowerPC/PPCFixupKinds.h index d1d44f54ff5..fcf3dbaa6cd 100644 --- a/llvm/lib/Target/PowerPC/PPCFixupKinds.h +++ b/llvm/lib/Target/PowerPC/PPCFixupKinds.h @@ -15,9 +15,14 @@ namespace llvm { namespace PPC { enum Fixups { - // fixup_ppc_br24 - 24-bit PC relative relocation for calls like 'bl'. + // fixup_ppc_br24 - 24-bit PC relative relocation for direct branches like 'b' + // and 'bl'. fixup_ppc_br24 = FirstTargetFixupKind, + /// fixup_ppc_brcond14 - 14-bit PC relative relocation for conditional + /// branches. + fixup_ppc_brcond14, + // Marker LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind diff --git a/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp b/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp index 29cc2cabcbc..53183127c27 100644 --- a/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp +++ b/llvm/lib/Target/PowerPC/PPCMCCodeEmitter.cpp @@ -43,11 +43,8 @@ public: const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { const static MCFixupKindInfo Infos[] = { // name offset bits flags - { "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 }, -#endif + { "fixup_ppc_br24", 6, 24, MCFixupKindInfo::FKF_IsPCRel }, + { "fixup_ppc_brcond14", 16, 14, MCFixupKindInfo::FKF_IsPCRel } }; if (Kind < FirstTargetFixupKind) @@ -115,8 +112,9 @@ unsigned PPCMCCodeEmitter::getCondBrEncoding(const MCInst &MI, unsigned OpNo, 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_brcond14)); return 0; } |