diff options
author | Chris Lattner <sabre@nondot.org> | 2005-02-05 01:44:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-02-05 01:44:18 +0000 |
commit | 88fe29a1da91017d8390039e3e8baaf2775afa88 (patch) | |
tree | de518085dae157c75506d976e259e4117db58b59 /include | |
parent | 286629736f7453fe0cdf9517e4b141c7086a2e77 (diff) | |
download | external_llvm-88fe29a1da91017d8390039e3e8baaf2775afa88.zip external_llvm-88fe29a1da91017d8390039e3e8baaf2775afa88.tar.gz external_llvm-88fe29a1da91017d8390039e3e8baaf2775afa88.tar.bz2 |
Eliminate the explicit volatile fields in LoadInst and StoreInst. This shrinks
LoadInst from 60 -> 56 bytes and StoreInst from 76 -> 72 bytes.
Note however, that this doesn't actually save any memory on common systems
where 'malloc' returns 8-byte aligned memory, as the saved space is replaced
by useless alignment padding. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Instructions.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 9d0e02f..eb4188b 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -167,14 +167,14 @@ public: // LoadInst Class //===----------------------------------------------------------------------===// -/// LoadInst - an instruction for reading from memory +/// LoadInst - an instruction for reading from memory. This uses the +/// SubclassData field in Value to store whether or not the load is volatile. /// class LoadInst : public UnaryInstruction { - bool Volatile; // True if this is a volatile load - LoadInst(const LoadInst &LI) - : UnaryInstruction(LI.getType(), Load, LI.getOperand(0)), - Volatile(LI.isVolatile()) { + : UnaryInstruction(LI.getType(), Load, LI.getOperand(0)) { + setVolatile(LI.isVolatile()); + #ifndef NDEBUG AssertOK(); #endif @@ -191,11 +191,11 @@ public: /// isVolatile - Return true if this is a load from a volatile memory /// location. /// - bool isVolatile() const { return Volatile; } + bool isVolatile() const { return SubclassData; } /// setVolatile - Specify whether this is a volatile load or not. /// - void setVolatile(bool V) { Volatile = V; } + void setVolatile(bool V) { SubclassData = V; } virtual LoadInst *clone() const; @@ -224,11 +224,10 @@ public: /// class StoreInst : public Instruction { Use Ops[2]; - bool Volatile; // True if this is a volatile store - StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store, Ops, 2), - Volatile(SI.isVolatile()) { + StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store, Ops, 2) { Ops[0].init(SI.Ops[0], this); Ops[1].init(SI.Ops[1], this); + setVolatile(SI.isVolatile()); #ifndef NDEBUG AssertOK(); #endif @@ -245,11 +244,11 @@ public: /// isVolatile - Return true if this is a load from a volatile memory /// location. /// - bool isVolatile() const { return Volatile; } + bool isVolatile() const { return SubclassData; } /// setVolatile - Specify whether this is a volatile load or not. /// - void setVolatile(bool V) { Volatile = V; } + void setVolatile(bool V) { SubclassData = V; } /// Transparently provide more efficient getOperand methods. Value *getOperand(unsigned i) const { |