aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commitbf417a6d46d6e1e09fd10e20e863d451924bf083 (patch)
treee621880a2a909c26c4b669817e5c4c258304ef83 /lib
parent1d3a8b0bd88f4a3bc4359c2bf18eda4c62c6b2b2 (diff)
downloadexternal_llvm-bf417a6d46d6e1e09fd10e20e863d451924bf083.zip
external_llvm-bf417a6d46d6e1e09fd10e20e863d451924bf083.tar.gz
external_llvm-bf417a6d46d6e1e09fd10e20e863d451924bf083.tar.bz2
Treat external variables similarly to those with weak linkage: load indirect.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/PPC32ISelSimple.cpp8
-rw-r--r--lib/Target/PowerPC/PowerPCISelSimple.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 8605380..8c212dc 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/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/lib/Target/PowerPC/PowerPCISelSimple.cpp b/lib/Target/PowerPC/PowerPCISelSimple.cpp
index 8605380..8c212dc 100644
--- a/lib/Target/PowerPC/PowerPCISelSimple.cpp
+++ b/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: