Created by: fhahn
The current behavior is to walk from the bottom instruction up to the current top instruction to find instructions that pop registers. This is too permissive and may remove instructions not used to save/restore callee-saved registers, e.g. spills of local variables to the stack.
This patches switches to a more conservative approach in which requires callee-saved registers to be popped in reverse order they have been pushed.
Both LLVM and GCC commonly use this pattern to save/restore callee-saved registers on AArch64, but they might use different patterns if that is more efficient. I think we should use this conservative approach for now, and maybe make it more permissive once we have clean call inlining implemented on AArch64 and solid test coverage.
This patch has no effect unless opt_cleancall > 1. I will put up a patch implementing clean call inlining for AArch64 soon and this patch will include a test case for analyze_callee_save_reg.
Change-Id: I5723db8d24fbf23f1687bb63c42c9084286bbb23