mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-19 19:31:50 +00:00
move MorphNode to out of line and merge setNodeOperands into it. There is
no behavior or performance change here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33869 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
48b8592652
commit
d429bcd4ac
@ -967,22 +967,11 @@ protected:
|
||||
Prev = 0; Next = 0;
|
||||
}
|
||||
|
||||
/// 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, SDVTList L) {
|
||||
NodeType = Opc;
|
||||
ValueList = L.VTs;
|
||||
NumValues = L.NumVTs;
|
||||
|
||||
// Clear the operands list, updating used nodes to remove this from their
|
||||
// use list.
|
||||
for (op_iterator I = op_begin(), E = op_end(); I != E; ++I)
|
||||
I->Val->removeUser(this);
|
||||
delete [] OperandList;
|
||||
OperandList = 0;
|
||||
NumOperands = 0;
|
||||
}
|
||||
/// MorphNodeTo - This frees the operands of the current node, resets the
|
||||
/// opcode, types, and operands to the specified value. This should only be
|
||||
/// used by the SelectionDAG class.
|
||||
void MorphNodeTo(unsigned Opc, SDVTList L,
|
||||
const SDOperand *Ops, unsigned NumOps);
|
||||
|
||||
void setValueTypes(SDVTList L) {
|
||||
assert(NumValues == 0 && "Should not have values yet!");
|
||||
@ -990,18 +979,6 @@ protected:
|
||||
NumValues = L.NumVTs;
|
||||
}
|
||||
|
||||
void setOperands(const SDOperand *Ops, unsigned NumOps) {
|
||||
assert(NumOperands == 0 && "Should not have operands yet!");
|
||||
NumOperands = NumOps;
|
||||
OperandList = new SDOperand[NumOperands];
|
||||
|
||||
for (unsigned i = 0, e = NumOps; i != e; ++i) {
|
||||
OperandList[i] = Ops[i];
|
||||
SDNode *N = OperandList[i].Val;
|
||||
N->Uses.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
void addUser(SDNode *User) {
|
||||
Uses.push_back(User);
|
||||
}
|
||||
|
@ -2064,7 +2064,32 @@ UpdateNodeOperands(SDOperand InN, SDOperand *Ops, unsigned NumOps) {
|
||||
}
|
||||
|
||||
|
||||
/// MorphNodeTo - This frees the operands of the current node, resets the
|
||||
/// opcode, types, and operands to the specified value. This should only be
|
||||
/// used by the SelectionDAG class.
|
||||
void SDNode::MorphNodeTo(unsigned Opc, SDVTList L,
|
||||
const SDOperand *Ops, unsigned NumOps) {
|
||||
NodeType = Opc;
|
||||
ValueList = L.VTs;
|
||||
NumValues = L.NumVTs;
|
||||
|
||||
// Clear the operands list, updating used nodes to remove this from their
|
||||
// use list.
|
||||
for (op_iterator I = op_begin(), E = op_end(); I != E; ++I)
|
||||
I->Val->removeUser(this);
|
||||
delete [] OperandList;
|
||||
|
||||
|
||||
// Assign the new operands.
|
||||
NumOperands = NumOps;
|
||||
OperandList = NumOperands ? new SDOperand[NumOperands] : 0;
|
||||
|
||||
for (unsigned i = 0, e = NumOps; i != e; ++i) {
|
||||
OperandList[i] = Ops[i];
|
||||
SDNode *N = OperandList[i].Val;
|
||||
N->Uses.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// SelectNodeTo - These are used for target selectors to *mutate* the
|
||||
/// specified node to have the specified return type, Target opcode, and
|
||||
@ -2085,7 +2110,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
|
||||
RemoveNodeFromCSEMaps(N);
|
||||
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, 0, 0);
|
||||
|
||||
CSEMap.InsertNode(N, IP);
|
||||
return N;
|
||||
@ -2104,8 +2129,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
RemoveNodeFromCSEMaps(N);
|
||||
SDOperand OperandList[] = { Op1 };
|
||||
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->setOperands(OperandList, 1);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 1);
|
||||
CSEMap.InsertNode(N, IP);
|
||||
return N;
|
||||
}
|
||||
@ -2125,8 +2149,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
|
||||
SDOperand OperandList[] = { Op1, Op2 };
|
||||
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->setOperands(OperandList, 2);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 2);
|
||||
|
||||
CSEMap.InsertNode(N, IP); // Memoize the new node.
|
||||
return N;
|
||||
@ -2146,8 +2169,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
RemoveNodeFromCSEMaps(N);
|
||||
|
||||
SDOperand OperandList[] = { Op1, Op2, Op3 };
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->setOperands(OperandList, 3);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 3);
|
||||
|
||||
CSEMap.InsertNode(N, IP); // Memoize the new node.
|
||||
return N;
|
||||
@ -2165,8 +2187,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
return ON;
|
||||
|
||||
RemoveNodeFromCSEMaps(N);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->setOperands(Ops, NumOps);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps);
|
||||
|
||||
CSEMap.InsertNode(N, IP); // Memoize the new node.
|
||||
return N;
|
||||
@ -2185,8 +2206,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
RemoveNodeFromCSEMaps(N);
|
||||
|
||||
SDOperand OperandList[] = { Op1, Op2 };
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->setOperands(OperandList, 2);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 2);
|
||||
|
||||
CSEMap.InsertNode(N, IP); // Memoize the new node.
|
||||
return N;
|
||||
@ -2207,8 +2227,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
|
||||
RemoveNodeFromCSEMaps(N);
|
||||
|
||||
SDOperand OperandList[] = { Op1, Op2, Op3 };
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs);
|
||||
N->setOperands(OperandList, 3);
|
||||
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, OperandList, 3);
|
||||
|
||||
CSEMap.InsertNode(N, IP); // Memoize the new node.
|
||||
return N;
|
||||
@ -2542,7 +2561,7 @@ void StoreSDNode::ANCHOR() {}
|
||||
|
||||
HandleSDNode::~HandleSDNode() {
|
||||
SDVTList VTs = { 0, 0 };
|
||||
MorphNodeTo(ISD::HANDLENODE, VTs); // Drops operand uses.
|
||||
MorphNodeTo(ISD::HANDLENODE, VTs, 0, 0); // Drops operand uses.
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user