public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6972] tree: move tree_vec_map_cache_hasher into header Date: Tue, 1 Feb 2022 19:15:40 +0000 (GMT) [thread overview] Message-ID: <20220201191540.6C13F3858D35@sourceware.org> (raw) https://gcc.gnu.org/g:b649071d4b3490aa43c6c2212312ace304c9ff1c commit r12-6972-gb649071d4b3490aa43c6c2212312ace304c9ff1c Author: Jason Merrill <jason@redhat.com> Date: Thu Jan 27 10:53:07 2022 -0500 tree: move tree_vec_map_cache_hasher into header gcc/ChangeLog: * tree.h (struct tree_vec_map_cache_hasher): Move from... * tree.cc (struct tree_vec_map_cache_hasher): ...here. Diff: --- gcc/tree.h | 17 +++++++++++++++++ gcc/tree.cc | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gcc/tree.h b/gcc/tree.h index 4c01d94244e..e2157d66d6c 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -5559,6 +5559,23 @@ struct tree_decl_map_cache_hasher : ggc_cache_ptr_hash<tree_decl_map> #define tree_vec_map_hash tree_decl_map_hash #define tree_vec_map_marked_p tree_map_base_marked_p +struct tree_vec_map_cache_hasher : ggc_cache_ptr_hash<tree_vec_map> +{ + static hashval_t hash (tree_vec_map *m) { return DECL_UID (m->base.from); } + + static bool + equal (tree_vec_map *a, tree_vec_map *b) + { + return a->base.from == b->base.from; + } + + static int + keep_cache_entry (tree_vec_map *&m) + { + return ggc_marked_p (m->base.from); + } +}; + /* Hasher for tree decls. Pointer equality is enough here, but the DECL_UID is a better hash than the pointer value and gives a predictable traversal order. Additionally it can be used across PCH save/restore. */ diff --git a/gcc/tree.cc b/gcc/tree.cc index 9d445b2740f..7ce4f242751 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -242,23 +242,6 @@ static GTY ((cache)) static GTY ((cache)) hash_table<tree_decl_map_cache_hasher> *value_expr_for_decl; -struct tree_vec_map_cache_hasher : ggc_cache_ptr_hash<tree_vec_map> -{ - static hashval_t hash (tree_vec_map *m) { return DECL_UID (m->base.from); } - - static bool - equal (tree_vec_map *a, tree_vec_map *b) - { - return a->base.from == b->base.from; - } - - static int - keep_cache_entry (tree_vec_map *&m) - { - return ggc_marked_p (m->base.from); - } -}; - static GTY ((cache)) hash_table<tree_vec_map_cache_hasher> *debug_args_for_decl;
reply other threads:[~2022-02-01 19:15 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220201191540.6C13F3858D35@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).