avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] AW: Register allocator / -fnew-ra issue


From: Björn Haase
Subject: [avr-libc-dev] AW: Register allocator / -fnew-ra issue
Date: Wed, 8 Dec 2004 00:11:51 +0100

>>
>>
>> P.P.S.: Two further examples of compilation results (all with -Os
and -fnew-ra)
>>
>
>IIRC, the new-ra work on GCC is pretty much on hold due to a bunch of
issues. I would highly
>recommend that you stay away from it for the time being.
>
>Eric

I have come to the conclusion, that the main possible improvement of avr-gcc
code
efficiency now is the register allocator. I have seen really *weird* code
when using the
default. ... seems mainly to be related to SI objects ...
"-morder1" sometimes.
My experience is that -fnew-ra generates much
better results, in the rare case that it does not make gcc crash :-|, of
course.
I have observed this with both, 4.0 and older versions.

I have some ideas on how to help the register allocator to use the resources
more efficiently. Unfortunately, that would require more substantial changes
in the
compiler ABI.

I have the impression that the valuable r24...r31 registers frequently are
wasted for
SI or QI values that could not really benefit of adiw and the pointer
operations.

Also when passing  memory references  as function parameters, the pointers
never are
passed in one of the XYZ Registers.

What I have in mind is:

1.)
Teach the compiler to work with the PHI mode.
I.e., parse the machine description and add for each pattern that is defined
for the HI mode
an identical pattern refering to the same operation with PHI mode. This
could possibly be
done in an automatic way.

2.)
Define pointers to be of mode PHI. I.e. while generating identical code, we
could now
identify most pointer objects in RTL by their machine mode!

3.)
Rewrite "function_arg" such that objects of mode
  HI    are passed as usual in r24:25, r22:23, ... r8:9
  PHI   are passed in X, Z, r24:25, r22:23, ...
  SI/SF are passed in r16:r19, r20:r23 , r12:r15, r8 ... r11
  QI    are passed in r16,r17, ... r23, r15 ... r9
given that the respective registers have not been used already by an earlier
parameter
of another mode.

4.)
Adapt the library functions that are written in assembler such that they are
compliant
with the modified ABI.

In my opinion, this way, we could possibly help the RA to make much better
use of the register
file.

Yours,

Björn





reply via email to

[Prev in Thread] Current Thread [Next in Thread]