]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/memmodel.h
Move MEMMODEL_* from coretypes.h to memmodel.h
[thirdparty/gcc.git] / gcc / memmodel.h
index d53eb7bc9d9966c2b1510e584f0fd50b13cde572..f21f5f5557eb9220373efea0901280d4ffc7bff0 100644 (file)
@@ -1,5 +1,5 @@
 /* Prototypes of memory model helper functions.
-   Copyright (C) 2015-2016 Free Software Foundation, Inc.
+   Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -20,6 +20,34 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_MEMMODEL_H
 #define GCC_MEMMODEL_H
 
+/* Suppose that higher bits are target dependent. */
+#define MEMMODEL_MASK ((1<<16)-1)
+
+/* Legacy sync operations set this upper flag in the memory model.  This allows
+   targets that need to do something stronger for sync operations to
+   differentiate with their target patterns and issue a more appropriate insn
+   sequence.  See bugzilla 65697 for background.  */
+#define MEMMODEL_SYNC (1<<15)
+
+/* Memory model without SYNC bit for targets/operations that do not care.  */
+#define MEMMODEL_BASE_MASK (MEMMODEL_SYNC-1)
+
+/* Memory model types for the __atomic* builtins.
+   This must match the order in libstdc++-v3/include/bits/atomic_base.h.  */
+enum memmodel
+{
+  MEMMODEL_RELAXED = 0,
+  MEMMODEL_CONSUME = 1,
+  MEMMODEL_ACQUIRE = 2,
+  MEMMODEL_RELEASE = 3,
+  MEMMODEL_ACQ_REL = 4,
+  MEMMODEL_SEQ_CST = 5,
+  MEMMODEL_LAST = 6,
+  MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC,
+  MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC,
+  MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC
+};
+
 /* Return the memory model from a host integer.  */
 static inline enum memmodel
 memmodel_from_int (unsigned HOST_WIDE_INT val)