llvm.org GIT mirror llvm / 28f02fd
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 Dan Gohman 11 years ago
5 changed file(s) with 17 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
1414
1515 #ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H
1616 #define LLVM_CODEGEN_MACHINEMEMOPERAND_H
17
18 #include "llvm/Support/MathExtras.h"
1719
1820 namespace llvm {
1921
4648 };
4749
4850 /// MachineMemOperand - Construct an MachineMemOperand object with the
49 /// specified address Value, flags, offset, size, and alignment.
51 /// specified address Value, flags, offset, size, and base alignment.
5052 MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s,
51 unsigned int a);
53 unsigned int base_alignment);
5254
5355 /// getValue - Return the base address of the memory access. This may either
5456 /// be a normal LLVM IR Value, or one of the special values used in CodeGen.
7173 uint64_t getSize() const { return Size; }
7274
7375 /// getAlignment - Return the minimum known alignment in bytes of the
74 /// memory reference.
75 unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; }
76 /// actual memory reference.
77 uint64_t getAlignment() const {
78 return MinAlign(getBaseAlignment(), getOffset());
79 }
80
81 /// getBaseAlignment - Return the minimum known alignment in bytes of the
82 /// base address, without the offset.
83 uint64_t getBaseAlignment() const { return (1u << (Flags >> 3)) >> 1; }
7684
7785 bool isLoad() const { return Flags & MOLoad; }
7886 bool isStore() const { return Flags & MOStore; }
283283 int64_t o, uint64_t s, unsigned int a)
284284 : Offset(o), Size(s), V(v),
285285 Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {
286 assert(isPowerOf2_32(a) && "Alignment is not a power of 2!");
286 assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
287287 assert((isLoad() || isStore()) && "Not a load/store!");
288288 }
289289
50145014 dyn_cast(getBasePtr().getNode());
50155015 if (!getSrcValue() && FI)
50165016 return MachineMemOperand(PseudoSourceValue::getFixedStack(FI->getIndex()),
5017 Flags, 0, Size, getAlignment());
5017 Flags, 0, Size, getOriginalAlignment());
50185018 else
50195019 return MachineMemOperand(getSrcValue(), Flags, getSrcValueOffset(),
5020 Size, getAlignment());
5020 Size, getOriginalAlignment());
50215021 }
50225022
50235023 /// Profile - Gather unique data for the node.
472472 else {
473473 MachineMemOperand MMO(PseudoSourceValue::getFixedStack(NewFI),
474474 MMOs[i].getFlags(), MMOs[i].getOffset(),
475 MMOs[i].getSize(), MMOs[i].getAlignment());
475 MMOs[i].getSize(), MMOs[i].getBaseAlignment());
476476 MI->addMemOperand(MF, MMO);
477477 }
478478 }
204204 assert(MFI.getObjectOffset(FrameIndex) != -1);
205205 MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FrameIndex),
206206 Flags,
207 MFI.getObjectOffset(FrameIndex),
207 /*Offset=*/0,
208208 MFI.getObjectSize(FrameIndex),
209209 MFI.getObjectAlignment(FrameIndex));
210210 NewMI->addMemOperand(MF, MMO);