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

Chris Lattner lattner at cs.uiuc.edu
Fri Aug 26 10:15:42 PDT 2005



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelDAGToDAG.cpp updated: 1.39 -> 1.40
PPC32ISelPattern.cpp updated: 1.168 -> 1.169
---
Log message:

Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool.  This allows the isel machinery to 
create constants that it will end up deciding are not needed, without them
ending up in the resultant function constant pool.



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

 PPC32ISelDAGToDAG.cpp |    9 +++------
 PPC32ISelPattern.cpp  |    6 ++++--
 2 files changed, 7 insertions(+), 8 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.39 llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.40
--- llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.39	Fri Aug 26 11:38:51 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp	Fri Aug 26 12:15:30 2005
@@ -15,7 +15,6 @@
 #include "PowerPC.h"
 #include "PPC32TargetMachine.h"
 #include "PPC32ISelLowering.h"
-#include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/SSARegMap.h"
@@ -696,11 +695,9 @@
     break;
   }
   case ISD::ConstantFP: {  // FIXME: this should get sucked into the legalizer
-    MachineConstantPool *CP = CurDAG->getMachineFunction().getConstantPool();
     Constant *CFP = ConstantFP::get(Type::FloatTy,
                                     cast<ConstantFPSDNode>(N)->getValue());
-    SDOperand CPN = CurDAG->getConstantPool(CP->getConstantPoolIndex(CFP),
-                                            MVT::i32);
+    SDOperand CPN = CurDAG->getConstantPool(CFP, MVT::i32);
     SDOperand Tmp;
     if (PICEnabled)
       Tmp = CurDAG->getTargetNode(PPC::ADDIS, MVT::i32, getGlobalBaseReg(),CPN);
@@ -723,8 +720,8 @@
     break;
   }
   case ISD::ConstantPool: {
-    unsigned CPIIdx = cast<ConstantPoolSDNode>(N)->getIndex();
-    SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(CPIIdx, MVT::i32);
+    Constant *C = cast<ConstantPoolSDNode>(N)->get();
+    SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i32);
     if (PICEnabled)
       Tmp = CurDAG->getTargetNode(PPC::ADDIS, MVT::i32, getGlobalBaseReg(),CPI);
     else


Index: llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.168 llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.169
--- llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.168	Fri Aug 26 11:38:51 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp	Fri Aug 26 12:15:30 2005
@@ -866,7 +866,8 @@
     return Result;
 
   case ISD::ConstantPool:
-    Tmp1 = cast<ConstantPoolSDNode>(N)->getIndex();
+    Tmp1 = BB->getParent()->getConstantPool()->
+               getConstantPoolIndex(cast<ConstantPoolSDNode>(N)->get());
     Tmp2 = MakeIntReg();
     if (PICEnabled)
       BuildMI(BB, PPC::ADDIS, 2, Tmp2).addReg(getGlobalBaseReg())
@@ -927,7 +928,8 @@
 
     if (ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Address)) {
       Tmp1 = MakeIntReg();
-      int CPI = CP->getIndex();
+      unsigned CPI = BB->getParent()->getConstantPool()->
+        getConstantPoolIndex(CP->get());
       if (PICEnabled)
         BuildMI(BB, PPC::ADDIS, 2, Tmp1).addReg(getGlobalBaseReg())
           .addConstantPoolIndex(CPI);






More information about the llvm-commits mailing list