Kiwi Engine
VM for interpreter
|
Define KEInstruction class. More...
Go to the source code of this file.
Data Structures | |
struct | KEInstruction |
Enumerations | |
enum | KEOpcode { KENopOpcode, KEFunctionOpcode, KECompoundOpcode, KEMovLOpcode, KEMovPOpcode, KEMovHOpcode, KEMovROpcode, KESetBoolOpcode, KESetSignedIntOpcode, KESetUnsignedIntOpcode, KESetFloatOpcode, KESetStringOpcode, KELogicalNotOpcode, KELogicalAndOpcode, KELogicalOrOpcode, KELogicalXorOpcode, KEBitNotOpcode, KEBitAndOpcode, KEBitOrOpcode, KEBitXorOpcode, KEEqualBoolOpcode, KEEqualSignedIntOpcode, KEEqualUnsignedIntOpcode, KEEqualFloatOpcode, KEEqualStringOpcode, KENotEqualBoolOpcode, KENotEqualSignedIntOpcode, KENotEqualUnsignedIntOpcode, KENotEqualFloatOpcode, KENotEqualStringOpcode, KELessThanSignedIntOpcode, KELessThanUnsignedIntOpcode, KELessThanFloatOpcode, KELessThanStringOpcode, KELessEqualSignedIntOpcode, KELessEqualUnsignedIntOpcode, KELessEqualFloatOpcode, KELessEqualStringOpcode, KEGreaterThanSignedIntOpcode, KEGreaterThanUnsignedIntOpcode, KEGreaterThanFloatOpcode, KEGreaterThanStringOpcode, KEGreateEqualSignedIntOpcode, KEGreateEqualUnsignedIntOpcode, KEGreateEqualFloatOpcode, KEGreateEqualStringOpcode, KENegSignedIntOpcode, KENegFloatOpcode, KEAddSignedIntOpcode, KEAddUnsignedIntOpcode, KEAddFloatOpcode, KEAddStringOpcode, KESubSignedIntOpcode, KESubUnsignedIntOpcode, KESubFloatOpcode, KEMulSignedIntOpcode, KEMulUnsignedIntOpcode, KEMulFloatOpcode, KEDivSignedIntOpcode, KEDivUnsignedIntOpcode, KEDivFloatOpcode, KEModSignedIntOpcode, KEModUnsignedIntOpcode, KECastItoUOpcode, KECastItoFOpcode, KECastUtoIOpcode, KECastUtoFOpcode, KECastFtoIOpcode, KECastFtoUOpcode, KECreateFuncOpcode, KECallFuncOpcode, KECallBuiltinOpcode, KERootFrameOpcode, KECreateFrameOpcode, KESetFrameOpcode, KEGetFrameOpcode, KECreateArrayOpcode, KESetArrayOpcode, KEGetArrayOpcode, KECreateDictionaryOpcode, KESetDictionaryOpcode, KEGetDictionaryOpcode, KEIfThenOpcode, KEIfElseOpcode, KESwitchOpcode, KECaseOpcode, KEWhileOpcode, KEForeachArrayOpcode, KEForeachDictOpcode, KEReturnOpcode, KENextOpcode, KELastOpcode, KEExitOpcode } |
Functions | |
struct KEInstruction * | KEAllocateFunctionInstruction (struct KEInstruction *body, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate function instruction object. More... | |
struct KEInstruction * | KEAllocateNopInstruction (struct KELineInfo *linfo, struct CNResource *resource) |
Allocate nop instruction. More... | |
struct KEInstruction * | KEAllocateCompoundInstruction (struct KELineInfo *linfo, struct CNResource *resource) |
Allocate compound instruction. More... | |
struct KEInstruction * | KEAllocateMovInstruction (KEOpcode opcode, KERegisterId dstid, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate move instruction. More... | |
struct KEInstruction * | KEAllocateSetBoolInstruction (KERegisterId dstid, CNBoolean val, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-bool instruction. More... | |
struct KEInstruction * | KEAllocateSetSignedIntInstruction (KERegisterId dstid, int64_t val, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-signed-int instruction. More... | |
struct KEInstruction * | KEAllocateSetUnsignedIntInstruction (KERegisterId dstid, uint64_t val, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-unsigned-int instruction. More... | |
struct KEInstruction * | KEAllocateSetFloatInstruction (KERegisterId dstid, double val, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-float instruction. More... | |
struct KEInstruction * | KEAllocateSetStringInstruction (KERegisterId dstid, struct CNString *val, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-string instruction. More... | |
struct KEInstruction * | KEAllocateUnaryInstruction (KEOpcode opcode, KERegisterId dstid, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate unary instruction. More... | |
struct KEInstruction * | KEAllocateBinaryInstruction (KEOpcode opcode, KERegisterId dstid, KERegisterId leftid, KERegisterId rightid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate binary instruction. More... | |
struct KEInstruction * | KEAllocateCreateFunctionInstruction (KERegisterId dstid, struct KEPath *funcpath, struct CNObjectList *hiddenregs, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate create-function instruction. More... | |
struct KEInstruction * | KEAllocateCallFunctionInstruction (KERegisterId funcid, struct CNObjectList *retregs, struct CNObjectList *paramregs, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate call-function instruction. More... | |
struct KEInstruction * | KEAllocateCallBuiltinInstruction (struct KEPath *path, struct CNObjectList *retregs, struct CNObjectList *paramregs, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate call-builtin instruction. More... | |
struct KEInstruction * | KEAllocateRootFrameInstruction (KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate root-frame instruction. More... | |
struct KEInstruction * | KEAllocateCreateFrameInstruction (KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate create-frame instruction. More... | |
struct KEInstruction * | KEAllocateSetFrameInstruction (KERegisterId dstid, struct KEPath *dstpath, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-frame instruction. More... | |
struct KEInstruction * | KEAllocateGetFrameInstruction (KERegisterId dstid, KERegisterId srcid, struct KEPath *srcpath, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate get-frame instruction. More... | |
struct KEInstruction * | KEAllocateCreateArrayInstruction (KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate create-array instruction. More... | |
struct KEInstruction * | KEAllocateSetArrayInstruction (KERegisterId dstid, KERegisterId dstindex, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-array instruction. More... | |
struct KEInstruction * | KEAllocateGetArrayInstruction (KERegisterId dstid, KERegisterId srcid, KERegisterId srcindex, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate get-array instruction. More... | |
struct KEInstruction * | KEAllocateCreateDictionaryInstruction (KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate create-dictionary instruction. More... | |
struct KEInstruction * | KEAllocateSetDictionaryInstruction (KERegisterId dstid, KERegisterId dstkey, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate set-dictionary instruction. More... | |
struct KEInstruction * | KEAllocateGetDictionaryInstruction (KERegisterId dstid, KERegisterId srcid, KERegisterId srckey, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate get-dictionary instruction. More... | |
struct KEInstruction * | KEAllocateIfInstruction (KERegisterId condid, struct KEInstruction *theninst, struct KEInstruction *elseinst, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate if instruction. More... | |
struct KEInstruction * | KEAllocateSwitchInstruction (KERegisterId condid, struct CNObjectList *caseinsts, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate switch instruction. More... | |
struct KEInstruction * | KEAllocateCaseInstruction (CNBoolean isdef, uint64_t caseval, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate case instruction. More... | |
struct KEInstruction * | KEAllocateWhileInstruction (KERegisterId condid, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate while instruction. More... | |
struct KEInstruction * | KEAllocateForeachArrayInstruction (KERegisterId elmid, KERegisterId arrayid, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate foreach-array instruction. More... | |
struct KEInstruction * | KEAllocateForeachDictionaryInstruction (KERegisterId elmid, KERegisterId dictid, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate foreach-dictionary instruction. More... | |
struct KEInstruction * | KEAllocateReturnInstruction (struct KELineInfo *linfo, struct CNResource *resource) |
Allocate return instruction. More... | |
struct KEInstruction * | KEAllocateNextInstruction (struct KELineInfo *linfo, struct CNResource *resource) |
Allocate next instruction. More... | |
struct KEInstruction * | KEAllocateLastInstruction (struct KELineInfo *linfo, struct CNResource *resource) |
Allocate last instruction. More... | |
struct KEInstruction * | KEAllocateExitInstruction (KERegisterId codeid, struct KELineInfo *linfo, struct CNResource *resource) |
Allocate exit instruction. More... | |
const char * | KEOpcodeString (KEOpcode src) |
Get string to present the opcode. More... | |
Define KEInstruction class.
enum KEOpcode |
Opcode of instruction
struct KEInstruction* KEAllocateBinaryInstruction | ( | KEOpcode | opcode, |
KERegisterId | dstid, | ||
KERegisterId | leftid, | ||
KERegisterId | rightid, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate binary instruction.
opcode | Opcode for the instruction |
dstid | Destination register id |
leftid | Source left register id |
rightid | Source right register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCallBuiltinInstruction | ( | struct KEPath * | path, |
struct CNObjectList * | retregs, | ||
struct CNObjectList * | paramregs, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate call-builtin instruction.
path | Path of the built-in function |
retregs | List of registers to store return values |
paramregs | List of registers to pass parameter values |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCallFunctionInstruction | ( | KERegisterId | funcid, |
struct CNObjectList * | retregs, | ||
struct CNObjectList * | paramregs, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate call-function instruction.
funcid | Register id which contains pointer of the function |
retregs | List of registers to store return values |
paramregs | List of registers to pass parameter values |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCaseInstruction | ( | CNBoolean | isdef, |
uint64_t | caseval, | ||
struct KEInstruction * | bodyinst, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate case instruction.
isdef | Flag to present is-default or not |
caseval | Case value |
bodyinst | Body instruction |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCompoundInstruction | ( | struct KELineInfo * | linfo, |
struct CNResource * | resource | ||
) |
Allocate compound instruction.
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCreateArrayInstruction | ( | KERegisterId | dstid, |
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate create-array instruction.
dstid | Destination register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCreateDictionaryInstruction | ( | KERegisterId | dstid, |
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate create-dictionary instruction.
dstid | Destination register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCreateFrameInstruction | ( | KERegisterId | dstid, |
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate create-frame instruction.
dstid | Destination register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateCreateFunctionInstruction | ( | KERegisterId | dstid, |
struct KEPath * | funcpath, | ||
struct CNObjectList * | hiddenregs, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate create-function instruction.
dstid | Destination register id |
funcpath | Path of the body of the function |
hiddenregs | List if CNNumber to present the local register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateExitInstruction | ( | KERegisterId | codeid, |
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate exit instruction.
codeid | Exit code register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateForeachArrayInstruction | ( | KERegisterId | elmid, |
KERegisterId | arrayid, | ||
struct KEInstruction * | bodyinst, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate foreach-array instruction.
elmid | Element variable register id |
arrayid | Array variable id |
bodyinst | Body instruction |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateForeachDictionaryInstruction | ( | KERegisterId | elmid, |
KERegisterId | dictid, | ||
struct KEInstruction * | bodyinst, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate foreach-dictionary instruction.
elmid | Element variable register id |
dictid | Dictionary variable id |
bodyinst | Body instruction |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateFunctionInstruction | ( | struct KEInstruction * | body, |
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate function instruction object.
inst | Allocated object |
NULL | Allocation failed |
body | Body of the function |
linfo | Line information |
resource | Resource to allocate the object |
struct KEInstruction* KEAllocateGetArrayInstruction | ( | KERegisterId | dstid, |
KERegisterId | srcid, | ||
KERegisterId | srcindex, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate get-array instruction.
dstid | Destination register id |
srcid | Source id |
srcindex | Source index |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateGetDictionaryInstruction | ( | KERegisterId | dstid, |
KERegisterId | srcid, | ||
KERegisterId | srckey, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate get-dictionary instruction.
dstid | Destination register id |
srcid | Source id |
srckey | Source key |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateGetFrameInstruction | ( | KERegisterId | dstid, |
KERegisterId | srcid, | ||
struct KEPath * | srcpath, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate get-frame instruction.
dstid | Destination register id |
srcid | Source id |
srcpath | Source path |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateIfInstruction | ( | KERegisterId | condid, |
struct KEInstruction * | theninst, | ||
struct KEInstruction * | elseinst, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate if instruction.
condid | Conditional register id |
theninst | Then part instruction |
elseinst | Else part instruction |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateLastInstruction | ( | struct KELineInfo * | linfo, |
struct CNResource * | resource | ||
) |
Allocate last instruction.
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateMovInstruction | ( | KEOpcode | opcode, |
KERegisterId | dstid, | ||
KERegisterId | srcid, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate move instruction.
opcode | Opcode |
dstid | Destination register id |
srcid | Source register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateNextInstruction | ( | struct KELineInfo * | linfo, |
struct CNResource * | resource | ||
) |
Allocate next instruction.
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateNopInstruction | ( | struct KELineInfo * | linfo, |
struct CNResource * | resource | ||
) |
Allocate nop instruction.
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateReturnInstruction | ( | struct KELineInfo * | linfo, |
struct CNResource * | resource | ||
) |
Allocate return instruction.
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateRootFrameInstruction | ( | KERegisterId | dstid, |
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate root-frame instruction.
dstid | Destination register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetArrayInstruction | ( | KERegisterId | dstid, |
KERegisterId | dstindex, | ||
KERegisterId | srcid, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-array instruction.
dstid | Destination register id |
dstindex | Destination index id |
srcid | Source id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetBoolInstruction | ( | KERegisterId | dstid, |
CNBoolean | val, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-bool instruction.
dstid | Destination register id |
val | Source value |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetDictionaryInstruction | ( | KERegisterId | dstid, |
KERegisterId | dstkey, | ||
KERegisterId | srcid, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-dictionary instruction.
dstid | Destination register id |
dstkey | Destination key |
srcid | Source id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetFloatInstruction | ( | KERegisterId | dstid, |
double | val, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-float instruction.
dstid | Destination register id |
val | Source value |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetFrameInstruction | ( | KERegisterId | dstid, |
struct KEPath * | dstpath, | ||
KERegisterId | srcid, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-frame instruction.
dstid | Destination register id |
dstpath | Destination path |
srcid | Source id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetSignedIntInstruction | ( | KERegisterId | dstid, |
int64_t | val, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-signed-int instruction.
dstid | Destination register id |
val | Source value |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetStringInstruction | ( | KERegisterId | dstid, |
struct CNString * | val, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-string instruction.
dstid | Destination register id |
val | Source value |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSetUnsignedIntInstruction | ( | KERegisterId | dstid, |
uint64_t | val, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate set-unsigned-int instruction.
dstid | Destination register id |
val | Source value |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateSwitchInstruction | ( | KERegisterId | condid, |
struct CNObjectList * | caseinsts, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate switch instruction.
condid | Conditional register id |
caseinsts | List of case instructions |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateUnaryInstruction | ( | KEOpcode | opcode, |
KERegisterId | dstid, | ||
KERegisterId | srcid, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate unary instruction.
opcode | Opcode for this instruction |
dstid | Destination register id |
srcid | Source register id |
linfo | Line information |
resource | Resource to allocate the instruction |
struct KEInstruction* KEAllocateWhileInstruction | ( | KERegisterId | condid, |
struct KEInstruction * | bodyinst, | ||
struct KELineInfo * | linfo, | ||
struct CNResource * | resource | ||
) |
Allocate while instruction.
condid | Condition register id |
bodyinst | Body instruction |
linfo | Line information |
resource | Resource to allocate the instruction |
const char* KEOpcodeString | ( | KEOpcode | src | ) |
Get string to present the opcode.
src | Source opcode |