Changes in directory llvm/lib/Target/PowerPC:
PPCCodeEmitter.cpp updated: 1.62 -> 1.63 PPCJITInfo.cpp updated: 1.23 -> 1.24 PPCRelocations.h updated: 1.7 -> 1.8 --- Log message: Implement PPC64 relocations types --- Diffs of the changes: (+36 -5) PPCCodeEmitter.cpp | 23 ++++++++++++++++++++--- PPCJITInfo.cpp | 12 +++++++++++- PPCRelocations.h | 6 +++++- 3 files changed, 36 insertions(+), 5 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.62 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.63 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.62 Tue Jul 11 12:58:07 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Wed Jul 12 16:23:20 2006 @@ -162,16 +162,23 @@ switch (MI.getOpcode()) { default: DEBUG(MI.dump()); assert(0 && "Unknown instruction for relocation!"); case PPC::LIS: + case PPC::LIS8: + case PPC::ADDIS8: Reloc = PPC::reloc_absolute_high; // Pointer to symbol break; case PPC::LI: + case PPC::LI8: case PPC::LA: + // Loads. case PPC::LBZ: case PPC::LHA: case PPC::LHZ: case PPC::LWZ: case PPC::LFS: case PPC::LFD: + case PPC::LWZ8: + + // Stores. case PPC::STB: case PPC::STH: case PPC::STW: @@ -179,6 +186,13 @@ case PPC::STFD: Reloc = PPC::reloc_absolute_low; break; + + case PPC::LWA: + case PPC::LD: + case PPC::STD: + case PPC::STD_32: + Reloc = PPC::reloc_absolute_low_ix; + break; } } if (MO.isGlobalAddress()) @@ -197,16 +211,19 @@ rv = MCE.getJumpTableEntryAddress(MO.getJumpTableIndex()); unsigned Opcode = MI.getOpcode(); - if (Opcode == PPC::LIS || Opcode == PPC::ADDIS) { + if (Opcode == PPC::LIS || Opcode == PPC::LIS8 || + Opcode == PPC::ADDIS || Opcode == PPC::ADDIS8) { // lis wants hi16(addr) if ((short)rv < 0) rv += 1 << 16; rv >>= 16; - } else if (Opcode == PPC::LWZ || Opcode == PPC::LA || - Opcode == PPC::LI || + } else if (Opcode == PPC::LWZ || Opcode == PPC::LWZ8 || + Opcode == PPC::LA || + Opcode == PPC::LI || Opcode == PPC::LI8 || Opcode == PPC::LFS || Opcode == PPC::LFD) { // These load opcodes want lo16(addr) rv &= 0xffff; } else { + MI.dump(); assert(0 && "Unknown constant pool or jump table using instruction!"); } } else { Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.23 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.24 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.23 Thu Jun 1 12:17:06 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Wed Jul 12 16:23:20 2006 @@ -207,7 +207,7 @@ case PPC::reloc_absolute_ptr_high: // Pointer relocations. case PPC::reloc_absolute_ptr_low: case PPC::reloc_absolute_high: // high bits of ref -> low 16 of instr - case PPC::reloc_absolute_low: // low bits of ref -> low 16 of instr + case PPC::reloc_absolute_low: { // low bits of ref -> low 16 of instr ResultPtr += MR->getConstantVal(); // If this is a high-part access, get the high-part. @@ -227,6 +227,16 @@ *RelocPos = LowBits | HighBits; // Slam into low 16-bits break; } + case PPC::reloc_absolute_low_ix: { // low bits of ref -> low 14 of instr + ResultPtr += MR->getConstantVal(); + // Do the addition then mask, so the addition does not overflow the 16-bit + // immediate section of the instruction. + unsigned LowBits = (*RelocPos + ResultPtr) & 0xFFFC; + unsigned HighBits = *RelocPos & 0xFFFF0003; + *RelocPos = LowBits | HighBits; // Slam into low 14-bits. + break; + } + } } } Index: llvm/lib/Target/PowerPC/PPCRelocations.h diff -u llvm/lib/Target/PowerPC/PPCRelocations.h:1.7 llvm/lib/Target/PowerPC/PPCRelocations.h:1.8 --- llvm/lib/Target/PowerPC/PPCRelocations.h:1.7 Wed May 24 12:04:04 2006 +++ llvm/lib/Target/PowerPC/PPCRelocations.h Wed Jul 12 16:23:20 2006 @@ -34,9 +34,13 @@ reloc_absolute_high, // reloc_absolute_low - Absolute relocation, for the la instruction (which - // is really an addi). Add the low 16-bits of teh specified global + // is really an addi). Add the low 16-bits of the specified global // address into the low 16-bits of the instruction. reloc_absolute_low, + + // reloc_absolute_low_ix - Absolute relocation for the 64-bit load/store + // instruction which have two implicit zero bits. + reloc_absolute_low_ix, // reloc_absolute_ptr_high - Absolute relocation for references to lazy // pointer stubs. In this case, the relocated instruction should be _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits