summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-23 05:54:25 +0000
committerChris Lattner <sabre@nondot.org>2004-11-23 05:54:25 +0000
commit6500c6d332a50b6a153d57cabd9bf21c6f8e7ac2 (patch)
tree790a99729b797e1724cc72ba0502ccc27474631d /llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
parentc3a739429142fc2e16f54f3aa89b3b8fdacbd00c (diff)
downloadbcm5719-llvm-6500c6d332a50b6a153d57cabd9bf21c6f8e7ac2.tar.gz
bcm5719-llvm-6500c6d332a50b6a153d57cabd9bf21c6f8e7ac2.zip
LA is really addi. Be consistent with operand ordering to avoid confusing the code emitter
llvm-svn: 18138
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 83ace163939..b8546338e86 100644
--- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -698,14 +698,16 @@ void PPC32ISel::copyConstantToRegister(MachineBasicBlock *MBB,
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);
OpenPOWER on IntegriCloud