public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* best ABI strategy ?
@ 2011-11-30 16:18 Aurelien Buhrig
  2011-11-30 16:57 ` Georg-Johann Lay
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Aurelien Buhrig @ 2011-11-30 16:18 UTC (permalink / raw)
  To: gcc-help

Hi,

I'm trying to optimize our target ABI, and I'm wondering what is the
best strategy to define it.
Is there a paper, or any hint, dealing with this topic ?
For instance,
- which ratio between call-used-reg vs "static regs"
- which ratio between arg regs vs call-used-reg
- what should be return regs
- ...
I guess this problem is very target dependent, but there are maybe
general ideas about this.


In particular, for now my call-used regs set is the same that arg regs
set. I noticed GCC would not use arg regs for reloading, (or would
prefer others), even if they are not actually used by function args.
and it generates extra push/pop of static regs. I there a way force
gcc preferring using "free" arg regs ?

Thank you by advance!

Aurélien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best ABI strategy ?
  2011-11-30 16:18 best ABI strategy ? Aurelien Buhrig
@ 2011-11-30 16:57 ` Georg-Johann Lay
  2011-11-30 21:18   ` Aurelien Buhrig
  2011-11-30 18:49 ` Aurelien Buhrig
       [not found] ` <mcrfwh5saxu.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
  2 siblings, 1 reply; 5+ messages in thread
From: Georg-Johann Lay @ 2011-11-30 16:57 UTC (permalink / raw)
  To: Aurelien Buhrig; +Cc: gcc-help

Aurelien Buhrig wrote:
> Hi,
> 
> I'm trying to optimize our target ABI, and I'm wondering what is the
> best strategy to define it.
> Is there a paper, or any hint, dealing with this topic ?
> For instance,
> - which ratio between call-used-reg vs "static regs"
> - which ratio between arg regs vs call-used-reg
> - what should be return regs
> - ...
> I guess this problem is very target dependent, but there are maybe
> general ideas about this.

If it's about new hardware/silicon/controller, it is a good idea to do a
controller compiler co-design. That way you can get the best out of a new
architecture as you have the most degrees of freedom to find a good point in
the ISA/ABI plane.

This requires of course to start the compiler development early and in a stage
where the ISA is still work in progress, i.e. there is no final silicon but
just an instruction set simulator for the upcoming hardware.

In many cases, you cannot really say what's the best except you actually
implement it and look how smooth it works.  My experience is that ISA designers
just think up to the assembler level, but have no idea how a compiler works and
what it needs and which features it can use and which not.

If the silicon/ISA is already fix and there is no feedback possible, it is
often easy to parametrize different ABI flavours through compiler switches so
you can benchmark, switch back and forth between ABIs and see what their pros
and contras are.

Johann

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best ABI strategy ?
  2011-11-30 16:18 best ABI strategy ? Aurelien Buhrig
  2011-11-30 16:57 ` Georg-Johann Lay
@ 2011-11-30 18:49 ` Aurelien Buhrig
       [not found] ` <mcrfwh5saxu.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
  2 siblings, 0 replies; 5+ messages in thread
From: Aurelien Buhrig @ 2011-11-30 18:49 UTC (permalink / raw)
  To: gcc-help

> Hi,
>
> I'm trying to optimize our target ABI, and I'm wondering what is the
> best strategy to define it.
> Is there a paper, or any hint, dealing with this topic ?
> For instance,
> - which ratio between call-used-reg vs "static regs"
> - which ratio between arg regs vs call-used-reg
> - what should be return regs
> - ...
> I guess this problem is very target dependent, but there are maybe
> general ideas about this.
>
>
> In particular, for now my call-used regs set is the same that arg regs
> set. I noticed GCC would not use arg regs for reloading, (or would
> prefer others), even if they are not actually used by function args.
> and it generates extra push/pop of static regs. I there a way force
> gcc preferring using "free" arg regs ?
>
> Thank you by advance!
>
> Aurélien

