+2015-06-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * 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 <richard.sandiford@arm.com>
* defaults.h (HAVE_epilogue, gen_epilogue): Delete.
#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
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
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
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))