| Class | Voodoo::ARMGasGenerator |
| In: |
voodoo/generators/arm_gas_generator.rb
|
| Parent: | CommonCodeGenerator |
The ARM code generator generates assembly code for use with the GNU assembler.
The first four arguments are passed in the registers r0 through r3. Any additional arguments are passed on the stack, starting at r13. r13 will always be a multiple of 8.
The return address for the called function is passed in r14.
The called function will store its return value in r0.
The called function is required to preserve the values of registers r4 through r11 and register r13.
This calling convention is compatible with the Procedure Call Standard for the ARM Architecture (AAPCS).
Call frames have the following layout:
When a function is called, it receives a stack frame that looks like the following:
: old frame padding argn : arg4 <-- r13 points here
The function prologue of functions generated by this code generator creates activation frames that look as follows:
: old frame padding argn : arg4 saved r14 saved r11 : saved r4 <-- r13 points here
Inside a function, registers r4..r8, r10, and r11 are used for local variables and function arguments.
r12 is used as a temporary, and r3 is used when another temporary is needed.
Return the register in which the nth (0-based) argument is stored, or nil if not stored in a register
Destroys the current stack frame. If ret is true, loads the saved value of lr into pc.
Writes any constants that need to be written to the instruction stream, and clears the list of constants that need to be written.
Load a value into a register. Returns the name of the register. If the value was already in a register, the name of that register is returned. Else, the value is loaded into a register and the name of that register is returned. The register to use in that case may be specified using the optional second argument.