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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187314
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
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)));
}
/* 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);
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
+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
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;
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;
}
#include "diagnostic.h"
#include "tree-diagnostic.h"
#include "cgraph.h"
+#include "timevar.h"
#include "output.h"
/* Do nothing; in many cases the default hook. */
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. */
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);
+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.
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. */
dump_memory_report (false);
}
+ timevar_stop (TV_PHASE_CGRAPH);
/* Show the LTO report before launching LTRANS. */
if (flag_lto_report)
print_lto_report ();
/* 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
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
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.
basically finished. */
if (in_lto_p || !flag_lto || flag_fat_lto_objects)
{
- varpool_output_variables ();
finish_aliases_2 ();
/* Likewise for mudflap static object registrations. */
}
/* 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))
- {
- node->finalized = 1;
- assemble_aliases (node);
- return true;
- }
+ gcc_assert (TREE_ASM_WRITTEN (decl));
+ node->finalized = 1;
+ assemble_aliases (node);
+ return true;
}
return false;