Hi,

This patch add new field for varpool_node to mark vars requiring bounds 
initalization.  These changes were previously reverted from 4.9 and I'll assume 
patch is OK for trunk if no objections arise.

Patch was bootstrapped and tested for linux-x86_64.

Thanks,
Ilya
--
gcc/

2014-04-16  Ilya Enkovich  <ilya.enkov...@intel.com>

        * cgraph.h (varpool_node): Add need_bounds_init field.
        * lto-cgraph.c (lto_output_varpool_node): Output
        need_bounds_init value.
        (input_varpool_node): Read need_bounds_init value.
        * varpool.c (dump_varpool_node): Dump need_bounds_init field.


diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 15310d8..a6a51cf 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -640,6 +640,10 @@ public:
   /* Set when variable is scheduled to be assembled.  */
   unsigned output : 1;
 
+  /* Set when variable has statically initialized pointer
+     or is a static bounds variable and needs initalization.  */
+  unsigned need_bounds_init : 1;
+
   /* Set if the variable is dynamically initialized, except for
      function local statics.   */
   unsigned dynamically_initialized : 1;
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 173067f..999ce3d 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -585,6 +585,7 @@ lto_output_varpool_node (struct lto_simple_output_block 
*ob, varpool_node *node,
                     && boundary_p && !DECL_EXTERNAL (node->decl), 1);
          /* in_other_partition.  */
     }
+  bp_pack_value (&bp, node->need_bounds_init, 1);
   streamer_write_bitpack (&bp);
   if (node->same_comdat_group && !boundary_p)
     {
@@ -1160,6 +1161,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
   node->analyzed = bp_unpack_value (&bp, 1);
   node->used_from_other_partition = bp_unpack_value (&bp, 1);
   node->in_other_partition = bp_unpack_value (&bp, 1);
+  node->need_bounds_init = bp_unpack_value (&bp, 1);
   if (node->in_other_partition)
     {
       DECL_EXTERNAL (node->decl) = 1;
diff --git a/gcc/varpool.c b/gcc/varpool.c
index acb5221..0eeb2b6 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -205,6 +205,8 @@ dump_varpool_node (FILE *f, varpool_node *node)
     fprintf (f, " initialized");
   if (node->output)
     fprintf (f, " output");
+  if (node->need_bounds_init)
+    fprintf (f, " need-bounds-init");
   if (TREE_READONLY (node->decl))
     fprintf (f, " read-only");
   if (ctor_for_folding (node->decl) != error_mark_node)

Reply via email to