summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-21 19:47:04 +0000
committerDan Gohman <gohman@apple.com>2009-09-21 19:47:04 +0000
commit28f02fdd76f4efc05d14649e0eec90ce8e71e17e (patch)
tree4871a48055d37956277077fbc4bea72781807c57 /include
parent78a130a31cb8eca6f4c46f80a8cc4e0aff472be0 (diff)
downloadllvm-28f02fdd76f4efc05d14649e0eec90ce8e71e17e.tar.gz
llvm-28f02fdd76f4efc05d14649e0eec90ce8e71e17e.tar.bz2
llvm-28f02fdd76f4efc05d14649e0eec90ce8e71e17e.tar.xz
Change MachineMemOperand's alignment value to be the alignment of
the base pointer, without the offset. This matches MemSDNode's new alignment behavior, and holds more interesting information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineMemOperand.h16
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; }