This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GOOGLE] Remove mod_id_to_name map
- From: Xinliang David Li <davidxl at google dot com>
- To: Dehao Chen <dehao at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 8 Jan 2014 17:06:05 -0800
- Subject: Re: [GOOGLE] Remove mod_id_to_name map
- Authentication-results: sourceware.org; auth=none
- References: <CAO2gOZXsGs-_-PxQB4zsL9Y45UW6feoug1WwWr4dvXR58Hib2g at mail dot gmail dot com>
Ok.
David
On Wed, Jan 8, 2014 at 10:58 AM, Dehao Chen <dehao@google.com> wrote:
> This patch removes mod_id_to_name map because the info is already
> there in module_infos. And also, AutoFDO don't have access to update
> this map because its a file-static structure.
>
> Bootstrapped and passed regression test.
>
> OK for google branch?
>
> Thanks,
> Dehao
>
> Index: gcc/coverage.c
> ===================================================================
> --- gcc/coverage.c (revision 206366)
> +++ gcc/coverage.c (working copy)
> @@ -615,37 +615,17 @@ reorder_module_groups (const char *imports_file, u
> module_name_tab.dispose ();
> }
>
> -typedef struct {
> - unsigned int mod_id;
> - const char *mod_name;
> -} mod_id_to_name_t;
> -
> -static vec<mod_id_to_name_t> *mod_names;
> -
> -static void
> -record_module_name (unsigned int mod_id, const char *name)
> -{
> - mod_id_to_name_t t;
> -
> - t.mod_id = mod_id;
> - t.mod_name = xstrdup (name);
> - if (!mod_names)
> - vec_alloc (mod_names, 10);
> - mod_names->safe_push (t);
> -}
> -
> /* Return the module name for module with MOD_ID. */
>
> const char *
> get_module_name (unsigned int mod_id)
> {
> size_t i;
> - mod_id_to_name_t *elt;
>
> - for (i = 0; mod_names->iterate (i, &elt); i++)
> + for (i = 0; i < num_in_fnames; i++)
> {
> - if (elt->mod_id == mod_id)
> - return elt->mod_name;
> + if (module_infos[i]->ident == mod_id)
> + return lbasename (module_infos[i]->source_filename);
> }
>
> gcc_assert (0);
> @@ -927,9 +907,6 @@ read_counts_file (const char *da_file_name, unsign
> }
> }
>
> - record_module_name (mod_info->ident,
> - lbasename (mod_info->source_filename));
> -
> if (dump_enabled_p ())
> {
> dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,