simplify MorphNodeTo to take a VTList operand.

llvm-svn: 33868
This commit is contained in:
Chris Lattner 2007-02-04 02:41:42 +00:00
parent 486edfbc6f
commit 3bf17b6fa5
2 changed files with 17 additions and 21 deletions

View File

@ -970,10 +970,10 @@ protected:
/// 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) {
void MorphNodeTo(unsigned Opc, SDVTList L) {
NodeType = Opc;
ValueList = 0;
NumValues = 0;
ValueList = L.VTs;
NumValues = L.NumVTs;
// Clear the operands list, updating used nodes to remove this from their
// use list.
@ -1058,10 +1058,7 @@ class HandleSDNode : public SDNode {
virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
public:
HandleSDNode(SDOperand X) : SDNode(ISD::HANDLENODE, X) {}
~HandleSDNode() {
MorphNodeTo(ISD::HANDLENODE); // Drops operand uses.
}
~HandleSDNode();
SDOperand getValue() const { return getOperand(0); }
};

View File

@ -2085,8 +2085,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
CSEMap.InsertNode(N, IP);
return N;
@ -2105,8 +2104,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
RemoveNodeFromCSEMaps(N);
SDOperand OperandList[] = { Op1 };
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
N->setOperands(OperandList, 1);
CSEMap.InsertNode(N, IP);
return N;
@ -2127,8 +2125,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
SDOperand OperandList[] = { Op1, Op2 };
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
N->setOperands(OperandList, 2);
CSEMap.InsertNode(N, IP); // Memoize the new node.
@ -2149,8 +2146,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
RemoveNodeFromCSEMaps(N);
SDOperand OperandList[] = { Op1, Op2, Op3 };
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
N->setOperands(OperandList, 3);
CSEMap.InsertNode(N, IP); // Memoize the new node.
@ -2169,8 +2165,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
return ON;
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
N->setOperands(Ops, NumOps);
CSEMap.InsertNode(N, IP); // Memoize the new node.
@ -2190,8 +2185,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
RemoveNodeFromCSEMaps(N);
SDOperand OperandList[] = { Op1, Op2 };
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
N->setOperands(OperandList, 2);
CSEMap.InsertNode(N, IP); // Memoize the new node.
@ -2213,8 +2207,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
RemoveNodeFromCSEMaps(N);
SDOperand OperandList[] = { Op1, Op2, Op3 };
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
N->setValueTypes(VTs);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
N->setOperands(OperandList, 3);
CSEMap.InsertNode(N, IP); // Memoize the new node.
@ -2547,6 +2540,12 @@ void VTSDNode::ANCHOR() {}
void LoadSDNode::ANCHOR() {}
void StoreSDNode::ANCHOR() {}
HandleSDNode::~HandleSDNode() {
SDVTList VTs = { 0, 0 };
MorphNodeTo(ISD::HANDLENODE, VTs); // Drops operand uses.
}
/// Profile - Gather unique data for the node.
///
void SDNode::Profile(FoldingSetNodeID &ID) {