From eb19e40efbd3cae80c908a30cdf4d33450733c45 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 30 Nov 2005 22:45:14 +0000 Subject: [PATCH] Make SelectNodeTo return N git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24548 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/SelectionDAG.h | 58 ++++++++-------- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 84 +++++++++++++---------- 2 files changed, 79 insertions(+), 63 deletions(-) diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index da6bec8ab0c..5f7d2d72499 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -20,7 +20,7 @@ #include #include -#include // FIXME remove eventually, turning map into const char* map. +#include namespace llvm { class TargetLowering; @@ -272,33 +272,35 @@ public: /// SelectNodeTo - These are used for target selectors to *mutate* the /// specified node to have the specified return type, Target opcode, and /// operands. Note that target opcodes are stored as - /// ISD::BUILTIN_OP_END+TargetOpcode in the node opcode field. - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1, SDOperand Op2); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1, SDOperand Op2, SDOperand Op3); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1, SDOperand Op2, SDOperand Op3, SDOperand Op4); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1, SDOperand Op2, SDOperand Op3, SDOperand Op4, - SDOperand Op5); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1, SDOperand Op2, SDOperand Op3, SDOperand Op4, - SDOperand Op5, SDOperand Op6); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, - SDOperand Op3); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, - SDOperand Op3, SDOperand Op4); - void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, - SDOperand Op3, SDOperand Op4, SDOperand Op5); + /// ISD::BUILTIN_OP_END+TargetOpcode in the node opcode field. The 0th value + /// of the resultant node is returned. + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDOperand Op1); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDOperand Op1, SDOperand Op2); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDOperand Op1, SDOperand Op2, SDOperand Op3); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDOperand Op1, SDOperand Op2, SDOperand Op3, + SDOperand Op4); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDOperand Op1, SDOperand Op2, SDOperand Op3, + SDOperand Op4, SDOperand Op5); + 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 VT1, + MVT::ValueType VT2, SDOperand Op1, SDOperand Op2); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, + MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, + SDOperand Op3); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, + MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, + SDOperand Op3, SDOperand Op4); + SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, + MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, + SDOperand Op3, SDOperand Op4, SDOperand Op5); SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT) { return getNode(ISD::BUILTIN_OP_END+Opcode, VT); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 039cd57584f..ac7f0abbbbb 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1415,104 +1415,118 @@ void SelectionDAG::setNodeValueTypes(SDNode *N, MVT::ValueType VT1, /// specified node to have the specified return type, Target opcode, and /// operands. Note that target opcodes are stored as /// ISD::BUILTIN_OP_END+TargetOpcode in the node opcode field. -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N->setValueTypes(VT); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N->setValueTypes(VT); N->setOperands(Op1); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N->setValueTypes(VT); N->setOperands(Op1, Op2); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2, SDOperand Op3) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N->setValueTypes(VT); N->setOperands(Op1, Op2, Op3); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3, SDOperand Op4) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, 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); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3, SDOperand Op4, - SDOperand Op5) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2, SDOperand Op3,SDOperand Op4, + SDOperand Op5) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N->setValueTypes(VT); N->setOperands(Op1, Op2, Op3, Op4, Op5); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT, SDOperand Op1, - SDOperand Op2, SDOperand Op3, SDOperand Op4, - SDOperand Op5, SDOperand Op6) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2, SDOperand Op3,SDOperand Op4, + SDOperand Op5, SDOperand Op6) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); N->setValueTypes(VT); N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT1, MVT::ValueType VT2, - SDOperand Op1, SDOperand Op2) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT1, MVT::ValueType VT2, + SDOperand Op1, SDOperand Op2) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); setNodeValueTypes(N, VT1, VT2); N->setOperands(Op1, Op2); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT1, MVT::ValueType VT2, - SDOperand Op1, SDOperand Op2, SDOperand Op3) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT1, MVT::ValueType VT2, + SDOperand Op1, SDOperand Op2, + SDOperand Op3) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); setNodeValueTypes(N, VT1, VT2); N->setOperands(Op1, Op2, Op3); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT1, MVT::ValueType VT2, - SDOperand Op1, SDOperand Op2, - SDOperand Op3, SDOperand Op4) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT1, MVT::ValueType VT2, + SDOperand Op1, SDOperand Op2, + SDOperand Op3, SDOperand Op4) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); setNodeValueTypes(N, VT1, VT2); N->setOperands(Op1, Op2, Op3, Op4); + return SDOperand(N, 0); } -void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, - MVT::ValueType VT1, MVT::ValueType VT2, - SDOperand Op1, SDOperand Op2, - SDOperand Op3, SDOperand Op4, SDOperand Op5) { +SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT1, MVT::ValueType VT2, + SDOperand Op1, SDOperand Op2, + SDOperand Op3, SDOperand Op4, + SDOperand Op5) { RemoveNodeFromCSEMaps(N); N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); setNodeValueTypes(N, VT1, VT2); N->setOperands(Op1, Op2, Op3, Op4, Op5); + return SDOperand(N, 0); } // ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.