diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-07 20:05:04 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-07 20:05:04 +0000 |
commit | aba4239d93a5fbbbfca7efe3c1c8fc8254e5bcd3 (patch) | |
tree | 4fd4cdea3ba4deec7a7cccea0bbc447f5d519b3e | |
parent | 604db2aeb99f94376a8babaa04ea94d04d53a027 (diff) | |
download | external_llvm-aba4239d93a5fbbbfca7efe3c1c8fc8254e5bcd3.zip external_llvm-aba4239d93a5fbbbfca7efe3c1c8fc8254e5bcd3.tar.gz external_llvm-aba4239d93a5fbbbfca7efe3c1c8fc8254e5bcd3.tar.bz2 |
Shrink MachineMemOperand by storing the alignment in log form
and rearranging the fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53195 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/MachineMemOperand.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index 404de06..5ab27e9 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -16,6 +16,8 @@ #ifndef LLVM_CODEGEN_MEMOPERAND_H #define LLVM_CODEGEN_MEMOPERAND_H +#include "llvm/Support/MathExtras.h" + namespace llvm { class Value; @@ -29,11 +31,10 @@ class Value; /// that aren't explicit in the regular LLVM IR. /// class MachineMemOperand { - const Value *V; - unsigned int Flags; int64_t Offset; uint64_t Size; - unsigned int Alignment; + const Value *V; + unsigned int Flags; public: /// Flags values. These may be or'd together. @@ -50,7 +51,7 @@ public: /// specified address Value, flags, offset, size, and alignment. MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, unsigned int a) - : V(v), Flags(f), Offset(o), Size(s), Alignment(a) {} + : Offset(o), Size(s), V(v), Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {} /// getValue - Return the base address of the memory access. /// Special values are PseudoSourceValue::FPRel, PseudoSourceValue::SPRel, @@ -59,7 +60,7 @@ public: const Value *getValue() const { return V; } /// getFlags - Return the raw flags of the source value, \see MemOperandFlags. - unsigned int getFlags() const { return Flags; } + unsigned int getFlags() const { return Flags & 7; } /// getOffset - For normal values, this is a byte offset added to the base /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex @@ -71,7 +72,7 @@ public: /// getAlignment - Return the minimum known alignment in bytes of the /// memory reference. - unsigned int getAlignment() const { return Alignment; } + unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; } bool isLoad() const { return Flags & MOLoad; } bool isStore() const { return Flags & MOStore; } |