Commit 49ba8180 by Jan Hubicka

gengtype.c (open_base_files): Add lto-streamer.h


	* gengtype.c (open_base_files): Add lto-streamer.h
	* cgraph.h (cgraph_local_info): lto_file_data is now in GGC.
	(pass_ipa_cp): GGC collect.
	* toplev. (compile_file): Do not output symbols.
	* ipa-inline.c (pass_ipa_inline): Add ggc collect.
	* timevar.def (TV_VARPOOL, TV_IPA_LTO_DECL_INIT_IO,
	TV_IPA_LTO_DECL_MERGE, TV_IPA_LTO_CGRAPH_MERGE, TV_VAROUT): New.
	* lto-section-in.c: Include ggc.h
	(lto_new_in_decl_state): Alloc in GGC.
	(lto_delete_in_decl_state): Likewise.
	* ipa.c (pass_ipa_function_visibility, pass_ipa_whole_program): Collect.

	* lto/lto.c (lto_read_in_decl_state): Use GGC.
	(lto_wpa_write_files): Announce what we are writting.
	(all_file_decl_data): New.
	(read_cgraph_and_symbols): Use GGC; correct timevars.
	(do_whole_program_analysis): Collect.
	* lto/Make-lang.in (lto.o): Fix dependency.
	* Makefile.in (GTFILES): Add lto-streamer.h.
	* varpool.c (varpool_analyze_pending_decls): Use TV_VARPOOL.
	(varpool_assemble_pending_decls): Use VAROUT.
	* lto-streamer.h (lto_tree_ref_table): Annotate.
	(lto_in_decl_state): Annotate.
	(lto_file_decl_data): Annotate.

