mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 07:31:53 +00:00
Provide two overloads of AnalyzeNewNode.
The first can update the SDNode in an SDValue while the second is called with SDNode* and returns a possibly updated SDNode*. This patch has no intended functional impact, but helps eliminating ugly temporary SDValues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55608 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1189f3ac3b
commit
ed63214fcb
@ -221,11 +221,11 @@ NodeDone:
|
||||
/// AnalyzeNewNode - The specified node is the root of a subtree of potentially
|
||||
/// new nodes. Correct any processed operands (this may change the node) and
|
||||
/// calculate the NodeId.
|
||||
void DAGTypeLegalizer::AnalyzeNewNode(SDValue &Val) {
|
||||
SDNode * const N(Val.getNode());
|
||||
/// Returns the potentially changed node.
|
||||
SDNode *DAGTypeLegalizer::AnalyzeNewNode(SDNode *N) {
|
||||
// If this was an existing node that is already done, we're done.
|
||||
if (N->getNodeId() != NewNode)
|
||||
return;
|
||||
return N;
|
||||
|
||||
// Remove any stale map entries.
|
||||
ExpungeNode(N);
|
||||
@ -268,16 +268,26 @@ void DAGTypeLegalizer::AnalyzeNewNode(SDValue &Val) {
|
||||
|
||||
// Some operands changed - update the node.
|
||||
if (!NewOps.empty())
|
||||
Val.setNode(DAG.UpdateNodeOperands(SDValue(N, 0),
|
||||
&NewOps[0],
|
||||
NewOps.size()).getNode());
|
||||
N = DAG.UpdateNodeOperands(SDValue(N, 0),
|
||||
&NewOps[0],
|
||||
NewOps.size()).getNode();
|
||||
|
||||
SDNode * const Nu(Val.getNode());
|
||||
Nu->setNodeId(Nu->getNumOperands()-NumProcessed);
|
||||
if (Nu->getNodeId() == ReadyToProcess)
|
||||
Worklist.push_back(Nu);
|
||||
N->setNodeId(N->getNumOperands()-NumProcessed);
|
||||
if (N->getNodeId() == ReadyToProcess)
|
||||
Worklist.push_back(N);
|
||||
return N;
|
||||
}
|
||||
|
||||
/// AnalyzeNewNode - call AnalyzeNewNode(SDNode *N)
|
||||
/// and update the node in SDValue if necessary.
|
||||
void DAGTypeLegalizer::AnalyzeNewNode(SDValue &Val) {
|
||||
SDNode *N(Val.getNode());
|
||||
SDNode *M(AnalyzeNewNode(N));
|
||||
if (N != M)
|
||||
Val.setNode(M);
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
/// NodeUpdateListener - This class is a DAGUpdateListener that listens for
|
||||
/// updates to nodes and recomputes their ready state.
|
||||
@ -338,9 +348,7 @@ void DAGTypeLegalizer::ReplaceNodeWith(SDNode *From, SDNode *To) {
|
||||
// If expansion produced new nodes, make sure they are properly marked.
|
||||
ExpungeNode(From);
|
||||
|
||||
SDValue ToNode(To, 0);
|
||||
AnalyzeNewNode(ToNode); // Expunges To.
|
||||
To = ToNode.getNode();
|
||||
To = AnalyzeNewNode(To); // Expunges To.
|
||||
|
||||
assert(From->getNumValues() == To->getNumValues() &&
|
||||
"Node results don't match");
|
||||
|
@ -157,9 +157,7 @@ public:
|
||||
/// for the specified node, adding it to the worklist if ready.
|
||||
SDNode *ReanalyzeNode(SDNode *N) {
|
||||
N->setNodeId(NewNode);
|
||||
SDValue V(N, 0);
|
||||
AnalyzeNewNode(V); // FIXME: ignore the change?
|
||||
return V.getNode();
|
||||
return AnalyzeNewNode(N);
|
||||
}
|
||||
|
||||
void NoteDeletion(SDNode *Old, SDNode *New) {
|
||||
@ -171,6 +169,7 @@ public:
|
||||
|
||||
private:
|
||||
void AnalyzeNewNode(SDValue &Val);
|
||||
SDNode *AnalyzeNewNode(SDNode *N);
|
||||
|
||||
void ReplaceValueWith(SDValue From, SDValue To);
|
||||
void ReplaceNodeWith(SDNode *From, SDNode *To);
|
||||
|
Loading…
Reference in New Issue
Block a user