Commit 53e030f1 by Jakub Jelinek Committed by Jakub Jelinek

tree.h (struct tree_decl_map): New type.

	* tree.h (struct tree_decl_map): New type.
	(tree_decl_map_eq, tree_decl_map_marked_p): Define.
	(tree_decl_map_hash): New prototype.
	(debug_expr_for_decl, value_expr_for_decl): Change into
	tree_decl_map hashtab from tree_map.
	(init_ttree): Adjust initialization.
	(tree_decl_map_hash): New function.
	(decl_debug_expr_lookup, decl_debug_expr_insert,
	decl_value_expr_lookup, decl_value_expr_insert): Adjust.
cp/
	* cp-objcp-common.c (shadowed_var_for_decl): Change into
	tree_decl_map hashtab from tree_map.
	(decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust.
	(init_shadowed_var_for_decl): Adjust initialization.

From-SVN: r160185
parent 3333a2dd
2010-06-02 Jakub Jelinek <jakub@redhat.com>
* tree.h (struct tree_decl_map): New type.
(tree_decl_map_eq, tree_decl_map_marked_p): Define.
(tree_decl_map_hash): New prototype.
(debug_expr_for_decl, value_expr_for_decl): Change into
tree_decl_map hashtab from tree_map.
(init_ttree): Adjust initialization.
(tree_decl_map_hash): New function.
(decl_debug_expr_lookup, decl_debug_expr_insert,
decl_value_expr_lookup, decl_value_expr_insert): Adjust.
2010-06-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2010-06-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_ld_sol2_emulation): Test for GNU ld *_sol2 * configure.ac (gcc_cv_ld_sol2_emulation): Test for GNU ld *_sol2
......
2010-06-02 Jakub Jelinek <jakub@redhat.com>
* cp-objcp-common.c (shadowed_var_for_decl): Change into
tree_decl_map hashtab from tree_map.
(decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust.
(init_shadowed_var_for_decl): Adjust initialization.
2010-06-02 Jason Merrill <jason@redhat.com> 2010-06-02 Jason Merrill <jason@redhat.com>
* error.c (dump_type): Improve typedef handling. * error.c (dump_type): Improve typedef handling.
......
/* Some code common to C++ and ObjC++ front ends. /* Some code common to C++ and ObjC++ front ends.
Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc. Copyright (C) 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Ziemowit Laski <zlaski@apple.com> Contributed by Ziemowit Laski <zlaski@apple.com>
This file is part of GCC. This file is part of GCC.
...@@ -177,7 +177,7 @@ has_c_linkage (const_tree decl) ...@@ -177,7 +177,7 @@ has_c_linkage (const_tree decl)
return DECL_EXTERN_C_P (decl); return DECL_EXTERN_C_P (decl);
} }
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map)))
htab_t shadowed_var_for_decl; htab_t shadowed_var_for_decl;
/* Lookup a shadowed var for FROM, and return it if we find one. */ /* Lookup a shadowed var for FROM, and return it if we find one. */
...@@ -185,11 +185,11 @@ static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) ...@@ -185,11 +185,11 @@ static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
tree tree
decl_shadowed_for_var_lookup (tree from) decl_shadowed_for_var_lookup (tree from)
{ {
struct tree_map *h, in; struct tree_decl_map *h, in;
in.base.from = from; in.base.from = from;
h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in, h = (struct tree_decl_map *)
htab_hash_pointer (from)); htab_find_with_hash (shadowed_var_for_decl, &in, DECL_UID (from));
if (h) if (h)
return h->to; return h->to;
return NULL_TREE; return NULL_TREE;
...@@ -200,22 +200,22 @@ decl_shadowed_for_var_lookup (tree from) ...@@ -200,22 +200,22 @@ decl_shadowed_for_var_lookup (tree from)
void void
decl_shadowed_for_var_insert (tree from, tree to) decl_shadowed_for_var_insert (tree from, tree to)
{ {
struct tree_map *h; struct tree_decl_map *h;
void **loc; void **loc;
h = GGC_NEW (struct tree_map); h = GGC_NEW (struct tree_decl_map);
h->hash = htab_hash_pointer (from);
h->base.from = from; h->base.from = from;
h->to = to; h->to = to;
loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, h->hash, INSERT); loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, DECL_UID (from),
*(struct tree_map **) loc = h; INSERT);
*(struct tree_decl_map **) loc = h;
} }
void void
init_shadowed_var_for_decl (void) init_shadowed_var_for_decl (void)
{ {
shadowed_var_for_decl = htab_create_ggc (512, tree_map_hash, shadowed_var_for_decl = htab_create_ggc (512, tree_decl_map_hash,
tree_map_eq, 0); tree_decl_map_eq, 0);
} }
......
...@@ -196,10 +196,10 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node))) ...@@ -196,10 +196,10 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
/* General tree->tree mapping structure for use in hash tables. */ /* General tree->tree mapping structure for use in hash tables. */
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map)))
htab_t debug_expr_for_decl; htab_t debug_expr_for_decl;
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map)))
htab_t value_expr_for_decl; htab_t value_expr_for_decl;
static GTY ((if_marked ("tree_priority_map_marked_p"), static GTY ((if_marked ("tree_priority_map_marked_p"),
...@@ -533,11 +533,11 @@ init_ttree (void) ...@@ -533,11 +533,11 @@ init_ttree (void)
type_hash_table = htab_create_ggc (TYPE_HASH_INITIAL_SIZE, type_hash_hash, type_hash_table = htab_create_ggc (TYPE_HASH_INITIAL_SIZE, type_hash_hash,
type_hash_eq, 0); type_hash_eq, 0);
debug_expr_for_decl = htab_create_ggc (512, tree_map_hash, debug_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash,
tree_map_eq, 0); tree_decl_map_eq, 0);
value_expr_for_decl = htab_create_ggc (512, tree_map_hash, value_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash,
tree_map_eq, 0); tree_decl_map_eq, 0);
init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash, init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash,
tree_priority_map_eq, 0); tree_priority_map_eq, 0);
...@@ -5560,7 +5560,7 @@ tree_map_base_eq (const void *va, const void *vb) ...@@ -5560,7 +5560,7 @@ tree_map_base_eq (const void *va, const void *vb)
return (a->from == b->from); return (a->from == b->from);
} }
/* Hash a from tree in a tree_map. */ /* Hash a from tree in a tree_base_map. */
unsigned int unsigned int
tree_map_base_hash (const void *item) tree_map_base_hash (const void *item)
...@@ -5578,12 +5578,22 @@ tree_map_base_marked_p (const void *p) ...@@ -5578,12 +5578,22 @@ tree_map_base_marked_p (const void *p)
return ggc_marked_p (((const struct tree_map_base *) p)->from); return ggc_marked_p (((const struct tree_map_base *) p)->from);
} }
/* Hash a from tree in a tree_map. */
unsigned int unsigned int
tree_map_hash (const void *item) tree_map_hash (const void *item)
{ {
return (((const struct tree_map *) item)->hash); return (((const struct tree_map *) item)->hash);
} }
/* Hash a from tree in a tree_decl_map. */
unsigned int
tree_decl_map_hash (const void *item)
{
return DECL_UID (((const struct tree_decl_map *) item)->base.from);
}
/* Return the initialization priority for DECL. */ /* Return the initialization priority for DECL. */
priority_type priority_type
...@@ -5689,11 +5699,11 @@ print_value_expr_statistics (void) ...@@ -5689,11 +5699,11 @@ print_value_expr_statistics (void)
tree tree
decl_debug_expr_lookup (tree from) decl_debug_expr_lookup (tree from)
{ {
struct tree_map *h, in; struct tree_decl_map *h, in;
in.base.from = from; in.base.from = from;
h = (struct tree_map *) htab_find_with_hash (debug_expr_for_decl, &in, h = (struct tree_decl_map *)
htab_hash_pointer (from)); htab_find_with_hash (debug_expr_for_decl, &in, DECL_UID (from));
if (h) if (h)
return h->to; return h->to;
return NULL_TREE; return NULL_TREE;
...@@ -5704,15 +5714,15 @@ decl_debug_expr_lookup (tree from) ...@@ -5704,15 +5714,15 @@ decl_debug_expr_lookup (tree from)
void void
decl_debug_expr_insert (tree from, tree to) decl_debug_expr_insert (tree from, tree to)
{ {
struct tree_map *h; struct tree_decl_map *h;
void **loc; void **loc;
h = GGC_NEW (struct tree_map); h = GGC_NEW (struct tree_decl_map);
h->hash = htab_hash_pointer (from);
h->base.from = from; h->base.from = from;
h->to = to; h->to = to;
loc = htab_find_slot_with_hash (debug_expr_for_decl, h, h->hash, INSERT); loc = htab_find_slot_with_hash (debug_expr_for_decl, h, DECL_UID (from),
*(struct tree_map **) loc = h; INSERT);
*(struct tree_decl_map **) loc = h;
} }
/* Lookup a value expression for FROM, and return it if we find one. */ /* Lookup a value expression for FROM, and return it if we find one. */
...@@ -5720,11 +5730,11 @@ decl_debug_expr_insert (tree from, tree to) ...@@ -5720,11 +5730,11 @@ decl_debug_expr_insert (tree from, tree to)
tree tree
decl_value_expr_lookup (tree from) decl_value_expr_lookup (tree from)
{ {
struct tree_map *h, in; struct tree_decl_map *h, in;
in.base.from = from; in.base.from = from;
h = (struct tree_map *) htab_find_with_hash (value_expr_for_decl, &in, h = (struct tree_decl_map *)
htab_hash_pointer (from)); htab_find_with_hash (value_expr_for_decl, &in, DECL_UID (from));
if (h) if (h)
return h->to; return h->to;
return NULL_TREE; return NULL_TREE;
...@@ -5735,15 +5745,15 @@ decl_value_expr_lookup (tree from) ...@@ -5735,15 +5745,15 @@ decl_value_expr_lookup (tree from)
void void
decl_value_expr_insert (tree from, tree to) decl_value_expr_insert (tree from, tree to)
{ {
struct tree_map *h; struct tree_decl_map *h;
void **loc; void **loc;
h = GGC_NEW (struct tree_map); h = GGC_NEW (struct tree_decl_map);
h->hash = htab_hash_pointer (from);
h->base.from = from; h->base.from = from;
h->to = to; h->to = to;
loc = htab_find_slot_with_hash (value_expr_for_decl, h, h->hash, INSERT); loc = htab_find_slot_with_hash (value_expr_for_decl, h, DECL_UID (from),
*(struct tree_map **) loc = h; INSERT);
*(struct tree_decl_map **) loc = h;
} }
/* Hashing of types so that we don't make duplicates. /* Hashing of types so that we don't make duplicates.
......
...@@ -5381,6 +5381,17 @@ struct GTY(()) tree_map { ...@@ -5381,6 +5381,17 @@ struct GTY(()) tree_map {
extern unsigned int tree_map_hash (const void *); extern unsigned int tree_map_hash (const void *);
#define tree_map_marked_p tree_map_base_marked_p #define tree_map_marked_p tree_map_base_marked_p
/* Map from a decl tree to another tree. */
struct GTY(()) tree_decl_map {
struct tree_map_base base;
tree to;
};
#define tree_decl_map_eq tree_map_base_eq
extern unsigned int tree_decl_map_hash (const void *);
#define tree_decl_map_marked_p tree_map_base_marked_p
/* Map from a tree to an int. */ /* Map from a tree to an int. */
struct GTY(()) tree_int_map { struct GTY(()) tree_int_map {
......
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