SPRAB89A September 2011 – March 2014
As discussed in Section 3.3, functions are responsible for preserving the contents of registers designated as callee-saved, normally accomplished by saving modified registers in the local frame upon entry to the function and restoring them before exit. Usually, the order and locations of the callee-saved registers on the stack do not matter, as long as they are restored from the same location as they were saved. In most cases, the compiler saves registers in an arbitrary order. However, there are some features which require a known ordering:
The callee-saved register safe debug order is A15, B15, B14, B13, B12, B11, B10, B3, A14, A13, A12, A11, A10.
When using safe debug, and in the absence of a special stack layout (see Section 4.5.3 and Section 4.5.4), the compiler will always save registers in that relative order, starting at the bottom (highest address) of the frame. If any registers are not saved, the registers will be packed so that there are no holes in the stack, but the relative order will remain the same.