Didn't mean to check these in.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 9 Nov 2007 01:28:33 +0000 (01:28 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 9 Nov 2007 01:28:33 +0000 (01:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43923 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 0731299f3595075564b6ced79bfbbcd31ee2ed85..6e58631f0c1416e324f6cff582427ae2233b20e3 100644 (file)
@@ -1599,17 +1599,21 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
       case 8: LD = DAG.getLoad(MVT::i64, Chain, Addr, NULL, 0); break;
       }
 
-      Addr = LD;
       if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) {
         // For PIC, the sequence is:
         // BRIND(load(Jumptable + index) + RelocBase)
-        // RelocBase can be JumpTable, GOT or some sort of global base.
-        if (PTy != MVT::i32)
-          Addr = DAG.getNode(ISD::SIGN_EXTEND, PTy, Addr);
-        Addr = DAG.getNode(ISD::ADD, PTy, Addr,
-                           TLI.getPICJumpTableRelocBase(Table, DAG));
+        // RelocBase is the JumpTable on PPC and X86, GOT on Alpha
+        SDOperand Reloc;
+        if (TLI.usesGlobalOffsetTable())
+          Reloc = DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, PTy);
+        else
+          Reloc = Table;
+        Addr = (PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD;
+        Addr = DAG.getNode(ISD::ADD, PTy, Addr, Reloc);
+        Result = DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), Addr);
+      } else {
+        Result = DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), LD);
       }
-      Result = DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), Addr);
     }
     }
     break;
index eadfa1fbb2921323c23c2b8e1a5dbc1027e6088c..3708b1cb9a7330804cf643ca5cd09f43104a76b8 100644 (file)
@@ -393,13 +393,6 @@ unsigned TargetLowering::getVectorTypeBreakdown(MVT::ValueType VT,
   return 1;
 }
 
-SDOperand TargetLowering::getPICJumpTableRelocBase(SDOperand Table,
-                                                   SelectionDAG &DAG) const {
-  if (usesGlobalOffsetTable())
-    return DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, getPointerTy());
-  return Table;
-}
-
 //===----------------------------------------------------------------------===//
 //  Optimization Methods
 //===----------------------------------------------------------------------===//