| Class | Voodoo::NasmGenerator |
| In: |
voodoo/generators/nasm_generator.rb
|
| Parent: | CommonCodeGenerator |
The NASM code generator is a common base class for generators that output assembly code for use with the Netwide Assembler.
This class is used by both the I386NasmGenerator and the AMD64NasmGenerator, and contains the functionality that is common to both.
To use the functionality from this class, a subclass must define the following methods and constants:
Evaluate an expression. The result is stored in register (@RETURN_REG by default). The following registers may be clobbered: @AX, @BX, @CX, @DX
Multiply x by y. The result is stored in @AX by default, but a different register can be specified by passing a third argument.
Load the value associated with the given symbol. Returns a string that can be used to refer to the loaded value.
Load a value. Returns a string that can be used to refer to the loaded value.
Return a from a function.
words may contain an expression to be evaluated. The result of the evaluation is returned from the function.