diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-07-09 03:06:09 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-07-09 03:06:09 +0000 |
commit | f98df77ce31d9b5986c0350c8c9d4e028fc0a49d (patch) | |
tree | fe302b0afef5f45efd91e938d8c2eb16e20e1d0a /gcc/sese.c | |
parent | 677f36a639850b44bf9645f75aacc5990e9aa1cb (diff) | |
download | gcc-f98df77ce31d9b5986c0350c8c9d4e028fc0a49d.zip gcc-f98df77ce31d9b5986c0350c8c9d4e028fc0a49d.tar.gz gcc-f98df77ce31d9b5986c0350c8c9d4e028fc0a49d.tar.bz2 |
convert some hash_table to hash_map
gcc/
* graphite-htab.h: Use hash_map instead of hash_table.
* graphite-clast-to-gimple.c: Adjust.
* passes.c: Use hash_map instead of hash_table.
* sese.c: Likewise.
* sese.h: Remove now unused code.
From-SVN: r212382
Diffstat (limited to 'gcc/sese.c')
-rw-r--r-- | gcc/sese.c | 89 |
1 files changed, 17 insertions, 72 deletions
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" -#include "hash-table.h" +#include "hash-map.h" #include "tree.h" #include "tree-pretty-print.h" #include "basic-block.h" @@ -53,56 +53,37 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #include "tree-ssa-propagate.h" -/* Print to stderr the element ELT. */ +/* Helper function for debug_rename_map. */ -static void -debug_rename_elt (rename_map_elt elt) +bool +debug_rename_map_1 (tree_node *const &old_name, tree_node *const &expr, + void *) { fprintf (stderr, "("); - print_generic_expr (stderr, elt->old_name, 0); + print_generic_expr (stderr, old_name, 0); fprintf (stderr, ", "); - print_generic_expr (stderr, elt->expr, 0); + print_generic_expr (stderr, expr, 0); fprintf (stderr, ")\n"); -} - -/* Helper function for debug_rename_map. */ - -int -debug_rename_map_1 (rename_map_elt_s **slot, void *s ATTRIBUTE_UNUSED) -{ - struct rename_map_elt_s *entry = *slot; - debug_rename_elt (entry); - return 1; + return true; } /* Hashtable helpers. */ -struct rename_map_hasher : typed_free_remove <rename_map_elt_s> +struct rename_map_hasher : default_hashmap_traits { - typedef rename_map_elt_s value_type; - typedef rename_map_elt_s compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + static inline hashval_t hash (tree); }; /* Computes a hash function for database element ELT. */ inline hashval_t -rename_map_hasher::hash (const value_type *elt) +rename_map_hasher::hash (tree old_name) { - return SSA_NAME_VERSION (elt->old_name); + return SSA_NAME_VERSION (old_name); } -/* Compares database elements E1 and E2. */ - -inline bool -rename_map_hasher::equal (const value_type *elt1, const compare_type *elt2) -{ - return (elt1->old_name == elt2->old_name); -} - -typedef hash_table<rename_map_hasher> rename_map_type; +typedef hash_map<tree, tree, rename_map_hasher> rename_map_type; /* Print to stderr all the elements of RENAME_MAP. */ @@ -112,26 +93,6 @@ debug_rename_map (rename_map_type *rename_map) { rename_map->traverse <void *, debug_rename_map_1> (NULL); } - -/* Computes a hash function for database element ELT. */ - -hashval_t -rename_map_elt_info (const void *elt) -{ - return SSA_NAME_VERSION (((const struct rename_map_elt_s *) elt)->old_name); -} - -/* Compares database elements E1 and E2. */ - -int -eq_rename_map_elts (const void *e1, const void *e2) -{ - const struct rename_map_elt_s *elt1 = (const struct rename_map_elt_s *) e1; - const struct rename_map_elt_s *elt2 = (const struct rename_map_elt_s *) e2; - - return (elt1->old_name == elt2->old_name); -} - /* Record LOOP as occurring in REGION. */ @@ -418,15 +379,10 @@ get_false_edge_from_guard_bb (basic_block bb) static tree get_rename (rename_map_type *rename_map, tree old_name) { - struct rename_map_elt_s tmp; - rename_map_elt_s **slot; - gcc_assert (TREE_CODE (old_name) == SSA_NAME); - tmp.old_name = old_name; - slot = rename_map->find_slot (&tmp, NO_INSERT); - - if (slot && *slot) - return (*slot)->expr; + tree *expr = rename_map->get (old_name); + if (expr) + return *expr; return NULL_TREE; } @@ -436,21 +392,10 @@ get_rename (rename_map_type *rename_map, tree old_name) static void set_rename (rename_map_type *rename_map, tree old_name, tree expr) { - struct rename_map_elt_s tmp; - rename_map_elt_s **slot; - if (old_name == expr) return; - tmp.old_name = old_name; - slot = rename_map->find_slot (&tmp, INSERT); - - if (!slot) - return; - - free (*slot); - - *slot = new_rename_map_elt (old_name, expr); + rename_map->put (old_name, expr); } /* Renames the scalar uses of the statement COPY, using the |