SPRAB89A September 2011 – March 2014
The helper functions adhere to the standard calling conventions, except as specifically noted previously. However, typical implementations require a small subset of the available registers. If a caller is using a register that would normally have to be preserved across a call (that is, a caller-save register), but the helper function is known not to use it, then the caller can avoid having to save it. For this reason the ABI changes the designation of these registers on a function-by-function basis so that callers are not required to unnecessarily preserve unused registers.
Note that from a compiler's point of view, use of this information is optional, providing only an optimization opportunity. From a library implementer's point of view, the ABI mandates that alternate implementations of the helper functions must conform to the additional restrictions.
Helper functions with special register conventions cannot be called via PLT entries (see Section 6.6). Consequently, their definitions must be marked STV_INTERNAL or STV_HIDDEN to prevent them from being importable from a shared library.
Table 8-9 lists those helper functions that have modified register save conventions. If a function is listed in the table, the given registers are the only registers modified by a call to that function. If a function is not listed, it follows the standard rules.
Function | Registers Modified |
---|---|
_ _C6000_divi | A0,A1,A2,A4,A6,B0,B1,B2,B4,B5,B30,B31 |
_ _C6000_divu | A0,A1,A2,A4,A6,B0,B1,B2,B4,B30,B31 |
_ _C6000_remi | A1,A2,A4,A5,A6,B0,B1,B2,B4,B30,B31 |
_ _C6000_remu | A1,A4,A5,A7,B0,B1,B2,B4,B30,B31 |
_ _C6000_divremi | A1,A2,A4,A5,A6,B0,B1,B2,B4,B30,B31 |
_ _C6000_divremu | A0,A1,A2,A4,A6,B0,B1,B2,B4,B30,B31 |
_ _C6000_strasgi_64plus | A31,A30,B31,B30,ILC,RILC,B30,B31 |
_ _C6000_push_rts | A15,A3,B3,B30,B31 |
_ _C6000_pop_rts | B10,B11,B12,B13,B14,B30,B31 |
_ _C6000_call_stub | A3-A5,A8,A9,A16-A31,B8,B9,B16-B31,ILC,RILC |
B30 and B31 are assumed to be modified by any call, even if they are not used by the callee. This is so they are available as scratch registers for trampolines. See Section 3.8.