summaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authormkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-20 01:05:25 +0000
committermkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-20 01:05:25 +0000
commit30c3c4427521f96fb58b6e1debb86da4f113f06f (patch)
tree417412c5d20847fc0d23a560bad46ac7075e732f /gcc/emit-rtl.c
parent0f8e46b16a53c02d7255dcd6b6e9b5bc7f8ec953 (diff)
downloadgcc-30c3c4427521f96fb58b6e1debb86da4f113f06f.tar.gz
* emit-rtl.c (need_atomic_barrier_p): New function.
* emit-rtl.h (need_atomic_barrier_p): Declare it. * config/alpha/alpha.c (alpha_{pre,post}_atomic_barrier): Use it. * config/arm/arm.c (arm_{pre,post}_atomic_barrier): Use it. * config/tilegx/tilegx.c (tile_{pre,post}_atomic_barrier): Use it. * config/mips/mips.c (mips_{pre,post}_atomic_barrier_p): Remove. (mips_process_sync_loop): Use generic version instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188806 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index c82bd61c7e1..9565c618b81 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -6161,4 +6161,29 @@ locator_eq (int loc1, int loc2)
return locator_scope (loc1) == locator_scope (loc2);
}
+
+/* Return true if memory model MODEL requires a pre-operation (release-style)
+ barrier or a post-operation (acquire-style) barrier. While not universal,
+ this function matches behavior of several targets. */
+
+bool
+need_atomic_barrier_p (enum memmodel model, bool pre)
+{
+ switch (model)
+ {
+ case MEMMODEL_RELAXED:
+ case MEMMODEL_CONSUME:
+ return false;
+ case MEMMODEL_RELEASE:
+ return pre;
+ case MEMMODEL_ACQUIRE:
+ return !pre;
+ case MEMMODEL_ACQ_REL:
+ case MEMMODEL_SEQ_CST:
+ return true;
+ default:
+ gcc_unreachable ();
+ }
+}
+
#include "gt-emit-rtl.h"