* [PATCH][C++] Replace splay-tree usage in tree-inline.c by pointer-map
@ 2007-03-28 12:03 Richard Guenther
2007-03-30 17:39 ` Mark Mitchell
0 siblings, 1 reply; 2+ messages in thread
From: Richard Guenther @ 2007-03-28 12:03 UTC (permalink / raw)
To: gcc-patches
This replaces splay-tree usage during inlining by the use of a
pointer-map. As we are only mapping trees to trees this naturally fits
and promises compile-time wins with the chance of a memory usage
increase.
Fortunately even for tramp3d we manage to reduce peak memory usage by
4kB (out of 924492kB), so the constant overhead of splay-trees overweight
the unused extra space a hashtable has. Compile time for tramp3d improves
by at least 3% and at most 5% from three runs (on a not completely idle
system).
Bootstrapped and tested on x86_64-unknown-linux-gnu. This needs a C++
frontend maintainer to approve.
Thanks,
Richard.
2007-03-28 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.
cp/
* optimize.c (maybe_clone_body): Replace splay-tree usage by
pointer-map.
Index: omp-low.c
===================================================================
*** omp-low.c (revision 123218)
--- omp-low.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 41,46 ****
--- 41,47 ----
#include "tree-pass.h"
#include "ggc.h"
#include "except.h"
+ #include "splay-tree.h"
/* Lowering of OpenMP parallel and workshare constructs proceeds in two
*************** is_reference (tree decl)
*** 441,457 ****
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;
}
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;
}
static inline tree
--- 442,458 ----
static inline tree
lookup_decl (tree var, omp_context *ctx)
{
! 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)
{
! tree *n;
! n = (tree *) pointer_map_contains (ctx->cb.decl_map, var);
! return n ? *n : NULL_TREE;
}
static inline tree
*************** new_omp_context (tree stmt, omp_context
*** 844,850 ****
ctx->depth = 1;
}
! ctx->cb.decl_map = splay_tree_new (splay_tree_compare_pointers, 0, 0);
return ctx;
}
--- 845,851 ----
ctx->depth = 1;
}
! ctx->cb.decl_map = pointer_map_create ();
return ctx;
}
*************** delete_omp_context (splay_tree_value val
*** 857,863 ****
{
omp_context *ctx = (omp_context *) value;
! splay_tree_delete (ctx->cb.decl_map);
if (ctx->field_map)
splay_tree_delete (ctx->field_map);
--- 858,864 ----
{
omp_context *ctx = (omp_context *) value;
! pointer_map_destroy (ctx->cb.decl_map);
if (ctx->field_map)
splay_tree_delete (ctx->field_map);
Index: gimplify.c
===================================================================
*** gimplify.c (revision 123218)
--- gimplify.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 49,54 ****
--- 49,55 ----
#include "target.h"
#include "optabs.h"
#include "pointer-set.h"
+ #include "splay-tree.h"
enum gimplify_omp_var_data
Index: tree-inline.c
===================================================================
*** tree-inline.c (revision 123218)
--- tree-inline.c (working copy)
*************** static tree copy_decl_maybe_to_var (tree
*** 148,161 ****
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);
/* 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);
}
/* Construct new SSA name for old NAME. ID is the inline context. */
--- 148,159 ----
void
insert_decl_map (copy_body_data *id, tree key, tree 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)
! *pointer_map_insert (id->decl_map, value) = value;
}
/* Construct new SSA name for old NAME. ID is the inline context. */
*************** static tree
*** 164,176 ****
remap_ssa_name (tree name, copy_body_data *id)
{
tree new;
! splay_tree_node n;
gcc_assert (TREE_CODE (name) == SSA_NAME);
! n = splay_tree_lookup (id->decl_map, (splay_tree_key) name);
if (n)
! return (tree) n->value;
/* Do not set DEF_STMT yet as statement is not copied yet. We do that
in copy_bb. */
--- 162,174 ----
remap_ssa_name (tree name, copy_body_data *id)
{
tree new;
! tree *n;
gcc_assert (TREE_CODE (name) == SSA_NAME);
! n = (tree *) pointer_map_contains (id->decl_map, name);
if (n)
! return *n;
/* Do not set DEF_STMT yet as statement is not copied yet. We do that
in copy_bb. */
*************** remap_ssa_name (tree name, copy_body_dat
*** 207,213 ****
tree
remap_decl (tree decl, copy_body_data *id)
{
! splay_tree_node n;
tree fn;
/* We only remap local variables in the current function. */
--- 205,211 ----
tree
remap_decl (tree decl, copy_body_data *id)
{
! tree *n;
tree fn;
/* We only remap local variables in the current function. */
*************** remap_decl (tree decl, copy_body_data *i
*** 215,221 ****
/* See if we have remapped this declaration. */
! n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
/* If we didn't already have an equivalent for this declaration,
create one now. */
--- 213,219 ----
/* See if we have remapped this declaration. */
! n = (tree *) pointer_map_contains (id->decl_map, decl);
/* If we didn't already have an equivalent for this declaration,
create one now. */
*************** remap_decl (tree decl, copy_body_data *i
*** 268,289 ****
return t;
}
! return unshare_expr ((tree) n->value);
}
! static tree
! remap_type_1 (tree type, copy_body_data *id)
{
! splay_tree_node 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);
if (node)
! return (tree) node->value;
/* The type only needs remapping if it's variably modified. */
if (! variably_modified_type_p (type, id->src_fn))
--- 266,287 ----
return t;
}
! return unshare_expr (*n);
}
! tree
! remap_type (tree type, copy_body_data *id)
{
! tree *node;
tree new, t;
if (type == NULL)
return type;
/* See if we have remapped this type. */
! node = (tree *) pointer_map_contains (id->decl_map, type);
if (node)
! return *node;
/* The type only needs remapping if it's variably modified. */
if (! variably_modified_type_p (type, id->src_fn))
*************** remap_type_1 (tree type, copy_body_data
*** 393,421 ****
return new;
}
- tree
- remap_type (tree type, copy_body_data *id)
- {
- splay_tree_node node;
-
- if (type == NULL)
- return type;
-
- /* See if we have remapped this type. */
- node = splay_tree_lookup (id->decl_map, (splay_tree_key) type);
- if (node)
- return (tree) node->value;
-
- /* The type only needs remapping if it's variably modified. */
- if (! variably_modified_type_p (type, id->src_fn))
- {
- insert_decl_map (id, type, type);
- return type;
- }
-
- return remap_type_1 (type, id);
- }
-
static tree
remap_decls (tree decls, copy_body_data *id)
{
--- 391,396 ----
*************** copy_body_r (tree *tp, int *walk_subtree
*** 650,661 ****
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;
! n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
if (n)
{
! value = (tree) n->value;
STRIP_TYPE_NOPS (value);
if (TREE_CONSTANT (value) || TREE_READONLY_DECL_P (value))
{
--- 625,636 ----
and thus don't count as variable modification. Avoid
keeping bogosities like 0 = 0. */
tree decl = GIMPLE_STMT_OPERAND (*tp, 0), value;
! tree *n;
! n = (tree *) pointer_map_contains (id->decl_map, decl);
if (n)
{
! value = *n;
STRIP_TYPE_NOPS (value);
if (TREE_CONSTANT (value) || TREE_READONLY_DECL_P (value))
{
*************** copy_body_r (tree *tp, int *walk_subtree
*** 669,677 ****
/* 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;
! n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
if (n)
{
tree new;
--- 644,652 ----
/* Get rid of *& from inline substitutions that can happen when a
pointer argument is an ADDR_EXPR. */
tree decl = TREE_OPERAND (*tp, 0);
! tree *n;
! n = (tree *) pointer_map_contains (id->decl_map, decl);
if (n)
{
tree new;
*************** copy_body_r (tree *tp, int *walk_subtree
*** 682,689 ****
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);
old = *tp;
*tp = fold_indirect_ref_1 (type, new);
if (! *tp)
--- 657,664 ----
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 (*n));
! new = unshare_expr (*n);
old = *tp;
*tp = fold_indirect_ref_1 (type, new);
if (! *tp)
*************** copy_body_r (tree *tp, int *walk_subtree
*** 718,728 ****
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));
gcc_assert (n);
! new_block = (tree) n->value;
}
TREE_BLOCK (*tp) = new_block;
}
--- 693,703 ----
new_block = id->block;
if (TREE_BLOCK (*tp))
{
! tree *n;
! n = (tree *) pointer_map_contains (id->decl_map,
! TREE_BLOCK (*tp));
gcc_assert (n);
! new_block = *n;
}
TREE_BLOCK (*tp) = new_block;
}
*************** expand_call_inline (basic_block bb, tree
*** 2354,2360 ****
tree t;
tree use_retvar;
tree fn;
! splay_tree st;
tree return_slot;
tree modify_dest;
location_t saved_location;
--- 2329,2335 ----
tree t;
tree use_retvar;
tree fn;
! struct pointer_map_t *st;
tree return_slot;
tree modify_dest;
location_t saved_location;
*************** expand_call_inline (basic_block bb, tree
*** 2509,2516 ****
/* 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);
/* Record the function we are about to inline. */
id->src_fn = fn;
--- 2484,2490 ----
/* Local declarations will be replaced by their equivalents in this
map. */
st = id->decl_map;
! id->decl_map = pointer_map_create ();
/* Record the function we are about to inline. */
id->src_fn = fn;
*************** expand_call_inline (basic_block bb, tree
*** 2576,2582 ****
}
/* Clean up. */
! splay_tree_delete (id->decl_map);
id->decl_map = st;
/* If the inlined function returns a result that we care about,
--- 2550,2556 ----
}
/* Clean up. */
! pointer_map_destroy (id->decl_map);
id->decl_map = st;
/* If the inlined function returns a result that we care about,
*************** clone_body (tree clone, tree fn, void *a
*** 2870,2876 ****
id.src_fn = fn;
id.dst_fn = clone;
id.src_cfun = DECL_STRUCT_FUNCTION (fn);
! id.decl_map = (splay_tree)arg_map;
id.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
--- 2844,2850 ----
id.src_fn = fn;
id.dst_fn = clone;
id.src_cfun = DECL_STRUCT_FUNCTION (fn);
! id.decl_map = (struct pointer_map_t *)arg_map;
id.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
*************** copy_tree_r (tree *tp, int *walk_subtree
*** 2964,2975 ****
static void
remap_save_expr (tree *tp, void *st_, int *walk_subtrees)
{
! splay_tree st = (splay_tree) st_;
! splay_tree_node n;
tree t;
/* See if we already encountered this SAVE_EXPR. */
! n = splay_tree_lookup (st, (splay_tree_key) *tp);
/* If we didn't already remap this SAVE_EXPR, do so now. */
if (!n)
--- 2938,2949 ----
static void
remap_save_expr (tree *tp, void *st_, int *walk_subtrees)
{
! struct pointer_map_t *st = (struct pointer_map_t *) st_;
! tree *n;
tree t;
/* See if we already encountered this SAVE_EXPR. */
! n = (tree *) pointer_map_contains (st, *tp);
/* If we didn't already remap this SAVE_EXPR, do so now. */
if (!n)
*************** remap_save_expr (tree *tp, void *st_, in
*** 2977,2991 ****
t = copy_node (*tp);
/* Remember this SAVE_EXPR. */
! splay_tree_insert (st, (splay_tree_key) *tp, (splay_tree_value) t);
/* Make sure we don't remap an already-remapped SAVE_EXPR. */
! splay_tree_insert (st, (splay_tree_key) t, (splay_tree_value) t);
}
else
{
/* We've already walked into this SAVE_EXPR; don't do it again. */
*walk_subtrees = 0;
! t = (tree) n->value;
}
/* Replace this SAVE_EXPR with the copy. */
--- 2951,2965 ----
t = copy_node (*tp);
/* Remember this SAVE_EXPR. */
! *pointer_map_insert (st, *tp) = t;
/* Make sure we don't remap an already-remapped SAVE_EXPR. */
! *pointer_map_insert (st, t) = t;
}
else
{
/* We've already walked into this SAVE_EXPR; don't do it again. */
*walk_subtrees = 0;
! t = *n;
}
/* Replace this SAVE_EXPR with the copy. */
*************** static tree
*** 3050,3068 ****
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;
/* 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);
/* If it's there, remap it. */
if (n)
! *tp = (tree) n->value;
}
else if (TREE_CODE (*tp) == STATEMENT_LIST)
--- 3024,3042 ----
unsave_r (tree *tp, int *walk_subtrees, void *data)
{
copy_body_data *id = (copy_body_data *) data;
! 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 = (tree *) pointer_map_contains (st, *tp);
/* If it's there, remap it. */
if (n)
! *tp = *n;
}
else if (TREE_CODE (*tp) == STATEMENT_LIST)
*************** unsave_expr_now (tree expr)
*** 3099,3105 ****
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.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
--- 3073,3079 ----
memset (&id, 0, sizeof (id));
id.src_fn = current_function_decl;
id.dst_fn = current_function_decl;
! id.decl_map = pointer_map_create ();
id.copy_decl = copy_decl_no_change;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
*************** unsave_expr_now (tree expr)
*** 3114,3120 ****
walk_tree (&expr, unsave_r, &id, NULL);
/* Clean up. */
! splay_tree_delete (id.decl_map);
return expr;
}
--- 3088,3094 ----
walk_tree (&expr, unsave_r, &id, NULL);
/* Clean up. */
! pointer_map_destroy (id.decl_map);
return expr;
}
*************** tree_function_versioning (tree old_decl,
*** 3373,3379 ****
id.statements_to_fold = pointer_set_create ();
}
! id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
id.src_fn = old_decl;
id.dst_fn = new_decl;
id.src_node = old_version_node;
--- 3347,3353 ----
id.statements_to_fold = pointer_set_create ();
}
! id.decl_map = pointer_map_create ();
id.src_fn = old_decl;
id.dst_fn = new_decl;
id.src_node = old_version_node;
*************** tree_function_versioning (tree old_decl,
*** 3450,3456 ****
number_blocks (new_decl);
/* Clean up. */
! splay_tree_delete (id.decl_map);
if (!update_clones)
{
fold_marked_statements (0, id.statements_to_fold);
--- 3424,3430 ----
number_blocks (new_decl);
/* Clean up. */
! pointer_map_destroy (id.decl_map);
if (!update_clones)
{
fold_marked_statements (0, id.statements_to_fold);
*************** build_duplicate_type (tree type)
*** 3491,3501 ****
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);
! type = remap_type_1 (type, &id);
! splay_tree_delete (id.decl_map);
return type;
}
--- 3465,3475 ----
id.src_fn = current_function_decl;
id.dst_fn = current_function_decl;
id.src_cfun = cfun;
! id.decl_map = pointer_map_create ();
! type = remap_type (type, &id);
! pointer_map_destroy (id.decl_map);
return type;
}
Index: tree-inline.h
===================================================================
*** tree-inline.h (revision 123218)
--- tree-inline.h (working copy)
*************** Boston, MA 02110-1301, USA. */
*** 23,29 ****
#define GCC_TREE_INLINE_H
#include "varray.h"
! #include "splay-tree.h"
/* Data required for function body duplication. */
--- 23,29 ----
#define GCC_TREE_INLINE_H
#include "varray.h"
! #include "pointer-set.h"
/* Data required for function body duplication. */
*************** typedef struct copy_body_data
*** 49,55 ****
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;
/* Create a new decl to replace DECL in the destination function. */
tree (*copy_decl) (tree, struct copy_body_data *);
--- 49,55 ----
tree retvar;
/* The map from local declarations in the inlined function to
equivalents in the function into which it is being inlined. */
! 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 *);
Index: Makefile.in
===================================================================
*** Makefile.in (revision 123218)
--- Makefile.in (working copy)
*************** SCEV_H = tree-scalar-evolution.h $(GGC_H
*** 788,794 ****
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)
REAL_H = real.h $(MACHMODE_H)
DBGCNT_H = dbgcnt.h dbgcnt.def
--- 788,794 ----
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) pointer-set.h
REAL_H = real.h $(MACHMODE_H)
DBGCNT_H = dbgcnt.h dbgcnt.def
*************** gimplify.o : gimplify.c $(CONFIG_H) $(SY
*** 2186,2192 ****
$(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)
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 \
--- 2186,2192 ----
$(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) $(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 \
*************** gimple-low.o : gimple-low.c $(CONFIG_H)
*** 2195,2201 ****
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)
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
--- 2195,2201 ----
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) $(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
Index: cp/optimize.c
===================================================================
*** cp/optimize.c (revision 123218)
--- cp/optimize.c (working copy)
*************** maybe_clone_body (tree fn)
*** 99,105 ****
tree parm;
tree clone_parm;
int parmno;
! splay_tree decl_map;
/* Update CLONE's source position information to match FN's. */
DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
--- 99,105 ----
tree parm;
tree clone_parm;
int parmno;
! struct pointer_map_t *decl_map;
/* Update CLONE's source position information to match FN's. */
DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
*************** maybe_clone_body (tree fn)
*** 139,145 ****
start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
/* Remap the parameters. */
! decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
for (parmno = 0,
parm = DECL_ARGUMENTS (fn),
clone_parm = DECL_ARGUMENTS (clone);
--- 139,145 ----
start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
/* Remap the parameters. */
! decl_map = pointer_map_create ();
for (parmno = 0,
parm = DECL_ARGUMENTS (fn),
clone_parm = DECL_ARGUMENTS (clone);
*************** maybe_clone_body (tree fn)
*** 152,160 ****
{
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);
}
else if (DECL_ARTIFICIAL (parm)
&& DECL_NAME (parm) == vtt_parm_identifier)
--- 152,158 ----
{
tree in_charge;
in_charge = in_charge_arg_for_name (DECL_NAME (clone));
! *pointer_map_insert (decl_map, parm) = in_charge;
}
else if (DECL_ARTIFICIAL (parm)
&& DECL_NAME (parm) == vtt_parm_identifier)
*************** maybe_clone_body (tree fn)
*** 165,190 ****
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);
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);
! }
}
/* 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);
clone_parm = TREE_CHAIN (clone_parm);
}
}
--- 163,180 ----
if (DECL_HAS_VTT_PARM_P (clone))
{
DECL_ABSTRACT_ORIGIN (clone_parm) = parm;
! *pointer_map_insert (decl_map, parm) = clone_parm;
clone_parm = TREE_CHAIN (clone_parm);
}
/* Otherwise, map the VTT parameter to `NULL'. */
else
! *pointer_map_insert (decl_map, parm) = null_pointer_node;
}
/* Map other parameters to their equivalents in the cloned
function. */
else
{
! *pointer_map_insert (decl_map, parm) = clone_parm;
clone_parm = TREE_CHAIN (clone_parm);
}
}
*************** maybe_clone_body (tree fn)
*** 193,206 ****
{
parm = DECL_RESULT (fn);
clone_parm = DECL_RESULT (clone);
! splay_tree_insert (decl_map, (splay_tree_key) parm,
! (splay_tree_value) clone_parm);
}
/* Clone the body. */
clone_body (clone, fn, decl_map);
/* Clean up. */
! splay_tree_delete (decl_map);
/* The clone can throw iff the original function can throw. */
cp_function_chain->can_throw = !TREE_NOTHROW (fn);
--- 183,195 ----
{
parm = DECL_RESULT (fn);
clone_parm = DECL_RESULT (clone);
! *pointer_map_insert (decl_map, parm) = clone_parm;
}
/* Clone the body. */
clone_body (clone, fn, decl_map);
/* Clean up. */
! pointer_map_destroy (decl_map);
/* The clone can throw iff the original function can throw. */
cp_function_chain->can_throw = !TREE_NOTHROW (fn);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][C++] Replace splay-tree usage in tree-inline.c by pointer-map
2007-03-28 12:03 [PATCH][C++] Replace splay-tree usage in tree-inline.c by pointer-map Richard Guenther
@ 2007-03-30 17:39 ` Mark Mitchell
0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2007-03-30 17:39 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc-patches
Richard Guenther wrote:
> 2007-03-28 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.
>
> cp/
> * optimize.c (maybe_clone_body): Replace splay-tree usage by
> pointer-map.
OK, thanks.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-30 17:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-28 12:03 [PATCH][C++] Replace splay-tree usage in tree-inline.c by pointer-map Richard Guenther
2007-03-30 17:39 ` Mark Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).