Extracting live registers

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Extracting live registers

Paulo Matos-3
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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting live registers

Paulo Matos-3
Apologies, wrong mailing list. Should have sent this to gcc-help.

On 06/11/2018 21:35, Paulo Matos wrote:

> 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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting live registers

Segher Boessenkool
In reply to this post by Paulo Matos-3
Hi Paulo,

On Tue, Nov 06, 2018 at 09:35:35PM +0100, Paulo Matos wrote:
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting live registers

Paulo Matos-3


On 07/11/2018 00:40, Segher Boessenkool wrote:
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting live registers

Segher Boessenkool
On Wed, Nov 07, 2018 at 08:52:15AM +0100, Paulo Matos wrote:

> On 07/11/2018 00:40, Segher Boessenkool wrote:
> > -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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting live registers

Paulo Matos-3


On 07/11/2018 20:27, Segher Boessenkool wrote:
>
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting live registers

Segher Boessenkool
On Wed, Nov 07, 2018 at 09:49:02PM +0100, Paulo Matos wrote:
> On 07/11/2018 20:27, Segher Boessenkool wrote:
> > 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.

> 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