c++: Adjust pushdecl/duplicate_decls API
[gcc.git] / gcc / ipa-reference.c
index 06c122551b8e5098a1ce392d052502f62ae3083e..4a6c011c525eceb1e096618ff169a1b8ed95467d 100644 (file)
@@ -1,5 +1,5 @@
 /* Callgraph based analysis of static variables.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
+   Copyright (C) 2004-2020 Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "calls.h"
 #include "ipa-utils.h"
 #include "ipa-reference.h"
+#include "alloc-pool.h"
 #include "symbol-summary.h"
 
 /* The static variables defined within the compilation unit that are
@@ -492,6 +493,7 @@ init_function_info (struct cgraph_node *fn)
 
   info->local.statics_read = BITMAP_ALLOC (&local_info_obstack);
   info->local.statics_written = BITMAP_ALLOC (&local_info_obstack);
+  info->global.statics_read = NULL;
 
   return &info->local;
 }
@@ -901,7 +903,7 @@ propagate (void)
       ipa_reference_global_vars_info_t node_g;
 
       /* No need to produce summaries for inline clones.  */
-      if (node->global.inlined_to)
+      if (node->inlined_to)
        continue;
 
       node_info = get_reference_vars_info (node);
@@ -977,7 +979,7 @@ write_node_summary_p (struct cgraph_node *node,
   ipa_reference_optimization_summary_t info;
 
   /* See if we have (non-empty) info.  */
-  if (!node->definition || node->global.inlined_to)
+  if (!node->definition || node->inlined_to)
     return false;
   info = get_reference_optimization_summary (node);
   if (!info)
@@ -1037,7 +1039,7 @@ stream_out_bitmap (struct lto_simple_output_block *ob,
   EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
     {
       tree decl = (*reference_vars_to_consider) [index];
-      lto_output_var_decl_index (ob->decl_state, ob->main_stream, decl);
+      lto_output_var_decl_ref (ob->decl_state, ob->main_stream, decl);
     }
 }
 
@@ -1055,7 +1057,7 @@ ipa_reference_write_optimization_summary (void)
   int i;
 
   vec_alloc (reference_vars_to_consider, ipa_reference_vars_uids);
-  reference_vars_to_consider->safe_grow (ipa_reference_vars_uids);
+  reference_vars_to_consider->safe_grow (ipa_reference_vars_uids, true);
 
   /* See what variables we are interested in.  */
   for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
@@ -1156,9 +1158,7 @@ ipa_reference_read_optimization_summary (void)
            fprintf (dump_file, "all module statics:");
          for (i = 0; i < (unsigned int)b_count; i++)
            {
-             unsigned int var_index = streamer_read_uhwi (ib);
-             tree v_decl = lto_file_decl_data_get_var_decl (file_data,
-                                                            var_index);
+             tree v_decl = lto_input_var_decl_ref (ib, file_data);
              bool existed;
              bitmap_set_bit (all_module_statics,
                              ipa_reference_var_get_or_insert_uid
@@ -1204,9 +1204,7 @@ ipa_reference_read_optimization_summary (void)
                    (&optimization_summary_obstack);
                  for (j = 0; j < (unsigned int)v_count; j++)
                    {
-                     unsigned int var_index = streamer_read_uhwi (ib);
-                     tree v_decl = lto_file_decl_data_get_var_decl (file_data,
-                                                                    var_index);
+                     tree v_decl = lto_input_var_decl_ref (ib, file_data);
                      bitmap_set_bit (info->statics_read,
                                      ipa_reference_var_uid (v_decl));
                      if (dump_file)
@@ -1233,9 +1231,7 @@ ipa_reference_read_optimization_summary (void)
                    (&optimization_summary_obstack);
                  for (j = 0; j < (unsigned int)v_count; j++)
                    {
-                     unsigned int var_index = streamer_read_uhwi (ib);
-                     tree v_decl = lto_file_decl_data_get_var_decl (file_data,
-                                                                    var_index);
+                     tree v_decl = lto_input_var_decl_ref (ib, file_data);
                      bitmap_set_bit (info->statics_written,
                                      ipa_reference_var_uid (v_decl));
                      if (dump_file)