From af16bc762a0d806b2297013a56edcf7cd38cb25f Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Thu, 20 Sep 2012 18:35:40 +0200 Subject: function.c (push_cfun): Check old current_function_decl matches old cfun... 2012-09-20 Martin Jambor * function.c (push_cfun): Check old current_function_decl matches old cfun, set new current_function_decl to the decl of the new cfun. (push_struct_function): Likewise. (pop_cfun): Likewise. (allocate_struct_function): Move call to invoke_set_current_function_hook to the end of the function. * cfgexpand.c (estimated_stack_frame_size): Do not set and restore current_function_decl. * cgraph.c (cgraph_release_function_body): Likewise. * cgraphunit.c (cgraph_process_new_functions): Likewise. (cgraph_add_new_function): Likewise. (cgraph_analyze_function): Likewise. (assemble_thunk): Set cfun to NULL at the end. (expand_function): Move call to set_cfun downwards. * gimple-low.c (record_vars_into): Only check current_function_decl before possibly doing push_cfun. * gimplify.c (gimplify_function_tree): Do not set and restore current_function_decl. * ipa-inline-analysis.c (compute_inline_parameters): Likewise. (inline_analyze_function): Likewise. * ipa-prop.c (ipa_analyze_node): Likewise. * ipa-pure-const.c (analyze_function): Likewise. * lto-streamer-in.c (lto_input_function_body): Do not set current_function_decl. * lto-streamer-out.c (output_function): Do not set and restore current_function_decl. * omp-low.c (finalize_task_copyfn): Likewise. (expand_omp_taskreg): Likewise. (create_task_copyfn): Likewise, move push_cfun up quite a bit. * passes.c (dump_passes): Do not set and restore current_function_decl. (do_per_function): Likewise. (do_per_function_toporder): Likewise. * trans-mem.c (ipa_tm_scan_irr_function): Likewise. (ipa_tm_transform_transaction): Likewise. (ipa_tm_transform_clone): Likewise. (ipa_tm_execute): Likewise. * tree-emutls.c (lower_emutls_function_body): Likewise. * tree-inline.c (initialize_cfun): Do not call pop_cfun. (tree_function_versioning): Do not call push_cfun, do not set and restore current_function_decl. Remove assert checking consistency of cfun and current_function_decl. * tree-profile.c (tree_profiling): Do not set and restore current_function_decl. * tree-sra.c (convert_callers_for_node): Do not set current_function_decl. (convert_callers): Do not restore current_function_decl. (modify_function): Do not set current_function_decl. * tree-ssa-structalias.c (ipa_pta_execute): Do not set and restore current_function_decl. fortran/ * trans-decl.c (gfc_get_extern_function_decl): Push NULL cfun. Do not set and restore current_function_decl. (gfc_init_coarray_decl): Do not set and restore current_function_decl. lto/ * lto.c (lto_materialize_function): Call push_struct_function and pop_cfun. From-SVN: r191577 --- gcc/tree-inline.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'gcc/tree-inline.c') diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index ad62cae..a585c0b 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2048,7 +2048,8 @@ remap_decl_1 (tree decl, void *data) } /* Build struct function and associated datastructures for the new clone - NEW_FNDECL to be build. CALLEE_FNDECL is the original */ + NEW_FNDECL to be build. CALLEE_FNDECL is the original. Function changes + the cfun to the function of new_fndecl (and current_function_decl too). */ static void initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) @@ -2113,7 +2114,6 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) cfun->gimple_df->in_ssa_p = true; init_ssa_operands (cfun); } - pop_cfun (); } /* Helper function for copy_cfg_body. Move debug stmts from the end @@ -5047,8 +5047,6 @@ tree_function_versioning (tree old_decl, tree new_decl, struct ipa_replace_map *replace_info; basic_block old_entry_block, bb; VEC (gimple, heap) *init_stmts = VEC_alloc (gimple, heap, 10); - - tree old_current_function_decl = current_function_decl; tree vars = NULL_TREE; gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL @@ -5119,14 +5117,12 @@ tree_function_versioning (tree old_decl, tree new_decl, id.transform_return_to_modify = false; id.transform_lang_insert_block = NULL; - current_function_decl = new_decl; old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (old_decl)); initialize_cfun (new_decl, old_decl, old_entry_block->count); DECL_STRUCT_FUNCTION (new_decl)->gimple_df->ipa_pta = id.src_cfun->gimple_df->ipa_pta; - push_cfun (DECL_STRUCT_FUNCTION (new_decl)); /* Copy the function's static chain. */ p = DECL_STRUCT_FUNCTION (old_decl)->static_chain_decl; @@ -5280,9 +5276,6 @@ tree_function_versioning (tree old_decl, tree new_decl, gcc_assert (!id.debug_stmts); VEC_free (gimple, heap, init_stmts); pop_cfun (); - current_function_decl = old_current_function_decl; - gcc_assert (!current_function_decl - || DECL_STRUCT_FUNCTION (current_function_decl) == cfun); return; } -- cgit v1.1