Forget the last point. GCC does use free arg regs. The testcases I
looked at were not relevant. Sorry!

Aurélien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best ABI strategy ?
  2011-11-30 16:57 ` Georg-Johann Lay
@ 2011-11-30 21:18   ` Aurelien Buhrig
  0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Buhrig @ 2011-11-30 21:18 UTC (permalink / raw)
  To: gcc-help

2011/11/30 Georg-Johann Lay <avr@gjlay.de>:
> Aurelien Buhrig wrote:
>> Hi,
>>
>> I'm trying to optimize our target ABI, and I'm wondering what is the
>> best strategy to define it.
>> Is there a paper, or any hint, dealing with this topic ?
>> For instance,
>> - which ratio between call-used-reg vs "static regs"
>> - which ratio between arg regs vs call-used-reg
>> - what should be return regs
>> - ...
>> I guess this problem is very target dependent, but there are maybe
>> general ideas about this.
>
> If it's about new hardware/silicon/controller, it is a good idea to do a
> controller compiler co-design. That way you can get the best out of a new
> architecture as you have the most degrees of freedom to find a good point in
> the ISA/ABI plane.
>
> This requires of course to start the compiler development early and in a stage
> where the ISA is still work in progress, i.e. there is no final silicon but
> just an instruction set simulator for the upcoming hardware.
>
> In many cases, you cannot really say what's the best except you actually
> implement it and look how smooth it works.  My experience is that ISA designers
> just think up to the assembler level, but have no idea how a compiler works and
> what it needs and which features it can use and which not.
>
> If the silicon/ISA is already fix and there is no feedback possible, it is
> often easy to parametrize different ABI flavours through compiler switches so
> you can benchmark, switch back and forth between ABIs and see what their pros
> and contras are.
>
> Johann

Hi Johann,

We actually tried to optimize both the ISA and the compîler for the
new extended version, although there was some legacy. Now ISA is
almost fixed. I'm just trying to see which register convention is the
best. I will try to use/define those switches to benchmak the ABI, but
I wanted to know if such studies were available.

Thanks for your reply,
Aurélien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: best ABI strategy ?
       [not found] ` <mcrfwh5saxu.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
@ 2011-12-01 13:09   ` Aurelien Buhrig
  0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Buhrig @ 2011-12-01 13:09 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

2011/11/30 Ian Lance Taylor <iant@google.com>:
> Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com> writes:
>
>> I'm trying to optimize our target ABI, and I'm wondering what is the
>> best strategy to define it.
>> Is there a paper, or any hint, dealing with this topic ?
>> For instance,
>> - which ratio between call-used-reg vs "static regs"
>> - which ratio between arg regs vs call-used-reg
>> - what should be return regs
>> - ...
>> I guess this problem is very target dependent, but there are maybe
>> general ideas about this.
>
> I don't know of any papers on this topic.
>
> There are several things that feed into this, including:
>
> * The relative cost of saving registers on the stack.
>
> * How orthogonal your register set is--e.g., are there any registers
>  with special purposes in the ISA?  Are there different register
>  classes that hold different types of values?  Are there any
>  restrictions on which registers can be used in a memory address?
>
> * How many registers you have overall.
>
> * What kind of code you are most interested in optimizing.  E.g., image
>  processing code tends to lead to functions with lots of loops with
>  lots of loop local variables that benefit from being in registers.
>
> Ian

This pb is indeed highly hardware and application dependent. I will
experiment to see what is the best...

Thanks for your help,
Aurélien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-01 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30 16:18 best ABI strategy ? Aurelien Buhrig
2011-11-30 16:57 ` Georg-Johann Lay
2011-11-30 21:18   ` Aurelien Buhrig
2011-11-30 18:49 ` Aurelien Buhrig
     [not found] ` <mcrfwh5saxu.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
2011-12-01 13:09   ` Aurelien Buhrig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).