Unformatted text preview: ble 6 Stack limit / register variable 7 Frame pointer Scratch reg. / new sb in inter-link-unit calls Lower end of current stack frame Link address / scratch register Program counter 178 Architectural Support for High-Level Languages 1. Four argument registers which pass values into the function. The function need not preserve these so it can use them as scratch registers once it has used or saved its parameter values. Since they will not be preserved across any calls this function makes to other functions, they must be saved across such calls if they contain values that are needed again. Hence, they are caller-saved register variables when so used. 2. Five (to seven) register variables which the function must return with unchanged values. These are callee-saved register variables. This function must save them if it wishes to use the registers, but it can rely on functions it calls not changing them. 3. Seven (to five) registers which have a dedicated role, at least some of the time. The link register (Ir), for example, carries the return address on function entry, but if it is saved (as it must be if the function calls subfunctions) it may then be used as a scratch register. APCS variants There are several (16) different variants of the APCS which are used to generate code for a range of different systems. They support: 32-or 26-bit PCs. Older ARM processors operated in a 26-bit address space and some later versions continue to support this for backwards compatibility reasons. Implicit or explicit stack-limit checking. Stack overflow must be detected if code is to operate reliably. The compiler can insert instructions to perform explicit checks for overflow. Where memory management hardware is available, an ARM system can allocate memory to the stack in units of a page. If the next logical page is mapped out, a stack overflow will cause a data abort and be detected. Therefore the memory management unit can perform stack-limit checking and there is no need for the compiler to insert instructions to perform explicit check...
View Full Document
This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.
- Spring '09