diff mbox

[GOOGLE] Remove mod_id_to_name map

Message ID CAO2gOZXsGs-_-PxQB4zsL9Y45UW6feoug1WwWr4dvXR58Hib2g@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen Jan. 8, 2014, 6:58 p.m. UTC
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

Comments

Xinliang David Li Jan. 9, 2014, 1:06 a.m. UTC | #1
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,
diff mbox

Patch

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,