From ccf5bbdd40aaa0258eb9671cd11c0bab4a16236e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 30 Jun 2015 20:56:14 +0000 Subject: [PATCH] gcc/ * defaults.h (HAVE_mem_thread_fence, gen_mem_thread_fence) (HAVE_memory_barrier, gen_memory_barrier, HAVE_mem_signal_fence) (gen_mem_signal_fence): Delete. * target-insns.def (mem_signal_fence, mem_thread_fence) (memory_barrier): New targetm instruction patterns. * optabs.c (expand_mem_thread_fence): Use them instead of HAVE_*/gen_* interface. (expand_mem_signal_fence): Likewise. From-SVN: r225209 --- gcc/ChangeLog | 11 +++++++++++ gcc/defaults.h | 30 ------------------------------ gcc/optabs.c | 12 ++++++------ gcc/target-insns.def | 3 +++ 4 files changed, 20 insertions(+), 36 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18c02bdce44..631a3a7e756 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-06-30 Richard Sandiford + + * defaults.h (HAVE_mem_thread_fence, gen_mem_thread_fence) + (HAVE_memory_barrier, gen_memory_barrier, HAVE_mem_signal_fence) + (gen_mem_signal_fence): Delete. + * target-insns.def (mem_signal_fence, mem_thread_fence) + (memory_barrier): New targetm instruction patterns. + * optabs.c (expand_mem_thread_fence): Use them instead of HAVE_*/gen_* + interface. + (expand_mem_signal_fence): Likewise. + 2015-06-30 Richard Sandiford * defaults.h (HAVE_epilogue, gen_epilogue): Delete. diff --git a/gcc/defaults.h b/gcc/defaults.h index 95ec8f7c5cd..011de6343fa 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -1426,36 +1426,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define TARGET_VTABLE_USES_DESCRIPTORS 0 #endif -#ifndef HAVE_mem_thread_fence -#define HAVE_mem_thread_fence 0 -static inline rtx -gen_mem_thread_fence (rtx) -{ - gcc_unreachable (); - return NULL; -} -#endif - -#ifndef HAVE_memory_barrier -#define HAVE_memory_barrier 0 -static inline rtx -gen_memory_barrier () -{ - gcc_unreachable (); - return NULL; -} -#endif - -#ifndef HAVE_mem_signal_fence -#define HAVE_mem_signal_fence 0 -static inline rtx -gen_mem_signal_fence (rtx) -{ - gcc_unreachable (); - return NULL; -} -#endif - #ifndef HAVE_load_multiple #define HAVE_load_multiple 0 static inline rtx diff --git a/gcc/optabs.c b/gcc/optabs.c index 8377c2267e6..163d57dae3d 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -7575,12 +7575,12 @@ expand_asm_memory_barrier (void) void expand_mem_thread_fence (enum memmodel model) { - if (HAVE_mem_thread_fence) - emit_insn (gen_mem_thread_fence (GEN_INT (model))); + if (targetm.have_mem_thread_fence ()) + emit_insn (targetm.gen_mem_thread_fence (GEN_INT (model))); else if (!is_mm_relaxed (model)) { - if (HAVE_memory_barrier) - emit_insn (gen_memory_barrier ()); + if (targetm.have_memory_barrier ()) + emit_insn (targetm.gen_memory_barrier ()); else if (synchronize_libfunc != NULL_RTX) emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0); else @@ -7594,8 +7594,8 @@ expand_mem_thread_fence (enum memmodel model) void expand_mem_signal_fence (enum memmodel model) { - if (HAVE_mem_signal_fence) - emit_insn (gen_mem_signal_fence (GEN_INT (model))); + if (targetm.have_mem_signal_fence ()) + emit_insn (targetm.gen_mem_signal_fence (GEN_INT (model))); else if (!is_mm_relaxed (model)) { /* By default targets are coherent between a thread and the signal diff --git a/gcc/target-insns.def b/gcc/target-insns.def index 8fa81ded852..99f3221b2a2 100644 --- a/gcc/target-insns.def +++ b/gcc/target-insns.def @@ -32,6 +32,9 @@ Instructions should be documented in md.texi rather than here. */ DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1)) DEF_TARGET_INSN (epilogue, (void)) +DEF_TARGET_INSN (mem_signal_fence, (rtx x0)) +DEF_TARGET_INSN (mem_thread_fence, (rtx x0)) +DEF_TARGET_INSN (memory_barrier, (void)) DEF_TARGET_INSN (prologue, (void)) DEF_TARGET_INSN (return, (void)) DEF_TARGET_INSN (sibcall_epilogue, (void)) -- 2.30.2