ipa.c (cgraph_build_static_cdtor_1): Support contructors with "chkp ctor" and "bnd_legacy" attributes.
* ipa.c (cgraph_build_static_cdtor_1): Support contructors with "chkp ctor" and "bnd_legacy" attributes. * gimplify.c (gimplify_init_constructor): Avoid infinite loop during gimplification of bounds initializer. From-SVN: r204198
This commit is contained in:
parent
2017035a60
commit
0038da6695
|
@ -1,3 +1,10 @@
|
||||||
|
2013-10-30 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||||
|
|
||||||
|
* ipa.c (cgraph_build_static_cdtor_1): Support contructors
|
||||||
|
with "chkp ctor" and "bnd_legacy" attributes.
|
||||||
|
* gimplify.c (gimplify_init_constructor): Avoid infinite
|
||||||
|
loop during gimplification of bounds initializer.
|
||||||
|
|
||||||
2013-10-30 Ilya Enkovich <ilya.enkovich@intel.com>
|
2013-10-30 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||||
|
|
||||||
* c-family/c-common.c (handle_bnd_variable_size_attribute): New.
|
* c-family/c-common.c (handle_bnd_variable_size_attribute): New.
|
||||||
|
|
|
@ -4080,10 +4080,19 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
|
||||||
individual element initialization. Also don't do this for small
|
individual element initialization. Also don't do this for small
|
||||||
all-zero initializers (which aren't big enough to merit
|
all-zero initializers (which aren't big enough to merit
|
||||||
clearing), and don't try to make bitwise copies of
|
clearing), and don't try to make bitwise copies of
|
||||||
TREE_ADDRESSABLE types. */
|
TREE_ADDRESSABLE types.
|
||||||
|
|
||||||
|
We cannot apply such transformation when compiling chkp static
|
||||||
|
initializer because creation of initializer image in the memory
|
||||||
|
will require static initialization of bounds for it. It should
|
||||||
|
result in another gimplification of similar initializer and we
|
||||||
|
may fall into infinite loop. */
|
||||||
if (valid_const_initializer
|
if (valid_const_initializer
|
||||||
&& !(cleared || num_nonzero_elements == 0)
|
&& !(cleared || num_nonzero_elements == 0)
|
||||||
&& !TREE_ADDRESSABLE (type))
|
&& !TREE_ADDRESSABLE (type)
|
||||||
|
&& (!current_function_decl
|
||||||
|
|| !lookup_attribute ("chkp ctor",
|
||||||
|
DECL_ATTRIBUTES (current_function_decl))))
|
||||||
{
|
{
|
||||||
HOST_WIDE_INT size = int_size_in_bytes (type);
|
HOST_WIDE_INT size = int_size_in_bytes (type);
|
||||||
unsigned int align;
|
unsigned int align;
|
||||||
|
|
30
gcc/ipa.c
30
gcc/ipa.c
|
@ -1260,9 +1260,11 @@ make_pass_ipa_whole_program_visibility (gcc::context *ctxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate and emit a static constructor or destructor. WHICH must
|
/* Generate and emit a static constructor or destructor. WHICH must
|
||||||
be one of 'I' (for a constructor) or 'D' (for a destructor). BODY
|
be one of 'I' (for a constructor), 'D' (for a destructor), 'P'
|
||||||
is a STATEMENT_LIST containing GENERIC statements. PRIORITY is the
|
(for chp static vars constructor) or 'B' (for chkp static bounds
|
||||||
initialization priority for this constructor or destructor.
|
constructor). BODY is a STATEMENT_LIST containing GENERIC
|
||||||
|
statements. PRIORITY is the initialization priority for this
|
||||||
|
constructor or destructor.
|
||||||
|
|
||||||
FINAL specify whether the externally visible name for collect2 should
|
FINAL specify whether the externally visible name for collect2 should
|
||||||
be produced. */
|
be produced. */
|
||||||
|
@ -1321,6 +1323,20 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final)
|
||||||
DECL_STATIC_CONSTRUCTOR (decl) = 1;
|
DECL_STATIC_CONSTRUCTOR (decl) = 1;
|
||||||
decl_init_priority_insert (decl, priority);
|
decl_init_priority_insert (decl, priority);
|
||||||
break;
|
break;
|
||||||
|
case 'P':
|
||||||
|
DECL_STATIC_CONSTRUCTOR (decl) = 1;
|
||||||
|
DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("chkp ctor"),
|
||||||
|
NULL,
|
||||||
|
NULL_TREE);
|
||||||
|
decl_init_priority_insert (decl, priority);
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
DECL_STATIC_CONSTRUCTOR (decl) = 1;
|
||||||
|
DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("bnd_legacy"),
|
||||||
|
NULL,
|
||||||
|
NULL_TREE);
|
||||||
|
decl_init_priority_insert (decl, priority);
|
||||||
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
DECL_STATIC_DESTRUCTOR (decl) = 1;
|
DECL_STATIC_DESTRUCTOR (decl) = 1;
|
||||||
decl_fini_priority_insert (decl, priority);
|
decl_fini_priority_insert (decl, priority);
|
||||||
|
@ -1338,9 +1354,11 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate and emit a static constructor or destructor. WHICH must
|
/* Generate and emit a static constructor or destructor. WHICH must
|
||||||
be one of 'I' (for a constructor) or 'D' (for a destructor). BODY
|
be one of 'I' (for a constructor), 'D' (for a destructor), 'P'
|
||||||
is a STATEMENT_LIST containing GENERIC statements. PRIORITY is the
|
(for chkp static vars constructor) or 'B' (for chkp static bounds
|
||||||
initialization priority for this constructor or destructor. */
|
constructor). BODY is a STATEMENT_LIST containing GENERIC
|
||||||
|
statements. PRIORITY is the initialization priority for this
|
||||||
|
constructor or destructor. */
|
||||||
|
|
||||||
void
|
void
|
||||||
cgraph_build_static_cdtor (char which, tree body, int priority)
|
cgraph_build_static_cdtor (char which, tree body, int priority)
|
||||||
|
|
Loading…
Reference in New Issue