This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: noreturn function attribute and ret asm instruction
- From: Kristis Makris <kristis dot makris at asu dot edu>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: Jim Wilson <wilson at tuliptree dot org>, gcc-bugs at gcc dot gnu dot org
- Date: 11 Sep 2003 18:29:21 -0700
- Subject: Re: noreturn function attribute and ret asm instruction
- References: <1061654032.13013.9.camel@syd.monet.net><3F4A71EA.40209@tuliptree.org> <1061880472.16160.134.camel@syd.monet.net><87wud0sxtj.fsf@egil.codesourcery.com><1062202145.1918.7.camel@syd.monet.net><1062537266.1047.7.camel@leaf.tuliptree.org> <87isoarh0m.fsf@egil.codesourcery.com>
On Tue, 2003-09-02 at 14:56, Zack Weinberg wrote:
> Jim Wilson <wilson@tuliptree.org> writes:
> > The real problem here is that we have no support for asms that change
> > flow of control. Adding a function attribute to suppress the ret does
> > not fix this. Letting asms change flow of control would require syntax
> > and semantic changes. This would be a major change, and it isn't clear
> > if it is a good idea. It might impede optimization so much that it
> > hurts more than it helps.
On the same note, is there any way to tell gcc that it should create
code for a function that will leave the state of the registers exactly
as it was originally when the function was entered ? Is there some
function attribute for that ? So if the caller was already using certain
registers, can the responsibility of preserving those be somehow
offloaded to the callee ? Can I generate "a chunk of code" that does not
mess with the state of the processor, just like I would if the same code
was written in asm ?
I don't know if gcc was meant not to do that by design.