Add DebugLoc field and simple accessors.
[oota-llvm.git] / include / llvm / CodeGen / MachineMemOperand.h
index 404de0689a03f9411529a1f01194526b023a4ca7..4388c0aab2243aad6c028dcffd3ecf4b34605a3b 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_MEMOPERAND_H
-#define LLVM_CODEGEN_MEMOPERAND_H
+#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H
+#define LLVM_CODEGEN_MACHINEMEMOPERAND_H
 
 namespace llvm {
 
 class Value;
+class FoldingSetNodeID;
 
 //===----------------------------------------------------------------------===//
 /// MachineMemOperand - A description of a memory reference used in the backend.
@@ -29,11 +30,10 @@ class Value;
 /// that aren't explicit in the regular LLVM IR.
 ///
 class MachineMemOperand {
-  const Value *V;
-  unsigned int Flags;
   int64_t Offset;
   uint64_t Size;
-  unsigned int Alignment;
+  const Value *V;
+  unsigned int Flags;
 
 public:
   /// Flags values. These may be or'd together.
@@ -49,8 +49,7 @@ public:
   /// MachineMemOperand - Construct an MachineMemOperand object with the
   /// specified address Value, flags, offset, size, and alignment.
   MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s,
-                    unsigned int a)
-    : V(v), Flags(f), Offset(o), Size(s), Alignment(a) {}
+                    unsigned int a);
 
   /// getValue - Return the base address of the memory access.
   /// Special values are PseudoSourceValue::FPRel, PseudoSourceValue::SPRel,
@@ -59,7 +58,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; }
+  unsigned int getFlags() const { return Flags & 7; }
 
   /// getOffset - For normal values, this is a byte offset added to the base
   /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex
@@ -71,11 +70,15 @@ public:
 
   /// getAlignment - Return the minimum known alignment in bytes of the
   /// memory reference.
-  unsigned int getAlignment() const { return Alignment; }
+  unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; }
 
   bool isLoad() const { return Flags & MOLoad; }
   bool isStore() const { return Flags & MOStore; }
   bool isVolatile() const { return Flags & MOVolatile; }
+
+  /// Profile - Gather unique data for the object.
+  ///
+  void Profile(FoldingSetNodeID &ID) const;
 };
 
 } // End llvm namespace