Add support for target DAG nodes that take 4 operands, such as PowerPC's
authorNate Begeman <natebegeman@mac.com>
Thu, 18 Aug 2005 07:30:15 +0000 (07:30 +0000)
committerNate Begeman <natebegeman@mac.com>
Thu, 18 Aug 2005 07:30:15 +0000 (07:30 +0000)
rlwinm.

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

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

index e8f3ff4636e80f95dfd2b2219f71bdab1fc150e2..5fdf46c3fd89ba067a4a66b1c9b8062c091cc5ec 100644 (file)
@@ -226,6 +226,8 @@ public:
                     SDOperand Op1, SDOperand Op2);
   void SelectNodeTo(SDNode *N, MVT::ValueType VT, unsigned TargetOpc,
                     SDOperand Op1, SDOperand Op2, SDOperand Op3);
+  void SelectNodeTo(SDNode *N, MVT::ValueType VT, unsigned TargetOpc,
+                    SDOperand Op1, SDOperand Op2, SDOperand Op3, SDOperand Op4);
   
   SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT,
                           SDOperand Op1) {
index ad0c54586cb3a184f0d710e533adc842fc1c095d..b365d9d2d6f9132bdb725e68504e697252ffa718 100644 (file)
@@ -664,6 +664,15 @@ protected:
     Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
     Op2.Val->Uses.push_back(this);
   }
+  void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3) {
+    Operands.reserve(4);
+    Operands.push_back(Op0);
+    Operands.push_back(Op1);
+    Operands.push_back(Op2);
+    Operands.push_back(Op3);
+    Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
+    Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
+  }
   void addUser(SDNode *User) {
     Uses.push_back(User);
   }
index f413010185bfedfd595976d52ae48b52330f2b06..7f0725efaab2ec02bdb2d97a37623bf7c6d765d2 100644 (file)
@@ -1810,6 +1810,14 @@ void SelectionDAG::SelectNodeTo(SDNode *N, MVT::ValueType VT,
   N->setValueTypes(VT);
   N->setOperands(Op1, Op2, Op3);
 }
+void SelectionDAG::SelectNodeTo(SDNode *N, MVT::ValueType VT,
+                                unsigned TargetOpc, SDOperand Op1,
+                                SDOperand Op2, SDOperand Op3, SDOperand Op4) {
+  RemoveNodeFromCSEMaps(N);
+  N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
+  N->setValueTypes(VT);
+  N->setOperands(Op1, Op2, Op3, Op4);
+}
 
 /// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
 /// This can cause recursive merging of nodes in the DAG.