diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 8529c82..8d20917 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1320,7 +1320,6 @@ lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symta /* Restore decl state */ file_data->current_decl_state = file_data->global_decl_state; } - lto_data_in_delete (data_in); } diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in index 465662e..9570ff3 100644 --- a/gcc/lto/Make-lang.in +++ b/gcc/lto/Make-lang.in @@ -22,7 +22,7 @@ # The name of the LTO compiler. LTO_EXE = lto1$(exeext) # The LTO-specific object files inclued in $(LTO_EXE). -LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-dump.o +LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o tree-cfg.o lto/lto-partition.o lto/lto-symtab.o lto/lto-dump.o lto_OBJS = $(LTO_OBJS) # this is only useful in a LTO bootstrap, but this does not work right diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt index a098797..c10c662 100644 --- a/gcc/lto/lang.opt +++ b/gcc/lto/lang.opt @@ -77,6 +77,9 @@ LTO Driver RejectNegative Joined Var(flag_lto_dump_symbol) demangle LTO Var(flag_lto_dump_demangle) +fdump-lto-body= +LTO Driver RejectNegative Joined Var(flag_lto_dump_body) + fresolution= LTO Joined The resolution file. diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c index e0becd1..7371b4b 100644 --- a/gcc/lto/lto-dump.c +++ b/gcc/lto/lto-dump.c @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "basic-block.h" #include "tree.h" +#include "tree-cfg.h" #include "gimple.h" #include "cgraph.h" #include "lto-streamer.h" @@ -36,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "stdio.h" #include "lto.h" + /* Dump everything. */ void dump () @@ -56,7 +58,7 @@ dump_list () fprintf (stderr, "\n%20s",(flag_lto_dump_demangle) ? node->name (): node->dump_asm_name ()); fprintf (stderr, "%20s", node->dump_type_name ()); - fprintf (stderr, "%20s\n", node->dump_visibility ()); + fprintf (stderr, "%20s", node->dump_visibility ()); } } @@ -70,10 +72,24 @@ dump_symbol () { if (!strcmp(flag_lto_dump_symbol, node->name())) { - fprintf (stderr, "\n%20s",(flag_lto_dump_demangle) - ? node->name (): node->dump_asm_name ()); - fprintf (stderr, "%20s", node->dump_type_name ()); - fprintf (stderr, "%20s\n", node->dump_visibility ()); + // fprintf (stderr, "\n%20s",(flag_lto_dump_demangle) + // ? node->name (): node->dump_asm_name ()); + // fprintf (stderr, "%20s", node->dump_type_name ()); + // fprintf (stderr, "%20s", node->dump_visibility ()); + node->debug(); + } } +} + +/* Dump gimple body of specific function. */ +void +dump_body () +{ + cgraph_node *cnode; + FOR_EACH_FUNCTION (cnode) + if (!strcmp(cnode->name(), flag_lto_dump_body)) + { + cnode->get_untransformed_body(); + //debug_function (cnode->decl, 0); } } \ No newline at end of file diff --git a/gcc/lto/lto-dump.h b/gcc/lto/lto-dump.h index 352160c..3b6c9bc 100644 --- a/gcc/lto/lto-dump.h +++ b/gcc/lto/lto-dump.h @@ -29,4 +29,7 @@ void dump_list (); /*Dump specific variable or function used in IL. */ void dump_symbol (); +/*Dump gimple body of specific function. */ +void dump_body (); + #endif \ No newline at end of file diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index ab1eed3..88d1480 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -3373,6 +3373,10 @@ lto_main (void) if (flag_lto_dump_symbol) dump_symbol (); + /* Dump gimple body of specific function. */ + if (flag_lto_dump_body) + dump_body (); + timevar_stop (TV_PHASE_STREAM_IN); if (!seen_error ()) diff --git a/gcc/symtab.c b/gcc/symtab.c index 1d2374f..0e08519 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -815,7 +815,7 @@ symtab_node::dump_visibility () const "default", "protected", "hidden", "internal" }; - return visibility_types [DECL_VISIBILITY (decl)]; + return visibility_types[DECL_VISIBILITY (decl)]; } const char *