| Class | Voodoo::AMD64NasmGenerator |
| In: |
voodoo/generators/amd64_nasm_generator.rb
|
| Parent: | NasmGenerator |
Code generator that emits NASM assembly code for AMD64 processors.
The calling convention implemented by this code generator is compatible with the System V ABI for AMD64, provided that all arguments are integers or pointers.
Arguments are passed in registers. The registers are used in the following order:
Additional arguments are pushed on the stack, starting with the last argument and working backwards. These arguments are removed from the stack by the caller, after the called function returns.
The return value is passed in rax.
For varargs functions, rax must be set to an upper bound on the number of vector arguments. Since the code generator does not know whether the called function is a varargs function, this is always done. Since the code generator never passes any vector arguments, this means rax is set to +0+ before each call.
arg_n : arg_7 arg_6 saved_rip saved_rbp <-- rbp arg_0 arg_1 : arg_5 local_0 local_1 : local_n <-- rsp