llvm.org GIT mirror llvm / 35c640a
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 Dan Gohman 12 years ago
1 changed file(s) with 7 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1515 #ifndef LLVM_CODEGEN_MEMOPERAND_H
1616 #define LLVM_CODEGEN_MEMOPERAND_H
1717
18 #include "llvm/Support/MathExtras.h"
19
1820 namespace llvm {
1921
2022 class Value;
2830 /// that aren't explicit in the regular LLVM IR.
2931 ///
3032 class MachineMemOperand {
33 int64_t Offset;
34 uint64_t Size;
3135 const Value *V;
3236 unsigned int Flags;
33 int64_t Offset;
34 uint64_t Size;
35 unsigned int Alignment;
3637
3738 public:
3839 /// Flags values. These may be or'd together.
4950 /// specified address Value, flags, offset, size, and alignment.
5051 MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s,
5152 unsigned int a)
52 : V(v), Flags(f), Offset(o), Size(s), Alignment(a) {}
53 : Offset(o), Size(s), V(v), Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {}
5354
5455 /// getValue - Return the base address of the memory access.
5556 /// Special values are PseudoSourceValue::FPRel, PseudoSourceValue::SPRel,
5859 const Value *getValue() const { return V; }
5960
6061 /// getFlags - Return the raw flags of the source value, \see MemOperandFlags.
61 unsigned int getFlags() const { return Flags; }
62 unsigned int getFlags() const { return Flags & 7; }
6263
6364 /// getOffset - For normal values, this is a byte offset added to the base
6465 /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex
7071
7172 /// getAlignment - Return the minimum known alignment in bytes of the
7273 /// memory reference.
73 unsigned int getAlignment() const { return Alignment; }
74 unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; }
7475
7576 bool isLoad() const { return Flags & MOLoad; }
7677 bool isStore() const { return Flags & MOStore; }