* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158912
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
$(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,
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;
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 */
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 */
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 */
}
};
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 */
#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. */
{
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;
}
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. */
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;
/* 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];
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;
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,
$(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) \
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++)
{
/* 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++)
{
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 ();
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);
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
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;
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. */
lto_obj_file_close (current_lto_file);
current_lto_file = NULL;
+ ggc_collect ();
}
if (resolution_file_name)
/* 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");
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)
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. */
/* 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;
}
/* 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 ();
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 ();
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;
record_references_in_initializer (decl, analyzed);
changed = true;
}
- timevar_pop (TV_CGRAPH);
+ timevar_pop (TV_VARPOOL);
return changed;
}
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. */
/* 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;
}