diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-08-16 18:16:24 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-08-16 18:16:24 +0000 |
| commit | ba19325eaeb57776f9d5bfd37adb898353e878ab (patch) | |
| tree | 0711dfdf23ae1dda3d762f9c6ac71a2fc0d8b7e4 /llvm | |
| parent | f22556d3ade94a937c979c381acc537cd746b57c (diff) | |
| download | bcm5719-llvm-ba19325eaeb57776f9d5bfd37adb898353e878ab.tar.gz bcm5719-llvm-ba19325eaeb57776f9d5bfd37adb898353e878ab.zip | |
add some methods for dag->dag isel
llvm-svn: 22800
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/CodeGen/SelectionDAG.h | 19 | ||||
| -rw-r--r-- | llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 30 |
2 files changed, 40 insertions, 9 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h index 79e5014e46b..b05ae25e299 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -204,14 +204,23 @@ public: // getSrcValue - construct a node to track a Value* through the backend SDOperand getSrcValue(const Value* I, int offset = 0); - void replaceAllUsesWith(SDOperand Old, SDOperand New) { - assert(Old != New && "RAUW self!"); - assert(0 && "Unimplemented!"); - } - + + /// 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, MVT::ValueType VT, unsigned TargetOpc, + SDOperand Op1); + void SelectNodeTo(SDNode *N, MVT::ValueType VT, unsigned TargetOpc, + SDOperand Op1, SDOperand Op2); + void SelectNodeTo(SDNode *N, MVT::ValueType VT, unsigned TargetOpc, + SDOperand Op1, SDOperand Op2, SDOperand Op3); + + void dump() const; private: + void RemoveNodeFromCSEMaps(SDNode *N); void DeleteNodeIfDead(SDNode *N, void *NodeSet); /// SimplifySetCC - Try to simplify a setcc built with the specified operands diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index d1273bc1ba1..f0bc0e3ccb5 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -592,10 +592,17 @@ protected: NodeDepth = ND+1; } - virtual ~SDNode() { - // FIXME: Drop uses. - } + virtual ~SDNode() {} + /// MorphNodeTo - This clears the return value and operands list, and sets the + /// opcode of the node to the specified value. This should only be used by + /// the SelectionDAG class. + void MorphNodeTo(unsigned Opc) { + NodeType = Opc; + Values.clear(); + Operands.clear(); + } + void setValueTypes(MVT::ValueType VT) { Values.reserve(1); Values.push_back(VT); @@ -609,7 +616,22 @@ protected: void setValueTypes(std::vector<MVT::ValueType> &VTs) { std::swap(Values, VTs); } - + + void setOperands(SDOperand Op0) { + Operands.reserve(1); + Operands.push_back(Op0); + } + void setOperands(SDOperand Op0, SDOperand Op1) { + Operands.reserve(2); + Operands.push_back(Op0); + Operands.push_back(Op1); + } + void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2) { + Operands.reserve(3); + Operands.push_back(Op0); + Operands.push_back(Op1); + Operands.push_back(Op2); + } void removeUser(SDNode *User) { // Remove this user from the operand's use list. for (unsigned i = Uses.size(); ; --i) { |

