diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-11 12:41:36 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-11 12:41:36 +0000 |
commit | 5737913a9a605694b55935563fc11e1e440b0351 (patch) | |
tree | fb9ef6a13039426828243cade216220f16250a8c /gcc/function.c | |
parent | a4ed3c38182dc43cc106abc06a2f76465989eb3f (diff) | |
download | gcc-5737913a9a605694b55935563fc11e1e440b0351.tar.gz |
* cgraph.c (cgraph_release_function_body): Plug memory leak on
ipa_transforms_to_apply and CFG; ggc_free gimple df and struct function
so we are sure we do not dangle it forever.
* function.c (outer_function_chain, find_function_data): Remove.
(function_context_stack): New.
(push_function_context, pop_function_context): Update.
* function.h (struct function): Remove pointer outer.
(outer_function_chain, find_function_data): Remove.
* stmt.c (force_label_rtx): Remove dead call of find_function_data.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140285 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/gcc/function.c b/gcc/function.c index 412e6fa9af0..41c5a46a621 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -208,23 +208,14 @@ static void do_clobber_return_reg (rtx, void *); static void do_use_return_reg (rtx, void *); static void set_insn_locators (rtx, int) ATTRIBUTE_UNUSED; -/* Pointer to chain of `struct function' for containing functions. */ -struct function *outer_function_chain; - -/* Given a function decl for a containing function, - return the `struct function' for it. */ - -struct function * -find_function_data (tree decl) -{ - struct function *p; +/* Stack of nested functions. */ +/* Keep track of the cfun stack. */ - for (p = outer_function_chain; p; p = p->outer) - if (p->decl == decl) - return p; +typedef struct function *function_p; - gcc_unreachable (); -} +DEF_VEC_P(function_p); +DEF_VEC_ALLOC_P(function_p,heap); +static VEC(function_p,heap) *function_context_stack; /* Save the current context for compilation of a nested function. This is called from language-specific code. */ @@ -235,8 +226,7 @@ push_function_context (void) if (cfun == 0) allocate_struct_function (NULL, false); - cfun->outer = outer_function_chain; - outer_function_chain = cfun; + VEC_safe_push (function_p, heap, function_context_stack, cfun); set_cfun (NULL); } @@ -246,10 +236,8 @@ push_function_context (void) void pop_function_context (void) { - struct function *p = outer_function_chain; - + struct function *p = VEC_pop (function_p, function_context_stack); set_cfun (p); - outer_function_chain = p->outer; current_function_decl = p->decl; /* Reset variables that have known state during rtx generation. */ @@ -3905,13 +3893,6 @@ set_cfun (struct function *new_cfun) } } -/* Keep track of the cfun stack. */ - -typedef struct function *function_p; - -DEF_VEC_P(function_p); -DEF_VEC_ALLOC_P(function_p,heap); - /* Initialized with NOGC, making this poisonous to the garbage collector. */ static VEC(function_p,heap) *cfun_stack; |