diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2007-09-05 10:24:54 -0400 |
---|---|---|
committer | Sandra Loosemore <sandra@gcc.gnu.org> | 2007-09-05 10:24:54 -0400 |
commit | db2960f402c407aa41fe09d5195da5c414ae79af (patch) | |
tree | 62913df8af7e441af79b5b56d4d9cfe14bbd53e5 /gcc/tree-cfg.c | |
parent | e643dc23733beeb665a6841f8afe54b80388a459 (diff) | |
download | gcc-db2960f402c407aa41fe09d5195da5c414ae79af.zip gcc-db2960f402c407aa41fe09d5195da5c414ae79af.tar.gz gcc-db2960f402c407aa41fe09d5195da5c414ae79af.tar.bz2 |
Add target hook invoked when cfun changes.
2007-09-05 Sandra Loosemore <sandra@codesourcery.com>
gcc/
Add target hook invoked when cfun changes.
* doc/tm.texi (TARGET_SET_CURRENT_FUNCTION): Document.
* target.h (struct gcc_target): Add set_current_function.
* target-def.h (TARGET_SET_CURRENT_FUNCTION): Define.
(TARGET_INITIALIZER): Add initializer for set_current_function.
* tree.h (push_struct_function): New.
* tree-inline.h (push_cfun, pop_cfun): Move declarations to...
* function.h: Here.
(set_cfun): Declare.
* tree-inline.c (cfun_stack, push_cfun, pop_cfun): Moved to...
* function.c: Here.
(push_function_context_to): Use allocate_struct_function
to create null context, not init_dummy_function_start. Use set_cfun.
(pop_function_context_from): Use set_cfun.
(in_dummy_function): New.
(invoke_set_current_function_hook): New.
(set_cfun): New.
(push_cfun, pop_cfun): Use set_cfun.
(push_struct_function): New.
(allocate_struct_function): Call invoke_set_current_function_hook
before returning.
(prepare_function_start): Don't set cfun here. Remove unused
argument; fix all callers.
(init_dummy_function_start): Fiddle with in_dummy_function. Call
push_struct_function.
(init_function_start): Set cfun here.
(expand_dummy_function_end): Fiddle with in_dummy_function. Pop cfun.
* omp-low.c (create_omp_child_function): Use push_struct_function
and pop_cfun to save/restore state.
(expand_omp_parallel): Remove unused saved_cfun variable.
* cgraphunit.c (ipa_passes): Use set_cfun.
* gimple-low.c (record_vars_into): Use push_cfun/pop_cfun here.
* dwarf2out.c (dwarf2out_abstract_function): Likewise.
* matrix-reorg.c (transform_allocation_sites): Likewise.
(matrix_reorg): Use set_cfun.
* gimplify.c (gimplify_function_tree): Use push_cfun/pop_cfun here.
* tree-optimize.c (tree_rest_of_compilation): Remove one redundant
assignment to cfun; use set_cfun for the other.
* tree-cfg.c (move_sese_region_to_fn): Use set_cfun.
(dump_function_to_file): Use push_cfun/pop_cfun here.
* c-decl.c (finish_function): Use set_cfun.
gcc/ada/
* trans.c (Compilation_unit_to_gnu): Use set_cfun.
* utils.c (end_subprog_body): Likewise.
gcc/cp/
* decl.c (finish_function): Use set_cfun.
* method.c (use_thunk): Likewise.
gcc/fortran/
* trans-decl.c (build_entry_thunks): Use set_cfun.
(gfc_generate_function_code): Likewise.
gcc/java/
* decl.c (finish_method): Use set_cfun.
gcc/treelang/
* treetree.c (tree_code_create_function_wrapup): Use set_cfun.
From-SVN: r128132
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index b01d7ab..95f2714 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5582,7 +5582,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, /* Switch context to the child function to initialize DEST_FN's CFG. */ gcc_assert (dest_cfun->cfg == NULL); - cfun = dest_cfun; + set_cfun (dest_cfun); init_empty_tree_cfg (); @@ -5605,7 +5605,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, } } - cfun = saved_cfun; + set_cfun (saved_cfun); /* Move blocks from BBS into DEST_CFUN. */ gcc_assert (VEC_length (basic_block, bbs) >= 2); @@ -5655,11 +5655,11 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, FIXME, this is silly. The CFG ought to become a parameter to these helpers. */ - cfun = dest_cfun; + set_cfun (dest_cfun); make_edge (ENTRY_BLOCK_PTR, entry_bb, EDGE_FALLTHRU); if (exit_bb) make_edge (exit_bb, EXIT_BLOCK_PTR, 0); - cfun = saved_cfun; + set_cfun (saved_cfun); /* Back in the original function, the SESE region has disappeared, create a new basic block in its place. */ @@ -5695,7 +5695,6 @@ dump_function_to_file (tree fn, FILE *file, int flags) bool ignore_topmost_bind = false, any_var = false; basic_block bb; tree chain; - struct function *saved_cfun; fprintf (file, "%s (", lang_hooks.decl_printable_name (fn, 2)); @@ -5720,8 +5719,7 @@ dump_function_to_file (tree fn, FILE *file, int flags) } /* Switch CFUN to point to FN. */ - saved_cfun = cfun; - cfun = DECL_STRUCT_FUNCTION (fn); + push_cfun (DECL_STRUCT_FUNCTION (fn)); /* When GIMPLE is lowered, the variables are no longer available in BIND_EXPRs, so display them separately. */ @@ -5792,7 +5790,7 @@ dump_function_to_file (tree fn, FILE *file, int flags) fprintf (file, "\n\n"); /* Restore CFUN. */ - cfun = saved_cfun; + pop_cfun (); } |