summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-17 18:58:38 +0000
committerChris Lattner <sabre@nondot.org>2005-08-17 18:58:38 +0000
commit06d63f429f18a3f1a7c0ce9363b3d75a6e3c1fa5 (patch)
tree96c5df8b5c57fa0d711199bd5c2eddc5e9d1b5c3
parent686d6a1cb2b22d7e82acdba93d70529ed070da9c (diff)
downloadbcm5719-llvm-06d63f429f18a3f1a7c0ce9363b3d75a6e3c1fa5.tar.gz
bcm5719-llvm-06d63f429f18a3f1a7c0ce9363b3d75a6e3c1fa5.zip
Make removeUser more efficient, add a matching addUser.
Fix the setOperands methods I added to update use/def information correctly. llvm-svn: 22832
-rw-r--r--llvm/include/llvm/CodeGen/SelectionDAGNodes.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 930a163848e..3606c430eed 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -641,25 +641,33 @@ protected:
void setOperands(SDOperand Op0) {
Operands.reserve(1);
Operands.push_back(Op0);
+ Op0.Val->Uses.push_back(this);
}
void setOperands(SDOperand Op0, SDOperand Op1) {
Operands.reserve(2);
Operands.push_back(Op0);
Operands.push_back(Op1);
+ Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
}
void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2) {
Operands.reserve(3);
Operands.push_back(Op0);
Operands.push_back(Op1);
Operands.push_back(Op2);
+ Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
+ Op2.Val->Uses.push_back(this);
+ }
+ void addUser(SDNode *User) {
+ Uses.push_back(User);
}
void removeUser(SDNode *User) {
// Remove this user from the operand's use list.
for (unsigned i = Uses.size(); ; --i) {
assert(i != 0 && "Didn't find user!");
if (Uses[i-1] == User) {
- Uses.erase(Uses.begin()+i-1);
- break;
+ Uses[i-1] = Uses.back();
+ Uses.pop_back();
+ return;
}
}
}
OpenPOWER on IntegriCloud