aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h2
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h9
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp8
3 files changed, 19 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index e8f3ff4636..5fdf46c3fd 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -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) {
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index ad0c54586c..b365d9d2d6 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -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);
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index f413010185..7f0725efaa 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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.