summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-07-20 20:43:05 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-07-20 20:43:05 +0000
commit8e36261aa8f5ea62c8423090dff84cae6e539e0b (patch)
tree906a8486f977fc9bce6ef4d32db2af3b64e5b3eb /llvm
parent288b211afbaf111812e0fc228db5431828a34162 (diff)
downloadbcm5719-llvm-8e36261aa8f5ea62c8423090dff84cae6e539e0b.tar.gz
bcm5719-llvm-8e36261aa8f5ea62c8423090dff84cae6e539e0b.zip
Treat external variables similarly to those with weak linkage: load indirect.
llvm-svn: 15047
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp8
-rw-r--r--llvm/lib/Target/PowerPC/PowerPCISelSimple.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 8605380e17d..8c212dcf14a 100644
--- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -524,9 +524,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
// GV is located at PC + distance
unsigned CurPC = makeAnotherReg(Type::IntTy);
unsigned TmpReg = makeAnotherReg(GV->getType());
- unsigned Opcode = GV->hasWeakLinkage() ?
- PPC32::LOADLoIndirect :
- PPC32::LOADLoDirect;
+ unsigned Opcode = (GV->hasWeakLinkage() || GV->isExternal()) ?
+ PPC32::LOADLoIndirect : PPC32::LOADLoDirect;
// Move PC to destination reg
BuildMI(*MBB, IP, PPC32::MovePCtoLR, 0, CurPC);
@@ -2481,7 +2480,8 @@ void ISel::emitCastOperation(MachineBasicBlock *MBB,
unsigned SrcReg2 = makeAnotherReg(Type::IntTy);
BuildMI(*MBB, IP, PPC32::OR, 2, SrcReg2).addReg(SrcReg).addReg(SrcReg+1);
BuildMI(*MBB, IP, PPC32::ADDIC, 2, TmpReg).addReg(SrcReg2).addImm(-1);
- BuildMI(*MBB, IP, PPC32::SUBFE, 2, DestReg).addReg(TmpReg).addReg(SrcReg2);
+ BuildMI(*MBB, IP, PPC32::SUBFE, 2, DestReg).addReg(TmpReg)
+ .addReg(SrcReg2);
break;
}
case cFP32:
diff --git a/llvm/lib/Target/PowerPC/PowerPCISelSimple.cpp b/llvm/lib/Target/PowerPC/PowerPCISelSimple.cpp
index 8605380e17d..8c212dcf14a 100644
--- a/llvm/lib/Target/PowerPC/PowerPCISelSimple.cpp
+++ b/llvm/lib/Target/PowerPC/PowerPCISelSimple.cpp
@@ -524,9 +524,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
// GV is located at PC + distance
unsigned CurPC = makeAnotherReg(Type::IntTy);
unsigned TmpReg = makeAnotherReg(GV->getType());
- unsigned Opcode = GV->hasWeakLinkage() ?
- PPC32::LOADLoIndirect :
- PPC32::LOADLoDirect;
+ unsigned Opcode = (GV->hasWeakLinkage() || GV->isExternal()) ?
+ PPC32::LOADLoIndirect : PPC32::LOADLoDirect;
// Move PC to destination reg
BuildMI(*MBB, IP, PPC32::MovePCtoLR, 0, CurPC);
@@ -2481,7 +2480,8 @@ void ISel::emitCastOperation(MachineBasicBlock *MBB,
unsigned SrcReg2 = makeAnotherReg(Type::IntTy);
BuildMI(*MBB, IP, PPC32::OR, 2, SrcReg2).addReg(SrcReg).addReg(SrcReg+1);
BuildMI(*MBB, IP, PPC32::ADDIC, 2, TmpReg).addReg(SrcReg2).addImm(-1);
- BuildMI(*MBB, IP, PPC32::SUBFE, 2, DestReg).addReg(TmpReg).addReg(SrcReg2);
+ BuildMI(*MBB, IP, PPC32::SUBFE, 2, DestReg).addReg(TmpReg)
+ .addReg(SrcReg2);
break;
}
case cFP32:
OpenPOWER on IntegriCloud