node->definition = true;
notice_global_symbol (decl);
node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL;
+ if (!flag_toplevel_reorder)
+ node->no_reorder = true;
/* With -fkeep-inline-functions we are keeping all inline functions except
for extern inline ones. */
declared inline and nested functions. These were optimized out
in the original implementation and it is unclear whether we want
to change the behavior here. */
- if (((!opt_for_fn (decl, optimize) || flag_keep_static_functions)
+ if (((!opt_for_fn (decl, optimize) || flag_keep_static_functions
+ || node->no_reorder)
&& !node->cpp_implicit_alias
&& !DECL_DISREGARD_INLINE_LIMITS (decl)
&& !DECL_DECLARED_INLINE_P (decl)
it is available to notice_global_symbol. */
node->definition = true;
notice_global_symbol (decl);
+ if (!flag_toplevel_reorder)
+ node->no_reorder = true;
if (TREE_THIS_VOLATILE (decl) || DECL_PRESERVE_P (decl)
/* Traditionally we do not eliminate static variables when not
optimizing and when not doing toplevel reoder. */
- || node->no_reorder
- || ((!flag_toplevel_reorder
- && !DECL_COMDAT (node->decl)
- && !DECL_ARTIFICIAL (node->decl))))
+ || (node->no_reorder && !DECL_COMDAT (node->decl)
+ && !DECL_ARTIFICIAL (node->decl)))
node->force_output = true;
if (symtab->state == CONSTRUCTION
/* Some frontends produce various interface variables after compilation
finished. */
if (symtab->state == FINISHED
- || (!flag_toplevel_reorder
- && symtab->state == EXPANSION))
+ || (node->no_reorder
+ && symtab->state == EXPANSION))
node->assemble_decl ();
if (DECL_INITIAL (decl))
according to their order fields, which is the order in which they
appeared in the file. This implements -fno-toplevel-reorder. In
this mode we may output functions and variables which don't really
- need to be output.
- When NO_REORDER is true only do this for symbols marked no reorder. */
+ need to be output. */
static void
-output_in_order (bool no_reorder)
+output_in_order (void)
{
int max;
cgraph_order_sort *nodes;
{
if (pf->process && !pf->thunk.thunk_p && !pf->alias)
{
- if (no_reorder && !pf->no_reorder)
+ if (!pf->no_reorder)
continue;
i = pf->order;
gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
Please keep them in sync. */
FOR_EACH_VARIABLE (pv)
{
- if (no_reorder && !pv->no_reorder)
+ if (!pv->no_reorder)
continue;
if (DECL_HARD_REGISTER (pv->decl)
|| DECL_HAS_VALUE_EXPR_P (pv->decl))
state = EXPANSION;
- if (!flag_toplevel_reorder)
- output_in_order (false);
- else
- {
- /* Output first asm statements and anything ordered. The process
- flag is cleared for these nodes, so we skip them later. */
- output_in_order (true);
- expand_all_functions ();
- output_variables ();
- }
+ /* Output first asm statements and anything ordered. The process
+ flag is cleared for these nodes, so we skip them later. */
+ output_in_order ();
+ expand_all_functions ();
+ output_variables ();
process_new_functions ();
state = FINISHED;
/* Collect all variables that should not be reordered. */
FOR_EACH_VARIABLE (vnode)
if (vnode->get_partitioning_class () == SYMBOL_PARTITION
- && (!flag_toplevel_reorder || vnode->no_reorder))
+ && vnode->no_reorder)
varpool_order.safe_push (vnode);
n_varpool_nodes = varpool_order.length ();
varpool_order.qsort (varpool_node_cmp);
}
add_sorted_nodes (next_nodes, partition);
- add_symbol_to_partition (partition, order[i]);
+ if (!symbol_partitioned_p (order[i]))
+ add_symbol_to_partition (partition, order[i]);
if (!order[i]->alias)
total_size -= ipa_fn_summaries->get (order[i])->size;
vnode = dyn_cast <varpool_node *> (ref->referred);
if (!vnode->definition)
continue;
- if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder
+ if (!symbol_partitioned_p (vnode)
&& !vnode->no_reorder
&& vnode->get_partitioning_class () == SYMBOL_PARTITION)
add_symbol_to_partition (partition, vnode);
because it allows them to be removed. Coupling
with objects they refer to only helps to reduce
number of symbols promoted to hidden. */
- if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder
+ if (!symbol_partitioned_p (vnode)
&& !vnode->no_reorder
&& !vnode->can_remove_if_no_refs_p ()
&& vnode->get_partitioning_class () == SYMBOL_PARTITION)
next_nodes.truncate (0);
/* Varables that are not reachable from the code go into last partition. */
- if (flag_toplevel_reorder)
- {
- FOR_EACH_VARIABLE (vnode)
- if (vnode->get_partitioning_class () == SYMBOL_PARTITION
- && !symbol_partitioned_p (vnode)
- && !vnode->no_reorder)
- next_nodes.safe_push (vnode);
- }
+ FOR_EACH_VARIABLE (vnode)
+ if (vnode->get_partitioning_class () == SYMBOL_PARTITION
+ && !symbol_partitioned_p (vnode))
+ next_nodes.safe_push (vnode);
/* Output remaining ordered symbols. */
while (varpool_pos < n_varpool_nodes)