Add two helper functions: isAtLeastAcquire, isAtLeastRelease
authorRobin Morisset <morisset@google.com>
Fri, 15 Aug 2014 22:25:12 +0000 (22:25 +0000)
committerRobin Morisset <morisset@google.com>
Fri, 15 Aug 2014 22:25:12 +0000 (22:25 +0000)
These methods are available on AtomicOrdering values, and will be used
in a later separate patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215779 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Instructions.h

index 308467f7aa17a076265a2eaaf1acda22c43fac8e..f533ef5c37e52fd8e51dd1e3c54faabc7cae9cb6 100644 (file)
@@ -50,6 +50,22 @@ enum SynchronizationScope {
   CrossThread = 1
 };
 
+/// Returns true if the ordering is at least as strong as acquire
+/// (i.e. acquire, acq_rel or seq_cst)
+inline bool isAtLeastAcquire(AtomicOrdering Ord) {
+   return (Ord == Acquire ||
+    Ord == AcquireRelease ||
+    Ord == SequentiallyConsistent);
+}
+
+/// Returns true if the ordering is at least as strong as release
+/// (i.e. release, acq_rel or seq_cst)
+inline bool isAtLeastRelease(AtomicOrdering Ord) {
+return (Ord == Release ||
+    Ord == AcquireRelease ||
+    Ord == SequentiallyConsistent);
+}
+
 //===----------------------------------------------------------------------===//
 //                                AllocaInst Class
 //===----------------------------------------------------------------------===//