diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-31 14:07:29 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-31 14:07:29 +0000 |
commit | e3022db7ee7faeaced8afbfaa3d3edbc1c6098b3 (patch) | |
tree | e35d13b4ee94edc9550a7d68aaf4c9f58eb9c1b3 | |
parent | 2aedc2ffdf2feaa3543eb052124627300a210c3c (diff) | |
download | gcc-e3022db7ee7faeaced8afbfaa3d3edbc1c6098b3.tar.gz |
2007-03-31 Richard Guenther <rguenther@suse.de>
* omp-low.c (splay-tree.h): Include.
(lookup_decl): Replace splay-tree usage by pointer-map.
(maybe_lookup_decl): Likewise.
(new_omp_context): Likewise.
(delete_omp_context): Likewise.
* gimplify.c (splay-tree.h): Include.
* tree-inline.c (insert_decl_map): Replace splay-tree usage by
pointer-map.
(remap_ssa_name): Likewise.
(remap_decl): Likewise.
(remap_type_1): Likewise.
(remap_type): Likewise.
(copy_body_r): Likewise.
(expand_call_inline): Likewise.
(clone_body): Likewise.
(copy_tree_r): Likewise.
(remap_save_expr): Likewise.
(unsave_r): Likewise.
(unsave_expr_now): Likewise.
(tree_function_versioning): Likewise.
(build_duplicate_type): Likewise.
* tree-inline.h (pointer-set.h): Include instead of splay-tree.h.
(struct copy_body_data): Replace splay-tree by pointer-map.
* Makefile.in (TREE_INLINE_H): Depend on pointer-map.h, not $(SPLAY_TREE_H).
(gimplify.o): Depend on $(SPLAY_TREE_H).
(omp-low.p): Likewise.
* optimize.c (maybe_clone_body): Replace splay-tree usage by
pointer-map.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123381 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 30 | ||||
-rw-r--r-- | gcc/Makefile.in | 6 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/optimize.c | 27 | ||||
-rw-r--r-- | gcc/gimplify.c | 1 | ||||
-rw-r--r-- | gcc/omp-low.c | 17 | ||||
-rw-r--r-- | gcc/tree-inline.c | 93 | ||||
-rw-r--r-- | gcc/tree-inline.h | 4 |
8 files changed, 103 insertions, 80 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce64d10b0ff..4d6609fe3e8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,33 @@ +2007-03-31 Richard Guenther <rguenther@suse.de> + + * omp-low.c (splay-tree.h): Include. + (lookup_decl): Replace splay-tree usage by pointer-map. + (maybe_lookup_decl): Likewise. + (new_omp_context): Likewise. + (delete_omp_context): Likewise. + * gimplify.c (splay-tree.h): Include. + * tree-inline.c (insert_decl_map): Replace splay-tree usage by + pointer-map. + (remap_ssa_name): Likewise. + (remap_decl): Likewise. + (remap_type_1): Likewise. + (remap_type): Likewise. + (copy_body_r): Likewise. + (expand_call_inline): Likewise. + (clone_body): Likewise. + (copy_tree_r): Likewise. + (remap_save_expr): Likewise. + (unsave_r): Likewise. + (unsave_expr_now): Likewise. + (tree_function_versioning): Likewise. + (build_duplicate_type): Likewise. + * tree-inline.h (pointer-set.h): Include instead of splay-tree.h. + (struct copy_body_data): Replace splay-tree by pointer-map. + * Makefile.in (TREE_INLINE_H): Depend on pointer-map.h, + not $(SPLAY_TREE_H). + (gimplify.o): Depend on $(SPLAY_TREE_H). + (omp-low.p): Likewise. + 2007-03-31 Anatoly Sokolov <aesok@post.ru> * config/avr/predicates.md (even_register_operand, diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2b97b215cdf..d1ce5d4ca55 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -787,7 +787,7 @@ SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h $(PARAMS_H) LAMBDA_H = lambda.h $(TREE_H) vec.h $(GGC_H) TREE_DATA_REF_H = tree-data-ref.h $(LAMBDA_H) omega.h VARRAY_H = varray.h $(MACHMODE_H) $(SYSTEM_H) coretypes.h $(TM_H) -TREE_INLINE_H = tree-inline.h $(VARRAY_H) $(SPLAY_TREE_H) +TREE_INLINE_H = tree-inline.h $(VARRAY_H) pointer-set.h REAL_H = real.h $(MACHMODE_H) # @@ -2180,7 +2180,7 @@ gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ $(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(CGRAPH_H) $(TIMEVAR_H) $(TM_H) \ coretypes.h except.h $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) output.h \ $(GGC_H) gt-gimplify.h $(HASHTAB_H) $(TARGET_H) toplev.h $(OPTABS_H) \ - $(REAL_H) + $(REAL_H) $(SPLAY_TREE_H) gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ $(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.h \ $(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(TIMEVAR_H) $(TM_H) coretypes.h \ @@ -2189,7 +2189,7 @@ gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ omp-low.o : omp-low.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_H) \ $(TREE_FLOW_H) $(TIMEVAR_H) $(FLAGS_H) $(EXPR_H) toplev.h tree-pass.h \ - $(GGC_H) + $(GGC_H) $(SPLAY_TREE_H) tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \ $(TM_H) coretypes.h diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c13dceeb1fc..49211160400 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-03-31 Richard Guenther <rguenther@suse.de> + + * optimize.c (maybe_clone_body): Replace splay-tree usage by + pointer-map. + 2007-03-31 Douglas Gregor <doug.gregor@gmail.com> PR c++/31138 diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 839c4e6b012..1b508251164 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -99,7 +99,7 @@ maybe_clone_body (tree fn) tree parm; tree clone_parm; int parmno; - splay_tree decl_map; + struct pointer_map_t *decl_map; /* Update CLONE's source position information to match FN's. */ DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn); @@ -139,7 +139,7 @@ maybe_clone_body (tree fn) start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED); /* Remap the parameters. */ - decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); + decl_map = pointer_map_create (); for (parmno = 0, parm = DECL_ARGUMENTS (fn), clone_parm = DECL_ARGUMENTS (clone); @@ -152,9 +152,7 @@ maybe_clone_body (tree fn) { tree in_charge; in_charge = in_charge_arg_for_name (DECL_NAME (clone)); - splay_tree_insert (decl_map, - (splay_tree_key) parm, - (splay_tree_value) in_charge); + *pointer_map_insert (decl_map, parm) = in_charge; } else if (DECL_ARTIFICIAL (parm) && DECL_NAME (parm) == vtt_parm_identifier) @@ -165,26 +163,18 @@ maybe_clone_body (tree fn) if (DECL_HAS_VTT_PARM_P (clone)) { DECL_ABSTRACT_ORIGIN (clone_parm) = parm; - splay_tree_insert (decl_map, - (splay_tree_key) parm, - (splay_tree_value) clone_parm); + *pointer_map_insert (decl_map, parm) = clone_parm; clone_parm = TREE_CHAIN (clone_parm); } /* Otherwise, map the VTT parameter to `NULL'. */ else - { - splay_tree_insert (decl_map, - (splay_tree_key) parm, - (splay_tree_value) null_pointer_node); - } + *pointer_map_insert (decl_map, parm) = null_pointer_node; } /* Map other parameters to their equivalents in the cloned function. */ else { - splay_tree_insert (decl_map, - (splay_tree_key) parm, - (splay_tree_value) clone_parm); + *pointer_map_insert (decl_map, parm) = clone_parm; clone_parm = TREE_CHAIN (clone_parm); } } @@ -193,14 +183,13 @@ maybe_clone_body (tree fn) { parm = DECL_RESULT (fn); clone_parm = DECL_RESULT (clone); - splay_tree_insert (decl_map, (splay_tree_key) parm, - (splay_tree_value) clone_parm); + *pointer_map_insert (decl_map, parm) = clone_parm; } /* Clone the body. */ clone_body (clone, fn, decl_map); /* Clean up. */ - splay_tree_delete (decl_map); + pointer_map_destroy (decl_map); /* The clone can throw iff the original function can throw. */ cp_function_chain->can_throw = !TREE_NOTHROW (fn); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 02eed6aa9ad..8bedd86dad9 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -49,6 +49,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "target.h" #include "optabs.h" #include "pointer-set.h" +#include "splay-tree.h" enum gimplify_omp_var_data diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 1ced1eaa875..f176f9e4102 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -41,6 +41,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "tree-pass.h" #include "ggc.h" #include "except.h" +#include "splay-tree.h" /* Lowering of OpenMP parallel and workshare constructs proceeds in two @@ -441,17 +442,17 @@ is_reference (tree decl) static inline tree lookup_decl (tree var, omp_context *ctx) { - splay_tree_node n; - n = splay_tree_lookup (ctx->cb.decl_map, (splay_tree_key) var); - return (tree) n->value; + tree *n; + n = (tree *) pointer_map_contains (ctx->cb.decl_map, var); + return *n; } static inline tree maybe_lookup_decl (tree var, omp_context *ctx) { - splay_tree_node n; - n = splay_tree_lookup (ctx->cb.decl_map, (splay_tree_key) var); - return n ? (tree) n->value : NULL_TREE; + tree *n; + n = (tree *) pointer_map_contains (ctx->cb.decl_map, var); + return n ? *n : NULL_TREE; } static inline tree @@ -844,7 +845,7 @@ new_omp_context (tree stmt, omp_context *outer_ctx) ctx->depth = 1; } - ctx->cb.decl_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); + ctx->cb.decl_map = pointer_map_create (); return ctx; } @@ -857,7 +858,7 @@ delete_omp_context (splay_tree_value value) { omp_context *ctx = (omp_context *) value; - splay_tree_delete (ctx->cb.decl_map); + pointer_map_destroy (ctx->cb.decl_map); if (ctx->field_map) splay_tree_delete (ctx->field_map); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 966da8449f6..25844a6701b 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -148,14 +148,12 @@ static tree copy_decl_maybe_to_var (tree, copy_body_data *); void insert_decl_map (copy_body_data *id, tree key, tree value) { - splay_tree_insert (id->decl_map, (splay_tree_key) key, - (splay_tree_value) value); + *pointer_map_insert (id->decl_map, key) = value; /* Always insert an identity map as well. If we see this same new node again, we won't want to duplicate it a second time. */ if (key != value) - splay_tree_insert (id->decl_map, (splay_tree_key) value, - (splay_tree_value) value); + *pointer_map_insert (id->decl_map, value) = value; } /* Construct new SSA name for old NAME. ID is the inline context. */ @@ -164,13 +162,13 @@ static tree remap_ssa_name (tree name, copy_body_data *id) { tree new; - splay_tree_node n; + tree *n; gcc_assert (TREE_CODE (name) == SSA_NAME); - n = splay_tree_lookup (id->decl_map, (splay_tree_key) name); + n = (tree *) pointer_map_contains (id->decl_map, name); if (n) - return (tree) n->value; + return *n; /* Do not set DEF_STMT yet as statement is not copied yet. We do that in copy_bb. */ @@ -207,7 +205,7 @@ remap_ssa_name (tree name, copy_body_data *id) tree remap_decl (tree decl, copy_body_data *id) { - splay_tree_node n; + tree *n; tree fn; /* We only remap local variables in the current function. */ @@ -215,7 +213,7 @@ remap_decl (tree decl, copy_body_data *id) /* See if we have remapped this declaration. */ - n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl); + n = (tree *) pointer_map_contains (id->decl_map, decl); /* If we didn't already have an equivalent for this declaration, create one now. */ @@ -268,22 +266,22 @@ remap_decl (tree decl, copy_body_data *id) return t; } - return unshare_expr ((tree) n->value); + return unshare_expr (*n); } static tree remap_type_1 (tree type, copy_body_data *id) { - splay_tree_node node; + tree *node; tree new, t; if (type == NULL) return type; /* See if we have remapped this type. */ - node = splay_tree_lookup (id->decl_map, (splay_tree_key) type); + node = (tree *) pointer_map_contains (id->decl_map, type); if (node) - return (tree) node->value; + return *node; /* The type only needs remapping if it's variably modified. */ if (! variably_modified_type_p (type, id->src_fn)) @@ -396,15 +394,15 @@ remap_type_1 (tree type, copy_body_data *id) tree remap_type (tree type, copy_body_data *id) { - splay_tree_node node; + tree *node; if (type == NULL) return type; /* See if we have remapped this type. */ - node = splay_tree_lookup (id->decl_map, (splay_tree_key) type); + node = (tree *) pointer_map_contains (id->decl_map, type); if (node) - return (tree) node->value; + return *node; /* The type only needs remapping if it's variably modified. */ if (! variably_modified_type_p (type, id->src_fn)) @@ -650,12 +648,12 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) and thus don't count as variable modification. Avoid keeping bogosities like 0 = 0. */ tree decl = GIMPLE_STMT_OPERAND (*tp, 0), value; - splay_tree_node n; + tree *n; - n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl); + n = (tree *) pointer_map_contains (id->decl_map, decl); if (n) { - value = (tree) n->value; + value = *n; STRIP_TYPE_NOPS (value); if (TREE_CONSTANT (value) || TREE_READONLY_DECL_P (value)) { @@ -669,9 +667,9 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) /* Get rid of *& from inline substitutions that can happen when a pointer argument is an ADDR_EXPR. */ tree decl = TREE_OPERAND (*tp, 0); - splay_tree_node n; + tree *n; - n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl); + n = (tree *) pointer_map_contains (id->decl_map, decl); if (n) { tree new; @@ -682,8 +680,8 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) build_fold_indirect_ref wouldn't strip the INDIRECT_REF, but we absolutely rely on that. As fold_indirect_ref does other useful transformations, try that first, though. */ - tree type = TREE_TYPE (TREE_TYPE ((tree)n->value)); - new = unshare_expr ((tree)n->value); + tree type = TREE_TYPE (TREE_TYPE (*n)); + new = unshare_expr (*n); old = *tp; *tp = fold_indirect_ref_1 (type, new); if (! *tp) @@ -718,11 +716,11 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) new_block = id->block; if (TREE_BLOCK (*tp)) { - splay_tree_node n; - n = splay_tree_lookup (id->decl_map, - (splay_tree_key) TREE_BLOCK (*tp)); + tree *n; + n = (tree *) pointer_map_contains (id->decl_map, + TREE_BLOCK (*tp)); gcc_assert (n); - new_block = (tree) n->value; + new_block = *n; } TREE_BLOCK (*tp) = new_block; } @@ -2354,7 +2352,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) tree t; tree use_retvar; tree fn; - splay_tree st; + struct pointer_map_t *st; tree return_slot; tree modify_dest; location_t saved_location; @@ -2509,8 +2507,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) /* Local declarations will be replaced by their equivalents in this map. */ st = id->decl_map; - id->decl_map = splay_tree_new (splay_tree_compare_pointers, - NULL, NULL); + id->decl_map = pointer_map_create (); /* Record the function we are about to inline. */ id->src_fn = fn; @@ -2576,7 +2573,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) } /* Clean up. */ - splay_tree_delete (id->decl_map); + pointer_map_destroy (id->decl_map); id->decl_map = st; /* If the inlined function returns a result that we care about, @@ -2870,7 +2867,7 @@ clone_body (tree clone, tree fn, void *arg_map) id.src_fn = fn; id.dst_fn = clone; id.src_cfun = DECL_STRUCT_FUNCTION (fn); - id.decl_map = (splay_tree)arg_map; + id.decl_map = (struct pointer_map_t *)arg_map; id.copy_decl = copy_decl_no_change; id.transform_call_graph_edges = CB_CGE_DUPLICATE; @@ -2964,12 +2961,12 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) static void remap_save_expr (tree *tp, void *st_, int *walk_subtrees) { - splay_tree st = (splay_tree) st_; - splay_tree_node n; + struct pointer_map_t *st = (struct pointer_map_t *) st_; + tree *n; tree t; /* See if we already encountered this SAVE_EXPR. */ - n = splay_tree_lookup (st, (splay_tree_key) *tp); + n = (tree *) pointer_map_contains (st, *tp); /* If we didn't already remap this SAVE_EXPR, do so now. */ if (!n) @@ -2977,15 +2974,15 @@ remap_save_expr (tree *tp, void *st_, int *walk_subtrees) t = copy_node (*tp); /* Remember this SAVE_EXPR. */ - splay_tree_insert (st, (splay_tree_key) *tp, (splay_tree_value) t); + *pointer_map_insert (st, *tp) = t; /* Make sure we don't remap an already-remapped SAVE_EXPR. */ - splay_tree_insert (st, (splay_tree_key) t, (splay_tree_value) t); + *pointer_map_insert (st, t) = t; } else { /* We've already walked into this SAVE_EXPR; don't do it again. */ *walk_subtrees = 0; - t = (tree) n->value; + t = *n; } /* Replace this SAVE_EXPR with the copy. */ @@ -3050,19 +3047,19 @@ static tree unsave_r (tree *tp, int *walk_subtrees, void *data) { copy_body_data *id = (copy_body_data *) data; - splay_tree st = id->decl_map; - splay_tree_node n; + struct pointer_map_t *st = id->decl_map; + tree *n; /* Only a local declaration (variable or label). */ if ((TREE_CODE (*tp) == VAR_DECL && !TREE_STATIC (*tp)) || TREE_CODE (*tp) == LABEL_DECL) { /* Lookup the declaration. */ - n = splay_tree_lookup (st, (splay_tree_key) *tp); + n = (tree *) pointer_map_contains (st, *tp); /* If it's there, remap it. */ if (n) - *tp = (tree) n->value; + *tp = *n; } else if (TREE_CODE (*tp) == STATEMENT_LIST) @@ -3099,7 +3096,7 @@ unsave_expr_now (tree expr) memset (&id, 0, sizeof (id)); id.src_fn = current_function_decl; id.dst_fn = current_function_decl; - id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); + id.decl_map = pointer_map_create (); id.copy_decl = copy_decl_no_change; id.transform_call_graph_edges = CB_CGE_DUPLICATE; @@ -3114,7 +3111,7 @@ unsave_expr_now (tree expr) walk_tree (&expr, unsave_r, &id, NULL); /* Clean up. */ - splay_tree_delete (id.decl_map); + pointer_map_destroy (id.decl_map); return expr; } @@ -3373,7 +3370,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map, id.statements_to_fold = pointer_set_create (); } - id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); + id.decl_map = pointer_map_create (); id.src_fn = old_decl; id.dst_fn = new_decl; id.src_node = old_version_node; @@ -3450,7 +3447,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map, number_blocks (new_decl); /* Clean up. */ - splay_tree_delete (id.decl_map); + pointer_map_destroy (id.decl_map); if (!update_clones) { fold_marked_statements (0, id.statements_to_fold); @@ -3491,11 +3488,11 @@ build_duplicate_type (tree type) id.src_fn = current_function_decl; id.dst_fn = current_function_decl; id.src_cfun = cfun; - id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); + id.decl_map = pointer_map_create (); type = remap_type_1 (type, &id); - splay_tree_delete (id.decl_map); + pointer_map_destroy (id.decl_map); return type; } diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h index 998494e1aaa..e191105e049 100644 --- a/gcc/tree-inline.h +++ b/gcc/tree-inline.h @@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */ #define GCC_TREE_INLINE_H #include "varray.h" -#include "splay-tree.h" +#include "pointer-set.h" /* Data required for function body duplication. */ @@ -49,7 +49,7 @@ typedef struct copy_body_data tree retvar; /* The map from local declarations in the inlined function to equivalents in the function into which it is being inlined. */ - splay_tree decl_map; + struct pointer_map_t *decl_map; /* Create a new decl to replace DECL in the destination function. */ tree (*copy_decl) (tree, struct copy_body_data *); |