diff options
author | Ian Lance Taylor <ian@airs.com> | 2005-10-03 08:43:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2005-10-03 08:43:45 +0000 |
commit | 0b494699b41f22f5392c7f2f5f4683e96b8fc0cd (patch) | |
tree | 12db18961c42def11ca08dfd5229612afd843c31 /gcc/tree.c | |
parent | 644cb69f803dc904c271885272e70f032ce56a97 (diff) | |
download | gcc-0b494699b41f22f5392c7f2f5f4683e96b8fc0cd.zip gcc-0b494699b41f22f5392c7f2f5f4683e96b8fc0cd.tar.gz gcc-0b494699b41f22f5392c7f2f5f4683e96b8fc0cd.tar.bz2 |
gimplify.c (find_single_pointer_decl_1): New static function.
* gimplify.c (find_single_pointer_decl_1): New static function.
(find_single_pointer_decl): New static function.
(internal_get_tmp_var): For a formal variable, set restrict base
information if appropriate.
* alias.c (find_base_decl): If a VAR_DECL has a restrict base,
return it.
* tree.h (DECL_BASED_ON_RESTRICT_P): Define.
(DECL_GET_RESTRICT_BASE): Define.
(SET_DECL_RESTRICT_BASE): Define.
(decl_restrict_base_lookup): Declare.
(decl_restrict_base_insert): Declare.
(struct tree_decl_with_vis): Add based_on_restrict_p field.
* tree.c (restrict_base_for_decl): New static variable.
(init_ttree): Initialize restrict_base_for_decl.
(copy_node_stat): Copy restrict base information.
(decl_restrict_base_lookup): New function.
(decl_restrict_base_insert): New function.
(print_restrict_base_statistics): New static function.
(dump_tree_statistics): Call print_restrict_base_statistics.
From-SVN: r104890
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 57 |
1 files changed, 56 insertions, 1 deletions
@@ -144,6 +144,9 @@ static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) static GTY ((if_marked ("tree_int_map_marked_p"), param_is (struct tree_int_map))) htab_t init_priority_for_decl; +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) + htab_t restrict_base_for_decl; + struct tree_int_map GTY(()) { tree from; @@ -187,6 +190,8 @@ init_ttree (void) tree_map_eq, 0); init_priority_for_decl = htab_create_ggc (512, tree_int_map_hash, tree_int_map_eq, 0); + restrict_base_for_decl = htab_create_ggc (256, tree_map_hash, + tree_map_eq, 0); int_cst_hash_table = htab_create_ggc (1024, int_cst_hash_hash, int_cst_hash_eq, NULL); @@ -568,7 +573,11 @@ copy_node_stat (tree node MEM_STAT_DECL) SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node)); DECL_HAS_INIT_PRIORITY_P (t) = 1; } - + if (TREE_CODE (node) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (node)) + { + SET_DECL_RESTRICT_BASE (t, DECL_GET_RESTRICT_BASE (node)); + DECL_BASED_ON_RESTRICT_P (t) = 1; + } } else if (TREE_CODE_CLASS (code) == tcc_type) { @@ -3777,6 +3786,36 @@ decl_init_priority_insert (tree from, unsigned short to) *(struct tree_int_map **) loc = h; } +/* Look up a restrict qualified base decl for FROM. */ + +tree +decl_restrict_base_lookup (tree from) +{ + struct tree_map *h; + struct tree_map in; + + in.from = from; + h = htab_find_with_hash (restrict_base_for_decl, &in, + htab_hash_pointer (from)); + return h ? h->to : NULL_TREE; +} + +/* Record the restrict qualified base TO for FROM. */ + +void +decl_restrict_base_insert (tree from, tree to) +{ + struct tree_map *h; + void **loc; + + h = ggc_alloc (sizeof (struct tree_map)); + h->hash = htab_hash_pointer (from); + h->from = from; + h->to = to; + loc = htab_find_slot_with_hash (restrict_base_for_decl, h, h->hash, INSERT); + *(struct tree_map **) loc = h; +} + /* Print out the statistics for the DECL_DEBUG_EXPR hash table. */ static void @@ -3798,6 +3837,21 @@ print_value_expr_statistics (void) (long) htab_elements (value_expr_for_decl), htab_collisions (value_expr_for_decl)); } + +/* Print out statistics for the RESTRICT_BASE_FOR_DECL hash table, but + don't print anything if the table is empty. */ + +static void +print_restrict_base_statistics (void) +{ + if (htab_elements (restrict_base_for_decl) != 0) + fprintf (stderr, + "RESTRICT_BASE hash: size %ld, %ld elements, %f collisions\n", + (long) htab_size (restrict_base_for_decl), + (long) htab_elements (restrict_base_for_decl), + htab_collisions (restrict_base_for_decl)); +} + /* Lookup a debug expression for FROM, and return it if we find one. */ tree @@ -5725,6 +5779,7 @@ dump_tree_statistics (void) print_type_hash_statistics (); print_debug_expr_statistics (); print_value_expr_statistics (); + print_restrict_base_statistics (); lang_hooks.print_statistics (); } |