Replace all accesses to User::OperandList with getter and setter methods. NFC.

We don't want anyone to access OperandList directly as its going to be removed
and computed instead.  This uses getter's and setter's instead in which we
can later change the underlying implementation of OperandList.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239620 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Pete Cooper
2015-06-12 17:48:05 +00:00
parent 18dd79c396
commit cff40fc84a
6 changed files with 50 additions and 28 deletions
+4 -4
View File
@@ -49,7 +49,7 @@ void User::allocHungoffUses(unsigned N, bool IsPhi) {
Use *Begin = static_cast<Use*>(::operator new(size));
Use *End = Begin + N;
(void) new(End) Use::UserRef(const_cast<User*>(this), 1);
OperandList = Use::initTags(Begin, End);
setOperandList(Use::initTags(Begin, End));
// Tag this operand list as being a hung off.
HasHungOffUses = true;
}
@@ -63,9 +63,9 @@ void User::growHungoffUses(unsigned NewNumUses, bool IsPhi) {
// space to copy the old uses in to the new space.
assert(NewNumUses > OldNumUses && "realloc must grow num uses");
Use *OldOps = OperandList;
Use *OldOps = getOperandList();
allocHungoffUses(NewNumUses, IsPhi);
Use *NewOps = OperandList;
Use *NewOps = getOperandList();
// Now copy from the old operands list to the new one.
std::copy(OldOps, OldOps + OldNumUses, NewOps);
@@ -90,7 +90,7 @@ void *User::operator new(size_t s, unsigned Us) {
Use *Start = static_cast<Use*>(Storage);
Use *End = Start + Us;
User *Obj = reinterpret_cast<User*>(End);
Obj->OperandList = Start;
Obj->setOperandList(Start);
Obj->HasHungOffUses = false;
Obj->NumOperands = Us;
Use::initTags(Start, End);