[llvm-commits] [llvm] r162859 - /llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Aug 29 14:08:52 PDT 2012


Author: stoklund
Date: Wed Aug 29 16:08:52 2012
New Revision: 162859

URL: http://llvm.org/viewvc/llvm-project?rev=162859&view=rev
Log:
Add MachineMemOperand::isUnordered().

This means the same as LoadInst/StoreInst::isUnordered(), and implies
!isVolatile().

Atomic loads and stored are also ordered, and this is the right method
to check if it is safe to reorder memory operations. Ordered atomics
can't be reordered wrt normal loads and stores, which is a stronger
constraint than volatile.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=162859&r1=162858&r2=162859&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Wed Aug 29 16:08:52 2012
@@ -151,6 +151,15 @@
   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.





More information about the llvm-commits mailing list