mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
[SelectionDAG] Pass DAG to checkForCycles
Pass the DAG down to checkForCycles from all callers where we have it. This allows target-specific nodes to be printed properly. Also print some missing newlines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -334,7 +334,7 @@ public:
|
|||||||
assert((!N.getNode() || N.getValueType() == MVT::Other) &&
|
assert((!N.getNode() || N.getValueType() == MVT::Other) &&
|
||||||
"DAG root value is not a chain!");
|
"DAG root value is not a chain!");
|
||||||
if (N.getNode())
|
if (N.getNode())
|
||||||
checkForCycles(N.getNode());
|
checkForCycles(N.getNode(), this);
|
||||||
Root = N;
|
Root = N;
|
||||||
if (N.getNode())
|
if (N.getNode())
|
||||||
checkForCycles(this);
|
checkForCycles(this);
|
||||||
|
@ -49,7 +49,7 @@ template <typename T> struct DenseMapInfo;
|
|||||||
template <typename T> struct simplify_type;
|
template <typename T> struct simplify_type;
|
||||||
template <typename T> struct ilist_traits;
|
template <typename T> struct ilist_traits;
|
||||||
|
|
||||||
void checkForCycles(const SDNode *N);
|
void checkForCycles(const SDNode *N, const SelectionDAG *DAG = nullptr);
|
||||||
|
|
||||||
/// SDVTList - This represents a list of ValueType's that has been intern'd by
|
/// SDVTList - This represents a list of ValueType's that has been intern'd by
|
||||||
/// a SelectionDAG. Instances of this simple value class are returned by
|
/// a SelectionDAG. Instances of this simple value class are returned by
|
||||||
|
@ -5956,7 +5956,7 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
|||||||
// count of outstanding operands.
|
// count of outstanding operands.
|
||||||
for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ) {
|
for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ) {
|
||||||
SDNode *N = I++;
|
SDNode *N = I++;
|
||||||
checkForCycles(N);
|
checkForCycles(N, this);
|
||||||
unsigned Degree = N->getNumOperands();
|
unsigned Degree = N->getNumOperands();
|
||||||
if (Degree == 0) {
|
if (Degree == 0) {
|
||||||
// A node with no uses, add it to the result array immediately.
|
// A node with no uses, add it to the result array immediately.
|
||||||
@ -5976,7 +5976,7 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
|||||||
// such that by the time the end is reached all nodes will be sorted.
|
// such that by the time the end is reached all nodes will be sorted.
|
||||||
for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I) {
|
for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I) {
|
||||||
SDNode *N = I;
|
SDNode *N = I;
|
||||||
checkForCycles(N);
|
checkForCycles(N, this);
|
||||||
// N is in sorted position, so all its uses have one less operand
|
// N is in sorted position, so all its uses have one less operand
|
||||||
// that needs to be sorted.
|
// that needs to be sorted.
|
||||||
for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end();
|
for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end();
|
||||||
@ -6001,7 +6001,7 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
SDNode *S = ++I;
|
SDNode *S = ++I;
|
||||||
dbgs() << "Overran sorted position:\n";
|
dbgs() << "Overran sorted position:\n";
|
||||||
S->dumprFull();
|
S->dumprFull(this); dbgs() << "\n";
|
||||||
#endif
|
#endif
|
||||||
llvm_unreachable(nullptr);
|
llvm_unreachable(nullptr);
|
||||||
}
|
}
|
||||||
@ -6590,7 +6590,8 @@ bool ShuffleVectorSDNode::isSplatMask(const int *Mask, EVT VT) {
|
|||||||
#ifdef XDEBUG
|
#ifdef XDEBUG
|
||||||
static void checkForCyclesHelper(const SDNode *N,
|
static void checkForCyclesHelper(const SDNode *N,
|
||||||
SmallPtrSet<const SDNode*, 32> &Visited,
|
SmallPtrSet<const SDNode*, 32> &Visited,
|
||||||
SmallPtrSet<const SDNode*, 32> &Checked) {
|
SmallPtrSet<const SDNode*, 32> &Checked,
|
||||||
|
const llvm::SelectionDAG *DAG) {
|
||||||
// If this node has already been checked, don't check it again.
|
// If this node has already been checked, don't check it again.
|
||||||
if (Checked.count(N))
|
if (Checked.count(N))
|
||||||
return;
|
return;
|
||||||
@ -6598,29 +6599,30 @@ static void checkForCyclesHelper(const SDNode *N,
|
|||||||
// If a node has already been visited on this depth-first walk, reject it as
|
// If a node has already been visited on this depth-first walk, reject it as
|
||||||
// a cycle.
|
// a cycle.
|
||||||
if (!Visited.insert(N)) {
|
if (!Visited.insert(N)) {
|
||||||
dbgs() << "Offending node:\n";
|
|
||||||
N->dumprFull();
|
|
||||||
errs() << "Detected cycle in SelectionDAG\n";
|
errs() << "Detected cycle in SelectionDAG\n";
|
||||||
|
dbgs() << "Offending node:\n";
|
||||||
|
N->dumprFull(DAG); dbgs() << "\n";
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
|
for(unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
|
||||||
checkForCyclesHelper(N->getOperand(i).getNode(), Visited, Checked);
|
checkForCyclesHelper(N->getOperand(i).getNode(), Visited, Checked, DAG);
|
||||||
|
|
||||||
Checked.insert(N);
|
Checked.insert(N);
|
||||||
Visited.erase(N);
|
Visited.erase(N);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void llvm::checkForCycles(const llvm::SDNode *N) {
|
void llvm::checkForCycles(const llvm::SDNode *N,
|
||||||
|
const llvm::SelectionDAG *DAG) {
|
||||||
#ifdef XDEBUG
|
#ifdef XDEBUG
|
||||||
assert(N && "Checking nonexistent SDNode");
|
assert(N && "Checking nonexistent SDNode");
|
||||||
SmallPtrSet<const SDNode*, 32> visited;
|
SmallPtrSet<const SDNode*, 32> visited;
|
||||||
SmallPtrSet<const SDNode*, 32> checked;
|
SmallPtrSet<const SDNode*, 32> checked;
|
||||||
checkForCyclesHelper(N, visited, checked);
|
checkForCyclesHelper(N, visited, checked, DAG);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::checkForCycles(const llvm::SelectionDAG *DAG) {
|
void llvm::checkForCycles(const llvm::SelectionDAG *DAG) {
|
||||||
checkForCycles(DAG->getRoot().getNode());
|
checkForCycles(DAG->getRoot().getNode(), DAG);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user