mirror of git://gcc.gnu.org/git/gcc.git
cgraphbuild.c (build_cgraph_edges): Do not finalize vars with VALUE_EXPR.
* cgraphbuild.c (build_cgraph_edges): Do not finalize vars with VALUE_EXPR. * cgraph.h (varpool_can_remove_if_no_refs): Vars with VALUE_EXPR are removable. * toplev.c (wrapup_global_declaration_2): Vars with VALUE_EXPR need to wrapup. (compile_file): Do not output variables. * cgraphbuild.c (varpool_finalize_decl): When var is finalized late, output it. * langhooks.c: Include timevar.h (write_global_declarations): Finalize compilation unit after wrapup; set timevars correctly. * passes.c (rest_of_decl_compilation): Decls with VALUE_EXPR needs not to be added to varpool. * varpool.c (varpool_assemble_decl): Sanity check that we are called only on cases where it makes sense; skip constant pool and value expr vars. * lto.c (do_whole_program_analysis): Set timevars correctly. (lto_main): Likewise. * trans-common.c (create_common): Do not fake TREE_ASM_WRITTEN. * trans-decl.c (gfc_finish_cray_pointee): Likewise. From-SVN: r187314
This commit is contained in:
parent
36e0c0a515
commit
0d6bf48c3e
|
@ -1,3 +1,23 @@
|
|||
2012-05-08 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* cgraphbuild.c (build_cgraph_edges): Do not finalize vars
|
||||
with VALUE_EXPR.
|
||||
* cgraph.h (varpool_can_remove_if_no_refs): Vars with VALUE_EXPR
|
||||
are removable.
|
||||
* toplev.c (wrapup_global_declaration_2): Vars with VALUE_EXPR
|
||||
need to wrapup.
|
||||
(compile_file): Do not output variables.
|
||||
* cgraphbuild.c (varpool_finalize_decl): When var is finalized late,
|
||||
output it.
|
||||
* langhooks.c: Include timevar.h
|
||||
(write_global_declarations): Finalize compilation unit after wrapup;
|
||||
set timevars correctly.
|
||||
* passes.c (rest_of_decl_compilation): Decls with VALUE_EXPR needs
|
||||
not to be added to varpool.
|
||||
* varpool.c (varpool_assemble_decl): Sanity check that we are called
|
||||
only on cases where it makes sense; skip constant pool and value expr
|
||||
vars.
|
||||
|
||||
2012-05-08 David S. Miller <davem@davemloft.net>
|
||||
|
||||
* config/sparc/linux.h (LINK_SPEC): Don't pass "-Y" option.
|
||||
|
|
|
@ -1126,6 +1126,7 @@ varpool_can_remove_if_no_refs (struct varpool_node *node)
|
|||
return (!node->symbol.force_output && !node->symbol.used_from_other_partition
|
||||
&& (DECL_COMDAT (node->symbol.decl)
|
||||
|| !node->symbol.externally_visible
|
||||
|| DECL_HAS_VALUE_EXPR_P (node->symbol.decl)
|
||||
|| DECL_EXTERNAL (node->symbol.decl)));
|
||||
}
|
||||
|
||||
|
|
|
@ -356,7 +356,8 @@ build_cgraph_edges (void)
|
|||
/* Look for initializers of constant variables and private statics. */
|
||||
FOR_EACH_LOCAL_DECL (cfun, ix, decl)
|
||||
if (TREE_CODE (decl) == VAR_DECL
|
||||
&& (TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
|
||||
&& (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
|
||||
&& !DECL_HAS_VALUE_EXPR_P (decl))
|
||||
varpool_finalize_decl (decl);
|
||||
record_eh_tables (node, cfun);
|
||||
|
||||
|
|
|
@ -834,6 +834,10 @@ varpool_finalize_decl (tree decl)
|
|||
enqueue_node ((symtab_node)node);
|
||||
if (cgraph_state >= CGRAPH_STATE_IPA_SSA)
|
||||
varpool_analyze_node (node);
|
||||
/* Some frontends produce various interface variables after compilation
|
||||
finished. */
|
||||
if (cgraph_state == CGRAPH_STATE_FINISHED)
|
||||
varpool_assemble_decl (node);
|
||||
}
|
||||
|
||||
/* Discover all functions and variables that are trivially needed, analyze
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-05-08 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* trans-common.c (create_common): Do not fake TREE_ASM_WRITTEN.
|
||||
* trans-decl.c (gfc_finish_cray_pointee): Likewise.
|
||||
|
||||
2012-05-07 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/53255
|
||||
|
|
|
@ -697,8 +697,6 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv)
|
|||
DECL_IGNORED_P (var_decl) = 1;
|
||||
if (s->sym->attr.target)
|
||||
TREE_ADDRESSABLE (var_decl) = 1;
|
||||
/* This is a fake variable just for debugging purposes. */
|
||||
TREE_ASM_WRITTEN (var_decl) = 1;
|
||||
/* Fake variables are not visible from other translation units. */
|
||||
TREE_PUBLIC (var_decl) = 0;
|
||||
|
||||
|
|
|
@ -457,8 +457,6 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym)
|
|||
SET_DECL_VALUE_EXPR (decl, value);
|
||||
DECL_HAS_VALUE_EXPR_P (decl) = 1;
|
||||
GFC_DECL_CRAY_POINTEE (decl) = 1;
|
||||
/* This is a fake variable just for debugging purposes. */
|
||||
TREE_ASM_WRITTEN (decl) = 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "diagnostic.h"
|
||||
#include "tree-diagnostic.h"
|
||||
#include "cgraph.h"
|
||||
#include "timevar.h"
|
||||
#include "output.h"
|
||||
|
||||
/* Do nothing; in many cases the default hook. */
|
||||
|
@ -298,10 +299,7 @@ write_global_declarations (void)
|
|||
tree globals, decl, *vec;
|
||||
int len, i;
|
||||
|
||||
/* This lang hook is dual-purposed, and also finalizes the
|
||||
compilation unit. */
|
||||
finalize_compilation_unit ();
|
||||
|
||||
timevar_start (TV_PHASE_DEFERRED);
|
||||
/* Really define vars that have had only a tentative definition.
|
||||
Really output inline functions that must actually be callable
|
||||
and have not been output so far. */
|
||||
|
@ -318,7 +316,17 @@ write_global_declarations (void)
|
|||
|
||||
wrapup_global_declarations (vec, len);
|
||||
check_global_declarations (vec, len);
|
||||
timevar_stop (TV_PHASE_DEFERRED);
|
||||
|
||||
timevar_start (TV_PHASE_CGRAPH);
|
||||
/* This lang hook is dual-purposed, and also finalizes the
|
||||
compilation unit. */
|
||||
finalize_compilation_unit ();
|
||||
timevar_stop (TV_PHASE_CGRAPH);
|
||||
|
||||
timevar_start (TV_PHASE_CHECK_DBGINFO);
|
||||
emit_debug_global_declarations (vec, len);
|
||||
timevar_stop (TV_PHASE_CHECK_DBGINFO);
|
||||
|
||||
/* Clean up. */
|
||||
free (vec);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-05-04 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* lto.c (do_whole_program_analysis): Set timevars correctly.
|
||||
(lto_main): Likewise.
|
||||
|
||||
2012-05-04 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* lang.opt (fwpa): Do not mark as Optimization.
|
||||
|
|
|
@ -1958,6 +1958,7 @@ materialize_cgraph (void)
|
|||
static void
|
||||
do_whole_program_analysis (void)
|
||||
{
|
||||
timevar_start (TV_PHASE_CGRAPH);
|
||||
/* Note that since we are in WPA mode, materialize_cgraph will not
|
||||
actually read in all the function bodies. It only materializes
|
||||
the decls and cgraph nodes so that analysis can be performed. */
|
||||
|
@ -2017,6 +2018,7 @@ do_whole_program_analysis (void)
|
|||
dump_memory_report (false);
|
||||
}
|
||||
|
||||
timevar_stop (TV_PHASE_CGRAPH);
|
||||
/* Show the LTO report before launching LTRANS. */
|
||||
if (flag_lto_report)
|
||||
print_lto_report ();
|
||||
|
@ -2116,7 +2118,9 @@ lto_main (void)
|
|||
|
||||
/* Let the middle end know that we have read and merged all of
|
||||
the input files. */
|
||||
timevar_start (TV_PHASE_CGRAPH);
|
||||
compile ();
|
||||
timevar_stop (TV_PHASE_CGRAPH);
|
||||
|
||||
/* FIXME lto, if the processes spawned by WPA fail, we miss
|
||||
the chance to print WPA's report, so WPA will call
|
||||
|
|
|
@ -186,6 +186,7 @@ rest_of_decl_compilation (tree decl,
|
|||
if ((at_end
|
||||
|| !DECL_DEFER_OUTPUT (decl)
|
||||
|| DECL_INITIAL (decl))
|
||||
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl))
|
||||
&& !DECL_EXTERNAL (decl))
|
||||
{
|
||||
/* When reading LTO unit, we also read varpool, so do not
|
||||
|
|
|
@ -364,7 +364,8 @@ wrapup_global_declaration_1 (tree decl)
|
|||
bool
|
||||
wrapup_global_declaration_2 (tree decl)
|
||||
{
|
||||
if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
|
||||
if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl)
|
||||
|| (TREE_CODE (decl) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (decl)))
|
||||
return false;
|
||||
|
||||
/* Don't write out static consts, unless we still need them.
|
||||
|
@ -576,7 +577,6 @@ compile_file (void)
|
|||
basically finished. */
|
||||
if (in_lto_p || !flag_lto || flag_fat_lto_objects)
|
||||
{
|
||||
varpool_output_variables ();
|
||||
finish_aliases_2 ();
|
||||
|
||||
/* Likewise for mudflap static object registrations. */
|
||||
|
|
|
@ -269,25 +269,43 @@ assemble_aliases (struct varpool_node *node)
|
|||
}
|
||||
|
||||
/* Output one variable, if necessary. Return whether we output it. */
|
||||
|
||||
bool
|
||||
varpool_assemble_decl (struct varpool_node *node)
|
||||
{
|
||||
tree decl = node->symbol.decl;
|
||||
|
||||
if (!TREE_ASM_WRITTEN (decl)
|
||||
&& !node->alias
|
||||
&& !node->symbol.in_other_partition
|
||||
&& !DECL_EXTERNAL (decl)
|
||||
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
|
||||
/* Aliases are outout when their target is produced or by
|
||||
output_weakrefs. */
|
||||
if (node->alias)
|
||||
return false;
|
||||
|
||||
/* Constant pool is output from RTL land when the reference
|
||||
survive till this level. */
|
||||
if (DECL_IN_CONSTANT_POOL (decl))
|
||||
return false;
|
||||
|
||||
/* Decls with VALUE_EXPR should not be in the varpool at all. They
|
||||
are not real variables, but just info for debugging and codegen.
|
||||
Unfortunately at the moment emutls is not updating varpool correctly
|
||||
after turning real vars into value_expr vars. */
|
||||
if (DECL_HAS_VALUE_EXPR_P (decl)
|
||||
&& !targetm.have_tls)
|
||||
return false;
|
||||
|
||||
gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
|
||||
&& TREE_CODE (decl) == VAR_DECL
|
||||
&& !DECL_HAS_VALUE_EXPR_P (decl));
|
||||
|
||||
if (!node->symbol.in_other_partition
|
||||
&& !DECL_EXTERNAL (decl))
|
||||
{
|
||||
assemble_variable (decl, 0, 1, 0);
|
||||
if (TREE_ASM_WRITTEN (decl))
|
||||
{
|
||||
gcc_assert (TREE_ASM_WRITTEN (decl));
|
||||
node->finalized = 1;
|
||||
assemble_aliases (node);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue