Pack MachineInstr fields better.

This shrinks MachineInstr to 64 bytes (from 72).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2013-01-07 23:21:41 +00:00
parent 111e5fe7e0
commit b2c79f2f63
2 changed files with 6 additions and 7 deletions

View File

@ -87,7 +87,7 @@ private:
// anything other than to convey comment
// information to AsmPrinter.
uint16_t NumMemRefs; // information on memory references
uint8_t NumMemRefs; // Information on memory references.
mmo_iterator MemRefs;
DebugLoc debugLoc; // Source line information.
@ -993,7 +993,8 @@ public:
/// list. This does not transfer ownership.
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) {
MemRefs = NewMemRefs;
NumMemRefs = NewMemRefsEnd - NewMemRefs;
NumMemRefs = uint8_t(NewMemRefsEnd - NewMemRefs);
assert(NumMemRefs == NewMemRefsEnd - NewMemRefs && "Too many memrefs");
}
private:

View File

@ -741,16 +741,14 @@ void MachineInstr::RemoveOperand(unsigned OpNo) {
void MachineInstr::addMemOperand(MachineFunction &MF,
MachineMemOperand *MO) {
mmo_iterator OldMemRefs = MemRefs;
uint16_t OldNumMemRefs = NumMemRefs;
unsigned OldNumMemRefs = NumMemRefs;
uint16_t NewNum = NumMemRefs + 1;
unsigned NewNum = NumMemRefs + 1;
mmo_iterator NewMemRefs = MF.allocateMemRefsArray(NewNum);
std::copy(OldMemRefs, OldMemRefs + OldNumMemRefs, NewMemRefs);
NewMemRefs[NewNum - 1] = MO;
MemRefs = NewMemRefs;
NumMemRefs = NewNum;
setMemRefs(NewMemRefs, NewMemRefs + NewNum);
}
bool MachineInstr::hasPropertyInBundle(unsigned Mask, QueryType Type) const {