OperandList[i].setUser(this);
SDNode *N = OperandList[i].getVal();
N->addUser(i, this);
- ++N->UsesSize;
DeadNodeSet.erase(N);
}
bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const {
assert(Value < getNumValues() && "Bad value!");
- // If there is only one value, this is easy.
- if (getNumValues() == 1)
- return use_size() == NUses;
- if (use_size() < NUses) return false;
-
- SDOperand TheValue(const_cast<SDNode *>(this), Value);
-
- SmallPtrSet<SDNode*, 32> UsersHandled;
-
// TODO: Only iterate over uses of a given value of the node
for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
- if (*UI == TheValue) {
+ if (UI->getSDOperand().ResNo == Value) {
if (NUses == 0)
return false;
--NUses;
bool SDNode::hasAnyUseOfValue(unsigned Value) const {
assert(Value < getNumValues() && "Bad value!");
- if (use_empty()) return false;
-
- SDOperand TheValue(const_cast<SDNode *>(this), Value);
-
- SmallPtrSet<SDNode*, 32> UsersHandled;
-
- for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
- SDNode *User = UI->getUser();
- if (User->getNumOperands() == 1 ||
- UsersHandled.insert(User)) // First time we've seen this?
- for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i)
- if (User->getOperand(i) == TheValue) {
- return true;
- }
- }
+ for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI)
+ if (UI->getSDOperand().ResNo == Value)
+ return true;
return false;
}
}
if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(this)) {
- cerr << "<" << CSDN->getValue() << ">";
+ cerr << "<" << CSDN->getAPIntValue().toStringUnsigned() << ">";
} else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(this)) {
if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle)
cerr << "<" << CSDN->getValueAPF().convertToFloat() << ">";