http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
--- Comment #19 from Georg Lay <avr at gjlay dot de> 2010-11-10 13:00:47 UTC ---
(In reply to comment #18)
> I think BBreordering after the end of epilogue in case of normal functions is
> little confusing.
Yes, optimized code is often confusing.
> I am not sure what additional advantage we get by allowing this to happen
> after
> epilogue. Hence I tried to disable this.
There is no bug for functions not attributed naked. I do not see why that
should be changed. Note that the backend is lying about branch costs and sets
them to zero -- both in space and time. Therefore, .bbro has fun and jumps
around. Tweaking that is of no concern here.
> > Moreover, there is a gap between reload_completed and
> > epilogue_completed
>
> Agreed. Thanks for catching that.
>
>
> > because the naked return insn is allowed since after reload.
>
> I dindn't quite get this. Can you give some example?
avr.h allows that insn after reload:
(define_insn "return_from_naked_epilogue"
[(return)]
"(reload_completed
&& cfun->machine
&& cfun->machine->is_naked)"
...
so it might be emitted after reload. Because it is non-simple, it will occur
just once, but it must be in the right place (ensured by .pro_and_epilogue) and
must not be moved around (ensured by new target hook). Observe a simple test
case like lined out below, and how the compiler transform with/without naked,
optimize size/speed, branch cost 0/!=0
char c;
void foo (char i)
{
c = 17;
switch (i)
{
case 0 : c = 1; break;
case 3 : c = 2; break;
case 7 : c = 12; break;
case 9 : c = 32; break;
}
}