Implement support for taking the address of constant pool indices, which
authorChris Lattner <sabre@nondot.org>
Thu, 25 Aug 2005 05:04:11 +0000 (05:04 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 25 Aug 2005 05:04:11 +0000 (05:04 +0000)
is used by the int -> FP code among other things.  This gets
2005-05-12-Int64ToFP past that failure, to dying on lack of support for add_parts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23042 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelDAGToDAG.cpp

index 62fe16537e6e2e24eebbd0e418d89fdbe574109f..0ed454033bb9869a80d469c2e221c01c3a02bdbd 100644 (file)
@@ -557,6 +557,16 @@ SDOperand PPC32DAGToDAGISel::Select(SDOperand Op) {
                          getI32Imm(0));
     break;
   }
+  case ISD::ConstantPool: {
+    unsigned CPIIdx = cast<ConstantPoolSDNode>(N)->getIndex();
+    SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(CPIIdx, MVT::i32);
+    if (PICEnabled)
+      Tmp = CurDAG->getTargetNode(PPC::ADDIS, MVT::i32, getGlobalBaseReg(),CPI);
+    else
+      Tmp = CurDAG->getTargetNode(PPC::LIS, MVT::i32, CPI);
+    CurDAG->SelectNodeTo(N, MVT::i32, PPC::LA, Tmp, CPI);
+    break;
+  }
   case ISD::GlobalAddress: {
     GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
     SDOperand Tmp;