diff options
Diffstat (limited to 'include/llvm/CodeGen/MachineMemOperand.h')
-rw-r--r-- | include/llvm/CodeGen/MachineMemOperand.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index de238e48d1..1b01c4893e 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -16,6 +16,8 @@ #ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H #define LLVM_CODEGEN_MACHINEMEMOPERAND_H +#include "llvm/Support/MathExtras.h" + namespace llvm { class Value; @@ -47,9 +49,9 @@ public: }; /// MachineMemOperand - Construct an MachineMemOperand object with the - /// specified address Value, flags, offset, size, and alignment. + /// specified address Value, flags, offset, size, and base alignment. MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, - unsigned int a); + unsigned int base_alignment); /// getValue - Return the base address of the memory access. This may either /// be a normal LLVM IR Value, or one of the special values used in CodeGen. @@ -72,8 +74,14 @@ public: uint64_t getSize() const { return Size; } /// getAlignment - Return the minimum known alignment in bytes of the - /// memory reference. - unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; } + /// actual memory reference. + uint64_t getAlignment() const { + return MinAlign(getBaseAlignment(), getOffset()); + } + + /// getBaseAlignment - Return the minimum known alignment in bytes of the + /// base address, without the offset. + uint64_t getBaseAlignment() const { return (1u << (Flags >> 3)) >> 1; } bool isLoad() const { return Flags & MOLoad; } bool isStore() const { return Flags & MOStore; } |