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>
PR target/42895
......
......@@ -3623,6 +3623,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/lto-symtab.c \
$(srcdir)/tree-ssa-alias.h \
$(srcdir)/ipa-prop.h \
$(srcdir)/lto-streamer.h \
@all_gtfiles@
# Compute the list of GT header files from the corresponding C sources,
......
......@@ -87,7 +87,7 @@ struct GTY(()) cgraph_thunk_info {
struct GTY(()) cgraph_local_info {
/* 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;
......
......@@ -1571,7 +1571,7 @@ open_base_files (void)
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
"tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.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;
outf_p gtype_desc_c;
......
......@@ -1340,7 +1340,7 @@ struct ipa_opt_pass_d pass_ipa_cp =
0, /* properties_destroyed */
0, /* todo_flags_start */
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_write_summary, /* write_summary */
......
......@@ -2134,7 +2134,7 @@ struct ipa_opt_pass_d pass_ipa_inline =
0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_finish */
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_write_summary, /* write_summary */
......
......@@ -537,7 +537,8 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility =
0, /* properties_provided */
0, /* properties_destroyed */
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 =
0, /* properties_provided */
0, /* properties_destroyed */
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, /* write_summary */
......
......@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "lto-streamer.h"
#include "lto-compress.h"
#include "ggc.h"
/* Section names. These must correspond to the values of
enum lto_section_type. */
......@@ -433,7 +434,7 @@ lto_new_in_decl_state (void)
{
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));
return 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++)
if (state->streams[i].trees)
free (state->streams[i].trees);
free (state);
ggc_free (state->streams[i].trees);
ggc_free (state);
}
/* Hashtable helpers. lto_in_decl_states are hash by their function decls. */
......
......@@ -467,10 +467,10 @@ struct lto_cgraph_encoder_d
typedef struct lto_cgraph_encoder_d *lto_cgraph_encoder_t;
/* Mapping from indices to trees. */
struct lto_tree_ref_table
struct GTY(()) lto_tree_ref_table
{
/* Array of referenced trees . */
tree *trees;
tree * GTY((length ("%h.size"))) trees;
/* Size of array. */
unsigned int size;
......@@ -496,7 +496,7 @@ struct lto_tree_ref_encoder
/* 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. */
struct lto_tree_ref_table streams[LTO_N_DECL_STREAMS];
......@@ -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
serialized functions and ipa passes to connect themselves to the
global types and decls as they are reconstituted. */
struct lto_file_decl_data
struct GTY(()) lto_file_decl_data
{
/* Decl state currently used. */
struct lto_in_decl_state *current_decl_state;
......@@ -544,22 +544,22 @@ struct lto_file_decl_data
struct lto_in_decl_state *global_decl_state;
/* 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. */
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. */
const char *file_name;
const char *GTY((skip)) file_name;
/* Nonzero if this file should be recompiled with LTRANS. */
unsigned needs_ltrans_p : 1;
/* 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. */
htab_t renaming_hash_table;
htab_t GTY((skip)) renaming_hash_table;
};
struct lto_char_ptr_base
......
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_1_to_1_map): Partition varpool too.
(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 \
$(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \
langhooks.h vec.h $(BITMAP_H) pointer-set.h $(IPA_PROP_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) \
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) \
......
......@@ -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++)
{
uint32_t size = *data++;
tree *decls = (tree *) xcalloc (size, sizeof (tree));
tree *decls = GGC_NEWVEC (tree, size);
for (j = 0; j < size; j++)
{
......@@ -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. */
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++)
{
......@@ -376,7 +376,7 @@ lto_file_read (lto_file *file, FILE *resolution_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->section_hash_table = lto_obj_build_section_table (file);
file_data->renaming_hash_table = lto_create_renaming_table ();
......@@ -936,6 +936,9 @@ lto_wpa_write_files (void)
if (!file)
fatal_error ("lto_obj_file_open() failed");
if (!quiet_flag)
fprintf (stderr, " %s", temp_filename);
lto_set_current_out_file (file);
ipa_write_optimization_summaries (set, vset);
......@@ -1657,6 +1660,7 @@ lto_read_all_file_options (void)
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
number of files requested in the command line. Instantiate a
......@@ -1667,7 +1671,6 @@ static void
read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
{
unsigned int i, last_file_ix;
struct lto_file_decl_data **all_file_decl_data;
FILE *resolution;
struct cgraph_node *node;
......@@ -1676,7 +1679,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_DECL_IO);
/* 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);
/* Read the resolution file. */
......@@ -1723,6 +1726,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
lto_obj_file_close (current_lto_file);
current_lto_file = NULL;
ggc_collect ();
}
if (resolution_file_name)
......@@ -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. */
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);
if (!quiet_flag)
fprintf (stderr, "\nReading the callgraph\n");
timevar_push (TV_IPA_LTO_CGRAPH_IO);
/* Read the callgraph. */
input_cgraph ();
timevar_pop (TV_IPA_LTO_CGRAPH_IO);
if (!quiet_flag)
fprintf (stderr, "Merging declarations\n");
timevar_push (TV_IPA_LTO_DECL_MERGE);
/* Merge global decls. */
lto_symtab_merge_decls ();
/* Fixup all decls and types and free the type hash tables. */
lto_fixup_decls (all_file_decl_data);
free_gimple_type_tables ();
ggc_collect ();
timevar_pop (TV_IPA_LTO_DECL_MERGE);
/* Each pass will set the appropriate timer. */
if (!quiet_flag)
fprintf (stderr, "Reading summaries\n");
......@@ -1762,7 +1772,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
ipa_read_summaries ();
/* Finally merge the cgraph according to the decl merging decisions. */
timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
lto_symtab_merge_cgraph_nodes ();
ggc_collect ();
if (flag_ltrans)
for (node = cgraph_nodes; node; node = node->next)
......@@ -1776,8 +1788,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
node->ipa_transforms_to_apply,
(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
call the ipa passes directly. */
......@@ -1791,7 +1804,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* Indicate that the cgraph is built and ready. */
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)
/* Reading in the cgraph uses different timers, start timing WPA now. */
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;
bitmap_obstack_initialize (NULL);
ipa_register_cgraph_hooks ();
......@@ -1895,9 +1916,16 @@ do_whole_program_analysis (void)
fflush (stderr);
}
output_files = lto_wpa_write_files ();
ggc_collect ();
if (!quiet_flag)
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. */
if (flag_lto_report)
print_lto_report ();
......
......@@ -49,10 +49,14 @@ DEFTIMEVAR (TV_PCH_CPP_RESTORE , "PCH preprocessor state restore")
DEFTIMEVAR (TV_CGRAPH , "callgraph construction")
DEFTIMEVAR (TV_CGRAPHOPT , "callgraph optimization")
DEFTIMEVAR (TV_VARPOOL , "varpool construction")
DEFTIMEVAR (TV_IPA_CONSTANT_PROP , "ipa cp")
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_INIT_IO , "ipa lto decl init 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_WHOPR_WPA , "whopr wpa")
DEFTIMEVAR (TV_WHOPR_WPA_IO , "whopr wpa I/O")
......@@ -216,6 +220,7 @@ DEFTIMEVAR (TV_REORDER_BLOCKS , "reorder blocks")
DEFTIMEVAR (TV_SHORTEN_BRANCH , "shorten branches")
DEFTIMEVAR (TV_REG_STACK , "reg stack")
DEFTIMEVAR (TV_FINAL , "final")
DEFTIMEVAR (TV_VAROUT , "variable output")
DEFTIMEVAR (TV_SYMOUT , "symout")
DEFTIMEVAR (TV_VAR_TRACKING , "variable tracking")
DEFTIMEVAR (TV_TREE_IFCOMBINE , "tree if-combine")
......
......@@ -1056,7 +1056,7 @@ compile_file (void)
what's left of the symbol table output. */
timevar_pop (TV_PARSE);
if (flag_syntax_only)
if (flag_syntax_only || flag_wpa)
return;
ggc_protect_identifiers = false;
......
......@@ -399,8 +399,8 @@ bool
varpool_analyze_pending_decls (void)
{
bool changed = false;
timevar_push (TV_CGRAPH);
timevar_push (TV_VARPOOL);
while (varpool_first_unanalyzed_node)
{
tree decl = varpool_first_unanalyzed_node->decl;
......@@ -424,7 +424,7 @@ varpool_analyze_pending_decls (void)
record_references_in_initializer (decl, analyzed);
changed = true;
}
timevar_pop (TV_CGRAPH);
timevar_pop (TV_VARPOOL);
return changed;
}
......@@ -518,6 +518,7 @@ varpool_assemble_pending_decls (void)
if (errorcount || sorrycount)
return false;
timevar_push (TV_VAROUT);
/* 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
elsewhere. */
......@@ -539,6 +540,7 @@ varpool_assemble_pending_decls (void)
/* varpool_nodes_queue is now empty, clear the pointer to the last element
in the queue. */
varpool_last_needed_node = NULL;
timevar_pop (TV_VAROUT);
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