Commit 6be42dd4 by Richard Guenther Committed by Richard Biener

omp-low.c (splay-tree.h): Include.

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.

From-SVN: r123381
parent d393153e
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> 2007-03-31 Anatoly Sokolov <aesok@post.ru>
* config/avr/predicates.md (even_register_operand, * config/avr/predicates.md (even_register_operand,
......
...@@ -787,7 +787,7 @@ SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h $(PARAMS_H) ...@@ -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) LAMBDA_H = lambda.h $(TREE_H) vec.h $(GGC_H)
TREE_DATA_REF_H = tree-data-ref.h $(LAMBDA_H) omega.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) 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) REAL_H = real.h $(MACHMODE_H)
# #
...@@ -2180,7 +2180,7 @@ gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_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) \ $(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 \ 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) \ $(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) \ gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
$(DIAGNOSTIC_H) $(TREE_GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) langhooks.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 \ $(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) \ ...@@ -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) \ 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) \ $(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 \ $(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-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \ $(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
$(TM_H) coretypes.h $(TM_H) coretypes.h
......
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> 2007-03-31 Douglas Gregor <doug.gregor@gmail.com>
PR c++/31138 PR c++/31138
......
...@@ -99,7 +99,7 @@ maybe_clone_body (tree fn) ...@@ -99,7 +99,7 @@ maybe_clone_body (tree fn)
tree parm; tree parm;
tree clone_parm; tree clone_parm;
int parmno; int parmno;
splay_tree decl_map; struct pointer_map_t *decl_map;
/* Update CLONE's source position information to match FN's. */ /* Update CLONE's source position information to match FN's. */
DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn); DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
...@@ -139,7 +139,7 @@ maybe_clone_body (tree fn) ...@@ -139,7 +139,7 @@ maybe_clone_body (tree fn)
start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED); start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
/* Remap the parameters. */ /* Remap the parameters. */
decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); decl_map = pointer_map_create ();
for (parmno = 0, for (parmno = 0,
parm = DECL_ARGUMENTS (fn), parm = DECL_ARGUMENTS (fn),
clone_parm = DECL_ARGUMENTS (clone); clone_parm = DECL_ARGUMENTS (clone);
...@@ -152,9 +152,7 @@ maybe_clone_body (tree fn) ...@@ -152,9 +152,7 @@ maybe_clone_body (tree fn)
{ {
tree in_charge; tree in_charge;
in_charge = in_charge_arg_for_name (DECL_NAME (clone)); in_charge = in_charge_arg_for_name (DECL_NAME (clone));
splay_tree_insert (decl_map, *pointer_map_insert (decl_map, parm) = in_charge;
(splay_tree_key) parm,
(splay_tree_value) in_charge);
} }
else if (DECL_ARTIFICIAL (parm) else if (DECL_ARTIFICIAL (parm)
&& DECL_NAME (parm) == vtt_parm_identifier) && DECL_NAME (parm) == vtt_parm_identifier)
...@@ -165,26 +163,18 @@ maybe_clone_body (tree fn) ...@@ -165,26 +163,18 @@ maybe_clone_body (tree fn)
if (DECL_HAS_VTT_PARM_P (clone)) if (DECL_HAS_VTT_PARM_P (clone))
{ {
DECL_ABSTRACT_ORIGIN (clone_parm) = parm; DECL_ABSTRACT_ORIGIN (clone_parm) = parm;
splay_tree_insert (decl_map, *pointer_map_insert (decl_map, parm) = clone_parm;
(splay_tree_key) parm,
(splay_tree_value) clone_parm);
clone_parm = TREE_CHAIN (clone_parm); clone_parm = TREE_CHAIN (clone_parm);
} }
/* Otherwise, map the VTT parameter to `NULL'. */ /* Otherwise, map the VTT parameter to `NULL'. */
else else
{ *pointer_map_insert (decl_map, parm) = null_pointer_node;
splay_tree_insert (decl_map,
(splay_tree_key) parm,
(splay_tree_value) null_pointer_node);
}
} }
/* Map other parameters to their equivalents in the cloned /* Map other parameters to their equivalents in the cloned
function. */ function. */
else else
{ {
splay_tree_insert (decl_map, *pointer_map_insert (decl_map, parm) = clone_parm;
(splay_tree_key) parm,
(splay_tree_value) clone_parm);
clone_parm = TREE_CHAIN (clone_parm); clone_parm = TREE_CHAIN (clone_parm);
} }
} }
...@@ -193,14 +183,13 @@ maybe_clone_body (tree fn) ...@@ -193,14 +183,13 @@ maybe_clone_body (tree fn)
{ {
parm = DECL_RESULT (fn); parm = DECL_RESULT (fn);
clone_parm = DECL_RESULT (clone); clone_parm = DECL_RESULT (clone);
splay_tree_insert (decl_map, (splay_tree_key) parm, *pointer_map_insert (decl_map, parm) = clone_parm;
(splay_tree_value) clone_parm);
} }
/* Clone the body. */ /* Clone the body. */
clone_body (clone, fn, decl_map); clone_body (clone, fn, decl_map);
/* Clean up. */ /* Clean up. */
splay_tree_delete (decl_map); pointer_map_destroy (decl_map);
/* The clone can throw iff the original function can throw. */ /* The clone can throw iff the original function can throw. */
cp_function_chain->can_throw = !TREE_NOTHROW (fn); cp_function_chain->can_throw = !TREE_NOTHROW (fn);
......
...@@ -49,6 +49,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -49,6 +49,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "target.h" #include "target.h"
#include "optabs.h" #include "optabs.h"
#include "pointer-set.h" #include "pointer-set.h"
#include "splay-tree.h"
enum gimplify_omp_var_data enum gimplify_omp_var_data
......
...@@ -41,6 +41,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -41,6 +41,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-pass.h" #include "tree-pass.h"
#include "ggc.h" #include "ggc.h"
#include "except.h" #include "except.h"
#include "splay-tree.h"
/* Lowering of OpenMP parallel and workshare constructs proceeds in two /* Lowering of OpenMP parallel and workshare constructs proceeds in two
...@@ -441,17 +442,17 @@ is_reference (tree decl) ...@@ -441,17 +442,17 @@ is_reference (tree decl)
static inline tree static inline tree
lookup_decl (tree var, omp_context *ctx) lookup_decl (tree var, omp_context *ctx)
{ {
splay_tree_node n; tree *n;
n = splay_tree_lookup (ctx->cb.decl_map, (splay_tree_key) var); n = (tree *) pointer_map_contains (ctx->cb.decl_map, var);
return (tree) n->value; return *n;
} }
static inline tree static inline tree
maybe_lookup_decl (tree var, omp_context *ctx) maybe_lookup_decl (tree var, omp_context *ctx)
{ {
splay_tree_node n; tree *n;
n = splay_tree_lookup (ctx->cb.decl_map, (splay_tree_key) var); n = (tree *) pointer_map_contains (ctx->cb.decl_map, var);
return n ? (tree) n->value : NULL_TREE; return n ? *n : NULL_TREE;
} }
static inline tree static inline tree
...@@ -844,7 +845,7 @@ new_omp_context (tree stmt, omp_context *outer_ctx) ...@@ -844,7 +845,7 @@ new_omp_context (tree stmt, omp_context *outer_ctx)
ctx->depth = 1; 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; return ctx;
} }
...@@ -857,7 +858,7 @@ delete_omp_context (splay_tree_value value) ...@@ -857,7 +858,7 @@ delete_omp_context (splay_tree_value value)
{ {
omp_context *ctx = (omp_context *) 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) if (ctx->field_map)
splay_tree_delete (ctx->field_map); splay_tree_delete (ctx->field_map);
......
...@@ -148,14 +148,12 @@ static tree copy_decl_maybe_to_var (tree, copy_body_data *); ...@@ -148,14 +148,12 @@ static tree copy_decl_maybe_to_var (tree, copy_body_data *);
void void
insert_decl_map (copy_body_data *id, tree key, tree value) insert_decl_map (copy_body_data *id, tree key, tree value)
{ {
splay_tree_insert (id->decl_map, (splay_tree_key) key, *pointer_map_insert (id->decl_map, key) = value;
(splay_tree_value) value);
/* Always insert an identity map as well. If we see this same new /* 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. */ node again, we won't want to duplicate it a second time. */
if (key != value) if (key != value)
splay_tree_insert (id->decl_map, (splay_tree_key) value, *pointer_map_insert (id->decl_map, value) = value;
(splay_tree_value) value);
} }
/* Construct new SSA name for old NAME. ID is the inline context. */ /* Construct new SSA name for old NAME. ID is the inline context. */
...@@ -164,13 +162,13 @@ static tree ...@@ -164,13 +162,13 @@ static tree
remap_ssa_name (tree name, copy_body_data *id) remap_ssa_name (tree name, copy_body_data *id)
{ {
tree new; tree new;
splay_tree_node n; tree *n;
gcc_assert (TREE_CODE (name) == SSA_NAME); 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) if (n)
return (tree) n->value; return *n;
/* Do not set DEF_STMT yet as statement is not copied yet. We do that /* Do not set DEF_STMT yet as statement is not copied yet. We do that
in copy_bb. */ in copy_bb. */
...@@ -207,7 +205,7 @@ remap_ssa_name (tree name, copy_body_data *id) ...@@ -207,7 +205,7 @@ remap_ssa_name (tree name, copy_body_data *id)
tree tree
remap_decl (tree decl, copy_body_data *id) remap_decl (tree decl, copy_body_data *id)
{ {
splay_tree_node n; tree *n;
tree fn; tree fn;
/* We only remap local variables in the current function. */ /* We only remap local variables in the current function. */
...@@ -215,7 +213,7 @@ remap_decl (tree decl, copy_body_data *id) ...@@ -215,7 +213,7 @@ remap_decl (tree decl, copy_body_data *id)
/* See if we have remapped this declaration. */ /* 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, /* If we didn't already have an equivalent for this declaration,
create one now. */ create one now. */
...@@ -268,22 +266,22 @@ remap_decl (tree decl, copy_body_data *id) ...@@ -268,22 +266,22 @@ remap_decl (tree decl, copy_body_data *id)
return t; return t;
} }
return unshare_expr ((tree) n->value); return unshare_expr (*n);
} }
static tree static tree
remap_type_1 (tree type, copy_body_data *id) remap_type_1 (tree type, copy_body_data *id)
{ {
splay_tree_node node; tree *node;
tree new, t; tree new, t;
if (type == NULL) if (type == NULL)
return type; return type;
/* See if we have remapped this 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) if (node)
return (tree) node->value; return *node;
/* The type only needs remapping if it's variably modified. */ /* The type only needs remapping if it's variably modified. */
if (! variably_modified_type_p (type, id->src_fn)) if (! variably_modified_type_p (type, id->src_fn))
...@@ -396,15 +394,15 @@ remap_type_1 (tree type, copy_body_data *id) ...@@ -396,15 +394,15 @@ remap_type_1 (tree type, copy_body_data *id)
tree tree
remap_type (tree type, copy_body_data *id) remap_type (tree type, copy_body_data *id)
{ {
splay_tree_node node; tree *node;
if (type == NULL) if (type == NULL)
return type; return type;
/* See if we have remapped this 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) if (node)
return (tree) node->value; return *node;
/* The type only needs remapping if it's variably modified. */ /* The type only needs remapping if it's variably modified. */
if (! variably_modified_type_p (type, id->src_fn)) if (! variably_modified_type_p (type, id->src_fn))
...@@ -650,12 +648,12 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -650,12 +648,12 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
and thus don't count as variable modification. Avoid and thus don't count as variable modification. Avoid
keeping bogosities like 0 = 0. */ keeping bogosities like 0 = 0. */
tree decl = GIMPLE_STMT_OPERAND (*tp, 0), value; 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) if (n)
{ {
value = (tree) n->value; value = *n;
STRIP_TYPE_NOPS (value); STRIP_TYPE_NOPS (value);
if (TREE_CONSTANT (value) || TREE_READONLY_DECL_P (value)) if (TREE_CONSTANT (value) || TREE_READONLY_DECL_P (value))
{ {
...@@ -669,9 +667,9 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -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 /* Get rid of *& from inline substitutions that can happen when a
pointer argument is an ADDR_EXPR. */ pointer argument is an ADDR_EXPR. */
tree decl = TREE_OPERAND (*tp, 0); 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) if (n)
{ {
tree new; tree new;
...@@ -682,8 +680,8 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -682,8 +680,8 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
build_fold_indirect_ref wouldn't strip the INDIRECT_REF, build_fold_indirect_ref wouldn't strip the INDIRECT_REF,
but we absolutely rely on that. As fold_indirect_ref but we absolutely rely on that. As fold_indirect_ref
does other useful transformations, try that first, though. */ does other useful transformations, try that first, though. */
tree type = TREE_TYPE (TREE_TYPE ((tree)n->value)); tree type = TREE_TYPE (TREE_TYPE (*n));
new = unshare_expr ((tree)n->value); new = unshare_expr (*n);
old = *tp; old = *tp;
*tp = fold_indirect_ref_1 (type, new); *tp = fold_indirect_ref_1 (type, new);
if (! *tp) if (! *tp)
...@@ -718,11 +716,11 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -718,11 +716,11 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
new_block = id->block; new_block = id->block;
if (TREE_BLOCK (*tp)) if (TREE_BLOCK (*tp))
{ {
splay_tree_node n; tree *n;
n = splay_tree_lookup (id->decl_map, n = (tree *) pointer_map_contains (id->decl_map,
(splay_tree_key) TREE_BLOCK (*tp)); TREE_BLOCK (*tp));
gcc_assert (n); gcc_assert (n);
new_block = (tree) n->value; new_block = *n;
} }
TREE_BLOCK (*tp) = new_block; TREE_BLOCK (*tp) = new_block;
} }
...@@ -2354,7 +2352,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) ...@@ -2354,7 +2352,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
tree t; tree t;
tree use_retvar; tree use_retvar;
tree fn; tree fn;
splay_tree st; struct pointer_map_t *st;
tree return_slot; tree return_slot;
tree modify_dest; tree modify_dest;
location_t saved_location; location_t saved_location;
...@@ -2509,8 +2507,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) ...@@ -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 /* Local declarations will be replaced by their equivalents in this
map. */ map. */
st = id->decl_map; st = id->decl_map;
id->decl_map = splay_tree_new (splay_tree_compare_pointers, id->decl_map = pointer_map_create ();
NULL, NULL);
/* Record the function we are about to inline. */ /* Record the function we are about to inline. */
id->src_fn = fn; id->src_fn = fn;
...@@ -2576,7 +2573,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) ...@@ -2576,7 +2573,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
} }
/* Clean up. */ /* Clean up. */
splay_tree_delete (id->decl_map); pointer_map_destroy (id->decl_map);
id->decl_map = st; id->decl_map = st;
/* If the inlined function returns a result that we care about, /* If the inlined function returns a result that we care about,
...@@ -2870,7 +2867,7 @@ clone_body (tree clone, tree fn, void *arg_map) ...@@ -2870,7 +2867,7 @@ clone_body (tree clone, tree fn, void *arg_map)
id.src_fn = fn; id.src_fn = fn;
id.dst_fn = clone; id.dst_fn = clone;
id.src_cfun = DECL_STRUCT_FUNCTION (fn); 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.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE; id.transform_call_graph_edges = CB_CGE_DUPLICATE;
...@@ -2964,12 +2961,12 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) ...@@ -2964,12 +2961,12 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
static void static void
remap_save_expr (tree *tp, void *st_, int *walk_subtrees) remap_save_expr (tree *tp, void *st_, int *walk_subtrees)
{ {
splay_tree st = (splay_tree) st_; struct pointer_map_t *st = (struct pointer_map_t *) st_;
splay_tree_node n; tree *n;
tree t; tree t;
/* See if we already encountered this SAVE_EXPR. */ /* 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 we didn't already remap this SAVE_EXPR, do so now. */
if (!n) if (!n)
...@@ -2977,15 +2974,15 @@ remap_save_expr (tree *tp, void *st_, int *walk_subtrees) ...@@ -2977,15 +2974,15 @@ remap_save_expr (tree *tp, void *st_, int *walk_subtrees)
t = copy_node (*tp); t = copy_node (*tp);
/* Remember this SAVE_EXPR. */ /* 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. */ /* 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 else
{ {
/* We've already walked into this SAVE_EXPR; don't do it again. */ /* We've already walked into this SAVE_EXPR; don't do it again. */
*walk_subtrees = 0; *walk_subtrees = 0;
t = (tree) n->value; t = *n;
} }
/* Replace this SAVE_EXPR with the copy. */ /* Replace this SAVE_EXPR with the copy. */
...@@ -3050,19 +3047,19 @@ static tree ...@@ -3050,19 +3047,19 @@ static tree
unsave_r (tree *tp, int *walk_subtrees, void *data) unsave_r (tree *tp, int *walk_subtrees, void *data)
{ {
copy_body_data *id = (copy_body_data *) data; copy_body_data *id = (copy_body_data *) data;
splay_tree st = id->decl_map; struct pointer_map_t *st = id->decl_map;
splay_tree_node n; tree *n;
/* Only a local declaration (variable or label). */ /* Only a local declaration (variable or label). */
if ((TREE_CODE (*tp) == VAR_DECL && !TREE_STATIC (*tp)) if ((TREE_CODE (*tp) == VAR_DECL && !TREE_STATIC (*tp))
|| TREE_CODE (*tp) == LABEL_DECL) || TREE_CODE (*tp) == LABEL_DECL)
{ {
/* Lookup the declaration. */ /* 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 it's there, remap it. */
if (n) if (n)
*tp = (tree) n->value; *tp = *n;
} }
else if (TREE_CODE (*tp) == STATEMENT_LIST) else if (TREE_CODE (*tp) == STATEMENT_LIST)
...@@ -3099,7 +3096,7 @@ unsave_expr_now (tree expr) ...@@ -3099,7 +3096,7 @@ unsave_expr_now (tree expr)
memset (&id, 0, sizeof (id)); memset (&id, 0, sizeof (id));
id.src_fn = current_function_decl; id.src_fn = current_function_decl;
id.dst_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.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE; id.transform_call_graph_edges = CB_CGE_DUPLICATE;
...@@ -3114,7 +3111,7 @@ unsave_expr_now (tree expr) ...@@ -3114,7 +3111,7 @@ unsave_expr_now (tree expr)
walk_tree (&expr, unsave_r, &id, NULL); walk_tree (&expr, unsave_r, &id, NULL);
/* Clean up. */ /* Clean up. */
splay_tree_delete (id.decl_map); pointer_map_destroy (id.decl_map);
return expr; return expr;
} }
...@@ -3373,7 +3370,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map, ...@@ -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.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.src_fn = old_decl;
id.dst_fn = new_decl; id.dst_fn = new_decl;
id.src_node = old_version_node; id.src_node = old_version_node;
...@@ -3450,7 +3447,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map, ...@@ -3450,7 +3447,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
number_blocks (new_decl); number_blocks (new_decl);
/* Clean up. */ /* Clean up. */
splay_tree_delete (id.decl_map); pointer_map_destroy (id.decl_map);
if (!update_clones) if (!update_clones)
{ {
fold_marked_statements (0, id.statements_to_fold); fold_marked_statements (0, id.statements_to_fold);
...@@ -3491,11 +3488,11 @@ build_duplicate_type (tree type) ...@@ -3491,11 +3488,11 @@ build_duplicate_type (tree type)
id.src_fn = current_function_decl; id.src_fn = current_function_decl;
id.dst_fn = current_function_decl; id.dst_fn = current_function_decl;
id.src_cfun = cfun; 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); type = remap_type_1 (type, &id);
splay_tree_delete (id.decl_map); pointer_map_destroy (id.decl_map);
return type; return type;
} }
...@@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */ ...@@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA. */
#define GCC_TREE_INLINE_H #define GCC_TREE_INLINE_H
#include "varray.h" #include "varray.h"
#include "splay-tree.h" #include "pointer-set.h"
/* Data required for function body duplication. */ /* Data required for function body duplication. */
...@@ -49,7 +49,7 @@ typedef struct copy_body_data ...@@ -49,7 +49,7 @@ typedef struct copy_body_data
tree retvar; tree retvar;
/* The map from local declarations in the inlined function to /* The map from local declarations in the inlined function to
equivalents in the function into which it is being inlined. */ 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. */ /* Create a new decl to replace DECL in the destination function. */
tree (*copy_decl) (tree, struct copy_body_data *); tree (*copy_decl) (tree, struct copy_body_data *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment