This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GSOC] LTO dump tool project


Hi,

I have created another branch lto-dump-tool-improved as suggested.
I have applied the patch for separation to lto-dump binary, made a few
necessary changes in other files and it is running successfully.
I will keep on adding previous work to this branch incrementally.

Please find the diff file attached for dumping of TREE statistics and
GIMPLE statistics.

for example:
(after configuring with --enable-gather-detailed-mem-stats)
-fdump-lto-gimple-stats will dump
GIMPLE statements
Kind                   Stmts      Bytes
---------------------------------------
assignments                0          0
phi nodes                  0          0
conditionals               0          0
everything else            0          0
---------------------------------------
Total                      0          0
---------------------------------------

-fdump-lto-tree-stats will dump

Tree Statistics

Kind                   Nodes      Bytes
----------------------------------------
decls                   4327     932672
types                   1531     257208
blocks                     0          0
stmts                      0          0
refs                       0          0
exprs                      4        128
constants                 82       2060
identifiers             4430     177200
vecs                      16      28544
binfos                     0          0
ssa names                  0          0
constructors               0          0
random kinds            7301     291952
lang_decl kinds            0          0
lang_type kinds            0          0
omp clauses                0          0
----------------------------------------
Total                  17691    1689764



Please advise,

Hrishikesh

On Wed, Jun 27, 2018 at 1:00 AM, Hrishikesh Kulkarni
<hrishikeshparag@gmail.com> wrote:
> Hi,
>
> I have created another branch lto-dump-tool-improved as suggested.
> I have applied the patch for separation to lto-dump binary, made a few
> necessary changes in other files and it is running successfully.
> I will keep on adding previous work to this branch incrementally.
>
> Please find the diff file attached for dumping of TREE statistics and GIMPLE
> statistics.
>
> for example:
> (after configuring with --enable-gather-detailed-mem-stats)
> -fdump-lto-gimple-stats will dump
> GIMPLE statements
> Kind                   Stmts      Bytes
> ---------------------------------------
> assignments                0          0
> phi nodes                  0          0
> conditionals               0          0
> everything else            0          0
> ---------------------------------------
> Total                      0          0
> ---------------------------------------
>
> -fdump-lto-tree-stats will dump
>
> Tree Statistics
>
> Kind                   Nodes      Bytes
> ----------------------------------------
> decls                   4327     932672
> types                   1531     257208
> blocks                     0          0
> stmts                      0          0
> refs                       0          0
> exprs                      4        128
> constants                 82       2060
> identifiers             4430     177200
> vecs                      16      28544
> binfos                     0          0
> ssa names                  0          0
> constructors               0          0
> random kinds            7301     291952
> lang_decl kinds            0          0
> lang_type kinds            0          0
> omp clauses                0          0
> ----------------------------------------
> Total                  17691    1689764
>
>
>
> Please advise,
>
> Hrishikesh
>
>
> On Fri, Jun 22, 2018 at 2:29 PM, Martin Liška <mliska@suse.cz> wrote:
>>
>> On 06/18/2018 10:45 AM, Martin Jambor wrote:
>> > Hi,
>> >
>> > On Sun, Jun 17 2018, Hrishikesh Kulkarni wrote:
>> >> Hi,
>> >>
>> >> I am trying to isolate the dump tool into real lto-dump tool. I have
>> >> started with the copy&paste of lto.c into lto-dump.c and done the
>> >> changes to Make-lang.in and config-lang.in suggested by Martin (patch
>> >> attached). However when I try to build, I get the following error:
>> >>
>> >> In file included from ../../gcc/gcc/lto/lto-dump.c:24:0:
>> >>
>> >> ../../gcc/gcc/coretypes.h:397:24: fatal error: insn-modes.h: No such
>> >>
>> >> file or directory
>> >>
>> >> compilation terminated.
>> >>
>> >>
>> >> I am unable to find the missing dependencies and would be grateful for
>> >> suggestions on how to resolve the issue.
>> >
>> > insn-modes.h is one of header files which are generated at build time,
>> > you will find it in the gcc subdirectory of your build directory (as
>> > opposed to the source directory).
>> >
>> > Martin
>> >
>>
>> Hi.
>>
>> There's patch that works for me.
>> Needed dependency is here:
>>
>> +lto/lto-dump.o: $(LTO_EXE)
>>
>> It's bit artificial, but for now it works. Please start working
>> on separation of dump infrastructure to lto-dump.c. You'll need
>> to factor out common code shared in between lto.c and lto-dump.c.
>>
>> Martin
>
>
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 3a18b30..afdb76a 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1757,7 +1757,8 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
 
   /* We do not uniquify the pre-loaded cache entries, those are middle-end
      internal types that should not be merged.  */
-
+  std :: map <tree_code, int> stats; 
+  std :: map <tree_code, int> :: iterator itr;
   /* Read the global declarations and types.  */
   while (ib_main.p < ib_main.len)
     {
@@ -1799,8 +1800,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
 
 	  bool seen_type = false;
 
-    std :: map <tree, int> stats; 
-    std :: map <tree, int> :: iterator itr;
+
 
 	  for (unsigned i = 0; i < len; ++i)
 	    {
@@ -1810,9 +1810,11 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
 		 chains.  */
 	      if (TYPE_P (t))
 		{ 
-      itr = stats.find(t);
+      itr = stats.find(TREE_CODE(t));
       if (itr == stats.end())
-        stats.insert(std :: pair <tree, int> (t, 1));
+      {
+        stats.insert(std :: pair <tree_code, int> (TREE_CODE(t), 1));
+      }
       else
         itr->second++;
 
@@ -1844,12 +1846,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
 		}
 	    }
 
-       for (itr = stats.begin(); itr != stats.end(); ++itr)
-      {
-        fprintf(stderr, "\t%s\t%d\n", get_tree_code_name(TREE_CODE(itr->first)), itr->second );
-      }
-    fprintf(stderr, "\n" );
-
+ 
 	  /* Register DECLs with the debuginfo machinery.  */
 	  while (!dref_queue.is_empty ())
 	    {
@@ -1867,6 +1864,12 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
 	  gcc_assert (t && data_in->reader_cache->nodes.length () == from);
 	}
     }
+    fprintf(stderr, "\n");
+    for (itr = stats.begin(); itr != stats.end(); ++itr)
+    {
+      fprintf(stderr, "\t%s\t%d\n", get_tree_code_name(itr->first), itr->second );
+    }
+
   data_in->location_cache.apply_location_cache ();
 
   /* Read in lto_in_decl_state objects.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]