summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2012-09-20 18:35:40 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2012-09-20 18:35:40 +0200
commitaf16bc762a0d806b2297013a56edcf7cd38cb25f (patch)
treebd0847507cf2cc8fc2505732d6abf2f60dd73989 /gcc/cgraphunit.c
parentee6440f8d8ad3e2a015a50a598cb80669569da27 (diff)
downloadgcc-af16bc762a0d806b2297013a56edcf7cd38cb25f.tar.gz
function.c (push_cfun): Check old current_function_decl matches old cfun...
2012-09-20 Martin Jambor <mjambor@suse.cz> * 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
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 2dd0871e736..64460ac63b7 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -313,7 +313,6 @@ cgraph_process_new_functions (void)
if (!node->analyzed)
cgraph_analyze_function (node);
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
- current_function_decl = fndecl;
if ((cgraph_state == CGRAPH_STATE_IPA_SSA
&& !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
/* When not optimizing, be sure we run early local passes anyway
@@ -325,7 +324,6 @@ cgraph_process_new_functions (void)
free_dominance_info (CDI_POST_DOMINATORS);
free_dominance_info (CDI_DOMINATORS);
pop_cfun ();
- current_function_decl = NULL;
cgraph_call_function_insertion_hooks (node);
break;
@@ -495,14 +493,12 @@ cgraph_add_new_function (tree fndecl, bool lowered)
if (!lowered && cgraph_state == CGRAPH_STATE_EXPANSION)
{
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
- current_function_decl = fndecl;
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
execute_pass_list (all_lowering_passes);
execute_pass_list (pass_early_local_passes.pass.sub);
bitmap_obstack_release (NULL);
pop_cfun ();
- current_function_decl = NULL;
lowered = true;
}
@@ -521,7 +517,6 @@ cgraph_add_new_function (tree fndecl, bool lowered)
node->lowered = true;
cgraph_analyze_function (node);
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
- current_function_decl = fndecl;
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
@@ -529,7 +524,6 @@ cgraph_add_new_function (tree fndecl, bool lowered)
bitmap_obstack_release (NULL);
pop_cfun ();
expand_function (node);
- current_function_decl = NULL;
break;
default:
@@ -597,7 +591,6 @@ fixup_same_cpp_alias_visibility (symtab_node node, symtab_node target, tree alia
static void
cgraph_analyze_function (struct cgraph_node *node)
{
- tree save = current_function_decl;
tree decl = node->symbol.decl;
location_t saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
@@ -638,7 +631,6 @@ cgraph_analyze_function (struct cgraph_node *node)
}
else
{
- current_function_decl = decl;
push_cfun (DECL_STRUCT_FUNCTION (decl));
assign_assembler_name_if_neeeded (node->symbol.decl);
@@ -672,7 +664,6 @@ cgraph_analyze_function (struct cgraph_node *node)
}
node->analyzed = true;
- current_function_decl = save;
input_location = saved_loc;
}
@@ -1524,6 +1515,7 @@ assemble_thunk (struct cgraph_node *node)
bitmap_obstack_release (NULL);
}
current_function_decl = NULL;
+ set_cfun (NULL);
}
@@ -1616,8 +1608,6 @@ expand_function (struct cgraph_node *node)
/* Release the default bitmap obstack. */
bitmap_obstack_release (NULL);
- set_cfun (NULL);
-
/* If requested, warn about function definitions where the function will
return a value (usually of some struct or union type) which itself will
take up a lot of stack space. */
@@ -1662,6 +1652,7 @@ expand_function (struct cgraph_node *node)
/* Make sure that BE didn't give up on compiling. */
gcc_assert (TREE_ASM_WRITTEN (decl));
+ set_cfun (NULL);
current_function_decl = NULL;
/* It would make a lot more sense to output thunks before function body to get more