* cgraphunit.c (cgraph_order_sort_kind): New entry ORDER_VAR_UNDEF.
(output_in_order): Loop over undefined variables too. Output them
via assemble_undefined_decl. Skip variables that correspond to hard
registers or have value-exprs.
* varpool.c (symbol_table::output_variables): Handle undefined
variables together with defined ones.
From-SVN: r238371
+2016-07-15 Alexander Monakov <amonakov@ispras.ru>
+
+ * cgraphunit.c (cgraph_order_sort_kind): New entry ORDER_VAR_UNDEF.
+ (output_in_order): Loop over undefined variables too. Output them
+ via assemble_undefined_decl. Skip variables that correspond to hard
+ registers or have value-exprs.
+ * varpool.c (symbol_table::output_variables): Handle undefined
+ variables together with defined ones.
+
2016-07-15 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (get_representative_for): Make sure to return
ORDER_UNDEFINED = 0,
ORDER_FUNCTION,
ORDER_VAR,
+ ORDER_VAR_UNDEF,
ORDER_ASM
};
}
}
- FOR_EACH_DEFINED_VARIABLE (pv)
- if (!DECL_EXTERNAL (pv->decl))
- {
- if (no_reorder && !pv->no_reorder)
- continue;
- i = pv->order;
- gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
- nodes[i].kind = ORDER_VAR;
- nodes[i].u.v = pv;
- }
+ /* There is a similar loop in symbol_table::output_variables.
+ Please keep them in sync. */
+ FOR_EACH_VARIABLE (pv)
+ {
+ if (no_reorder && !pv->no_reorder)
+ continue;
+ if (DECL_HARD_REGISTER (pv->decl)
+ || DECL_HAS_VALUE_EXPR_P (pv->decl))
+ continue;
+ i = pv->order;
+ gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
+ nodes[i].kind = pv->definition ? ORDER_VAR : ORDER_VAR_UNDEF;
+ nodes[i].u.v = pv;
+ }
for (pa = symtab->first_asm_symbol (); pa; pa = pa->next)
{
break;
case ORDER_VAR:
-#ifdef ACCEL_COMPILER
- /* Do not assemble "omp declare target link" vars. */
- if (DECL_HAS_VALUE_EXPR_P (nodes[i].u.v->decl)
- && lookup_attribute ("omp declare target link",
- DECL_ATTRIBUTES (nodes[i].u.v->decl)))
- break;
-#endif
nodes[i].u.v->assemble_decl ();
break;
+ case ORDER_VAR_UNDEF:
+ assemble_undefined_decl (nodes[i].u.v->decl);
+ break;
+
case ORDER_ASM:
assemble_asm (nodes[i].u.a->asm_str);
break;
timevar_push (TV_VAROUT);
- FOR_EACH_VARIABLE (node)
- if (!node->definition
- && !DECL_HAS_VALUE_EXPR_P (node->decl)
- && !DECL_HARD_REGISTER (node->decl))
- assemble_undefined_decl (node->decl);
FOR_EACH_DEFINED_VARIABLE (node)
{
/* Handled in output_in_order. */
node->finalize_named_section_flags ();
}
- FOR_EACH_DEFINED_VARIABLE (node)
+ /* There is a similar loop in output_in_order. Please keep them in sync. */
+ FOR_EACH_VARIABLE (node)
{
/* Handled in output_in_order. */
if (node->no_reorder)
continue;
-#ifdef ACCEL_COMPILER
- /* Do not assemble "omp declare target link" vars. */
- if (DECL_HAS_VALUE_EXPR_P (node->decl)
- && lookup_attribute ("omp declare target link",
- DECL_ATTRIBUTES (node->decl)))
+ if (DECL_HARD_REGISTER (node->decl)
+ || DECL_HAS_VALUE_EXPR_P (node->decl))
continue;
-#endif
- if (node->assemble_decl ())
- changed = true;
+ if (node->definition)
+ changed |= node->assemble_decl ();
+ else
+ assemble_undefined_decl (node->decl);
}
timevar_pop (TV_VAROUT);
return changed;