diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-01 16:45:36 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-01 16:45:36 +0000 |
commit | ce9ec84194a1869a8eb4180b6eafd6b432a23769 (patch) | |
tree | 1a9bb0dbdc363905b0b9554093c37fa22dc1183a /gcc | |
parent | 068c688e1c7c551edca89c0efb2a073efddb12d4 (diff) | |
download | gcc-ce9ec84194a1869a8eb4180b6eafd6b432a23769.tar.gz |
* tree.c (build_common_builtin_nodes): Do not initialize
BUILT_IN_PROFILE_FUNC_ENTER and BUILT_IN_PROFILE_FUNC_EXIT.
* builtins.c (expand_builtin_profile_func): Remove.
(expand_builtin): Do not handle BUILT_IN_PROFILE_FUNC_ENTER and
BUILT_IN_PROFILE_FUNC_EXIT.
* builtins.def (profile_func_enter, profile_func_exit): Remove stubs.
(__cyg_profile_func_enter, __cyg_profile_func_exit): New.
* gimplify.c (gimplify_function_tree): Reorganize code calling
profiling functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167342 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/builtins.c | 29 | ||||
-rw-r--r-- | gcc/builtins.def | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 24 | ||||
-rw-r--r-- | gcc/tree.c | 6 |
5 files changed, 37 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bdfc8a20f48..26c6e8ef095 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2010-12-01 Jan Hubicka <jh@suse.cz> + + * tree.c (build_common_builtin_nodes): Do not initialize + BUILT_IN_PROFILE_FUNC_ENTER and BUILT_IN_PROFILE_FUNC_EXIT. + * builtins.c (expand_builtin_profile_func): Remove. + (expand_builtin): Do not handle BUILT_IN_PROFILE_FUNC_ENTER and + BUILT_IN_PROFILE_FUNC_EXIT. + * builtins.def (profile_func_enter, profile_func_exit): Remove stubs. + (__cyg_profile_func_enter, __cyg_profile_func_exit): New. + * gimplify.c (gimplify_function_tree): Reorganize code calling + profiling functions. + 2010-12-01 Joseph Myers <joseph@codesourcery.com> * opts.c: Expand comment on tm.h include. diff --git a/gcc/builtins.c b/gcc/builtins.c index 5c0938266c5..2816a7e1e61 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -5202,30 +5202,6 @@ build_string_literal (int len, const char *str) return t; } -/* Expand a call to either the entry or exit function profiler. */ - -static rtx -expand_builtin_profile_func (bool exitp) -{ - rtx this_rtx, which; - - this_rtx = DECL_RTL (current_function_decl); - gcc_assert (MEM_P (this_rtx)); - this_rtx = XEXP (this_rtx, 0); - - if (exitp) - which = profile_function_exit_libfunc; - else - which = profile_function_entry_libfunc; - - emit_library_call (which, LCT_NORMAL, VOIDmode, 2, this_rtx, Pmode, - expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS, - 0), - Pmode); - - return const0_rtx; -} - /* Expand a call to __builtin___clear_cache. */ static rtx @@ -6364,11 +6340,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, expand_builtin_prefetch (exp); return const0_rtx; - case BUILT_IN_PROFILE_FUNC_ENTER: - return expand_builtin_profile_func (false); - case BUILT_IN_PROFILE_FUNC_EXIT: - return expand_builtin_profile_func (true); - case BUILT_IN_INIT_TRAMPOLINE: return expand_builtin_init_trampoline (exp); case BUILT_IN_ADJUST_TRAMPOLINE: diff --git a/gcc/builtins.def b/gcc/builtins.def index 28bcc0b976f..3e102e31625 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -743,8 +743,10 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_VFPRINTF_CHK, "__vfprintf_chk", BT_FN_INT_FILEP DEF_EXT_LIB_BUILTIN (BUILT_IN_VPRINTF_CHK, "__vprintf_chk", BT_FN_INT_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0) /* Profiling hooks. */ -DEF_BUILTIN_STUB (BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter") -DEF_BUILTIN_STUB (BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit") +DEF_BUILTIN (BUILT_IN_PROFILE_FUNC_ENTER, "__cyg_profile_func_enter", BUILT_IN_NORMAL, BT_FN_VOID_PTR_PTR, BT_LAST, + false, false, false, ATTR_NULL, true, true) +DEF_BUILTIN (BUILT_IN_PROFILE_FUNC_EXIT, "__cyg_profile_func_exit", BUILT_IN_NORMAL, BT_FN_VOID_PTR_PTR, BT_LAST, + false, false, false, ATTR_NULL, true, true) /* TLS emulation. */ DEF_BUILTIN (BUILT_IN_EMUTLS_GET_ADDRESS, targetm.emutls.get_address, diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 59e4248114d..10e2b24a33e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7861,13 +7861,31 @@ gimplify_function_tree (tree fndecl) gimple new_bind; gimple tf; gimple_seq cleanup = NULL, body = NULL; - + tree tmp_var; + gimple call; + + x = implicit_built_in_decls[BUILT_IN_RETURN_ADDRESS]; + call = gimple_build_call (x, 0); + tmp_var = create_tmp_var (ptr_type_node, "return_addr"); + gimple_call_set_lhs (call, tmp_var); + gimplify_seq_add_stmt (&cleanup, call); x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_EXIT]; - gimplify_seq_add_stmt (&cleanup, gimple_build_call (x, 0)); + call = gimple_build_call (x, 2, + build_fold_addr_expr (current_function_decl), + tmp_var); + gimplify_seq_add_stmt (&cleanup, call); tf = gimple_build_try (seq, cleanup, GIMPLE_TRY_FINALLY); + x = implicit_built_in_decls[BUILT_IN_RETURN_ADDRESS]; + call = gimple_build_call (x, 0); + tmp_var = create_tmp_var (ptr_type_node, "return_addr"); + gimple_call_set_lhs (call, tmp_var); + gimplify_seq_add_stmt (&body, call); x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER]; - gimplify_seq_add_stmt (&body, gimple_build_call (x, 0)); + call = gimple_build_call (x, 2, + build_fold_addr_expr (current_function_decl), + tmp_var); + gimplify_seq_add_stmt (&body, call); gimplify_seq_add_stmt (&body, tf); new_bind = gimple_build_bind (NULL, body, gimple_bind_block (bind)); /* Clear the block for BIND, since it is no longer directly inside diff --git a/gcc/tree.c b/gcc/tree.c index 88666d3e0e8..3a41244cd0f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9324,12 +9324,6 @@ build_common_builtin_nodes (void) BUILT_IN_STACK_RESTORE, "__builtin_stack_restore", ECF_NOTHROW | ECF_LEAF); - ftype = build_function_type_list (void_type_node, NULL_TREE); - local_define_builtin ("__builtin_profile_func_enter", ftype, - BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter", 0); - local_define_builtin ("__builtin_profile_func_exit", ftype, - BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit", 0); - /* If there's a possibility that we might use the ARM EABI, build the alternate __cxa_end_cleanup node used to resume from C++ and Java. */ if (targetm.arm_eabi_unwinder) |