diff mbox

[MPX,2/X] Pointers Checker. Add flag to varpool_node

Message ID 20131119140621.GS21297@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Nov. 19, 2013, 2:06 p.m. UTC
Hi,

Here is a patch to add flag for marking symbols as requiring static initialization of bounds.  Used by Pointer Bounds Checker to handle statically initialized pointers and static bounds vars.

Thanks,
Ilya
--
2013-11-19  Ilya Enkovich  <ilya.enkovich@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.

Comments

Jeff Law Nov. 19, 2013, 7:09 p.m. UTC | #1
On 11/19/13 07:06, Ilya Enkovich wrote:
> Hi,
>
> Here is a patch to add flag for marking symbols as requiring static initialization of bounds.  Used by Pointer Bounds Checker to handle statically initialized pointers and static bounds vars.
>
> Thanks,
> Ilya
> --
> 2013-11-19  Ilya Enkovich  <ilya.enkovich@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.
OK.  This is fine to check in as long as any prerequisites are already in.

jeff
Richard Biener Nov. 20, 2013, 3:50 p.m. UTC | #2
On Tue, Nov 19, 2013 at 8:09 PM, Jeff Law <law@redhat.com> wrote:
> On 11/19/13 07:06, Ilya Enkovich wrote:
>>
>> Hi,
>>
>> Here is a patch to add flag for marking symbols as requiring static
>> initialization of bounds.  Used by Pointer Bounds Checker to handle
>> statically initialized pointers and static bounds vars.
>>
>> Thanks,
>> Ilya
>> --
>> 2013-11-19  Ilya Enkovich  <ilya.enkovich@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.
>
> OK.  This is fine to check in as long as any prerequisites are already in.

Please refrain from cluttering the tree with dead code.  Commit all patches
in one go once all patches are approved.

Thanks,
Richard.

> jeff
>
diff mbox

Patch

diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 1ac6dfb..31c3635 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -520,6 +520,10 @@  class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node {
 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;
 };
 
 /* Every top level asm statement is put into a asm_node.  */
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 99dbf96..0d3479d 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -579,6 +579,7 @@  lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_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)
     {
@@ -1149,6 +1150,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 1e4c823..471db82 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -204,6 +204,8 @@  dump_varpool_node (FILE *f, struct 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)