summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-07 08:36:50 +0000
committerChris Lattner <sabre@nondot.org>2001-07-07 08:36:50 +0000
commita073acb22d6262e40bef357279fd61ab0ef8b642 (patch)
treeb9a1ef2336895d1d3d250a339370d84b6b99f8d1 /llvm/lib/VMCore/Value.cpp
parent37099990b3d340de8cfa635cd8559ef79e8b2c5f (diff)
downloadbcm5719-llvm-a073acb22d6262e40bef357279fd61ab0ef8b642.tar.gz
bcm5719-llvm-a073acb22d6262e40bef357279fd61ab0ef8b642.zip
Changed the fundemental architecture of Operands for Instructions. Now
Operands are maintained as a vector<Use> in the User class, and operator iterators are provided as before. Getting an operand no longer requires a virtual function call. WARNING: getOperand(x) where x >= getNumOperands() will now assert instead of returning null! llvm-svn: 149
Diffstat (limited to 'llvm/lib/VMCore/Value.cpp')
-rw-r--r--llvm/lib/VMCore/Value.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index fa3c0f60fb4..a051bcb3cc6 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -89,14 +89,13 @@ User::User(const Type *Ty, ValueTy vty, const string &name)
void User::replaceUsesOfWith(Value *From, Value *To) {
if (From == To) return; // Duh what?
- for (unsigned OpNum = 0; Value *D = getOperand(OpNum); ++OpNum) {
- if (D == From) { // Okay, this operand is pointing to our fake def.
+ for (unsigned i = 0, E = getNumOperands(); i != E; ++i)
+ if (getOperand(i) == From) { // Is This operand is pointing to oldval?
// The side effects of this setOperand call include linking to
// "To", adding "this" to the uses list of To, and
// most importantly, removing "this" from the use list of "From".
- setOperand(OpNum, To); // Fix it now...
+ setOperand(i, To); // Fix it now...
}
- }
}
OpenPOWER on IntegriCloud