diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-07-27 18:21:10 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-07-27 18:21:10 +0000 |
commit | f141cc46faf6f0525f0baa10b6a6c976301874a5 (patch) | |
tree | 606b1c78ed5faa3eb7e66431a6304442826f6b60 /lib/Target/PowerPC/PPCCodeEmitter.cpp | |
parent | 16620fcbfd12fcd0530e79e121a7e5ff33cb9618 (diff) | |
download | llvm-f141cc46faf6f0525f0baa10b6a6c976301874a5.tar.gz llvm-f141cc46faf6f0525f0baa10b6a6c976301874a5.tar.bz2 llvm-f141cc46faf6f0525f0baa10b6a6c976301874a5.tar.xz |
Resolve BB references with relocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCCodeEmitter.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCCodeEmitter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp index 73b0436fd1..49d3f25f8c 100644 --- a/lib/Target/PowerPC/PPCCodeEmitter.cpp +++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp @@ -180,8 +180,16 @@ int PPCCodeEmitter::getMachineOpValue(MachineInstr &MI, MachineOperand &MO) { MCE.addRelocation(MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), Reloc, MO.getSymbolName(), 0)); } else if (MO.isMachineBasicBlock()) { - unsigned* CurrPC = (unsigned*)(intptr_t)MCE.getCurrentPCValue(); - TM.getJITInfo()->addBBRef(MO.getMachineBasicBlock(), (intptr_t)CurrPC); + unsigned Reloc = 0; + unsigned Opcode = MI.getOpcode(); + if (Opcode == PPC::B || Opcode == PPC::BL || Opcode == PPC::BLA) + Reloc = PPC::reloc_pcrel_bx; + else + // BLT,BLE,BEQ,BGE,BGT,BNE, or other bcx instruction + Reloc = PPC::reloc_pcrel_bcx; + MCE.addRelocation(MachineRelocation::getBB(MCE.getCurrentPCOffset(), + Reloc, + MO.getMachineBasicBlock())); } else if (MO.isConstantPoolIndex() || MO.isJumpTableIndex()) { if (MO.isConstantPoolIndex()) rv = MCE.getConstantPoolEntryAddress(MO.getConstantPoolIndex()); |