On 12/28/2011 07:13 PM, Michael Eager wrote: > Hi -- > > I've run into a problem with the MicroBlaze backend > where it is not recognizing a return pattern. I'm > trying to modify the back end to use the 'simple_return' > pattern, rather than 'return', since MicroBlaze has > exactly what the documentation describes: a no-frills > return instruction which does nothing more than branch > back to the caller. > > When I define only 'simple_return', there are undefined > references in function.c for emit_return_into_block() > and emit_use_return_register_into_block(), since these > are defined when HAVE_return is defined. > > MIPS has a similar call/return model, with a trivial > return instruction. mips.md defines expanders for both > 'return' and 'simple_return' and identical insn's for both > which generate the return jump. > > ARM also has a simple return, but the back end defines > 'return' and does not define 'simple_return'. > > My guess is that the #ifdef HAVE_return in function.c > which surrounds the undefined functions should be removed. > > What is the correct model for the back end? Define only > 'return' like ARM, define both 'return' and 'simple_return' > like MIPS, or define only 'simple_return' like I tried to do?
We should probably work towards the point where a port can define only simple_return. Historically that pattern didn't exist, so essentially every port uses return patterns and guards them with checks for an empty epilogue. If you want the least amount of work, define only such a return pattern. If you also want shrink-wrapping, define a simple_return pattern and make sure your epilogues are properly annotated with CFA information. If you want to help clean up this area, define only a simple_return pattern and fix the middle end to deal with this configuration. Bernd