diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2010-07-06 02:26:33 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2010-07-06 02:26:33 +0000 |
commit | c021f10b188584445b45ec9649cff4d39e640c3e (patch) | |
tree | d191bb056818e7ad987268cffaf32a266a191f4c /gcc/omp-low.c | |
parent | 979cc399477378ad45eb030ef5029e35c6be4371 (diff) | |
download | gcc-c021f10b188584445b45ec9649cff4d39e640c3e.zip gcc-c021f10b188584445b45ec9649cff4d39e640c3e.tar.gz gcc-c021f10b188584445b45ec9649cff4d39e640c3e.tar.bz2 |
vec.h (FOR_EACH_VEC_ELT_REVERSE): New macro.
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.
From-SVN: r161862
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index eca27c8d..f289159 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -3138,20 +3138,18 @@ maybe_catch_exception (gimple_seq body) /* Chain all the DECLs in LIST by their TREE_CHAIN fields. */ static tree -list2chain (tree list) +vec2chain (VEC(tree,gc) *v) { - tree t; + tree chain = NULL_TREE, t; + unsigned ix; - for (t = list; t; t = TREE_CHAIN (t)) + FOR_EACH_VEC_ELT_REVERSE (tree, v, ix, t) { - tree var = TREE_VALUE (t); - if (TREE_CHAIN (t)) - TREE_CHAIN (var) = TREE_VALUE (TREE_CHAIN (t)); - else - TREE_CHAIN (var) = NULL_TREE; + TREE_CHAIN (t) = chain; + chain = t; } - return list ? TREE_VALUE (list) : NULL_TREE; + return chain; } @@ -3210,12 +3208,12 @@ remove_exit_barrier (struct omp_region *region) { gimple parallel_stmt = last_stmt (region->entry); tree child_fun = gimple_omp_parallel_child_fn (parallel_stmt); - tree local_decls = DECL_STRUCT_FUNCTION (child_fun)->local_decls; - tree block; + tree local_decls, block, decl; + unsigned ix; any_addressable_vars = 0; - for (; local_decls; local_decls = TREE_CHAIN (local_decls)) - if (TREE_ADDRESSABLE (TREE_VALUE (local_decls))) + FOR_EACH_LOCAL_DECL (DECL_STRUCT_FUNCTION (child_fun), ix, decl) + if (TREE_ADDRESSABLE (decl)) { any_addressable_vars = 1; break; @@ -3334,7 +3332,7 @@ expand_omp_taskreg (struct omp_region *region) { basic_block entry_bb, exit_bb, new_bb; struct function *child_cfun; - tree child_fn, block, t, ws_args, *tp; + tree child_fn, block, t, ws_args; tree save_current; gimple_stmt_iterator gsi; gimple entry_stmt, stmt; @@ -3380,6 +3378,8 @@ expand_omp_taskreg (struct omp_region *region) } else { + unsigned ix; + /* If the parallel region needs data sent from the parent function, then the very first statement (except possible tree profile counter updates) of the parallel body @@ -3457,7 +3457,7 @@ expand_omp_taskreg (struct omp_region *region) /* Declare local variables needed in CHILD_CFUN. */ block = DECL_INITIAL (child_fn); - BLOCK_VARS (block) = list2chain (child_cfun->local_decls); + BLOCK_VARS (block) = vec2chain (child_cfun->local_decls); /* The gimplifier could record temporaries in parallel/task block rather than in containing function's local_decls chain, which would mean cgraph missed finalizing them. Do it now. */ @@ -3515,11 +3515,11 @@ expand_omp_taskreg (struct omp_region *region) single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; /* Remove non-local VAR_DECLs from child_cfun->local_decls list. */ - for (tp = &child_cfun->local_decls; *tp; ) - if (DECL_CONTEXT (TREE_VALUE (*tp)) != cfun->decl) - tp = &TREE_CHAIN (*tp); + for (ix = 0; VEC_iterate (tree, child_cfun->local_decls, ix, t); ) + if (DECL_CONTEXT (t) != cfun->decl) + ix++; else - *tp = TREE_CHAIN (*tp); + VEC_unordered_remove (tree, child_cfun->local_decls, ix); /* Inform the callgraph about the new function. */ DECL_STRUCT_FUNCTION (child_fn)->curr_properties |