views:

125

answers:

1

Hi all,

on iPhone/ARM, which CPU registers are functions supposed to preserve, if any?

+1  A: 

Wikipedia's article on Calling Convention has a good summary of the conventions for ARM.

Rob Napier
On all OSes - the same convention? I find that hard to believe. On x86, dozens of conventions exist.
Seva Alekseyev
The writers of the article made a nice reference to this in the section on x86, calling out how it is noteworthy in having so many (mostly due to its lack of registers), and providing a separate article explaining them. Wikipedia's discussion of the topic is about the most complete I've seen, and provides more discussion of why the x86 has such a hodgepodge of solutions compared to other chips. In short: in the early days of x86 (unlike other chips) there were several compiler vendors who went different ways. But today, even on x86, there is a strong move to standardize the ABIs.
Rob Napier