llvm.org GIT mirror llvm / ba2b297
Add non-temporal flags to MachineMemOperand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96226 91177308-0d34-0410-b5e6-96231b3b80d8 David Greene 10 years ago
2 changed file(s) with 11 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
4545 /// The memory access writes data.
4646 MOStore = 2,
4747 /// The memory access is volatile.
48 MOVolatile = 4
48 MOVolatile = 4,
49 /// The memory access is non-temporal.
50 MONonTemporal = 8,
51 // This is the number of bits we need to represent flags.
52 MOMaxBits = 4
4953 };
5054
5155 /// MachineMemOperand - Construct an MachineMemOperand object with the
6367 const Value *getValue() const { return V; }
6468
6569 /// getFlags - Return the raw flags of the source value, \see MemOperandFlags.
66 unsigned int getFlags() const { return Flags & 7; }
70 unsigned int getFlags() const { return Flags & ((1 << MOMaxBits) - 1); }
6771
6872 /// getOffset - For normal values, this is a byte offset added to the base
6973 /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex
7983
8084 /// getBaseAlignment - Return the minimum known alignment in bytes of the
8185 /// base address, without the offset.
82 uint64_t getBaseAlignment() const { return (1u << (Flags >> 3)) >> 1; }
86 uint64_t getBaseAlignment() const { return (1u << (Flags >> MOMaxBits)) >> 1; }
8387
8488 bool isLoad() const { return Flags & MOLoad; }
8589 bool isStore() const { return Flags & MOStore; }
8690 bool isVolatile() const { return Flags & MOVolatile; }
91 bool isNonTemporal() const { return Flags & MONonTemporal; }
8792
8893 /// refineAlignment - Update this MachineMemOperand to reflect the alignment
8994 /// of MMO, if it has a greater alignment. This must only be used when the
304304 MachineMemOperand::MachineMemOperand(const Value *v, unsigned int f,
305305 int64_t o, uint64_t s, unsigned int a)
306306 : Offset(o), Size(s), V(v),
307 Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {
307 Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)) {
308308 assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
309309 assert((isLoad() || isStore()) && "Not a load/store!");
310310 }
326326
327327 if (MMO->getBaseAlignment() >= getBaseAlignment()) {
328328 // Update the alignment value.
329 Flags = (Flags & 7) | ((Log2_32(MMO->getBaseAlignment()) + 1) << 3);
329 Flags = (Flags & ((1 << MOMaxBits) - 1)) |
330 ((Log2_32(MMO->getBaseAlignment()) + 1) << MOMaxBits);
330331 // Also update the base and offset, because the new alignment may
331332 // not be applicable with the old ones.
332333 V = MMO->getValue();