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

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

Re: [avr-gcc-list] Not naked but "topless" functions?


From: Kang Tin LAI
Subject: Re: [avr-gcc-list] Not naked but "topless" functions?
Date: Sat, 19 Oct 2002 00:40:04 +0800

Just finished a test with "noreturn", my codes is working and no significant
problem found yet. However, two redundant PUSHes found at prologue start, r28,
29 will never be restored and, two program flash and two SRAM consumed
unneccessarily.

No prologue code generated if frame not needed, good.
Totally no epilogue code generated, good.

"noreturn" is not specific to avr (I didn't find codes for "noreturn" in avr.c),
pushing register is controlled by avr.c according to something outside that I
don't know.

CVS is 20020911.

/***** with noreturn attribute *****/
/* prologue: frame size=5 */
        push r28
        push r29
        in r28,__SP_L__
        in r29,__SP_H__
        sbiw r28,5
        in __tmp_reg__,__SREG__
        cli
        out __SP_H__,r29
        out __SREG__,__tmp_reg__
        out __SP_L__,r28
/* prologue end (size=10) */

-- 
---
Kang Tin LAI <address@hidden>
-----

Larry Barello wrote:
> 
> Uh, no I have not.  I don't actually have the setup to build my own
> compiler.  This is great.
> 
> ----- Original Message -----
> From: "Marek Michalkiewicz" <address@hidden>
> To: "Larry Barello" <address@hidden>
> Cc: "AVR GCC List" <address@hidden>; <address@hidden>
> Sent: Friday, October 18, 2002 1:58 AM
> Subject: Re: [avr-gcc-list] Not naked but "topless" functions?
> 
> > > I may have the details off a bit, but the general idea holds: Naked is
> > > broken except in restricted circumstances, Kang's version of "naked"
> > > (actually "noreturn") should be in GCC as it covers "naked" and allows
> frame
> > > variables.
> >
> > Hmm, have you checked if recent CVS does what you need?
> >
> > 2002-06-08  Marek Michalkiewicz  <address@hidden>
> >
> > * config/avr/avr.c (avr_regs_to_save): No need to save any registers
> > in a noreturn function.
> > (avr_output_function_prologue, avr_output_function_epilogue):
> > Correct function size calculation.  Do not crash on empty function.
> > (avr_output_function_epilogue): No need for epilogue after a BARRIER.
> >
> > Even if you don't add the "noreturn" attribute, all of the epilogue will
> > be omitted if it is never reached.  With the attribute added, the prologue
> > should still allow frame variables, but should not save any registers.
> >
> > (I can't seem to be able to post to address@hidden due to a bad MX
> > record which some MTAs handle, but mine doesn't...  But you can repost
> it.)
> >
> > Marek
> >
> >
avr-gcc-list at http://avr1.org



reply via email to

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