From-SVN: r158912
parent 5a733826
2010-04-29 Jan HUbicka <jh@suse.cz>
* gengtype.c (open_base_files): Add lto-streamer.h
* cgraph.h (cgraph_local_info): lto_file_data is now in GGC.
(pass_ipa_cp): GGC collect.
* toplev. (compile_file): Do not output symbols.
* ipa-inline.c (pass_ipa_inline): Add ggc collect.
* timevar.def (TV_VARPOOL, TV_IPA_LTO_DECL_INIT_IO,
TV_IPA_LTO_DECL_MERGE, TV_IPA_LTO_CGRAPH_MERGE, TV_VAROUT): New.
* lto-section-in.c: Include ggc.h
(lto_new_in_decl_state): Alloc in GGC.
(lto_delete_in_decl_state): Likewise.
* ipa.c (pass_ipa_function_visibility, pass_ipa_whole_program): Collect.
2010-04-29 Bernd Schmidt <bernds@codesourcery.com> 2010-04-29 Bernd Schmidt <bernds@codesourcery.com>
PR target/42895 PR target/42895
......
...@@ -3623,6 +3623,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ ...@@ -3623,6 +3623,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/lto-symtab.c \ $(srcdir)/lto-symtab.c \
$(srcdir)/tree-ssa-alias.h \ $(srcdir)/tree-ssa-alias.h \
$(srcdir)/ipa-prop.h \ $(srcdir)/ipa-prop.h \
$(srcdir)/lto-streamer.h \
@all_gtfiles@ @all_gtfiles@
# Compute the list of GT header files from the corresponding C sources, # Compute the list of GT header files from the corresponding C sources,
......
...@@ -87,7 +87,7 @@ struct GTY(()) cgraph_thunk_info { ...@@ -87,7 +87,7 @@ struct GTY(()) cgraph_thunk_info {
struct GTY(()) cgraph_local_info { struct GTY(()) cgraph_local_info {
/* File stream where this node is being written to. */ /* File stream where this node is being written to. */
struct lto_file_decl_data * GTY ((skip)) lto_file_data; struct lto_file_decl_data * lto_file_data;
struct inline_summary inline_summary; struct inline_summary inline_summary;
......
...@@ -1571,7 +1571,7 @@ open_base_files (void) ...@@ -1571,7 +1571,7 @@ open_base_files (void)
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
"tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
"cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h", "cfglayout.h", "except.h", "output.h", "gimple.h", "cfgloop.h",
"target.h", "ipa-prop.h", NULL "target.h", "ipa-prop.h", "lto-streamer.h", NULL
}; };
const char *const *ifp; const char *const *ifp;
outf_p gtype_desc_c; outf_p gtype_desc_c;
......
...@@ -1340,7 +1340,7 @@ struct ipa_opt_pass_d pass_ipa_cp = ...@@ -1340,7 +1340,7 @@ struct ipa_opt_pass_d pass_ipa_cp =
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_cgraph | TODO_dump_func | TODO_dump_cgraph | TODO_dump_func |
TODO_remove_functions /* todo_flags_finish */ TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
}, },
ipcp_generate_summary, /* generate_summary */ ipcp_generate_summary, /* generate_summary */
ipcp_write_summary, /* write_summary */ ipcp_write_summary, /* write_summary */
......
...@@ -2134,7 +2134,7 @@ struct ipa_opt_pass_d pass_ipa_inline = ...@@ -2134,7 +2134,7 @@ struct ipa_opt_pass_d pass_ipa_inline =
0, /* properties_destroyed */ 0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_finish */ TODO_remove_functions, /* todo_flags_finish */
TODO_dump_cgraph | TODO_dump_func TODO_dump_cgraph | TODO_dump_func
| TODO_remove_functions /* todo_flags_finish */ | TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
}, },
inline_generate_summary, /* generate_summary */ inline_generate_summary, /* generate_summary */
inline_write_summary, /* write_summary */ inline_write_summary, /* write_summary */
......
...@@ -537,7 +537,8 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility = ...@@ -537,7 +537,8 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_remove_functions | TODO_dump_cgraph/* todo_flags_finish */ TODO_remove_functions | TODO_dump_cgraph
| TODO_ggc_collect /* todo_flags_finish */
} }
}; };
...@@ -592,7 +593,8 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility = ...@@ -592,7 +593,8 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_cgraph | TODO_remove_functions/* todo_flags_finish */ TODO_remove_functions | TODO_dump_cgraph
| TODO_ggc_collect /* todo_flags_finish */
}, },
NULL, /* generate_summary */ NULL, /* generate_summary */
NULL, /* write_summary */ NULL, /* write_summary */
......
...@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h" #include "output.h"
#include "lto-streamer.h" #include "lto-streamer.h"
#include "lto-compress.h" #include "lto-compress.h"
#include "ggc.h"
/* Section names. These must correspond to the values of /* Section names. These must correspond to the values of
enum lto_section_type. */ enum lto_section_type. */
...@@ -433,7 +434,7 @@ lto_new_in_decl_state (void) ...@@ -433,7 +434,7 @@ lto_new_in_decl_state (void)
{ {
struct lto_in_decl_state *state; struct lto_in_decl_state *state;
state = ((struct lto_in_decl_state *) xmalloc (sizeof (*state))); state = ((struct lto_in_decl_state *) ggc_alloc (sizeof (*state)));
memset (state, 0, sizeof (*state)); memset (state, 0, sizeof (*state));
return state; return state;
} }
...@@ -447,8 +448,8 @@ lto_delete_in_decl_state (struct lto_in_decl_state *state) ...@@ -447,8 +448,8 @@ lto_delete_in_decl_state (struct lto_in_decl_state *state)
for (i = 0; i < LTO_N_DECL_STREAMS; i++) for (i = 0; i < LTO_N_DECL_STREAMS; i++)
if (state->streams[i].trees) if (state->streams[i].trees)
free (state->streams[i].trees); ggc_free (state->streams[i].trees);
free (state); ggc_free (state);
} }
/* Hashtable helpers. lto_in_decl_states are hash by their function decls. */ /* Hashtable helpers. lto_in_decl_states are hash by their function decls. */
......
...@@ -467,10 +467,10 @@ struct lto_cgraph_encoder_d ...@@ -467,10 +467,10 @@ struct lto_cgraph_encoder_d
typedef struct lto_cgraph_encoder_d *lto_cgraph_encoder_t; typedef struct lto_cgraph_encoder_d *lto_cgraph_encoder_t;
/* Mapping from indices to trees. */ /* Mapping from indices to trees. */
struct lto_tree_ref_table struct GTY(()) lto_tree_ref_table
{ {
/* Array of referenced trees . */ /* Array of referenced trees . */
tree *trees; tree * GTY((length ("%h.size"))) trees;
/* Size of array. */ /* Size of array. */
unsigned int size; unsigned int size;
...@@ -496,7 +496,7 @@ struct lto_tree_ref_encoder ...@@ -496,7 +496,7 @@ struct lto_tree_ref_encoder
/* Structure to hold states of input scope. */ /* Structure to hold states of input scope. */
struct lto_in_decl_state struct GTY(()) lto_in_decl_state
{ {
/* Array of lto_in_decl_buffers to store type and decls streams. */ /* Array of lto_in_decl_buffers to store type and decls streams. */
struct lto_tree_ref_table streams[LTO_N_DECL_STREAMS]; struct lto_tree_ref_table streams[LTO_N_DECL_STREAMS];
...@@ -534,7 +534,7 @@ DEF_VEC_ALLOC_P(lto_out_decl_state_ptr, heap); ...@@ -534,7 +534,7 @@ DEF_VEC_ALLOC_P(lto_out_decl_state_ptr, heap);
by lto. This structure contains the tables that are needed by the by lto. This structure contains the tables that are needed by the
serialized functions and ipa passes to connect themselves to the serialized functions and ipa passes to connect themselves to the
global types and decls as they are reconstituted. */ global types and decls as they are reconstituted. */
struct lto_file_decl_data struct GTY(()) lto_file_decl_data
{ {
/* Decl state currently used. */ /* Decl state currently used. */
struct lto_in_decl_state *current_decl_state; struct lto_in_decl_state *current_decl_state;
...@@ -544,22 +544,22 @@ struct lto_file_decl_data ...@@ -544,22 +544,22 @@ struct lto_file_decl_data
struct lto_in_decl_state *global_decl_state; struct lto_in_decl_state *global_decl_state;
/* Table of cgraph nodes present in this file. */ /* Table of cgraph nodes present in this file. */
lto_cgraph_encoder_t cgraph_node_encoder; lto_cgraph_encoder_t GTY((skip)) cgraph_node_encoder;
/* Hash table maps lto-related section names to location in file. */ /* Hash table maps lto-related section names to location in file. */
htab_t function_decl_states; htab_t GTY((param_is (struct lto_in_decl_state))) function_decl_states;
/* The .o file that these offsets relate to. */ /* The .o file that these offsets relate to. */
const char *file_name; const char *GTY((skip)) file_name;
/* Nonzero if this file should be recompiled with LTRANS. */ /* Nonzero if this file should be recompiled with LTRANS. */
unsigned needs_ltrans_p : 1; unsigned needs_ltrans_p : 1;
/* Hash table maps lto-related section names to location in file. */ /* Hash table maps lto-related section names to location in file. */
htab_t section_hash_table; htab_t GTY((skip)) section_hash_table;
/* Hash new name of renamed global declaration to its original name. */ /* Hash new name of renamed global declaration to its original name. */
htab_t renaming_hash_table; htab_t GTY((skip)) renaming_hash_table;
}; };
struct lto_char_ptr_base struct lto_char_ptr_base
......
2010-04-28 Jan Hubicka <jh@suse.cz> 2010-04-28 Jan Hubicka <jh@suse.cz>
* lto/lto.c (lto_read_in_decl_state): Use GGC.
(lto_wpa_write_files): Announce what we are writting.
(all_file_decl_data): New.
(read_cgraph_and_symbols): Use GGC; correct timevars.
(do_whole_program_analysis): Collect.
* lto/Make-lang.in (lto.o): Fix dependency.
* Makefile.in (GTFILES): Add lto-streamer.h.
* varpool.c (varpool_analyze_pending_decls): Use TV_VARPOOL.
(varpool_assemble_pending_decls): Use VAROUT.
* lto-streamer.h (lto_tree_ref_table): Annotate.
(lto_in_decl_state): Annotate.
(lto_file_decl_data): Annotate.
2010-04-28 Jan Hubicka <jh@suse.cz>
* lto.c (lto_varpool_node_sets): New. * lto.c (lto_varpool_node_sets): New.
(lto_1_to_1_map): Partition varpool too. (lto_1_to_1_map): Partition varpool too.
(globalize_context_t, globalize_cross_file_statics, (globalize_context_t, globalize_cross_file_statics,
......
...@@ -85,7 +85,7 @@ lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h opts.h \ ...@@ -85,7 +85,7 @@ lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h opts.h \
$(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \ $(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \
langhooks.h vec.h $(BITMAP_H) pointer-set.h $(IPA_PROP_H) \ langhooks.h vec.h $(BITMAP_H) pointer-set.h $(IPA_PROP_H) \
$(COMMON_H) $(TIMEVAR_H) $(GIMPLE_H) $(LTO_H) $(LTO_TREE_H) \ $(COMMON_H) $(TIMEVAR_H) $(GIMPLE_H) $(LTO_H) $(LTO_TREE_H) \
$(LTO_TAGS_H) $(LTO_STREAMER_H) $(LTO_TAGS_H) $(LTO_STREAMER_H) gt-lto-lto.h
lto/lto-elf.o: lto/lto-elf.c $(CONFIG_H) coretypes.h $(SYSTEM_H) \ lto/lto-elf.o: lto/lto-elf.c $(CONFIG_H) coretypes.h $(SYSTEM_H) \
toplev.h $(LTO_H) $(TM_H) $(LIBIBERTY_H) $(GGC_H) $(LTO_STREAMER_H) toplev.h $(LTO_H) $(TM_H) $(LIBIBERTY_H) $(GGC_H) $(LTO_STREAMER_H)
lto/lto-coff.o: lto/lto-coff.c $(CONFIG_H) coretypes.h $(SYSTEM_H) \ lto/lto-coff.o: lto/lto-coff.c $(CONFIG_H) coretypes.h $(SYSTEM_H) \
......
...@@ -170,7 +170,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data, ...@@ -170,7 +170,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
for (i = 0; i < LTO_N_DECL_STREAMS; i++) for (i = 0; i < LTO_N_DECL_STREAMS; i++)
{ {
uint32_t size = *data++; uint32_t size = *data++;
tree *decls = (tree *) xcalloc (size, sizeof (tree)); tree *decls = GGC_NEWVEC (tree, size);
for (j = 0; j < size; j++) for (j = 0; j < size; j++)
{ {
...@@ -235,7 +235,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, ...@@ -235,7 +235,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
/* Read in per-function decl states and enter them in hash table. */ /* Read in per-function decl states and enter them in hash table. */
decl_data->function_decl_states = decl_data->function_decl_states =
htab_create (37, lto_hash_in_decl_state, lto_eq_in_decl_state, free); htab_create_ggc (37, lto_hash_in_decl_state, lto_eq_in_decl_state, NULL);
for (i = 1; i < num_decl_states; i++) for (i = 1; i < num_decl_states; i++)
{ {
...@@ -376,7 +376,7 @@ lto_file_read (lto_file *file, FILE *resolution_file) ...@@ -376,7 +376,7 @@ lto_file_read (lto_file *file, FILE *resolution_file)
resolutions = lto_resolution_read (resolution_file, file); resolutions = lto_resolution_read (resolution_file, file);
file_data = XCNEW (struct lto_file_decl_data); file_data = GGC_NEW (struct lto_file_decl_data);
file_data->file_name = file->filename; file_data->file_name = file->filename;
file_data->section_hash_table = lto_obj_build_section_table (file); file_data->section_hash_table = lto_obj_build_section_table (file);
file_data->renaming_hash_table = lto_create_renaming_table (); file_data->renaming_hash_table = lto_create_renaming_table ();
...@@ -936,6 +936,9 @@ lto_wpa_write_files (void) ...@@ -936,6 +936,9 @@ lto_wpa_write_files (void)
if (!file) if (!file)
fatal_error ("lto_obj_file_open() failed"); fatal_error ("lto_obj_file_open() failed");
if (!quiet_flag)
fprintf (stderr, " %s", temp_filename);
lto_set_current_out_file (file); lto_set_current_out_file (file);
ipa_write_optimization_summaries (set, vset); ipa_write_optimization_summaries (set, vset);
...@@ -1657,6 +1660,7 @@ lto_read_all_file_options (void) ...@@ -1657,6 +1660,7 @@ lto_read_all_file_options (void)
lto_reissue_options (); lto_reissue_options ();
} }
static GTY((length ("lto_stats.num_input_files + 1"))) struct lto_file_decl_data **all_file_decl_data;
/* Read all the symbols from the input files FNAMES. NFILES is the /* Read all the symbols from the input files FNAMES. NFILES is the
number of files requested in the command line. Instantiate a number of files requested in the command line. Instantiate a
...@@ -1667,7 +1671,6 @@ static void ...@@ -1667,7 +1671,6 @@ static void
read_cgraph_and_symbols (unsigned nfiles, const char **fnames) read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
{ {
unsigned int i, last_file_ix; unsigned int i, last_file_ix;
struct lto_file_decl_data **all_file_decl_data;
FILE *resolution; FILE *resolution;
struct cgraph_node *node; struct cgraph_node *node;
...@@ -1676,7 +1679,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1676,7 +1679,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_DECL_IO); timevar_push (TV_IPA_LTO_DECL_IO);
/* Set the hooks so that all of the ipa passes can read in their data. */ /* Set the hooks so that all of the ipa passes can read in their data. */
all_file_decl_data = XNEWVEC (struct lto_file_decl_data *, nfiles + 1); all_file_decl_data = GGC_CNEWVEC (struct lto_file_decl_data *, nfiles + 1);
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data); lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
/* Read the resolution file. */ /* Read the resolution file. */
...@@ -1723,6 +1726,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1723,6 +1726,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
lto_obj_file_close (current_lto_file); lto_obj_file_close (current_lto_file);
current_lto_file = NULL; current_lto_file = NULL;
ggc_collect ();
} }
if (resolution_file_name) if (resolution_file_name)
...@@ -1733,24 +1737,30 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1733,24 +1737,30 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* Set the hooks so that all of the ipa passes can read in their data. */ /* Set the hooks so that all of the ipa passes can read in their data. */
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data); lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
/* Each pass will set the appropriate timer. */
timevar_pop (TV_IPA_LTO_DECL_IO); timevar_pop (TV_IPA_LTO_DECL_IO);
if (!quiet_flag) if (!quiet_flag)
fprintf (stderr, "\nReading the callgraph\n"); fprintf (stderr, "\nReading the callgraph\n");
timevar_push (TV_IPA_LTO_CGRAPH_IO);
/* Read the callgraph. */ /* Read the callgraph. */
input_cgraph (); input_cgraph ();
timevar_pop (TV_IPA_LTO_CGRAPH_IO);
if (!quiet_flag) if (!quiet_flag)
fprintf (stderr, "Merging declarations\n"); fprintf (stderr, "Merging declarations\n");
timevar_push (TV_IPA_LTO_DECL_MERGE);
/* Merge global decls. */ /* Merge global decls. */
lto_symtab_merge_decls (); lto_symtab_merge_decls ();
/* Fixup all decls and types and free the type hash tables. */ /* Fixup all decls and types and free the type hash tables. */
lto_fixup_decls (all_file_decl_data); lto_fixup_decls (all_file_decl_data);
free_gimple_type_tables (); free_gimple_type_tables ();
ggc_collect ();
timevar_pop (TV_IPA_LTO_DECL_MERGE);
/* Each pass will set the appropriate timer. */
if (!quiet_flag) if (!quiet_flag)
fprintf (stderr, "Reading summaries\n"); fprintf (stderr, "Reading summaries\n");
...@@ -1762,7 +1772,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1762,7 +1772,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
ipa_read_summaries (); ipa_read_summaries ();
/* Finally merge the cgraph according to the decl merging decisions. */ /* Finally merge the cgraph according to the decl merging decisions. */
timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
lto_symtab_merge_cgraph_nodes (); lto_symtab_merge_cgraph_nodes ();
ggc_collect ();
if (flag_ltrans) if (flag_ltrans)
for (node = cgraph_nodes; node; node = node->next) for (node = cgraph_nodes; node; node = node->next)
...@@ -1776,8 +1788,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1776,8 +1788,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
node->ipa_transforms_to_apply, node->ipa_transforms_to_apply,
(ipa_opt_pass)&pass_ipa_inline); (ipa_opt_pass)&pass_ipa_inline);
} }
timevar_pop (TV_IPA_LTO_CGRAPH_MERGE);
timevar_push (TV_IPA_LTO_DECL_IO); timevar_push (TV_IPA_LTO_DECL_INIT_IO);
/* FIXME lto. This loop needs to be changed to use the pass manager to /* FIXME lto. This loop needs to be changed to use the pass manager to
call the ipa passes directly. */ call the ipa passes directly. */
...@@ -1791,7 +1804,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1791,7 +1804,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* Indicate that the cgraph is built and ready. */ /* Indicate that the cgraph is built and ready. */
cgraph_function_flags_ready = true; cgraph_function_flags_ready = true;
timevar_pop (TV_IPA_LTO_DECL_IO); timevar_pop (TV_IPA_LTO_DECL_INIT_IO);
ggc_free (all_file_decl_data);
all_file_decl_data = NULL;
} }
...@@ -1874,6 +1889,12 @@ do_whole_program_analysis (void) ...@@ -1874,6 +1889,12 @@ do_whole_program_analysis (void)
/* Reading in the cgraph uses different timers, start timing WPA now. */ /* Reading in the cgraph uses different timers, start timing WPA now. */
timevar_push (TV_WHOPR_WPA); timevar_push (TV_WHOPR_WPA);
if (pre_ipa_mem_report)
{
fprintf (stderr, "Memory consumption before IPA\n");
dump_memory_report (false);
}
cgraph_function_flags_ready = true; cgraph_function_flags_ready = true;
bitmap_obstack_initialize (NULL); bitmap_obstack_initialize (NULL);
ipa_register_cgraph_hooks (); ipa_register_cgraph_hooks ();
...@@ -1895,9 +1916,16 @@ do_whole_program_analysis (void) ...@@ -1895,9 +1916,16 @@ do_whole_program_analysis (void)
fflush (stderr); fflush (stderr);
} }
output_files = lto_wpa_write_files (); output_files = lto_wpa_write_files ();
ggc_collect ();
if (!quiet_flag) if (!quiet_flag)
fprintf (stderr, "\n"); fprintf (stderr, "\n");
if (post_ipa_mem_report)
{
fprintf (stderr, "Memory consumption after IPA\n");
dump_memory_report (false);
}
/* 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 ();
......
...@@ -49,10 +49,14 @@ DEFTIMEVAR (TV_PCH_CPP_RESTORE , "PCH preprocessor state restore") ...@@ -49,10 +49,14 @@ DEFTIMEVAR (TV_PCH_CPP_RESTORE , "PCH preprocessor state restore")
DEFTIMEVAR (TV_CGRAPH , "callgraph construction") DEFTIMEVAR (TV_CGRAPH , "callgraph construction")
DEFTIMEVAR (TV_CGRAPHOPT , "callgraph optimization") DEFTIMEVAR (TV_CGRAPHOPT , "callgraph optimization")
DEFTIMEVAR (TV_VARPOOL , "varpool construction")
DEFTIMEVAR (TV_IPA_CONSTANT_PROP , "ipa cp") DEFTIMEVAR (TV_IPA_CONSTANT_PROP , "ipa cp")
DEFTIMEVAR (TV_IPA_LTO_GIMPLE_IO , "ipa lto gimple I/O") DEFTIMEVAR (TV_IPA_LTO_GIMPLE_IO , "ipa lto gimple I/O")
DEFTIMEVAR (TV_IPA_LTO_DECL_IO , "ipa lto decl I/O") DEFTIMEVAR (TV_IPA_LTO_DECL_IO , "ipa lto decl I/O")
DEFTIMEVAR (TV_IPA_LTO_DECL_INIT_IO , "ipa lto decl init I/O")
DEFTIMEVAR (TV_IPA_LTO_CGRAPH_IO , "ipa lto cgraph I/O") DEFTIMEVAR (TV_IPA_LTO_CGRAPH_IO , "ipa lto cgraph I/O")
DEFTIMEVAR (TV_IPA_LTO_DECL_MERGE , "ipa lto decl merge")
DEFTIMEVAR (TV_IPA_LTO_CGRAPH_MERGE , "ipa lto cgraph merge")
DEFTIMEVAR (TV_LTO , "lto") DEFTIMEVAR (TV_LTO , "lto")
DEFTIMEVAR (TV_WHOPR_WPA , "whopr wpa") DEFTIMEVAR (TV_WHOPR_WPA , "whopr wpa")
DEFTIMEVAR (TV_WHOPR_WPA_IO , "whopr wpa I/O") DEFTIMEVAR (TV_WHOPR_WPA_IO , "whopr wpa I/O")
...@@ -216,6 +220,7 @@ DEFTIMEVAR (TV_REORDER_BLOCKS , "reorder blocks") ...@@ -216,6 +220,7 @@ DEFTIMEVAR (TV_REORDER_BLOCKS , "reorder blocks")
DEFTIMEVAR (TV_SHORTEN_BRANCH , "shorten branches") DEFTIMEVAR (TV_SHORTEN_BRANCH , "shorten branches")
DEFTIMEVAR (TV_REG_STACK , "reg stack") DEFTIMEVAR (TV_REG_STACK , "reg stack")
DEFTIMEVAR (TV_FINAL , "final") DEFTIMEVAR (TV_FINAL , "final")
DEFTIMEVAR (TV_VAROUT , "variable output")
DEFTIMEVAR (TV_SYMOUT , "symout") DEFTIMEVAR (TV_SYMOUT , "symout")
DEFTIMEVAR (TV_VAR_TRACKING , "variable tracking") DEFTIMEVAR (TV_VAR_TRACKING , "variable tracking")
DEFTIMEVAR (TV_TREE_IFCOMBINE , "tree if-combine") DEFTIMEVAR (TV_TREE_IFCOMBINE , "tree if-combine")
......
...@@ -1056,7 +1056,7 @@ compile_file (void) ...@@ -1056,7 +1056,7 @@ compile_file (void)
what's left of the symbol table output. */ what's left of the symbol table output. */
timevar_pop (TV_PARSE); timevar_pop (TV_PARSE);
if (flag_syntax_only) if (flag_syntax_only || flag_wpa)
return; return;
ggc_protect_identifiers = false; ggc_protect_identifiers = false;
......
...@@ -399,8 +399,8 @@ bool ...@@ -399,8 +399,8 @@ bool
varpool_analyze_pending_decls (void) varpool_analyze_pending_decls (void)
{ {
bool changed = false; bool changed = false;
timevar_push (TV_CGRAPH);
timevar_push (TV_VARPOOL);
while (varpool_first_unanalyzed_node) while (varpool_first_unanalyzed_node)
{ {
tree decl = varpool_first_unanalyzed_node->decl; tree decl = varpool_first_unanalyzed_node->decl;
...@@ -424,7 +424,7 @@ varpool_analyze_pending_decls (void) ...@@ -424,7 +424,7 @@ varpool_analyze_pending_decls (void)
record_references_in_initializer (decl, analyzed); record_references_in_initializer (decl, analyzed);
changed = true; changed = true;
} }
timevar_pop (TV_CGRAPH); timevar_pop (TV_VARPOOL);
return changed; return changed;
} }
...@@ -518,6 +518,7 @@ varpool_assemble_pending_decls (void) ...@@ -518,6 +518,7 @@ varpool_assemble_pending_decls (void)
if (errorcount || sorrycount) if (errorcount || sorrycount)
return false; return false;
timevar_push (TV_VAROUT);
/* EH might mark decls as needed during expansion. This should be safe since /* EH might mark decls as needed during expansion. This should be safe since
we don't create references to new function, but it should not be used we don't create references to new function, but it should not be used
elsewhere. */ elsewhere. */
...@@ -539,6 +540,7 @@ varpool_assemble_pending_decls (void) ...@@ -539,6 +540,7 @@ varpool_assemble_pending_decls (void)
/* varpool_nodes_queue is now empty, clear the pointer to the last element /* varpool_nodes_queue is now empty, clear the pointer to the last element
in the queue. */ in the queue. */
varpool_last_needed_node = NULL; varpool_last_needed_node = NULL;
timevar_pop (TV_VAROUT);
return changed; return changed;
} }
......
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