avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Add builtins in avr target.


From: Dmitry K.
Subject: Re: [avr-gcc-list] Add builtins in avr target.
Date: Fri, 18 Apr 2008 14:23:31 +1100
User-agent: KMail/1.5

On Friday 18 April 2008 12:56, Weddington, Eric wrote:
> > > 2008/4/17, Wouter van Gulik <address@hidden>:
> > >>  For a 2 cycles delays an rjmp can be used. Saves an instruction!
> > >
> > > And so on:
> > >
> > > 3 cycles:
> > >   rjmp .
> > >   nop
> >
> > I shall try to replace 'nop' with 'rjmp .' for two cycle
> > delay.  It is necessary to check that the linker relaxation
> > pass will not remove the  'rjmp .' instruction. Now I do not
> > wish to complicate a code and to optimize 3..6 cycles delays.
>
> AFAIK, linker relaxation will do JMP->RJMP transformations only. Going
> the other way is not a size optimization.

Alas, not only.

Linker relaxation replaces the (R)CALL,RET sequence
into (R)JMP,RET.  Note, the linker does not differ
the C and ASM functions and can spoil the delay routine
like:

  long_delay:
        rcall .
  middle_delay:
        rcall .
  short_delay:
        ret

or may destroy the program where the 'return to next
level' trik is used, like Avr-libc's old (1.4 and
early) float library.

The Binutils-2.17 makes such replacement unconditionally.
The 2.18 has an option to disable it: '--no-call-ret-replacement'.

IMHO, such replacement must be disabled by default.
Note, GCC for some targets can itself optimize tailing call.
This is better, as the second instruction (RET) is deleted.

Regards,
Dmitry.





reply via email to

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