Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.366 -> 1.367 --- Log message: Added isPredecessor. --- Diffs of the changes: (+23 -0) SelectionDAG.cpp | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.366 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.367 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.366 Thu Nov 2 19:28:29 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Nov 2 21:05:24 2006 @@ -2563,6 +2563,29 @@ return false; } +static void findPredecessor(SDNode *N, const SDNode *P, bool &found, + std::set<SDNode *> &Visited) { + if (found || !Visited.insert(N).second) + return; + + for (unsigned i = 0, e = N->getNumOperands(); !found && i != e; ++i) { + SDNode *Op = N->getOperand(i).Val; + if (Op == P) { + found = true; + return; + } + findPredecessor(Op, P, found, Visited); + } +} + +// isPredecessor - Return true if this node is a predecessor of N. +bool SDNode::isPredecessor(SDNode *N) const { + std::set<SDNode *> Visited; + bool found = false; + findPredecessor(N, this, found, Visited); + return found; +} + uint64_t SDNode::getConstantOperandVal(unsigned Num) const { assert(Num < NumOperands && "Invalid child # of SDNode!"); return cast<ConstantSDNode>(OperandList[Num])->getValue(); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits