This patch series introduces separate shrink-wrapping. There are many things the prologue/epilogue of a function do, and most of those things can be done independently. For example, most of the time, for many targets, the save of callee-saved registers can be done later than the "main" prologue.
Doing so helps quite a bit because the prologue is expensive for functions that do not need everything it does done for every path through the function; often, the hot paths do not need much at all, e.g. not those things the prologue needs to do for the function to call other functions. The first patch creates a command-line flag, some hooks, a status flag ("is this function wrapped separately", used by later passes), and documentation for these things. The next six patches are to prevent later passes from mishandling the epilogue instructions that now appear before the epilogue: mostly, you cannot do much to instructions with a REG_CFA_RESTORE note without confusing dwarf2cfi. The cprop one is for prologue instructions. Then, the main patch. And finally a patch for PowerPC that implements separate wrapping for GPRs and LR. Tested on powerpc64-linux (-m32/-m64, -mlra/-mno-lra), and on powerpc64le-linux. Previous versions of this series also tested on x86_64-linux. Is this okay for trunk? Segher Segher Boessenkool (9): separate shrink-wrap: New command-line flag, status flag, hooks, and doc cfgcleanup: Don't confuse CFI when -fshrink-wrap-separate dce: Don't dead-code delete separately wrapped restores regrename: Don't rename restores regrename: Don't run if function was separately shrink-wrapped sel-sched: Don't mess with register restores cprop: Leave RTX_FRAME_RELATED_P instructions alone shrink-wrap: shrink-wrapping for separate concerns rs6000: Separate shrink-wrapping gcc/cfgcleanup.c | 5 + gcc/common.opt | 4 + gcc/config/rs6000/rs6000.c | 257 ++++++++++++++++-- gcc/dce.c | 9 + gcc/doc/invoke.texi | 11 +- gcc/doc/tm.texi | 53 ++++ gcc/doc/tm.texi.in | 29 ++ gcc/emit-rtl.h | 4 + gcc/function.c | 15 +- gcc/regcprop.c | 3 + gcc/regrename.c | 12 +- gcc/sel-sched-ir.c | 1 + gcc/shrink-wrap.c | 647 +++++++++++++++++++++++++++++++++++++++++++++ gcc/shrink-wrap.h | 1 + gcc/target.def | 56 ++++ 15 files changed, 1088 insertions(+), 19 deletions(-) -- 1.9.3