C-minor v0.0

NativeCodeGenerator Class

Assembly: Topten.Cminor.Compiler.dll
Namespace: Topten.Cminor.CodeGen.Native

Native code generator

public class NativeCodeGenerator

Inheritance

NativeCodeGenerator → object

Constructors

NativeCodeGenerator()

Methods

Call(Label, int, Operand)

Generate a call to a function, passing the top N parameters

Convert(OperandType)

Convert the top of stack value to target type

CreateData()
CreateData(byte[])

Emit data

CreateLabel()

Creates a label for a jump or call target

CreateLocal(Operand)

Create a local variable

FinishFunction()

Finish generation of the current function

FreeLocal(Local)

Free a previously allocated local so stack space can be re-used

Jump(Label)

Generates an unconditional jump to a label

JumpIfFalse(Label)

Pop value from the stack and if false, jump to label

JumpIfTrue(Label)

Pop a value from the stack and if true, jump to label

LoadField(int, OperandType)

Pop an address from the top of stack and then load an unsigned byte from [address+offset] zero extending to 32-bit

LoadLabel(Label)

Load the address of a label

LoadLiteral(object)

Load a literal value onto the v-stack. Must be a boolean or number (integral or floating point)

LoadLocal(Local)

Load the value of a local to the vstack

LoadParameter(int)

Load the value of a parameter onto the stack

Operator(OperatorType)

Performs a unary op on the value on the top of stack

StartFunction(Label, Operand, params Operand[])

Start the generation of a function

StoreField(int, OperandType)

Pop an address from the top of stack and then load an unsigned byte from [address+offset] zero extending to 32-bit

StoreLocal(Local)

Store the value from the top of stack to a local

StoreParameter(int)

Store the top of stack to a parameter

VCall(int, Operand)

Generate a call to a function through a pointer store on the stack (after the parameters)