aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-27 20:43:25 +0000
committerDan Gohman <gohman@apple.com>2008-07-27 20:43:25 +0000
commit8968450305c28444edc3c272d8752a8db0c2f34a (patch)
tree254f94bf8a78f2a8cc7db6d7c40c26cca95c4023 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent6c4942641fae064a8743266af04a658681e97c20 (diff)
Tidy SDNode::use_iterator, and complete the transition to have it
parallel its analogue, Value::value_use_iterator. The operator* method now returns the user, rather than the use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 366cb4c429..c37fa38a05 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -4138,7 +4138,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDOperand FromN, SDOperand To,
while (!From->use_empty()) {
SDNode::use_iterator UI = From->use_begin();
- SDNode *U = UI->getUser();
+ SDNode *U = *UI;
// This node is about to morph, remove its old self from the CSE maps.
RemoveNodeFromCSEMaps(U);
@@ -4187,7 +4187,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From, SDNode *To,
while (!From->use_empty()) {
SDNode::use_iterator UI = From->use_begin();
- SDNode *U = UI->getUser();
+ SDNode *U = *UI;
// This node is about to morph, remove its old self from the CSE maps.
RemoveNodeFromCSEMaps(U);
@@ -4230,7 +4230,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From,
while (!From->use_empty()) {
SDNode::use_iterator UI = From->use_begin();
- SDNode *U = UI->getUser();
+ SDNode *U = *UI;
// This node is about to morph, remove its old self from the CSE maps.
RemoveNodeFromCSEMaps(U);
@@ -4276,16 +4276,9 @@ void SelectionDAG::ReplaceAllUsesOfValueWith(SDOperand From, SDOperand To,
return;
}
- if (From.use_empty()) return;
-
// Get all of the users of From.Val. We want these in a nice,
// deterministically ordered and uniqued set, so we use a SmallSetVector.
- SmallSetVector<SDNode*, 16> Users;
- for (SDNode::use_iterator UI = From.Val->use_begin(),
- E = From.Val->use_end(); UI != E; ++UI) {
- SDNode *User = UI->getUser();
- Users.insert(User);
- }
+ SmallSetVector<SDNode*, 16> Users(From.Val->use_begin(), From.Val->use_end());
while (!Users.empty()) {
// We know that this user uses some value of From. If it is the right
@@ -4350,7 +4343,7 @@ void SelectionDAG::ReplaceAllUsesOfValuesWith(const SDOperand *From,
for (unsigned i = 0; i != Num; ++i)
for (SDNode::use_iterator UI = From[i].Val->use_begin(),
E = From[i].Val->use_end(); UI != E; ++UI)
- Users.push_back(std::make_pair(UI->getUser(), i));
+ Users.push_back(std::make_pair(*UI, i));
while (!Users.empty()) {
// We know that this user uses some value of From. If it is the right
@@ -4556,7 +4549,7 @@ bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) const {
// 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->getSDOperand().ResNo == Value) {
+ if (UI.getUse().getSDOperand().ResNo == Value) {
if (NUses == 0)
return false;
--NUses;
@@ -4574,7 +4567,7 @@ bool SDNode::hasAnyUseOfValue(unsigned Value) const {
assert(Value < getNumValues() && "Bad value!");
for (SDNode::use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI)
- if (UI->getSDOperand().ResNo == Value)
+ if (UI.getUse().getSDOperand().ResNo == Value)
return true;
return false;
@@ -4586,7 +4579,7 @@ bool SDNode::hasAnyUseOfValue(unsigned Value) const {
bool SDNode::isOnlyUserOf(SDNode *N) const {
bool Seen = false;
for (SDNode::use_iterator I = N->use_begin(), E = N->use_end(); I != E; ++I) {
- SDNode *User = I->getUser();
+ SDNode *User = *I;
if (User == this)
Seen = true;
else