another selectto
authorAndrew Lenharth <andrewl@lenharth.org>
Mon, 23 Jan 2006 20:59:12 +0000 (20:59 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Mon, 23 Jan 2006 20:59:12 +0000 (20:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25548 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAG.h
include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 79b3371d50d036894406bee5c7a2a64670242fbb..1991cd3efedf91907478c7adc682efc3b109ccb5 100644 (file)
@@ -314,6 +314,10 @@ public:
   SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, 
                          SDOperand Op1, SDOperand Op2, SDOperand Op3, 
                          SDOperand Op4, SDOperand Op5, SDOperand Op6);
+  SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, 
+                         SDOperand Op1, SDOperand Op2, SDOperand Op3,
+                         SDOperand Op4, SDOperand Op5, SDOperand Op6,
+                        SDOperand Op7);
   SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, 
                          MVT::ValueType VT2, SDOperand Op1, SDOperand Op2);
   SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
index 0ee64f6452fea7aaf00bc8942ff36b93e5b5162e..7b4242903144ed50194910b8e96d479e1f20155d 100644 (file)
@@ -839,6 +839,24 @@ protected:
     Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
     Op4.Val->Uses.push_back(this); Op5.Val->Uses.push_back(this);
   }
+  void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3,
+                   SDOperand Op4, SDOperand Op5, SDOperand Op6) {
+    assert(NumOperands == 0 && "Should not have operands yet!");
+    OperandList = new SDOperand[7];
+    OperandList[0] = Op0;
+    OperandList[1] = Op1;
+    OperandList[2] = Op2;
+    OperandList[3] = Op3;
+    OperandList[4] = Op4;
+    OperandList[5] = Op5;
+    OperandList[6] = Op6;
+    NumOperands = 7;
+    Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
+    Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
+    Op4.Val->Uses.push_back(this); Op5.Val->Uses.push_back(this);
+    Op6.Val->Uses.push_back(this);
+  }
+
   void addUser(SDNode *User) {
     Uses.push_back(User);
   }
index 48d1d5c806d9ff46e66fd1c4aa2788cc6c8e03f2..3165fc1d651289be55bfe041c4c2e7ca4224ab98 100644 (file)
@@ -1649,6 +1649,29 @@ SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
   return SDOperand(N, 0);
 }
 
+SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
+                                     MVT::ValueType VT, SDOperand Op1,
+                                     SDOperand Op2, SDOperand Op3,SDOperand Op4,
+                                     SDOperand Op5, SDOperand Op6,
+                                    SDOperand Op7) {
+  // If an identical node already exists, use it.
+  std::vector<SDOperand> OpList;
+  OpList.push_back(Op1); OpList.push_back(Op2); OpList.push_back(Op3);
+  OpList.push_back(Op4); OpList.push_back(Op5); OpList.push_back(Op6);
+  OpList.push_back(Op7);
+  SDNode *&ON = OneResultNodes[std::make_pair(ISD::BUILTIN_OP_END+TargetOpc,
+                                              std::make_pair(VT, OpList))];
+  if (ON) return SDOperand(ON, 0);
+
+  RemoveNodeFromCSEMaps(N);
+  N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
+  N->setValueTypes(VT);
+  N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7);
+  
+  ON = N;   // Memoize the new node.
+  return SDOperand(N, 0);
+}
+
 SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, 
                                      MVT::ValueType VT1, MVT::ValueType VT2,
                                      SDOperand Op1, SDOperand Op2) {