Commit 0d6bf48c by Jan Hubicka Committed by Jan Hubicka

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
parent 36e0c0a5
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> 2012-05-08 David S. Miller <davem@davemloft.net>
* config/sparc/linux.h (LINK_SPEC): Don't pass "-Y" option. * 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) ...@@ -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 return (!node->symbol.force_output && !node->symbol.used_from_other_partition
&& (DECL_COMDAT (node->symbol.decl) && (DECL_COMDAT (node->symbol.decl)
|| !node->symbol.externally_visible || !node->symbol.externally_visible
|| DECL_HAS_VALUE_EXPR_P (node->symbol.decl)
|| DECL_EXTERNAL (node->symbol.decl))); || DECL_EXTERNAL (node->symbol.decl)));
} }
......
...@@ -356,7 +356,8 @@ build_cgraph_edges (void) ...@@ -356,7 +356,8 @@ build_cgraph_edges (void)
/* Look for initializers of constant variables and private statics. */ /* Look for initializers of constant variables and private statics. */
FOR_EACH_LOCAL_DECL (cfun, ix, decl) FOR_EACH_LOCAL_DECL (cfun, ix, decl)
if (TREE_CODE (decl) == VAR_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); varpool_finalize_decl (decl);
record_eh_tables (node, cfun); record_eh_tables (node, cfun);
......
...@@ -834,6 +834,10 @@ varpool_finalize_decl (tree decl) ...@@ -834,6 +834,10 @@ varpool_finalize_decl (tree decl)
enqueue_node ((symtab_node)node); enqueue_node ((symtab_node)node);
if (cgraph_state >= CGRAPH_STATE_IPA_SSA) if (cgraph_state >= CGRAPH_STATE_IPA_SSA)
varpool_analyze_node (node); 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 /* Discover all functions and variables that are trivially needed, analyze
......
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> 2012-05-07 Tobias Burnus <burnus@net-b.de>
PR fortran/53255 PR fortran/53255
......
...@@ -697,8 +697,6 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv) ...@@ -697,8 +697,6 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv)
DECL_IGNORED_P (var_decl) = 1; DECL_IGNORED_P (var_decl) = 1;
if (s->sym->attr.target) if (s->sym->attr.target)
TREE_ADDRESSABLE (var_decl) = 1; 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. */ /* Fake variables are not visible from other translation units. */
TREE_PUBLIC (var_decl) = 0; TREE_PUBLIC (var_decl) = 0;
......
...@@ -457,8 +457,6 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym) ...@@ -457,8 +457,6 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym)
SET_DECL_VALUE_EXPR (decl, value); SET_DECL_VALUE_EXPR (decl, value);
DECL_HAS_VALUE_EXPR_P (decl) = 1; DECL_HAS_VALUE_EXPR_P (decl) = 1;
GFC_DECL_CRAY_POINTEE (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 ...@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h" #include "diagnostic.h"
#include "tree-diagnostic.h" #include "tree-diagnostic.h"
#include "cgraph.h" #include "cgraph.h"
#include "timevar.h"
#include "output.h" #include "output.h"
/* Do nothing; in many cases the default hook. */ /* Do nothing; in many cases the default hook. */
...@@ -298,10 +299,7 @@ write_global_declarations (void) ...@@ -298,10 +299,7 @@ write_global_declarations (void)
tree globals, decl, *vec; tree globals, decl, *vec;
int len, i; int len, i;
/* This lang hook is dual-purposed, and also finalizes the timevar_start (TV_PHASE_DEFERRED);
compilation unit. */
finalize_compilation_unit ();
/* Really define vars that have had only a tentative definition. /* Really define vars that have had only a tentative definition.
Really output inline functions that must actually be callable Really output inline functions that must actually be callable
and have not been output so far. */ and have not been output so far. */
...@@ -318,7 +316,17 @@ write_global_declarations (void) ...@@ -318,7 +316,17 @@ write_global_declarations (void)
wrapup_global_declarations (vec, len); wrapup_global_declarations (vec, len);
check_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); emit_debug_global_declarations (vec, len);
timevar_stop (TV_PHASE_CHECK_DBGINFO);
/* Clean up. */ /* Clean up. */
free (vec); free (vec);
......
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> 2012-05-04 Richard Guenther <rguenther@suse.de>
* lang.opt (fwpa): Do not mark as Optimization. * lang.opt (fwpa): Do not mark as Optimization.
......
...@@ -1958,6 +1958,7 @@ materialize_cgraph (void) ...@@ -1958,6 +1958,7 @@ materialize_cgraph (void)
static void static void
do_whole_program_analysis (void) do_whole_program_analysis (void)
{ {
timevar_start (TV_PHASE_CGRAPH);
/* Note that since we are in WPA mode, materialize_cgraph will not /* Note that since we are in WPA mode, materialize_cgraph will not
actually read in all the function bodies. It only materializes actually read in all the function bodies. It only materializes
the decls and cgraph nodes so that analysis can be performed. */ the decls and cgraph nodes so that analysis can be performed. */
...@@ -2017,6 +2018,7 @@ do_whole_program_analysis (void) ...@@ -2017,6 +2018,7 @@ do_whole_program_analysis (void)
dump_memory_report (false); dump_memory_report (false);
} }
timevar_stop (TV_PHASE_CGRAPH);
/* Show the LTO report before launching LTRANS. */ /* Show the LTO report before launching LTRANS. */
if (flag_lto_report) if (flag_lto_report)
print_lto_report (); print_lto_report ();
...@@ -2116,7 +2118,9 @@ lto_main (void) ...@@ -2116,7 +2118,9 @@ lto_main (void)
/* Let the middle end know that we have read and merged all of /* Let the middle end know that we have read and merged all of
the input files. */ the input files. */
timevar_start (TV_PHASE_CGRAPH);
compile (); compile ();
timevar_stop (TV_PHASE_CGRAPH);
/* FIXME lto, if the processes spawned by WPA fail, we miss /* FIXME lto, if the processes spawned by WPA fail, we miss
the chance to print WPA's report, so WPA will call the chance to print WPA's report, so WPA will call
......
...@@ -186,6 +186,7 @@ rest_of_decl_compilation (tree decl, ...@@ -186,6 +186,7 @@ rest_of_decl_compilation (tree decl,
if ((at_end if ((at_end
|| !DECL_DEFER_OUTPUT (decl) || !DECL_DEFER_OUTPUT (decl)
|| DECL_INITIAL (decl)) || DECL_INITIAL (decl))
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl))
&& !DECL_EXTERNAL (decl)) && !DECL_EXTERNAL (decl))
{ {
/* When reading LTO unit, we also read varpool, so do not /* When reading LTO unit, we also read varpool, so do not
......
...@@ -364,7 +364,8 @@ wrapup_global_declaration_1 (tree decl) ...@@ -364,7 +364,8 @@ wrapup_global_declaration_1 (tree decl)
bool bool
wrapup_global_declaration_2 (tree decl) 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; return false;
/* Don't write out static consts, unless we still need them. /* Don't write out static consts, unless we still need them.
...@@ -576,7 +577,6 @@ compile_file (void) ...@@ -576,7 +577,6 @@ compile_file (void)
basically finished. */ basically finished. */
if (in_lto_p || !flag_lto || flag_fat_lto_objects) if (in_lto_p || !flag_lto || flag_fat_lto_objects)
{ {
varpool_output_variables ();
finish_aliases_2 (); finish_aliases_2 ();
/* Likewise for mudflap static object registrations. */ /* Likewise for mudflap static object registrations. */
......
...@@ -269,24 +269,42 @@ assemble_aliases (struct varpool_node *node) ...@@ -269,24 +269,42 @@ assemble_aliases (struct varpool_node *node)
} }
/* Output one variable, if necessary. Return whether we output it. */ /* Output one variable, if necessary. Return whether we output it. */
bool bool
varpool_assemble_decl (struct varpool_node *node) varpool_assemble_decl (struct varpool_node *node)
{ {
tree decl = node->symbol.decl; tree decl = node->symbol.decl;
if (!TREE_ASM_WRITTEN (decl) /* Aliases are outout when their target is produced or by
&& !node->alias output_weakrefs. */
&& !node->symbol.in_other_partition if (node->alias)
&& !DECL_EXTERNAL (decl) return false;
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
/* 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); assemble_variable (decl, 0, 1, 0);
if (TREE_ASM_WRITTEN (decl)) gcc_assert (TREE_ASM_WRITTEN (decl));
{ node->finalized = 1;
node->finalized = 1; assemble_aliases (node);
assemble_aliases (node); return true;
return true;
}
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment