patch to improve i386 epilogue (version 2)

Jeffrey A Law law@cygnus.com
Sat Sep 19 23:32:00 GMT 1998


  In message < 199809190707.DAA01442@jwlab.FEITH.COM >you write:
  > [ The change to jump.c is the only difference from the previous
  >   version of this patch. ]
  > 
  > This change allows gcc to skip the loading of the stack pointer
  > when it is already known to contain the proper value.  This
  > optimization is currently only implemented for leaf functions.
I suspect your call counts are still going to be inaccurate -- for
example flow.c can/will delete calls if they are in an unreachable
block without calling delete_insn.

There may be other cases where this can happen too -- we'd really
need to read all of the optimizers a little more closely.

Also, don't we have to be careful with the value changing over time?

ie, what happens if at prologue generation time we think there is a
call, but due to some optimization after reload we end up deleting
a call (can this happen?!?) and leaf_function_p returns true.

Presumably you aren't calling leaf_function_p in the epilogue expander
because we've already got a sequence started and thus we can't get to
the original insn chain?

Maybe it would be better to pass in a variable to the prologue/epilogue
expanders indicating whether or not the current function is a leaf
function.  An interface change for the md files, but a relatively minor
one.

I like the idea though.  It mirrors something I did for the mn10x
series before I made ACCUMULATE_OUTGOING_ARGS work for more targets.
The basic idea was we could eliminate the frame pointer in any
function which didn't make function calls.

jeff



More information about the Gcc-patches mailing list