]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/lto/ChangeLog
Add an no_reorder attribute for LTO
authorAndi Kleen <ak@linux.intel.com>
Wed, 24 Sep 2014 03:29:24 +0000 (03:29 +0000)
committerAndi Kleen <ak@gcc.gnu.org>
Wed, 24 Sep 2014 03:29:24 +0000 (03:29 +0000)
commit7861b6489dd7777b1b8829fd8726079f133eb34c
tree73e70259b9d2f956939310c8f0e194397eda7e4b
parent2f4a54f2d91538336797b9a5401c83e6f9831f0b
Add an no_reorder attribute for LTO

Some projects need to prevent reordering of specific top level
declarations with LTO, in particular declarations defining init calls.

The only way to do that with LTO was to use -fno-toplevel-reorder,
which stops reordering for all declarations and makes LTO partitioning
less efficient.

This patch adds a new no_reorder attribute that stops reordering only
for the marked declaration. The program can then only mark e.g. the
initcalls and leave all the other declarations alone.

The patch does:

- Adds the new no_reorder attribute for the C family.
- Initializes a new no_reorder flag in the symtab_nodes in the
function visibility flag.
- Maintains the no_reorder flag when creating new nodes.
- Changes the partition code to always keep a separate
sorted queue of ordered nodes and flush them in order with the other
nodes. This is used by all nodes with -fno-toplevel-reorder,
and only the marked ones without it.
Parts of the old -fno-toplevel-reorder code paths are reused.
- Adds various checks throughout the tree to make no_reorder
marked functions behave the same as with -fno-toplevel-reorder
- Changes the LTO streamer to serialize the no_reorder attribute.

gcc/c-family/:

2014-09-23  Andi Kleen  <ak@linux.intel.com>

* c-common.c (handle_no_reorder_attribute): New function.
(c_common_attribute_table): Add no_reorder attribute.

gcc/:

2014-09-23  Andi Kleen  <ak@linux.intel.com>

* cgraph.h (symtab_node): Add no_reorder attribute.
(symbol_table::output_asm_statements): Remove.
* cgraphclones.c (cgraph_node::create_clone): Copy no_reorder.
(cgraph_node::create_version_clone): Dito.
(symbol_table::output_asm_statements): Remove.
* trans-mem.c (ipa_tm_create_version_alias): Dito.
* cgraphunit.c (varpool_node::finalize_decl): Check no_reorder.
(output_in_order): Add no_reorder flag. Only handle no_reorder
nodes when set.
(symbol_table::compile): Add separate pass for no_reorder nodes.
(process_common_attributes): Set no_reorder flag in symtab node.
Add node argument.
(process_function_and_variable_attributes): Pass symtab nodes to
process_common_attributes.
* doc/extend.texi (no_reorder): Document no_reorder attribute.
* lto-cgraph.c (lto_output_node): Serialize no_reorder.
(lto_output_varpool_node): Dito.
(input_overwrite_node): Dito.
(input_varpool_node): Dito.
* varpool.c (varpool_node::add): Set no_reorder attribute.
(symbol_table::remove_unreferenced_decls): Handle no_reorder.
(symbol_table::output_variables): Dito.
* symtab.c (symtab_node::dump_base): Print no_reorder.

gcc/lto/:

2014-09-23  Andi Kleen  <ak@linux.intel.com>

* lto-partition.c (node_cmp): Update comment.
(varpool_node_cmp): Use symtab_node for comparison.
(add_sorted_nodes): New function.
(lto_balanced_map): Change to keep ordered queue
of ordered node. Handle no_reorder attribute.

From-SVN: r215537
14 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/cgraph.h
gcc/cgraphclones.c
gcc/cgraphunit.c
gcc/doc/extend.texi
gcc/ipa-visibility.c
gcc/lto-cgraph.c
gcc/lto/ChangeLog
gcc/lto/lto-partition.c
gcc/symtab.c
gcc/trans-mem.c
gcc/varpool.c