[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 13 10:11:00 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.147 -> 1.148
---
Log message:

Force non-darwin targets to use a static relo model.  This fixes PR734: http://llvm.cs.uiuc.edu/PR734 ,
tested by CodeGen/Generic/vector.ll


---
Diffs of the changes:  (+8 -7)

 PPCISelLowering.cpp |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.147 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.148
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.147	Wed Apr 12 14:07:14 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp	Thu Apr 13 12:10:48 2006
@@ -805,7 +805,10 @@
     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 @@
       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 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 @@
       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)".






More information about the llvm-commits mailing list