Re: [PATCH] add 'rs6000_in_function_epilogue_p()'

Jim Blandy
2005-12-02T22:19:11Z

On 12/2/05, Paul Gilliam <pgilliam@us.ibm.com> wrote:
> This patch does *not* assume that the exit of the function is near the end of the function.
>
> It's more/less of a hack than that!
>
> Here is the 'algorithm':
> 1) scan forward from the point of execution:
> a) If you find an instruction that modifies the stack pointer, execution is not in an epilogue, return.
> b) Stop scanning if you find a return instruction or reach the end of the function.
> 2) scan backward from the point of execution:
> a) If you find an instruction that modifies the stack pointer, execution *is* in an epilogue, return.
> b) Stop scanning if you reach the beginning of the function.

(That text belongs in a comment, else Daniel wouldn't have got it wrong!)

You know, there's no reason this logic wouldn't be equally useful in
the skip_prologue function. If the prologue scan doesn't make it to
the PC, then we could do the above, and use it to provide an accurate
frame ID. That would fix the bug, and backtraces too.