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

Chris Lattner lattner at cs.uiuc.edu
Wed May 11 11:57:53 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.105 -> 1.106
---
Log message:

Do not memoize ADJCALLSTACKDOWN nodes, provide a method to hack on them.


---
Diffs of the changes:  (+24 -3)

 SelectionDAG.cpp |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.105 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.106
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.105	Tue May 10 23:50:30 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Wed May 11 13:57:39 2005
@@ -1192,9 +1192,17 @@
 #endif
   }
 
-  SDNode *&N = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))];
-  if (N) return SDOperand(N, 0);
-  N = new SDNode(Opcode, N1, N2);
+  // Memoize this node if possible.
+  SDNode *N;
+  if (Opcode != ISD::ADJCALLSTACKDOWN) {
+    SDNode *&BON = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))];
+    if (BON) return SDOperand(BON, 0);
+
+    BON = N = new SDNode(Opcode, N1, N2);
+  } else {
+    N = new SDNode(ISD::ADJCALLSTACKDOWN, N1, N2);
+  }
+
 
   if (Opcode != ISD::READPORT && Opcode != ISD::READIO)
     N->setValueTypes(VT);
@@ -1205,6 +1213,19 @@
   return SDOperand(N, 0);
 }
 
+// setAdjCallChain - This method changes the token chain of an ADJCALLSTACKDOWN
+// node to be the specified operand.
+void SDNode::setAdjCallChain(SDOperand N) {
+  assert(N.getValueType() == MVT::Other);
+  assert(getOpcode() == ISD::ADJCALLSTACKDOWN && "Cannot adjust this node!");
+
+  Operands[0].Val->removeUser(this);
+  Operands[0] = N;
+  N.Val->Uses.push_back(this);
+}
+
+
+
 SDOperand SelectionDAG::getLoad(MVT::ValueType VT,
                                 SDOperand Chain, SDOperand Ptr, 
                                 SDOperand SV) {






More information about the llvm-commits mailing list