Discussion:
Extracting live registers
Paulo Matos
2018-11-06 20:35:35 UTC
Permalink
Hi,

I remember from awhile ago that there's some option (or there was...)
that gets GCC to print some register allocation information together
with the assembler output.

I am interested in obtaining the live registers per basic block. I think
the option I had in mind did that but I can't remember the option name
anymore. Can someone point me out to the option or a way to extract such
information?

Kind regards,
--
Paulo Matos
Paulo Matos
2018-11-06 21:01:04 UTC
Permalink
Apologies, wrong mailing list. Should have sent this to gcc-help.
Post by Paulo Matos
Hi,
I remember from awhile ago that there's some option (or there was...)
that gets GCC to print some register allocation information together
with the assembler output.
I am interested in obtaining the live registers per basic block. I think
the option I had in mind did that but I can't remember the option name
anymore. Can someone point me out to the option or a way to extract such
information?
Kind regards,
--
Paulo Matos
Segher Boessenkool
2018-11-06 23:40:02 UTC
Permalink
Hi Paulo,
Post by Paulo Matos
I remember from awhile ago that there's some option (or there was...)
that gets GCC to print some register allocation information together
with the assembler output.
I am interested in obtaining the live registers per basic block. I think
the option I had in mind did that but I can't remember the option name
anymore. Can someone point me out to the option or a way to extract such
information?
-fdump-rtl-alignments[-all] is the last dump with all that information I
think. This one also has all this info without -all it seems. With -all
it shows it interleaving the RTL dump as well, which may or may not be
handy for you.


Segher
Paulo Matos
2018-11-07 07:52:15 UTC
Permalink
Post by Segher Boessenkool
Hi Paulo,
-fdump-rtl-alignments[-all] is the last dump with all that information I
think. This one also has all this info without -all it seems. With -all
it shows it interleaving the RTL dump as well, which may or may not be
handy for you.
Thanks, however it provides no correspondence to the set of asm
instructions in the basic block. After you mentioned
-fdump-rtl-alignments, I tried a few related flags and hit upon what I
thought would work: -dA and -dP, but unfortunately these don't output
live out information per basic block so it's not helpful for my
application. It would be great if -dA or -dP would show live out info as
well, but that doesn't seem to be the case at the moment.
--
Paulo Matos
Segher Boessenkool
2018-11-07 19:27:43 UTC
Permalink
Post by Paulo Matos
Post by Segher Boessenkool
-fdump-rtl-alignments[-all] is the last dump with all that information I
think. This one also has all this info without -all it seems. With -all
it shows it interleaving the RTL dump as well, which may or may not be
handy for you.
Thanks, however it provides no correspondence to the set of asm
instructions in the basic block. After you mentioned
-fdump-rtl-alignments, I tried a few related flags and hit upon what I
thought would work: -dA and -dP, but unfortunately these don't output
live out information per basic block so it's not helpful for my
application. It would be great if -dA or -dP would show live out info as
well, but that doesn't seem to be the case at the moment.
Sure, it shows the register information at the edges of basic blocks
only. This is what you asked for btw ;-)

(The per-instruction info isn't readily available, and none of this is
available in the final passes).


Segher
Paulo Matos
2018-11-07 20:49:02 UTC
Permalink
Post by Segher Boessenkool
Sure, it shows the register information at the edges of basic blocks
only. This is what you asked for btw ;-)
True, but I need a way to map that information to the assembly
instructions in the basic block. :) I think it's not impossible with all
that gcc provides, but there's certainly a fair amount of parsing of
these files, which is not ideal given their format might change under my
feet.
--
Paulo Matos
Segher Boessenkool
2018-11-07 22:19:23 UTC
Permalink
Post by Paulo Matos
Post by Segher Boessenkool
Sure, it shows the register information at the edges of basic blocks
only. This is what you asked for btw ;-)
True, but I need a way to map that information to the assembly
instructions in the basic block. :)
With -dp you have the insn uids in the .s file, so you can match them up
with the RTL dumps. You can use -dP as well if you like that better.
Post by Paulo Matos
I think it's not impossible with all
that gcc provides, but there's certainly a fair amount of parsing of
these files, which is not ideal given their format might change under my
feet.
Yes, the dump files are not meant for this. They aren't completely
parsable even.


Segher

Loading...