Limit the number of memory operands in MachineInstr to 2^16 and store the number in padding.

Saves one machine word on MachineInstr (88->80 bytes on x86_64, 48->44 on i386).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2012-03-16 16:39:27 +00:00
parent 87f3dbc446
commit 861ea230a7
2 changed files with 17 additions and 17 deletions

View File

@@ -74,9 +74,10 @@ private:
// anything other than to convey comment
// information to AsmPrinter.
uint16_t NumMemRefs; // information on memory references
mmo_iterator MemRefs;
std::vector<MachineOperand> Operands; // the operands
mmo_iterator MemRefs; // information on memory references
mmo_iterator MemRefsEnd;
MachineBasicBlock *Parent; // Pointer to the owning basic block.
DebugLoc debugLoc; // Source line information.
@@ -284,13 +285,13 @@ public:
/// Access to memory operands of the instruction
mmo_iterator memoperands_begin() const { return MemRefs; }
mmo_iterator memoperands_end() const { return MemRefsEnd; }
bool memoperands_empty() const { return MemRefsEnd == MemRefs; }
mmo_iterator memoperands_end() const { return MemRefs + NumMemRefs; }
bool memoperands_empty() const { return NumMemRefs == 0; }
/// hasOneMemOperand - Return true if this instruction has exactly one
/// MachineMemOperand.
bool hasOneMemOperand() const {
return MemRefsEnd - MemRefs == 1;
return NumMemRefs == 1;
}
/// API for querying MachineInstr properties. They are the same as MCInstrDesc
@@ -888,7 +889,7 @@ public:
/// list. This does not transfer ownership.
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) {
MemRefs = NewMemRefs;
MemRefsEnd = NewMemRefsEnd;
NumMemRefs = NewMemRefsEnd - NewMemRefs;
}
private: