[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jul 9 17:29:15 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.136 -> 1.137
SelectionDAG.cpp updated: 1.123 -> 1.124
---
Log message:

Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode


---
Diffs of the changes:  (+38 -46)

 LegalizeDAG.cpp  |    7 ++---
 SelectionDAG.cpp |   77 +++++++++++++++++++++++++------------------------------
 2 files changed, 38 insertions(+), 46 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.136 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.137
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.136	Sat Jul  9 19:07:11 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Jul  9 19:29:03 2005
@@ -679,7 +679,7 @@
       Tmp3 = PromoteOp(Node->getOperand(1));
       Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Tmp1, Tmp3, Tmp2,
                            Node->getOperand(3),
-                           Node->getOperand(1).getValueType()); 
+                          DAG.getValueType(Node->getOperand(1).getValueType()));
       break;
 
     case Expand:
@@ -718,8 +718,7 @@
       if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) ||
           Tmp3 != Node->getOperand(2))
         Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Tmp1, Tmp2, Tmp3,
-                             Node->getOperand(3),
-                             cast<MVTSDNode>(Node)->getExtraValueType());
+                             Node->getOperand(3), Node->getOperand(4));
       break;
     case Promote:
     case Expand:
@@ -1482,7 +1481,7 @@
         SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
         Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, DAG.getEntryNode(),
                              Node->getOperand(0), StackSlot,
-                             DAG.getSrcValue(NULL), ExtraVT);
+                             DAG.getSrcValue(NULL), DAG.getValueType(ExtraVT));
         Result = DAG.getNode(ISD::EXTLOAD, Node->getValueType(0),
                              Result, StackSlot, DAG.getSrcValue(NULL), ExtraVT);
       } else {


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.123 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.124
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.123	Sat Jul  9 19:07:11 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Sat Jul  9 19:29:03 2005
@@ -235,7 +235,6 @@
                                      cast<SetCCSDNode>(N)->getCondition(),
                                      N->getValueType(0))));
     break;
-  case ISD::TRUNCSTORE:
   case ISD::EXTLOAD:
   case ISD::SEXTLOAD:
   case ISD::ZEXTLOAD: {
@@ -1465,6 +1464,20 @@
   return getNode(Opcode, VT, Ops);
 }
 
+SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
+                                SDOperand N1, SDOperand N2, SDOperand N3,
+                                SDOperand N4, SDOperand N5) {
+  std::vector<SDOperand> Ops;
+  Ops.reserve(5);
+  Ops.push_back(N1);
+  Ops.push_back(N2);
+  Ops.push_back(N3);
+  Ops.push_back(N4);
+  Ops.push_back(N5);
+  return getNode(Opcode, VT, Ops);
+}
+
+
 SDOperand SelectionDAG::getSrcValue(const Value *V, int Offset) {
   assert((!V || isa<PointerType>(V->getType())) &&
          "SrcValue is not a pointer?");
@@ -1496,6 +1509,27 @@
       else                 // Unconditional branch to false dest.
         return getNode(ISD::BR, MVT::Other, Ops[0], Ops[3]);
     break;
+
+  case ISD::TRUNCSTORE: {
+    assert(Ops.size() == 5 && "TRUNCSTORE takes 5 operands!");
+    MVT::ValueType EVT = cast<VTSDNode>(Ops[4])->getVT();
+#if 0 // FIXME: If the target supports EVT natively, convert to a truncate/store
+    // If this is a truncating store of a constant, convert to the desired type
+    // and store it instead.
+    if (isa<Constant>(Ops[0])) {
+      SDOperand Op = getNode(ISD::TRUNCATE, EVT, N1);
+      if (isa<Constant>(Op))
+        N1 = Op;
+    }
+    // Also for ConstantFP?
+#endif
+    if (Ops[0].getValueType() == EVT)       // Normal store?
+      return getNode(ISD::STORE, VT, Ops[0], Ops[1], Ops[2], Ops[3]);
+    assert(Ops[1].getValueType() > EVT && "Not a truncation?");
+    assert(MVT::isInteger(Ops[1].getValueType()) == MVT::isInteger(EVT) &&
+           "Can't do FP-INT conversion!");
+    break;
+  }
   }
 
   // Memoize nodes.
@@ -1596,47 +1630,6 @@
   return SDOperand(N, 0);
 }
 
-SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,SDOperand N1,
-                                SDOperand N2, SDOperand N3, SDOperand N4,
-                                MVT::ValueType EVT) {
-  switch (Opcode) {
-  default:  assert(0 && "Bad opcode for this accessor!");
-  case ISD::TRUNCSTORE:
-#if 0 // FIXME: If the target supports EVT natively, convert to a truncate/store
-    // If this is a truncating store of a constant, convert to the desired type
-    // and store it instead.
-    if (isa<Constant>(N1)) {
-      SDOperand Op = getNode(ISD::TRUNCATE, EVT, N1);
-      if (isa<Constant>(Op))
-        N1 = Op;
-    }
-    // Also for ConstantFP?
-#endif
-    if (N1.getValueType() == EVT)       // Normal store?
-      return getNode(ISD::STORE, VT, N1, N2, N3, N4);
-    assert(N2.getValueType() > EVT && "Not a truncation?");
-    assert(MVT::isInteger(N2.getValueType()) == MVT::isInteger(EVT) &&
-           "Can't do FP-INT conversion!");
-    break;
-  }
-
-  EVTStruct NN;
-  NN.Opcode = Opcode;
-  NN.VT = VT;
-  NN.EVT = EVT;
-  NN.Ops.push_back(N1);
-  NN.Ops.push_back(N2);
-  NN.Ops.push_back(N3);
-  NN.Ops.push_back(N4);
-
-  SDNode *&N = MVTSDNodes[NN];
-  if (N) return SDOperand(N, 0);
-  N = new MVTSDNode(Opcode, VT, N1, N2, N3, N4, EVT);
-  AllNodes.push_back(N);
-  return SDOperand(N, 0);
-}
-
-
 /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
 /// indicated value.  This method ignores uses of other values defined by this
 /// operation.






More information about the llvm-commits mailing list