diff options
-rw-r--r-- | gcc/ChangeLog | 53 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 3 | ||||
-rw-r--r-- | gcc/cgraph.c | 3 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 13 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 10 | ||||
-rw-r--r-- | gcc/function.c | 26 | ||||
-rw-r--r-- | gcc/gimple-low.c | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 5 | ||||
-rw-r--r-- | gcc/ipa-inline-analysis.c | 5 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 2 | ||||
-rw-r--r-- | gcc/ipa-pure-const.c | 3 | ||||
-rw-r--r-- | gcc/lto-streamer-in.c | 1 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 2 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/lto/lto.c | 3 | ||||
-rw-r--r-- | gcc/omp-low.c | 14 | ||||
-rw-r--r-- | gcc/passes.c | 7 | ||||
-rw-r--r-- | gcc/trans-mem.c | 10 | ||||
-rw-r--r-- | gcc/tree-emutls.c | 2 | ||||
-rw-r--r-- | gcc/tree-inline.c | 11 | ||||
-rw-r--r-- | gcc/tree-profile.c | 5 | ||||
-rw-r--r-- | gcc/tree-sra.c | 7 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 4 |
24 files changed, 101 insertions, 105 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ab7c338fbf..cc31d346ebf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,56 @@ +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. + 2012-09-20 Diego Novillo <dnovillo@google.com> PR target/54631 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 6b580d7439c..3f1638b7ff9 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1420,10 +1420,8 @@ estimated_stack_frame_size (struct cgraph_node *node) HOST_WIDE_INT size = 0; size_t i; tree var; - tree old_cur_fun_decl = current_function_decl; struct function *fn = DECL_STRUCT_FUNCTION (node->symbol.decl); - current_function_decl = node->symbol.decl; push_cfun (fn); init_vars_expansion (); @@ -1443,7 +1441,6 @@ estimated_stack_frame_size (struct cgraph_node *node) fini_vars_expansion (); pop_cfun (); - current_function_decl = old_cur_fun_decl; return size; } diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 3d4703b4b63..0e9accecf20 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1127,7 +1127,6 @@ cgraph_release_function_body (struct cgraph_node *node) { if (DECL_STRUCT_FUNCTION (node->symbol.decl)) { - tree old_decl = current_function_decl; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); if (cfun->cfg && current_loops) @@ -1137,11 +1136,9 @@ cgraph_release_function_body (struct cgraph_node *node) } if (cfun->gimple_df) { - current_function_decl = node->symbol.decl; delete_tree_ssa (); delete_tree_cfg_annotations (); cfun->eh = NULL; - current_function_decl = old_decl; } if (cfun->cfg) { 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 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3552ffc4d4a..2f405b86bf0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2012-09-20 Martin Jambor <mjambor@suse.cz> + + * 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. + 2012-09-17 Tobias Burnus <burnus@net-b.de> PR fortran/54608 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 53c248d963b..910b1500fdc 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1630,17 +1630,14 @@ gfc_get_extern_function_decl (gfc_symbol * sym) /* By construction, the external function cannot be a contained procedure. */ locus old_loc; - tree save_fn_decl = current_function_decl; - current_function_decl = NULL_TREE; gfc_save_backend_locus (&old_loc); - push_cfun (cfun); + push_cfun (NULL); gfc_create_function_decl (gsym->ns, true); pop_cfun (); gfc_restore_backend_locus (&old_loc); - current_function_decl = save_fn_decl; } /* If the namespace has entries, the proc_name is the @@ -4861,16 +4858,12 @@ add_argument_checking (stmtblock_t *block, gfc_symbol *sym) void gfc_init_coarray_decl (bool main_tu) { - tree save_fn_decl; - if (gfc_option.coarray != GFC_FCOARRAY_LIB) return; if (gfort_gvar_caf_this_image || gfort_gvar_caf_num_images) return; - save_fn_decl = current_function_decl; - current_function_decl = NULL_TREE; push_cfun (cfun); gfort_gvar_caf_this_image @@ -4906,7 +4899,6 @@ gfc_init_coarray_decl (bool main_tu) pushdecl_top_level (gfort_gvar_caf_num_images); pop_cfun (); - current_function_decl = save_fn_decl; } diff --git a/gcc/function.c b/gcc/function.c index ec21d9c3ea4..d6e19543753 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4412,22 +4412,34 @@ set_cfun (struct function *new_cfun) static VEC(function_p,heap) *cfun_stack; -/* Push the current cfun onto the stack, and set cfun to new_cfun. */ +/* Push the current cfun onto the stack, and set cfun to new_cfun. Also set + current_function_decl accordingly. */ void push_cfun (struct function *new_cfun) { + gcc_assert ((!cfun && !current_function_decl) + || (cfun && current_function_decl == cfun->decl)); VEC_safe_push (function_p, heap, cfun_stack, cfun); + current_function_decl = new_cfun ? new_cfun->decl : NULL_TREE; set_cfun (new_cfun); } -/* Pop cfun from the stack. */ +/* Pop cfun from the stack. Also set current_function_decl accordingly. */ void pop_cfun (void) { struct function *new_cfun = VEC_pop (function_p, cfun_stack); + /* When in_dummy_function, we do have a cfun but current_function_decl is + NULL. We also allow pushing NULL cfun and subsequently changing + current_function_decl to something else and have both restored by + pop_cfun. */ + gcc_checking_assert (in_dummy_function + || !cfun + || current_function_decl == cfun->decl); set_cfun (new_cfun); + current_function_decl = new_cfun ? new_cfun->decl : NULL_TREE; } /* Return value of funcdef and increase it. */ @@ -4474,8 +4486,6 @@ allocate_struct_function (tree fndecl, bool abstract_p) OVERRIDE_ABI_FORMAT (fndecl); #endif - invoke_set_current_function_hook (fndecl); - if (fndecl != NULL_TREE) { DECL_STRUCT_FUNCTION (fndecl) = cfun; @@ -4501,6 +4511,8 @@ allocate_struct_function (tree fndecl, bool abstract_p) but is this worth the hassle? */ cfun->can_throw_non_call_exceptions = flag_non_call_exceptions; } + + invoke_set_current_function_hook (fndecl); } /* This is like allocate_struct_function, but pushes a new cfun for FNDECL @@ -4509,7 +4521,13 @@ allocate_struct_function (tree fndecl, bool abstract_p) void push_struct_function (tree fndecl) { + /* When in_dummy_function we might be in the middle of a pop_cfun and + current_function_decl and cfun may not match. */ + gcc_assert (in_dummy_function + || (!cfun && !current_function_decl) + || (cfun && current_function_decl == cfun->decl)); VEC_safe_push (function_p, heap, cfun_stack, cfun); + current_function_decl = fndecl; allocate_struct_function (fndecl, false); } diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index c5a16ac52d3..424ad550d78 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -991,7 +991,9 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi) void record_vars_into (tree vars, tree fn) { - if (fn != current_function_decl) + bool change_cfun = fn != current_function_decl; + + if (change_cfun) push_cfun (DECL_STRUCT_FUNCTION (fn)); for (; vars; vars = DECL_CHAIN (vars)) @@ -1011,7 +1013,7 @@ record_vars_into (tree vars, tree fn) add_local_decl (cfun, var); } - if (fn != current_function_decl) + if (change_cfun) pop_cfun (); } diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2bb334c37a8..a871e7d4c0c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -8287,14 +8287,12 @@ flag_instrument_functions_exclude_p (tree fndecl) void gimplify_function_tree (tree fndecl) { - tree oldfn, parm, ret; + tree parm, ret; gimple_seq seq; gimple bind; gcc_assert (!gimple_body (fndecl)); - oldfn = current_function_decl; - current_function_decl = fndecl; if (DECL_STRUCT_FUNCTION (fndecl)) push_cfun (DECL_STRUCT_FUNCTION (fndecl)); else @@ -8379,7 +8377,6 @@ gimplify_function_tree (tree fndecl) DECL_SAVED_TREE (fndecl) = NULL_TREE; cfun->curr_properties = PROP_gimple_any; - current_function_decl = oldfn; pop_cfun (); } diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 268f0777cfd..31ecec9af99 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -2554,7 +2554,6 @@ compute_inline_parameters (struct cgraph_node *node, bool early) HOST_WIDE_INT self_stack_size; struct cgraph_edge *e; struct inline_summary *info; - tree old_decl = current_function_decl; gcc_assert (!node->global.inlined_to); @@ -2581,7 +2580,6 @@ compute_inline_parameters (struct cgraph_node *node, bool early) } /* Even is_gimple_min_invariant rely on current_function_decl. */ - current_function_decl = node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); /* Estimate the stack size for the function if we're optimizing. */ @@ -2623,7 +2621,6 @@ compute_inline_parameters (struct cgraph_node *node, bool early) info->size = info->self_size; info->stack_frame_offset = 0; info->estimated_stack_size = info->estimated_self_stack_size; - current_function_decl = old_decl; pop_cfun (); } @@ -3554,7 +3551,6 @@ static void inline_analyze_function (struct cgraph_node *node) { push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; if (dump_file) fprintf (dump_file, "\nAnalyzing function: %s/%u\n", @@ -3563,7 +3559,6 @@ inline_analyze_function (struct cgraph_node *node) inline_indirect_intraprocedural_analysis (node); compute_inline_parameters (node, false); - current_function_decl = NULL; pop_cfun (); } diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 8f3cf72276f..7e1354d1d51 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1929,7 +1929,6 @@ ipa_analyze_node (struct cgraph_node *node) ipa_check_create_edge_args (); info = IPA_NODE_REF (node); push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; ipa_initialize_node_params (node); param_count = ipa_get_param_count (info); @@ -1947,7 +1946,6 @@ ipa_analyze_node (struct cgraph_node *node) BITMAP_FREE (parms_ainfo[i].pt_visited_statements); } - current_function_decl = NULL; pop_cfun (); } diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 6bdd4d14bdf..c4f23d9e1c3 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -725,7 +725,6 @@ static funct_state analyze_function (struct cgraph_node *fn, bool ipa) { tree decl = fn->symbol.decl; - tree old_decl = current_function_decl; funct_state l; basic_block this_block; @@ -753,7 +752,6 @@ analyze_function (struct cgraph_node *fn, bool ipa) } push_cfun (DECL_STRUCT_FUNCTION (decl)); - current_function_decl = decl; FOR_EACH_BB (this_block) { @@ -821,7 +819,6 @@ end: l->can_throw = false; pop_cfun (); - current_function_decl = old_decl; if (dump_file) { if (l->looping) diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index cca216cd842..a4b94b10ad0 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1036,7 +1036,6 @@ void lto_input_function_body (struct lto_file_decl_data *file_data, tree fn_decl, const char *data) { - current_function_decl = fn_decl; lto_read_body (file_data, fn_decl, data, LTO_section_function_body); } diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index e7e2d4ad9f6..709eb60ce38 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -797,7 +797,6 @@ output_function (struct cgraph_node *node) gcc_assert (current_function_decl == NULL_TREE && cfun == NULL); /* Set current_function_decl and cfun. */ - current_function_decl = function; push_cfun (fn); /* Make string 0 be a NULL string. */ @@ -851,7 +850,6 @@ output_function (struct cgraph_node *node) destroy_output_block (ob); - current_function_decl = NULL; pop_cfun (); } diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 4f3dd73fa35..7c437d6c9e5 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2012-09-20 Martin Jambor <mjambor@suse.cz> + + * lto.c (lto_materialize_function): Call push_struct_function and + pop_cfun. + 2012-09-19 Dehao Chen <dehao@google.com> * lto/lto.c (lto_fixup_prevailing_decls): Remove tree.exp.block field. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 68932267361..44718537b3c 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -221,7 +221,7 @@ lto_materialize_function (struct cgraph_node *node) gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL); - allocate_struct_function (decl, false); + push_struct_function (decl); announce_function (decl); lto_input_function_body (file_data, decl, data); if (DECL_FUNCTION_PERSONALITY (decl) && !first_personality_decl) @@ -229,6 +229,7 @@ lto_materialize_function (struct cgraph_node *node) lto_stats.num_function_bodies++; lto_free_section_data (file_data, LTO_section_function_body, name, data, len); + pop_cfun (); ggc_collect (); } } diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 9474167ce6d..4d32fb6d35d 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1243,7 +1243,7 @@ static void finalize_task_copyfn (gimple task_stmt) { struct function *child_cfun; - tree child_fn, old_fn; + tree child_fn; gimple_seq seq = NULL, new_seq; gimple bind; @@ -1257,9 +1257,7 @@ finalize_task_copyfn (gimple task_stmt) DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties & ~PROP_loops; - old_fn = current_function_decl; push_cfun (child_cfun); - current_function_decl = child_fn; bind = gimplify_body (child_fn, false); gimple_seq_add_stmt (&seq, bind); new_seq = maybe_catch_exception (seq); @@ -1271,7 +1269,6 @@ finalize_task_copyfn (gimple task_stmt) } gimple_set_body (child_fn, seq); pop_cfun (); - current_function_decl = old_fn; cgraph_add_new_function (child_fn, false); } @@ -3388,7 +3385,6 @@ expand_omp_taskreg (struct omp_region *region) basic_block entry_bb, exit_bb, new_bb; struct function *child_cfun; tree child_fn, block, t; - tree save_current; gimple_stmt_iterator gsi; gimple entry_stmt, stmt; edge e; @@ -3588,8 +3584,6 @@ expand_omp_taskreg (struct omp_region *region) /* Fix the callgraph edges for child_cfun. Those for cfun will be fixed in a following pass. */ push_cfun (child_cfun); - save_current = current_function_decl; - current_function_decl = child_fn; if (optimize) optimize_omp_library_calls (entry_stmt); rebuild_cgraph_edges (); @@ -3610,7 +3604,6 @@ expand_omp_taskreg (struct omp_region *region) } if (gimple_in_ssa_p (cfun)) update_ssa (TODO_update_ssa); - current_function_decl = save_current; pop_cfun (); } @@ -6456,7 +6449,7 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx) /* Populate the function. */ push_gimplify_context (&gctx); - current_function_decl = child_fn; + push_cfun (child_cfun); bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL); TREE_SIDE_EFFECTS (bind) = 1; @@ -6503,8 +6496,6 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx) else tcctx.cb.decl_map = NULL; - push_cfun (child_cfun); - arg = DECL_ARGUMENTS (child_fn); TREE_TYPE (arg) = build_pointer_type (record_type); sarg = DECL_CHAIN (arg); @@ -6662,7 +6653,6 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx) pop_gimplify_context (NULL); BIND_EXPR_BODY (bind) = list; pop_cfun (); - current_function_decl = ctx->cb.src_fn; } /* Lower the OpenMP parallel or task directive in the current statement diff --git a/gcc/passes.c b/gcc/passes.c index 97a1d0ec7fd..ba4e98e0682 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -703,7 +703,6 @@ void dump_passes (void) { struct cgraph_node *n, *node = NULL; - tree save_fndecl = current_function_decl; create_pass_tab(); @@ -718,7 +717,6 @@ dump_passes (void) return; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; dump_pass_list (all_lowering_passes, 1); dump_pass_list (all_small_ipa_passes, 1); @@ -728,7 +726,6 @@ dump_passes (void) dump_pass_list (all_passes, 1); pop_cfun (); - current_function_decl = save_fndecl; } @@ -1701,14 +1698,12 @@ do_per_function (void (*callback) (void *data), void *data) && (!node->clone_of || node->symbol.decl != node->clone_of->symbol.decl)) { push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; callback (data); if (!flag_wpa) { free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); } - current_function_decl = NULL; pop_cfun (); ggc_collect (); } @@ -1749,11 +1744,9 @@ do_per_function_toporder (void (*callback) (void *data), void *data) if (cgraph_function_with_gimple_body_p (node)) { push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; callback (data); free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); - current_function_decl = NULL; pop_cfun (); ggc_collect (); } diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 0b1c8a5f0e7..242b470a54e 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -3987,7 +3987,6 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone) || DECL_STRUCT_FUNCTION (node->symbol.decl)->cfg == NULL) return false; - current_function_decl = node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); calculate_dominance_info (CDI_DOMINATORS); @@ -4059,7 +4058,6 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone) VEC_free (basic_block, heap, queue); pop_cfun (); - current_function_decl = NULL; return ret; } @@ -4697,7 +4695,6 @@ ipa_tm_transform_transaction (struct cgraph_node *node) d = get_cg_data (&node, true); - current_function_decl = node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); calculate_dominance_info (CDI_DOMINATORS); @@ -4722,7 +4719,6 @@ ipa_tm_transform_transaction (struct cgraph_node *node) update_ssa (TODO_update_ssa_only_virtuals); pop_cfun (); - current_function_decl = NULL; } /* Transform the calls within the transactional clone of NODE. */ @@ -4741,8 +4737,7 @@ ipa_tm_transform_clone (struct cgraph_node *node) if (!node->callees && !node->indirect_calls && !d->irrevocable_blocks_clone) return; - current_function_decl = d->clone->symbol.decl; - push_cfun (DECL_STRUCT_FUNCTION (current_function_decl)); + push_cfun (DECL_STRUCT_FUNCTION (d->clone->symbol.decl)); calculate_dominance_info (CDI_DOMINATORS); need_ssa_rename = @@ -4753,7 +4748,6 @@ ipa_tm_transform_clone (struct cgraph_node *node) update_ssa (TODO_update_ssa_only_virtuals); pop_cfun (); - current_function_decl = NULL; } /* Main entry point for the transactional memory IPA pass. */ @@ -4800,7 +4794,6 @@ ipa_tm_execute (void) continue; } - current_function_decl = node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); calculate_dominance_info (CDI_DOMINATORS); @@ -4820,7 +4813,6 @@ ipa_tm_execute (void) } pop_cfun (); - current_function_decl = NULL; } /* For every local function on the callee list, scan as if we will be diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c index 88e77dace60..de71b23f3c2 100644 --- a/gcc/tree-emutls.c +++ b/gcc/tree-emutls.c @@ -618,7 +618,6 @@ lower_emutls_function_body (struct cgraph_node *node) struct lower_emutls_data d; bool any_edge_inserts = false; - current_function_decl = node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); d.cfun_node = node; @@ -689,7 +688,6 @@ lower_emutls_function_body (struct cgraph_node *node) gsi_commit_edge_inserts (); pop_cfun (); - current_function_decl = NULL; } /* Create emutls variable for VAR, DATA is pointer to static diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index ad62caef638..a585c0b88dc 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; } diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index a5b6bc80281..fa8173ecbaa 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -475,7 +475,6 @@ tree_profiling (void) continue; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; /* Local pure-const may imply need to fixup the cfg. */ if (execute_fixup_cfg () & TODO_cleanup_cfg) @@ -497,8 +496,6 @@ tree_profiling (void) easy to adjust it, if and when there is some. */ free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); - - current_function_decl = NULL; pop_cfun (); } @@ -533,7 +530,6 @@ tree_profiling (void) continue; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - current_function_decl = node->symbol.decl; FOR_EACH_BB (bb) { @@ -550,7 +546,6 @@ tree_profiling (void) rebuild_cgraph_edges (); - current_function_decl = NULL; pop_cfun (); } diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index ef3f5f99ed6..5acb6125079 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4616,7 +4616,6 @@ convert_callers_for_node (struct cgraph_node *node, for (cs = node->callers; cs; cs = cs->next_caller) { - current_function_decl = cs->caller->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (cs->caller->symbol.decl)); if (dump_file) @@ -4645,14 +4644,11 @@ static void convert_callers (struct cgraph_node *node, tree old_decl, ipa_parm_adjustment_vec adjustments) { - tree old_cur_fndecl = current_function_decl; basic_block this_block; cgraph_for_node_and_aliases (node, convert_callers_for_node, adjustments, false); - current_function_decl = old_cur_fndecl; - if (!encountered_recursive_call) return; @@ -4693,15 +4689,12 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments) rebuild_cgraph_edges (); free_dominance_info (CDI_DOMINATORS); pop_cfun (); - current_function_decl = NULL_TREE; new_node = cgraph_function_versioning (node, redirect_callers, NULL, NULL, false, NULL, NULL, "isra"); VEC_free (cgraph_edge_p, heap, redirect_callers); - current_function_decl = new_node->symbol.decl; push_cfun (DECL_STRUCT_FUNCTION (new_node->symbol.decl)); - ipa_modify_formal_parameters (current_function_decl, adjustments, "ISRA"); cfg_changed = ipa_sra_modify_function_body (adjustments); sra_ipa_reset_debug_stmts (adjustments); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 688b0688b82..711fbef2a64 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -6925,7 +6925,6 @@ ipa_pta_execute (void) { struct function *func; basic_block bb; - tree old_func_decl; /* Nodes without a body are not interesting. */ if (!cgraph_function_with_gimple_body_p (node)) @@ -6943,9 +6942,7 @@ ipa_pta_execute (void) } func = DECL_STRUCT_FUNCTION (node->symbol.decl); - old_func_decl = current_function_decl; push_cfun (func); - current_function_decl = node->symbol.decl; /* For externally visible or attribute used annotated functions use local constraints for their arguments. @@ -7002,7 +6999,6 @@ ipa_pta_execute (void) } } - current_function_decl = old_func_decl; pop_cfun (); if (dump_file) |