diff options
author | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-06 02:26:33 +0000 |
---|---|---|
committer | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-06 02:26:33 +0000 |
commit | 2ab2ce89368289e93c9022aae8689f109c132f5c (patch) | |
tree | d191bb056818e7ad987268cffaf32a266a191f4c /gcc/tree-ssa-live.c | |
parent | 01741c270449416238f8e70d812d0b71edcbd495 (diff) | |
download | gcc-2ab2ce89368289e93c9022aae8689f109c132f5c.tar.gz |
gcc/
* vec.h (FOR_EACH_VEC_ELT_REVERSE): New macro.
* function.h (struct_function): Change type of local_decls field
to a VEC.
(add_local_decl): New function.
(FOR_EACH_LOCAL_DECL): New macro.
* cfgexpand.c (init_vars_expansion): Adjust for new type of
cfun->local_decls.
(estimated_stack_frame_size): Likewise.
(expand_used_vars): Likewise.
* cgraphbuild.c (build_cgraph_edges): Likewise.
* function.c (instantiate_decls_1): Likewise.
* ipa-struct-reorg.c (build_data_structure): Likewise.
* ipa-type-escape.c (analyze_function): Likewise.
* lto-streamer-in.c (input_function): Likewise.
* lto-streamer-out.c (output_function): Likewise.
* tree-ssa-live.c (remove_unused_locals): Likewise.
* tree.c (free_lang_data_in_decl): Likewise.
(find_decls_types_in_node): Likewise.
* omp-low.c (remove_exit_barrier): Likewise.
(expand_omp_taskreg): Likewise.
(list2chain): Rename to...
(vec2chain): ...this. Adjust.
* cgraphunit.c (assemble_thunk): Call add_local_decl.
* tree-cfg.c (replace_by_duplicate_decl): Likewise.
* gimple-low.c (record_vars_into): Likewise.
* tree-inline.c (remap_decls): Likewise.
(declare_return_variable): Likewise.
(declare_inline_vars): Likewise.
(copy_forbidden): Adjust for new type of cfun->local_decls.
(add_local_variables): New function.
(expand_call_inline): Call it.
(tree_function_versioning): Likewise.
gcc/cp/
* decl.c (cp_finish_decl): Call add_local_decl.
* optimize.c (clone_body): Adjust for new type of cfun->local_decls.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161862 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r-- | gcc/tree-ssa-live.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index ca1b985bb8e..045d42cda3c 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -663,10 +663,11 @@ void remove_unused_locals (void) { basic_block bb; - tree t, *cell; + tree var, t; referenced_var_iterator rvi; var_ann_t ann; bitmap global_unused_vars = NULL; + unsigned ix; /* Removing declarations from lexical blocks when not optimizing is not only a waste of time, it actually causes differences in stack @@ -733,10 +734,8 @@ remove_unused_locals (void) cfun->has_local_explicit_reg_vars = false; /* Remove unmarked local vars from local_decls. */ - for (cell = &cfun->local_decls; *cell; ) + for (ix = 0; VEC_iterate (tree, cfun->local_decls, ix, var); ) { - tree var = TREE_VALUE (*cell); - if (TREE_CODE (var) != FUNCTION_DECL && (!(ann = var_ann (var)) || !ann->used)) @@ -749,7 +748,7 @@ remove_unused_locals (void) } else { - *cell = TREE_CHAIN (*cell); + VEC_unordered_remove (tree, cfun->local_decls, ix); continue; } } @@ -757,34 +756,29 @@ remove_unused_locals (void) && DECL_HARD_REGISTER (var) && !is_global_var (var)) cfun->has_local_explicit_reg_vars = true; - cell = &TREE_CHAIN (*cell); + + ix++; } /* Remove unmarked global vars from local_decls. */ if (global_unused_vars != NULL) { - for (t = cfun->local_decls; t; t = TREE_CHAIN (t)) - { - tree var = TREE_VALUE (t); - - if (TREE_CODE (var) == VAR_DECL - && is_global_var (var) - && (ann = var_ann (var)) != NULL - && ann->used) - mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars); - } - - for (cell = &cfun->local_decls; *cell; ) - { - tree var = TREE_VALUE (*cell); - - if (TREE_CODE (var) == VAR_DECL - && is_global_var (var) - && bitmap_bit_p (global_unused_vars, DECL_UID (var))) - *cell = TREE_CHAIN (*cell); - else - cell = &TREE_CHAIN (*cell); - } + tree var; + unsigned ix; + FOR_EACH_LOCAL_DECL (cfun, ix, var) + if (TREE_CODE (var) == VAR_DECL + && is_global_var (var) + && (ann = var_ann (var)) != NULL + && ann->used) + mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars); + + for (ix = 0; VEC_iterate (tree, cfun->local_decls, ix, var); ) + if (TREE_CODE (var) == VAR_DECL + && is_global_var (var) + && bitmap_bit_p (global_unused_vars, DECL_UID (var))) + VEC_unordered_remove (tree, cfun->local_decls, ix); + else + ix++; BITMAP_FREE (global_unused_vars); } |