mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user