From: Richard Sandiford Date: Thu, 26 Jun 2008 21:28:30 +0000 (+0000) Subject: libfuncs.h (LTI_synchronize): New libfunc_index. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e2ff10a93c232352cd9d648baa1070d2982f18cb;p=gcc.git libfuncs.h (LTI_synchronize): New libfunc_index. gcc/ * libfuncs.h (LTI_synchronize): New libfunc_index. (synchronize_libfunc): Declare. * builtins.c (expand_builtin_synchronize): Consider using synchronize_libfunc before falling back on an asm blockage. * config/mips/mips.c: Include libfuncs.h (mips_init_libfuncs): Initialize synchronize_libfunc for TARGET_MIPS16. From-SVN: r137162 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6570991875..3f2a1bd8373 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-06-26 Richard Sandiford + + * libfuncs.h (LTI_synchronize): New libfunc_index. + (synchronize_libfunc): Declare. + * builtins.c (expand_builtin_synchronize): Consider using + synchronize_libfunc before falling back on an asm blockage. + * config/mips/mips.c: Include libfuncs.h + (mips_init_libfuncs): Initialize synchronize_libfunc for TARGET_MIPS16. + 2008-06-26 Nathan Froyd * config/rs6000/rs6000.c (emit_allocate_stack): Add copy_r11 diff --git a/gcc/builtins.c b/gcc/builtins.c index 1039c603795..10af34254aa 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -5999,6 +5999,12 @@ expand_builtin_synchronize (void) } #endif + if (synchronize_libfunc != NULL_RTX) + { + emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0); + return; + } + /* If no explicit memory barrier instruction is available, create an empty asm stmt with a memory clobber. */ x = build4 (ASM_EXPR, void_type_node, build_string (0, ""), NULL, NULL, diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 56180054d74..e8b384e1db2 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "expr.h" #include "optabs.h" +#include "libfuncs.h" #include "flags.h" #include "reload.h" #include "tm_p.h" @@ -9424,6 +9425,11 @@ mips_init_libfuncs (void) else /* Register the gofast functions if selected using --enable-gofast. */ gofast_maybe_init_libfuncs (); + + /* The MIPS16 ISA does not have an encoding for "sync", so we rely + on an external non-MIPS16 routine to implement __sync_synchronize. */ + if (TARGET_MIPS16) + synchronize_libfunc = init_one_libfunc ("__sync_synchronize"); } /* Return the length of INSN. LENGTH is the initial length computed by diff --git a/gcc/libfuncs.h b/gcc/libfuncs.h index f7f6a6299c4..ef636da36bb 100644 --- a/gcc/libfuncs.h +++ b/gcc/libfuncs.h @@ -40,6 +40,8 @@ enum libfunc_index LTI_profile_function_entry, LTI_profile_function_exit, + LTI_synchronize, + LTI_gcov_flush, LTI_MAX @@ -69,6 +71,8 @@ extern GTY(()) rtx libfunc_table[LTI_MAX]; #define profile_function_entry_libfunc (libfunc_table[LTI_profile_function_entry]) #define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit]) +#define synchronize_libfunc (libfunc_table[LTI_synchronize]) + #define gcov_flush_libfunc (libfunc_table[LTI_gcov_flush]) #endif /* GCC_LIBFUNCS_H */