Add non-temporal flags to MachineMemOperand.
authorDavid Greene <greened@obbligato.org>
Mon, 15 Feb 2010 16:48:31 +0000 (16:48 +0000)
committerDavid Greene <greened@obbligato.org>
Mon, 15 Feb 2010 16:48:31 +0000 (16:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96226 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineMemOperand.h
lib/CodeGen/MachineInstr.cpp

index 5dee199c7d1a823421fcdcede3e5da8f3a1d26b7..7272aa5fc127442b644179389e650c2d2ac227cb 100644 (file)
@@ -46,7 +46,11 @@ public:
     /// The memory access writes data.
     MOStore = 2,
     /// The memory access is volatile.
-    MOVolatile = 4
+    MOVolatile = 4,
+    /// The memory access is non-temporal.
+    MONonTemporal = 8,
+    // This is the number of bits we need to represent flags.
+    MOMaxBits = 4
   };
 
   /// MachineMemOperand - Construct an MachineMemOperand object with the
@@ -64,7 +68,7 @@ public:
   const Value *getValue() const { return V; }
 
   /// getFlags - Return the raw flags of the source value, \see MemOperandFlags.
-  unsigned int getFlags() const { return Flags & 7; }
+  unsigned int getFlags() const { return Flags & ((1 << MOMaxBits) - 1); }
 
   /// getOffset - For normal values, this is a byte offset added to the base
   /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex
@@ -80,11 +84,12 @@ public:
 
   /// getBaseAlignment - Return the minimum known alignment in bytes of the
   /// base address, without the offset.
-  uint64_t getBaseAlignment() const { return (1u << (Flags >> 3)) >> 1; }
+  uint64_t getBaseAlignment() const { return (1u << (Flags >> MOMaxBits)) >> 1; }
 
   bool isLoad() const { return Flags & MOLoad; }
   bool isStore() const { return Flags & MOStore; }
   bool isVolatile() const { return Flags & MOVolatile; }
+  bool isNonTemporal() const { return Flags & MONonTemporal; }
 
   /// refineAlignment - Update this MachineMemOperand to reflect the alignment
   /// of MMO, if it has a greater alignment. This must only be used when the
index df61c7457690685025f5900a14325194a244882e..b6d98e8e7b47445b66d0c6e13033c0e56fa1c6f2 100644 (file)
@@ -305,7 +305,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
 MachineMemOperand::MachineMemOperand(const Value *v, unsigned int f,
                                      int64_t o, uint64_t s, unsigned int a)
   : Offset(o), Size(s), V(v),
-    Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {
+    Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)) {
   assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
   assert((isLoad() || isStore()) && "Not a load/store!");
 }
@@ -327,7 +327,8 @@ void MachineMemOperand::refineAlignment(const MachineMemOperand *MMO) {
 
   if (MMO->getBaseAlignment() >= getBaseAlignment()) {
     // Update the alignment value.
-    Flags = (Flags & 7) | ((Log2_32(MMO->getBaseAlignment()) + 1) << 3);
+    Flags = (Flags & ((1 << MOMaxBits) - 1)) |
+      ((Log2_32(MMO->getBaseAlignment()) + 1) << MOMaxBits);
     // Also update the base and offset, because the new alignment may
     // not be applicable with the old ones.
     V = MMO->getValue();