This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Concept of Scratch and Preserved Registers

Hi,

I am confused in understanding the difference between scratch and preserved registers. I have read the development guide of IAR Embedded Workbench but the topic was written in such a way that I could not get the real sence of it.
Any help or if possible some example that can help me differenciating between the both will be regarded.

Thanks in advance
Parents
  • Note: This was originally posted on 5th April 2011 at http://forums.arm.com


      r4-r11 - protected


    And r13, r14 too, of course. To the OP - AAPCS is what you need to google for.

    Note that the rules stated above are not  any sort of 'restrictions' imposed by ARM CPU, some people get confused by this.
    All registers in ARM (except for r14 (lr) and r15 (pc)) are mutually interchangeable ("equal in rights").
    But most compilers follow the AAPCS rules to avoid compatibility problems (otherwise, it would be  difficult to link together libraries produced with different compilers, for example).
Reply
  • Note: This was originally posted on 5th April 2011 at http://forums.arm.com


      r4-r11 - protected


    And r13, r14 too, of course. To the OP - AAPCS is what you need to google for.

    Note that the rules stated above are not  any sort of 'restrictions' imposed by ARM CPU, some people get confused by this.
    All registers in ARM (except for r14 (lr) and r15 (pc)) are mutually interchangeable ("equal in rights").
    But most compilers follow the AAPCS rules to avoid compatibility problems (otherwise, it would be  difficult to link together libraries produced with different compilers, for example).
Children
No data