8 #ifndef KEINSTRUCTION_H
9 #define KEINSTRUCTION_H
11 #include <Coconut/Coconut.h>
26 KESetUnsignedIntOpcode,
38 KEEqualSignedIntOpcode,
39 KEEqualUnsignedIntOpcode,
43 KENotEqualSignedIntOpcode,
44 KENotEqualUnsignedIntOpcode,
45 KENotEqualFloatOpcode,
46 KENotEqualStringOpcode,
47 KELessThanSignedIntOpcode,
48 KELessThanUnsignedIntOpcode,
49 KELessThanFloatOpcode,
50 KELessThanStringOpcode,
51 KELessEqualSignedIntOpcode,
52 KELessEqualUnsignedIntOpcode,
53 KELessEqualFloatOpcode,
54 KELessEqualStringOpcode,
55 KEGreaterThanSignedIntOpcode,
56 KEGreaterThanUnsignedIntOpcode,
57 KEGreaterThanFloatOpcode,
58 KEGreaterThanStringOpcode,
59 KEGreateEqualSignedIntOpcode,
60 KEGreateEqualUnsignedIntOpcode,
61 KEGreateEqualFloatOpcode,
62 KEGreateEqualStringOpcode,
66 KEAddUnsignedIntOpcode,
70 KESubUnsignedIntOpcode,
73 KEMulUnsignedIntOpcode,
76 KEDivUnsignedIntOpcode,
79 KEModUnsignedIntOpcode,
96 KECreateDictionaryOpcode,
97 KESetDictionaryOpcode,
98 KEGetDictionaryOpcode,
104 KEForeachArrayOpcode,
189 } callFunctionInstruction ;
202 } callBuiltinInstruction ;
208 } rootFrameInstruction ;
212 } createFrameInstruction ;
220 } setFrameInstruction ;
228 } getFrameInstruction ;
232 } createArrayInstruction ;
240 } setArrayInstruction ;
248 } getArrayInstruction ;
252 } createDictionaryInstruction ;
260 } setDictionaryInstruction ;
268 } getDictionaryInstruction ;
287 } switchInstruction ;
312 } foreachArrayInstruction ;
320 } foreachDictionaryInstruction ;
342 struct CNResource * resource) ;
376 struct CNResource * resource) ;
390 struct CNResource * resource) ;
404 struct CNResource * resource) ;
418 struct CNResource * resource) ;
432 struct CNResource * resource) ;
444 struct CNString * val,
446 struct CNResource * resource) ;
462 struct CNResource * resource) ;
480 struct CNResource * resource) ;
494 struct CNObjectList * hiddenregs,
496 struct CNResource * resource) ;
509 struct CNObjectList * retregs,
510 struct CNObjectList * paramregs,
512 struct CNResource * resource) ;
525 struct CNObjectList * retregs,
526 struct CNObjectList * paramregs,
528 struct CNResource * resource) ;
540 struct CNResource * resource) ;
552 struct CNResource * resource) ;
568 struct CNResource * resource) ;
584 struct CNResource * resource) ;
596 struct CNResource * resource) ;
612 struct CNResource * resource) ;
628 struct CNResource * resource) ;
640 struct CNResource * resource) ;
656 struct CNResource * resource) ;
672 struct CNResource * resource) ;
688 struct CNResource * resource) ;
700 struct CNObjectList * caseinsts,
702 struct CNResource * resource) ;
718 struct CNResource * resource) ;
732 struct CNResource * resource) ;
748 struct CNResource * resource) ;
764 struct CNResource * resource) ;
808 static inline struct CNResource *
811 return CNResourceOfObject(&(src->
superClass)) ;
struct KEInstruction * KEAllocateNextInstruction(struct KELineInfo *linfo, struct CNResource *resource)
Allocate next instruction.
KEProgram class.
Definition: KELineInfo.h:19
struct KEInstruction * KEAllocateCaseInstruction(CNBoolean isdef, uint64_t caseval, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource)
Allocate case instruction.
struct CNObjectList hiddenRegisters
Definition: KEInstruction.h:180
struct KEInstruction * KEAllocateIfInstruction(KERegisterId condid, struct KEInstruction *theninst, struct KEInstruction *elseinst, struct KELineInfo *linfo, struct CNResource *resource)
Allocate if instruction.
struct CNObjectList parameterRegisters
Definition: KEInstruction.h:188
KERegisterId elementId
Definition: KEInstruction.h:307
struct KEInstruction * KEAllocateReturnInstruction(struct KELineInfo *linfo, struct CNResource *resource)
Allocate return instruction.
KERegisterId rightId
Definition: KEInstruction.h:162
KERegisterId sourceIndex
Definition: KEInstruction.h:247
struct KEPath * sourcePath
Definition: KEInstruction.h:227
int64_t caseValue
Definition: KEInstruction.h:295
struct KEInstruction * KEAllocateGetFrameInstruction(KERegisterId dstid, KERegisterId srcid, struct KEPath *srcpath, struct KELineInfo *linfo, struct CNResource *resource)
Allocate get-frame instruction.
struct KEInstruction * KEAllocateForeachDictionaryInstruction(KERegisterId elmid, KERegisterId dictid, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource)
Allocate foreach-dictionary instruction.
struct KEPath * path
Definition: KEInstruction.h:169
KERegisterId arrayId
Definition: KEInstruction.h:309
struct KEInstruction * thenInstruction
Definition: KEInstruction.h:273
struct KELineInfo * lineInfo
Definition: KEInstruction.h:328
KERegisterId sourceKey
Definition: KEInstruction.h:267
struct KEInstruction * elseInstruction
Definition: KEInstruction.h:278
struct KEInstruction::@16::@22 unaryInstruction
Define KEValue data structure.
KERegisterId destinationKey
Definition: KEInstruction.h:257
struct KEInstruction * KEAllocateSetUnsignedIntInstruction(KERegisterId dstid, uint64_t val, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-unsigned-int instruction.
struct CNObjectList caseInstructionList
Definition: KEInstruction.h:284
struct KEInstruction::@16::@21 setInstruction
struct KEInstruction * defaultInstruction
Definition: KEInstruction.h:286
struct KEInstruction * KEAllocateRootFrameInstruction(KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate root-frame instruction.
struct KEInstruction * KEAllocateSetFrameInstruction(KERegisterId dstid, struct KEPath *dstpath, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-frame instruction.
struct KEInstruction * KEAllocateCreateDictionaryInstruction(KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate create-dictionary instruction.
KERegisterId functionId
Definition: KEInstruction.h:184
struct KEInstruction * KEAllocateSetBoolInstruction(KERegisterId dstid, CNBoolean val, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-bool instruction.
struct KEInstruction * KEAllocateCreateFrameInstruction(KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate create-frame instruction.
struct KEInstruction * KEAllocateSetStringInstruction(KERegisterId dstid, struct CNString *val, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-string instruction.
struct KEInstruction::@16::@20 moveInstruction
struct KEInstruction::@16::@23 binaryInstruction
struct KEInstruction * KEAllocateExitInstruction(KERegisterId codeid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate exit instruction.
struct KEInstruction * compoundInstruction
Definition: KEInstruction.h:125
struct KEInstruction * KEAllocateCreateArrayInstruction(KERegisterId dstid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate create-array instruction.
struct KEInstruction * KEAllocateGetArrayInstruction(KERegisterId dstid, KERegisterId srcid, KERegisterId srcindex, struct KELineInfo *linfo, struct CNResource *resource)
Allocate get-array instruction.
struct CNObjectList instructionList
Definition: KEInstruction.h:132
KEOpcode opCode
Definition: KEInstruction.h:119
CNBoolean isDefaultCondition
Definition: KEInstruction.h:290
Definition: KEInstruction.h:115
KERegisterId destinationId
Definition: KEInstruction.h:137
struct KEInstruction * KEAllocateSwitchInstruction(KERegisterId condid, struct CNObjectList *caseinsts, struct KELineInfo *linfo, struct CNResource *resource)
Allocate switch instruction.
struct KEInstruction * KEAllocateCreateFunctionInstruction(KERegisterId dstid, struct KEPath *funcpath, struct CNObjectList *hiddenregs, struct KELineInfo *linfo, struct CNResource *resource)
Allocate create-function instruction.
struct KEInstruction * KEAllocateSetSignedIntInstruction(KERegisterId dstid, int64_t val, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-signed-int instruction.
Define register information.
struct KEValue * pathValue
Definition: KEInstruction.h:174
struct KEInstruction * KEAllocateWhileInstruction(KERegisterId condid, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource)
Allocate while instruction.
struct KEInstruction * bodyInstruction
Definition: KEInstruction.h:303
struct KEInstruction * KEAllocateCallFunctionInstruction(KERegisterId funcid, struct CNObjectList *retregs, struct CNObjectList *paramregs, struct KELineInfo *linfo, struct CNResource *resource)
Allocate call-function instruction.
struct KEInstruction * KEAllocateSetFloatInstruction(KERegisterId dstid, double val, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-float instruction.
struct KEFrame * rootFrame
Definition: KEInstruction.h:207
struct KEInstruction * KEAllocateFunctionInstruction(struct KEInstruction *body, struct KELineInfo *linfo, struct CNResource *resource)
Allocate function instruction object.
struct KEInstruction::@16::@24 createFunctionInstruction
KERegisterId sourceId
Definition: KEInstruction.h:139
struct KEInstruction * KEAllocateNopInstruction(struct KELineInfo *linfo, struct CNResource *resource)
Allocate nop instruction.
KERegisterId dictionaryId
Definition: KEInstruction.h:317
struct KEInstruction::@16::@43 exitInstruction
KERegisterId conditionId
Definition: KEInstruction.h:271
struct CNObject superClass
Definition: KEInstruction.h:117
struct KEInstruction * KEAllocateMovInstruction(KEOpcode opcode, KERegisterId dstid, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate move instruction.
KERegisterId leftId
Definition: KEInstruction.h:160
struct KEInstruction * KEAllocateSetArrayInstruction(KERegisterId dstid, KERegisterId dstindex, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-array instruction.
struct KEInstruction::@16::@18 functionInstruction
struct KEInstruction * KEAllocateLastInstruction(struct KELineInfo *linfo, struct CNResource *resource)
Allocate last instruction.
struct KEInstruction * KEAllocateSetDictionaryInstruction(KERegisterId dstid, KERegisterId dstkey, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate set-dictionary instruction.
struct KEInstruction * caseInstruction
Definition: KEInstruction.h:297
struct KEInstruction * KEAllocateCallBuiltinInstruction(struct KEPath *path, struct CNObjectList *retregs, struct CNObjectList *paramregs, struct KELineInfo *linfo, struct CNResource *resource)
Allocate call-builtin instruction.
struct KEInstruction * KEAllocateUnaryInstruction(KEOpcode opcode, KERegisterId dstid, KERegisterId srcid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate unary instruction.
struct KEValue constantValue
Definition: KEInstruction.h:146
const char * KEOpcodeString(KEOpcode src)
Get string to present the opcode.
struct KEInstruction * KEAllocateForeachArrayInstruction(KERegisterId elmid, KERegisterId arrayid, struct KEInstruction *bodyinst, struct KELineInfo *linfo, struct CNResource *resource)
Allocate foreach-array instruction.
KERegisterId destinationIndex
Definition: KEInstruction.h:237
struct CNObjectList returnRegisters
Definition: KEInstruction.h:186
struct KEInstruction * KEAllocateGetDictionaryInstruction(KERegisterId dstid, KERegisterId srcid, KERegisterId srckey, struct KELineInfo *linfo, struct CNResource *resource)
Allocate get-dictionary instruction.
struct KEPath * destinationPath
Definition: KEInstruction.h:217
struct KEInstruction * KEAllocateBinaryInstruction(KEOpcode opcode, KERegisterId dstid, KERegisterId leftid, KERegisterId rightid, struct KELineInfo *linfo, struct CNResource *resource)
Allocate binary instruction.
uint16_t KERegisterId
Definition: KERegister.h:14
struct KEInstruction * KEAllocateCompoundInstruction(struct KELineInfo *linfo, struct CNResource *resource)
Allocate compound instruction.
KEOpcode
Definition: KEInstruction.h:16
KERegisterId maxLocalRegisterId
Definition: KEInstruction.h:127