diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-11-23 05:54:25 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-11-23 05:54:25 +0000 |
| commit | 6500c6d332a50b6a153d57cabd9bf21c6f8e7ac2 (patch) | |
| tree | 790a99729b797e1724cc72ba0502ccc27474631d /llvm/lib/Target/PowerPC | |
| parent | c3a739429142fc2e16f54f3aa89b3b8fdacbd00c (diff) | |
| download | bcm5719-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')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PowerPCInstrInfo.td | 2 |
2 files changed, 7 insertions, 5 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); diff --git a/llvm/lib/Target/PowerPC/PowerPCInstrInfo.td b/llvm/lib/Target/PowerPC/PowerPCInstrInfo.td index 4c6b5dc7309..cfd3ad4097c 100644 --- a/llvm/lib/Target/PowerPC/PowerPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PowerPCInstrInfo.td @@ -113,7 +113,7 @@ def ADDICo : DForm_2<13, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), "addic. $rD, $rA, $imm">; def ADDIS : DForm_2<15, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), "addis $rD, $rA, $imm">; -def LA : DForm_2<14, 0, 0, (ops GPRC:$rD, symbolLo:$sym, GPRC:$rA), +def LA : DForm_2<14, 0, 0, (ops GPRC:$rD, GPRC:$rA, symbolLo:$sym), "la $rD, $sym($rA)">; def LOADHiAddr : DForm_2<15, 0, 0, (ops GPRC:$rD, GPRC:$rA, symbolHi:$sym), "addis $rD, $rA, $sym">; |

