[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Aug 17 11:58:52 PDT 2005
Changes in directory llvm/include/llvm/CodeGen:
SelectionDAGNodes.h updated: 1.53 -> 1.54
---
Log message:
Make removeUser more efficient, add a matching addUser.
Fix the setOperands methods I added to update use/def information correctly.
---
Diffs of the changes: (+10 -2)
SelectionDAGNodes.h | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.53 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.54
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.53 Tue Aug 16 20:54:00 2005
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Wed Aug 17 13:58:38 2005
@@ -641,25 +641,33 @@
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;
}
}
}
More information about the llvm-commits
mailing list