[llvm-commits] [llvm] r119126 - in /llvm/trunk/lib/Target/PowerPC: PPCFixupKinds.h PPCMCCodeEmitter.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 14 22:12:22 PST 2010
Author: lattner
Date: Mon Nov 15 00:12:22 2010
New Revision: 119126
URL: http://llvm.org/viewvc/llvm-project?rev=119126&view=rev
Log:
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
Modified:
llvm/trunk/lib/Target/PowerPC/PPCFixupKinds.h
llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCFixupKinds.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCFixupKinds.h?rev=119126&r1=119125&r2=119126&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCFixupKinds.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCFixupKinds.h Mon Nov 15 00:12:22 2010
@@ -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
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp?rev=119126&r1=119125&r2=119126&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCCodeEmitter.cpp Mon Nov 15 00:12:22 2010
@@ -43,11 +43,8 @@
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 @@
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;
}
More information about the llvm-commits
mailing list