[GSOC] LTO dump tool project
Hrishikesh Kulkarni
hrishikeshparag@gmail.com
Wed Jul 4 18:54:00 GMT 2018
Hi,
I have:
tried to do all the formatting and style corrections according to
output given by check_GNU_style.py
removed '-fdump-lto' prefix from the command line options
added few necessary comments in the code
added command line option -type-stats from previous branch (added a
new percentage column to it)
for e.g.
integer_type 3 25.00%
pointer_type 3 25.00%
array_type 1 8.33%
function_type 5 41.67%
I have pushed the changes to the repo. Please find the diff file
attached herewith.
Regards,
Hrishikesh
On Tue, Jul 3, 2018 at 6:39 PM, Hrishikesh Kulkarni
<hrishikeshparag@gmail.com> wrote:
> Hi,
>
> Thanks for suggestions. I have started incorporating them. As a first:
>
> I have added command line options:
> -print-size to print the size of functions and variables
> size of variables is in bits and size of functions is represented as
> number of basic blocks.
>
> -print-value to print the value of initialization of global variables.
>
> -size-sort to sort the symbol names according to the size.
>
> for example command line options:
>
> ../stage1-build/gcc/lto-dump test_hello.o -fdump-lto-list -print-size
> -print-value -size-sort
>
> the dump is:
>
> Symbol Table
> Name Type Visibility Size Value
>
> printf function default 0
> main function default 3
> foo function default 3
> bar function default 6
>
> z variable default 8 97
> k variable default 32 5
> p variable default 32
> 4.400000095367431640625e+0
>
> I have also tried to make memory allocation dynamic to the best of my knowledge.
> I have pushed the changes to the repo. Please find the diff file
> attached herewith.
>
> Regards,
>
> Hrishikesh
>
>
> On Fri, Jun 29, 2018 at 12:55 PM, Martin Liška <mliska@suse.cz> wrote:
>> On 06/27/2018 10:06 PM, Hrishikesh Kulkarni wrote:
>>> Hi,
>>>
>>> I have added new command line options:
>>> -no-demangle -> for the default non demangled output
>>> -no-sort -> for the list of symbols in order of their occurrence
>>> -alpha-sort -> for the list of symbols in their alphabetical order
>>> -reverse-sort -> for the list of symbols in reversed order
>>> -defined-only -> for only the defined symbols
>>
>> Hi.
>>
>> Good progress.
>>
>>>
>>> for example:
>>>
>>> ../stage1-build/gcc/lto-dump test_hello.o -fdump-lto-list -alpha-sort
>>> -demangle -defined-only -reverse-sort
>>
>> Now as you have a separate tool (lto-dump), you can strip 'fdump-lto' prefix
>> from the older options.
>>
>>>
>>> will dump
>>>
>>> Symbol Table
>>> Name Type Visibility Size
>>> main function default
>>> k variable default
>>> foo function default
>>> bar function default
>>>
>>> It is a reversed alphabetical order of demangled symbol names which
>>> have been defined(hence printf excluded).
>>> Along with this I have also added all previous progress with reference
>>> to symbol table to the new branch.
>>>
>>> For further options to add like -size-sort and -print-size I tried to
>>> access size of the symbol with symtab node using
>>> TREE_INT_CST_LOW(DECL_SIZE(node->decl));
>>> but I am unable to do so.
>>> So how should I proceed with it?
>>
>> Sent advises via instant messaging.
>>
>> Martin
>>
>>>
>>> Please find the diff file attached herewith. I have also pushed the
>>> changes to the new branch.
>>>
>>> Please advise,
>>>
>>> Hrishikesh>
>>> On Wed, Jun 27, 2018 at 1:15 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 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
>>>>>
>>>>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: style.diff
Type: text/x-patch
Size: 8768 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20180704/24e176bb/attachment.bin>
More information about the Gcc
mailing list