Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.253 -> 1.254 --- Log message: * Added SDNode::isOnlyUse(). * Fix hasNUsesOfValue(), it should be const. --- Diffs of the changes: (+18 -3) SelectionDAG.cpp | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.253 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.254 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.253 Fri Feb 3 00:51:34 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 5 00:29:23 2006 @@ -2177,7 +2177,7 @@ /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the /// indicated value. This method ignores uses of other values defined by this /// operation. -bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) { +bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const { assert(Value < getNumValues() && "Bad value!"); // If there is only one value, this is easy. @@ -2185,11 +2185,11 @@ return use_size() == NUses; if (Uses.size() < NUses) return false; - SDOperand TheValue(this, Value); + SDOperand TheValue(const_cast<SDNode *>(this), Value); std::set<SDNode*> UsersHandled; - for (std::vector<SDNode*>::iterator UI = Uses.begin(), E = Uses.end(); + for (std::vector<SDNode*>::const_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) { SDNode *User = *UI; if (User->getNumOperands() == 1 || @@ -2207,6 +2207,21 @@ } +// isOnlyUse - Return true if this node is the only use of N. +bool SDNode::isOnlyUse(SDNode *N) const { + bool Seen = false; + for (SDNode::use_iterator I = N->use_begin(), E = N->use_end(); I != E; ++I) { + SDNode *User = *I; + if (User == this) + Seen = true; + else + return false; + } + + return Seen; +} + + const char *SDNode::getOperationName(const SelectionDAG *G) const { switch (getOpcode()) { default: _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits