Class Voodoo::I386NasmGenerator
In: voodoo/generators/i386_nasm_generator.rb
Parent: NasmGenerator

i386 NASM Code Generator

The i386 NASM code generator generates i386 assembly code for use with the Netwide Assembler.

Calling Convention

Function arguments are pushed on the stack in reverse order, so that the first argument is pushed last. Each argument occupies one word of stack space. These arguments are removed from the stack by the caller after the called function returns.

The return value is passed in eax.

Call Frames

Call frames have the following layout:

  argn
  :
  arg1
  arg0   <-- ebp + 8
  oldeip <-- ebp + 4
  oldebp <-- ebp
  local0 <-- ebp - 4
  local1 <-- ebp - 8
  :
  localn <-- esp

Methods

call   emit_function_prologue   let   load_arg   load_local   new   push   tail_call   use_value   word  

Constants

WORDSIZE = 4

Public Class methods

Public Instance methods

Call a function

Introduce a new local variable

Load the value of the nth argument

Load the value of the nth local variable

Push a word on the stack

Call a function, re-using the current call frame if possible

Define a machine word with the given value

[Validate]