diff options
author | David Greene <greened@obbligato.org> | 2010-01-20 20:13:31 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2010-01-20 20:13:31 +0000 |
commit | cf495bc2e505e52ad018da55bed11c7b8bc97db5 (patch) | |
tree | 97821c12347ff9b2b4c0d15c562fb14eeac1c289 /include | |
parent | 1bc76d48d476446f226f06f0aced7efb268f2536 (diff) | |
download | external_llvm-cf495bc2e505e52ad018da55bed11c7b8bc97db5.zip external_llvm-cf495bc2e505e52ad018da55bed11c7b8bc97db5.tar.gz external_llvm-cf495bc2e505e52ad018da55bed11c7b8bc97db5.tar.bz2 |
When XDEBUG is enabled, check for SelectionDAG cycles at some key
points. This will help us find future problems like the one
described in PR6019.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAG.h | 11 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index d55dd7f..33ebd00 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -63,6 +63,10 @@ enum CombineLevel { NoIllegalOperations // Combine may only create legal operations and types. }; +class SelectionDAG; +void checkForCycles(const SDNode *N); +void checkForCycles(const SelectionDAG *DAG); + /// SelectionDAG class - This is used to represent a portion of an LLVM function /// in a low-level Data Dependence DAG representation suitable for instruction /// selection. This DAG is constructed as the first step of instruction @@ -204,7 +208,12 @@ public: const SDValue &setRoot(SDValue N) { assert((!N.getNode() || N.getValueType() == MVT::Other) && "DAG root value is not a chain!"); - return Root = N; + if (N.getNode()) + checkForCycles(N.getNode()); + Root = N; + if (N.getNode()) + checkForCycles(this); + return Root; } /// Combine - This iterates over the nodes in the SelectionDAG, folding diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 6a53155..45a9d40 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -44,6 +44,8 @@ template <typename T> struct DenseMapInfo; template <typename T> struct simplify_type; template <typename T> struct ilist_traits; +void checkForCycles(const SDNode *N); + /// 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 /// SelectionDAG::getVTList(...). @@ -1363,6 +1365,7 @@ protected: OperandList[i].setUser(this); OperandList[i].setInitial(Ops[i]); } + checkForCycles(this); } /// This constructor adds no operands itself; operands can be @@ -1379,6 +1382,7 @@ protected: Ops[0].setInitial(Op0); NumOperands = 1; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with 2 operands. @@ -1389,6 +1393,7 @@ protected: Ops[1].setInitial(Op1); NumOperands = 2; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with 3 operands. @@ -1402,6 +1407,7 @@ protected: Ops[2].setInitial(Op2); NumOperands = 3; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with 4 operands. @@ -1417,6 +1423,7 @@ protected: Ops[3].setInitial(Op3); NumOperands = 4; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with N operands. @@ -1427,6 +1434,7 @@ protected: } NumOperands = N; OperandList = Ops; + checkForCycles(this); } /// DropOperands - Release the operands and set this node to have |