Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: About R12 - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

About R12 Dose R12 really have special use in ARM? Rate Topic: -----

#1 User is offline   Mountain 

  • Member
  • Pip
  • Group: Members
  • Posts: 9
  • Joined: 13-November 08

Posted 26 November 2008 - 03:19 AM

Recently, I read some books which say that R12 has some special use. It mean IP. But I think IP is the concept in Intel CUP, I did not see any concept about IP in ARM.

Dose R12 really have special use in ARM?
0

#2 User is offline   Jacob 

  • Contributor
  • PipPip
  • Group: Members.
  • Posts: 95
  • Joined: 13-May 08

Posted 26 November 2008 - 08:33 AM

The ARM architecture doesn't define special uses for many registers. Register "r12" is also referred to as "IP", and is used as an intra-procedure call scratch register. It is in the ARM Architecture Procedure Call Standard (AAPCS). However, it would be possible for a system to use a different procedure call standard that uses r12 for something else.

To be more descriptive, r12 can be used by the linker in the implementation of any veneers or similar generated code. It may also be used as a general-purpose scratch register between function calls, much like r0-r3.

Note: If you use assembly code, you can ignore the AAPCS for any utility functions you may define, so you can use r12 for whatever you like in that case. You only need to ensure that the externally-visible interface to your code is compliant with AAPCS.
0

#3 User is offline   isogen74 

  • Super Contributor
  • PipPipPipPip
  • Group: Members
  • Posts: 1098
  • Joined: 20-March 07

Posted 26 November 2008 - 09:33 AM

I think a good summary of AAPCS calling convention for C code is that the *called* function can safely assume that it can corrupt r0-r3 and r12. If the *calling* function needs to preserve these it must stack them before calling any function.

Note - private functions within a translation unit do not need to obey this rule, and most compilers will define an optimized calling convention for each TU local function.

This post has been edited by isogen74: 26 November 2008 - 09:35 AM

When optimizing software, consider that the quickest code to run is the bit you removed from the call path.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic