X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FMachineMemOperand.h;h=00a55b57f33473c34daccdbf3518104ecb9eddcd;hb=2c46deb1d07f4588ee70059cdd4c7145f81bc8e8;hp=1ac9080b75d564ba73b6ec05e306dfda402a397d;hpb=95d594cac3737ae1594a391276942a443cac426b;p=oota-llvm.git diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index 1ac9080b75d..00a55b57f33 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -34,22 +34,22 @@ struct MachinePointerInfo { /// If this is null, then the access is to a pointer in the default address /// space. const Value *V; - + /// Offset - This is an offset from the base Value*. int64_t Offset; - + explicit MachinePointerInfo(const Value *v = 0, int64_t offset = 0) : V(v), Offset(offset) {} - + MachinePointerInfo getWithOffset(int64_t O) const { if (V == 0) return MachinePointerInfo(0, 0); return MachinePointerInfo(V, Offset+O); } - + /// getAddrSpace - Return the LLVM IR address space number that this pointer /// points into. unsigned getAddrSpace() const; - + /// getConstantPool - Return a MachinePointerInfo record that refers to the /// constant pool. static MachinePointerInfo getConstantPool(); @@ -57,20 +57,20 @@ struct MachinePointerInfo { /// getFixedStack - Return a MachinePointerInfo record that refers to the /// the specified FrameIndex. static MachinePointerInfo getFixedStack(int FI, int64_t offset = 0); - + /// getJumpTable - Return a MachinePointerInfo record that refers to a /// jump table entry. static MachinePointerInfo getJumpTable(); - + /// getGOT - Return a MachinePointerInfo record that refers to a /// GOT entry. static MachinePointerInfo getGOT(); - + /// getStack - stack pointer relative access. static MachinePointerInfo getStack(int64_t Offset); }; - - + + //===----------------------------------------------------------------------===// /// MachineMemOperand - A description of a memory reference used in the backend. /// Instead of holding a StoreInst or LoadInst, this class holds the address @@ -99,8 +99,11 @@ public: MONonTemporal = 8, /// The memory access is invariant. MOInvariant = 16, + // Target hints allow target passes to annotate memory operations. + MOTargetStartBit = 5, + MOTargetNumBits = 3, // This is the number of bits we need to represent flags. - MOMaxBits = 5 + MOMaxBits = 8 }; /// MachineMemOperand - Construct an MachineMemOperand object with the @@ -110,7 +113,7 @@ public: const MDNode *Ranges = 0); const MachinePointerInfo &getPointerInfo() const { return PtrInfo; } - + /// getValue - Return the base address of the memory access. This may either /// be a normal LLVM IR Value, or one of the special values used in CodeGen. /// Special values are those obtained via @@ -123,6 +126,9 @@ public: /// getFlags - Return the raw flags of the source value, \see MemOperandFlags. unsigned int getFlags() const { return Flags & ((1 << MOMaxBits) - 1); } + /// Bitwise OR the current flags with the given flags. + void setFlags(unsigned f) { Flags |= (f & ((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 /// number. @@ -151,6 +157,15 @@ public: bool isNonTemporal() const { return Flags & MONonTemporal; } bool isInvariant() const { return Flags & MOInvariant; } + /// isUnordered - Returns true if this memory operation doesn't have any + /// ordering constraints other than normal aliasing. Volatile and atomic + /// memory operations can't be reordered. + /// + /// Currently, we don't model the difference between volatile and atomic + /// operations. They should retain their ordering relative to all memory + /// operations. + bool isUnordered() const { return !isVolatile(); } + /// refineAlignment - Update this MachineMemOperand to reflect the alignment /// of MMO, if it has a greater alignment. This must only be used when the /// new alignment applies to all users of this MachineMemOperand.