Commit e2ff10a9 by Richard Sandiford Committed by Richard Sandiford

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
parent f78c3290
2008-06-26 Richard Sandiford <rdsandiford@googlemail.com>
* 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 <froydnj@codesourcery.com> 2008-06-26 Nathan Froyd <froydnj@codesourcery.com>
* config/rs6000/rs6000.c (emit_allocate_stack): Add copy_r11 * config/rs6000/rs6000.c (emit_allocate_stack): Add copy_r11
......
...@@ -5999,6 +5999,12 @@ expand_builtin_synchronize (void) ...@@ -5999,6 +5999,12 @@ expand_builtin_synchronize (void)
} }
#endif #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 /* If no explicit memory barrier instruction is available, create an
empty asm stmt with a memory clobber. */ empty asm stmt with a memory clobber. */
x = build4 (ASM_EXPR, void_type_node, build_string (0, ""), NULL, NULL, x = build4 (ASM_EXPR, void_type_node, build_string (0, ""), NULL, NULL,
......
...@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h" #include "function.h"
#include "expr.h" #include "expr.h"
#include "optabs.h" #include "optabs.h"
#include "libfuncs.h"
#include "flags.h" #include "flags.h"
#include "reload.h" #include "reload.h"
#include "tm_p.h" #include "tm_p.h"
...@@ -9424,6 +9425,11 @@ mips_init_libfuncs (void) ...@@ -9424,6 +9425,11 @@ mips_init_libfuncs (void)
else else
/* Register the gofast functions if selected using --enable-gofast. */ /* Register the gofast functions if selected using --enable-gofast. */
gofast_maybe_init_libfuncs (); 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 /* Return the length of INSN. LENGTH is the initial length computed by
......
...@@ -40,6 +40,8 @@ enum libfunc_index ...@@ -40,6 +40,8 @@ enum libfunc_index
LTI_profile_function_entry, LTI_profile_function_entry,
LTI_profile_function_exit, LTI_profile_function_exit,
LTI_synchronize,
LTI_gcov_flush, LTI_gcov_flush,
LTI_MAX LTI_MAX
...@@ -69,6 +71,8 @@ extern GTY(()) rtx libfunc_table[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_entry_libfunc (libfunc_table[LTI_profile_function_entry])
#define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit]) #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]) #define gcov_flush_libfunc (libfunc_table[LTI_gcov_flush])
#endif /* GCC_LIBFUNCS_H */ #endif /* GCC_LIBFUNCS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment