This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: making naked attr generally available
- To: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Subject: Re: making naked attr generally available
- From: Bill Currie <bcurrie at tssc dot co dot nz>
- Date: Wed, 02 Jun 1999 09:40:10 +1200
- CC: law at cygnus dot com, bill at taniwha dot tssc dot co dot nz, egcs at egcs dot cygnus dot com, egcs-patches at egcs dot cygnus dot com
- Organization: NZ Telecommincations Systems Support Center
- References: <199906012040.VAA06666@phal.cygnus.co.uk>
Joern Rennecke wrote:
>
> > Bad news: the return statement (ie ret on i386) still gets output. I
> > still have to find the code that generates that.
>
> The rtl emitting code might do it, or jump.c (look for gen_return).
function.c, jump.c, reorg.c and stmt.c
I figured out for myself last night that I should look for gen_return,
but thanks for the confirmation that I was barking up the right tree.
The only problem was jump and reorg don't include tree.h, but that was
easily fixed (I don't wan't to declare another global variable).
> I think the easiest way to fix this is just to change the predicate
> of the "return" instruction in the *.md file to always return false
> while a naked function is compiled.
The problem with that is you have to tweak each and every *.md file that
has a "return" instruction, which kindof defeats the purpose of this
execise.
> That will force rtl generation to generate jumps to the end of the function
> instead of returns, and inhibit any optimizations that generate returns.
What I did was where-ever I found a gen_return, I make the code around
it conditional on DECL_NAKED_FUNCTION_P.
Unfortunatly, I haven't got an updated patch yet (I'll send one tonight)
due the the jump and reorg problem stated above (make bootstrap; goto
bed; sleep(28800); if (build_failed) abort();). I popped a #include
"tree.h" into jump.c and reorg.c, as I didn't want another global, but
if there's an outcry, I can do otherwise.
I've got one worry: what are we going to do about local variables in a
naked function? I agree with rth that naked functions can cause some
headaches, but I can still see the nead for such beasties.
Bill
--
Leave others their otherness