summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-04 16:50:45 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-04 16:50:45 +0000
commitbf3a27b83f6d5fc0203eb4eca0bbaf425d737532 (patch)
tree316a2296cdfe0b08198dd411e536b7787022ff04 /gcc/cgraphunit.c
parent29134d13431e7bd17d904a07f04fb5ac77da6dfa (diff)
downloadgcc-bf3a27b83f6d5fc0203eb4eca0bbaf425d737532.tar.gz
Pass manager: add support for termination of pass list
* cgraphunit.c (cgraph_node::expand_thunk): Call allocate_struct_function before init_function_start. (cgraph_node::expand): Use push_cfun and pop_cfun. * config/i386/i386.c (ix86_code_end): Call allocate_struct_function before init_function_start. * config/rs6000/rs6000.c (rs6000_code_end): Likewise. * function.c (init_function_start): Move preamble to all callers. * passes.c (do_per_function_toporder): Use push_cfun and pop_cfun. (execute_one_pass): Handle newly added TODO_discard_function. (execute_pass_list_1): Terminate if cfun equals to NULL. (execute_pass_list): Do not push and pop cfun, expect that cfun is set. * tree-pass.h (TODO_discard_function): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229764 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 43d31858edd..f73d9a78e03 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1618,6 +1618,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
fn_block = make_node (BLOCK);
BLOCK_VARS (fn_block) = a;
DECL_INITIAL (thunk_fndecl) = fn_block;
+ allocate_struct_function (thunk_fndecl, false);
init_function_start (thunk_fndecl);
cfun->is_thunk = 1;
insn_locations_init ();
@@ -1632,7 +1633,6 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
insn_locations_finalize ();
init_insn_lengths ();
free_after_compilation (cfun);
- set_cfun (NULL);
TREE_ASM_WRITTEN (thunk_fndecl) = 1;
thunk.thunk_p = false;
analyzed = false;
@@ -1944,9 +1944,11 @@ cgraph_node::expand (void)
bitmap_obstack_initialize (NULL);
/* Initialize the RTL code for the function. */
- current_function_decl = decl;
saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
+
+ gcc_assert (DECL_STRUCT_FUNCTION (decl));
+ push_cfun (DECL_STRUCT_FUNCTION (decl));
init_function_start (decl);
gimple_register_cfg_hooks ();
@@ -2014,8 +2016,8 @@ cgraph_node::expand (void)
/* Make sure that BE didn't give up on compiling. */
gcc_assert (TREE_ASM_WRITTEN (decl));
- set_cfun (NULL);
- current_function_decl = NULL;
+ if (cfun)
+ pop_cfun ();
/* It would make a lot more sense to output thunks before function body to get more
forward and lest backwarding jumps. This however would need solving problem