summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/cgraph.h1
-rw-r--r--gcc/cgraphbuild.c3
-rw-r--r--gcc/cgraphunit.c4
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-common.c2
-rw-r--r--gcc/fortran/trans-decl.c2
-rw-r--r--gcc/langhooks.c16
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto.c4
-rw-r--r--gcc/passes.c1
-rw-r--r--gcc/toplev.c4
-rw-r--r--gcc/varpool.c40
13 files changed, 85 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 986f2c10436..4d154702361 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ad1b258d485..ca8650d4d8f 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -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)));
}
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 3abf869684e..ea5351342c0 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -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);
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4c44d91af51..781ca4bda5f 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -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
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 5c580069daf..b26b5c72735 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index dcc2176a246..ce7114fb88d 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -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;
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 9196f0a3309..b03d393aa8e 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -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;
}
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index cb5da8c36fe..340cc99fa29 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -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);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 8c1d9013edb..4be2f2b04c5 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -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.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 32fc869e983..00f623f6a0d 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -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
diff --git a/gcc/passes.c b/gcc/passes.c
index d6b9b9bc84f..c90c2231d7c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -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
diff --git a/gcc/toplev.c b/gcc/toplev.c
index a2845ab7f59..90b22466a91 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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. */
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 103b5b5f810..5ab294bcd16 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -269,24 +269,42 @@ 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))
- {
- node->finalized = 1;
- assemble_aliases (node);
- return true;
- }
+ gcc_assert (TREE_ASM_WRITTEN (decl));
+ node->finalized = 1;
+ assemble_aliases (node);
+ return true;
}
return false;