aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-04-13 17:10:48 +0000
committerChris Lattner <sabre@nondot.org>2006-04-13 17:10:48 +0000
commita39d798e0af289956848b8583b2f80d4801656ec (patch)
tree1047617d407bc3ff4b84bf7688c756832cd21021 /lib/Target
parent8981f06a44a294714829549ca51f3acf6c4f8e7e (diff)
downloadexternal_llvm-a39d798e0af289956848b8583b2f80d4801656ec.zip
external_llvm-a39d798e0af289956848b8583b2f80d4801656ec.tar.gz
external_llvm-a39d798e0af289956848b8583b2f80d4801656ec.tar.bz2
Force non-darwin targets to use a static relo model. This fixes PR734,
tested by CodeGen/Generic/vector.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index 137b3f9..daeb5c9 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -805,7 +805,10 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
SDOperand CPI = DAG.getTargetConstantPool(C, MVT::i32, CP->getAlignment());
SDOperand Zero = DAG.getConstant(0, MVT::i32);
- if (getTargetMachine().getRelocationModel() == Reloc::Static) {
+ // If this is a non-darwin platform, we don't support non-static relo models
+ // yet.
+ if (getTargetMachine().getRelocationModel() == Reloc::Static ||
+ !getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin()) {
// Generate non-pic code that has direct accesses to the constant pool.
// The address of the global is just (hi(&g)+lo(&g)).
SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, CPI, Zero);
@@ -813,8 +816,6 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
return DAG.getNode(ISD::ADD, MVT::i32, Hi, Lo);
}
- // Only lower ConstantPool on Darwin.
- if (!getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin()) break;
SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, CPI, Zero);
if (getTargetMachine().getRelocationModel() == Reloc::PIC) {
// With PIC, the first instruction is actually "GR+hi(&G)".
@@ -832,7 +833,10 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
SDOperand GA = DAG.getTargetGlobalAddress(GV, MVT::i32, GSDN->getOffset());
SDOperand Zero = DAG.getConstant(0, MVT::i32);
- if (getTargetMachine().getRelocationModel() == Reloc::Static) {
+ // If this is a non-darwin platform, we don't support non-static relo models
+ // yet.
+ if (getTargetMachine().getRelocationModel() == Reloc::Static ||
+ !getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin()) {
// Generate non-pic code that has direct accesses to globals.
// The address of the global is just (hi(&g)+lo(&g)).
SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, GA, Zero);
@@ -840,9 +844,6 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
return DAG.getNode(ISD::ADD, MVT::i32, Hi, Lo);
}
- // Only lower GlobalAddress on Darwin.
- if (!getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin()) break;
-
SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, GA, Zero);
if (getTargetMachine().getRelocationModel() == Reloc::PIC) {
// With PIC, the first instruction is actually "GR+hi(&G)".