aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2021-11-18 18:42:35 +0100
committerJan Hubicka <jh@suse.cz>2021-11-18 18:42:35 +0100
commit75ac95f6647367783c4d65f6f686867ca425cb61 (patch)
tree36c8c6e5f54c9e2fff395cf1a072416ac33b9fcc /gcc/cgraphunit.c
parentc331a75d49b6043399f5ccce72a02ccf3b0ddc56 (diff)
downloadgcc-75ac95f6647367783c4d65f6f686867ca425cb61.zip
gcc-75ac95f6647367783c4d65f6f686867ca425cb61.tar.gz
gcc-75ac95f6647367783c4d65f6f686867ca425cb61.tar.bz2
Turn -fsemantic-interposition to optimization flag
Turn flag_semantic_interposition to optimization option so it can be enabled with per-function granuality. This is done by adding the flag among visibility flags into the symbol table. gcc/ChangeLog: 2021-11-18 Jan Hubicka <hubicka@ucw.cz> * cgraph.c (cgraph_node::get_availability): Update call of decl_replaceable_p. (cgraph_node::verify_node): Verify that semantic_interposition flag is set correclty. * cgraph.h: (symtab_node): Add semantic_interposition flag. * cgraphclones.c (set_new_clone_decl_and_node_flags): Clear semantic_interposition flag. * cgraphunit.c (cgraph_node::finalize_function): Set semantic_interposition flag. (cgraph_node::add_new_function): Likewise. (varpool_node::finalize_decl): Likewise. (cgraph_node::create_wrapper): Likewise. * common.opt (fsemantic-interposition): Turn to optimization node. * lto-cgraph.c (lto_output_node): Stream semantic_interposition. (lto_output_varpool_node): Likewise. (input_overwrite_node): Likewise. (input_varpool_node): Likewise. * symtab.c (symtab_node::dump_base): Dump new flag. * varasm.c (decl_replaceable_p): Add semantic_interposition_p parameter. * varasm.h (decl_replaceable_p): Update declaration. * varpool.c (varpool_node::ctor_useable_for_folding_p): Use semantic_interposition flag. (varpool_node::get_availability): Likewise. (varpool_node::create_alias): Copy semantic_interposition flag. gcc/cp/ChangeLog: 2021-11-18 Jan Hubicka <hubicka@ucw.cz> * decl.c (finish_function): Update use of decl_replaceable_p. gcc/lto/ChangeLog: 2021-11-18 Jan Hubicka <hubicka@ucw.cz> * lto-partition.c (promote_symbol): Clear semantic_interposition flag. gcc/testsuite/ChangeLog: 2021-11-18 Jan Hubicka <hubicka@ucw.cz> * gcc.dg/lto/semantic-interposition-1_0.c: New test. * gcc.dg/lto/semantic-interposition-1_1.c: New test.
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 55cb034..1e58ffd 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -452,6 +452,7 @@ cgraph_node::finalize_function (tree decl, bool no_collect)
node->definition = true;
notice_global_symbol (decl);
node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL;
+ node->semantic_interposition = opt_for_fn (decl, flag_semantic_interposition);
if (!flag_toplevel_reorder)
node->no_reorder = true;
@@ -554,6 +555,8 @@ cgraph_node::add_new_function (tree fndecl, bool lowered)
node = cgraph_node::get_create (fndecl);
node->local = false;
node->definition = true;
+ node->semantic_interposition = opt_for_fn (fndecl,
+ flag_semantic_interposition);
node->force_output = true;
if (TREE_PUBLIC (fndecl))
node->externally_visible = true;
@@ -581,6 +584,8 @@ cgraph_node::add_new_function (tree fndecl, bool lowered)
if (lowered)
node->lowered = true;
node->definition = true;
+ node->semantic_interposition = opt_for_fn (fndecl,
+ flag_semantic_interposition);
node->analyze ();
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
gimple_register_cfg_hooks ();
@@ -954,6 +959,7 @@ varpool_node::finalize_decl (tree decl)
/* Set definition first before calling notice_global_symbol so that
it is available to notice_global_symbol. */
node->definition = true;
+ node->semantic_interposition = flag_semantic_interposition;
notice_global_symbol (decl);
if (!flag_toplevel_reorder)
node->no_reorder = true;
@@ -2576,6 +2582,7 @@ cgraph_node::create_wrapper (cgraph_node *target)
/* Turn alias into thunk and expand it into GIMPLE representation. */
definition = true;
+ semantic_interposition = opt_for_fn (decl, flag_semantic_interposition);
/* Create empty thunk, but be sure we did not keep former thunk around.
In that case we would need to preserve the info. */