From a39d798e0af289956848b8583b2f80d4801656ec Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 13 Apr 2006 17:10:48 +0000 Subject: [PATCH] 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 --- lib/Target/PowerPC/PPCISelLowering.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 137b3f95547..daeb5c99fc2 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().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().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().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().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)". -- 2.34.1