making naked attr generally available
Wed Jun 30 23:15:00 GMT 1999
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
> 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.
Leave others their otherness
More information about the Gcc-patches