[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
Chris Lattner
lattner at persephone.cs.uiuc.edu
Mon Nov 22 21:54:42 PST 2004
Changes in directory llvm/lib/Target/PowerPC:
PPC32ISelSimple.cpp updated: 1.108 -> 1.109
---
Log message:
LA is really addi. Be consistent with operand ordering to avoid confusing the code emitter
---
Diffs of the changes: (+6 -4)
Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.108 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.109
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.108 Sat Nov 20 23:14:06 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Mon Nov 22 23:54:25 2004
@@ -698,14 +698,16 @@
unsigned GlobalBase = makeAnotherReg(Type::IntTy);
unsigned TmpReg = makeAnotherReg(GV->getType());
- unsigned Opcode = (GV->hasWeakLinkage()
- || GV->isExternal()
- || dyn_cast<Function>(GV)) ? PPC::LWZ : PPC::LA;
// Move value at base + distance into return reg
BuildMI(*MBB, IP, PPC::LOADHiAddr, 2, TmpReg)
.addReg(getGlobalBaseReg(MBB, IP)).addGlobalAddress(GV);
- BuildMI(*MBB, IP, Opcode, 2, R).addGlobalAddress(GV).addReg(TmpReg);
+
+ if (GV->hasWeakLinkage() || GV->isExternal() || dyn_cast<Function>(GV)) {
+ BuildMI(*MBB, IP, PPC::LWZ, 2, R).addGlobalAddress(GV).addReg(TmpReg);
+ } else {
+ BuildMI(*MBB, IP, PPC::LA, 2, R).addReg(TmpReg).addGlobalAddress(GV);
+ }
// Add the GV to the list of things whose addresses have been taken.
TM.AddressTaken.insert(GV);
More information about the llvm-commits
mailing list