From 6500c6d332a50b6a153d57cabd9bf21c6f8e7ac2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 23 Nov 2004 05:54:25 +0000 Subject: LA is really addi. Be consistent with operand ordering to avoid confusing the code emitter llvm-svn: 18138 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp') 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(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(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); -- cgit v1.2.3