diff options
Diffstat (limited to '')
-rw-r--r-- | includes/compiler/CInline.h | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/includes/compiler/CInline.h b/includes/compiler/CInline.h index 576f7e1..52cdf13 100644 --- a/includes/compiler/CInline.h +++ b/includes/compiler/CInline.h @@ -14,12 +14,29 @@ typedef struct CI_Var { Type *type; UInt32 qual; UInt8 sflags; - UInt8 xD; - UInt8 xE; + SInt8 xD; + SInt8 xE; } CI_Var; +enum { + CI_SFLAGS_NoClass = 0, + CI_SFLAGS_Register = 1, + CI_SFLAGS_Auto = 2, + CI_SFLAGS_HasObjectFlag2 = 0x80 +}; + +typedef struct CI_SwitchCase { + short labelID; + CInt64 min; + CInt64 max; +} CI_SwitchCase; + typedef struct CI_Switch { - int fix_me; + ENode *expr; + void *unkSwitch8; + short defaultlabelID; + short numcases; + CI_SwitchCase cases[0]; } CI_Switch; typedef struct CI_Statement { @@ -37,10 +54,23 @@ typedef struct CI_Statement { SInt16 statementnum; } ifgoto; CI_Switch *switchdata; - // TODO: Figure out the one for Inline ASM + struct { + void *data; + SInt32 size; + } asmdata; } u; } CI_Statement; +typedef enum { + CI_CanInline0, + CI_CanInline1, + CI_CanInline2, + CI_CanInline3, + CI_CanInline4, + CI_CanInline5, + CI_CanInline6 +} CI_CanInline; + struct CI_FuncData { short numarguments; CI_Var *arguments; @@ -53,7 +83,7 @@ struct CI_FuncData { SInt32 functionbodyoffset; HashNameNode *functionbodypath; SInt32 symdeclend; - Boolean can_inline; + UInt8 can_inline; }; typedef enum { @@ -71,11 +101,10 @@ typedef struct CI_Action { FileOffsetInfo fileoffset; TStream stream; TypeClass *tclass; - CI_ActionType actiontype; } inlinefunc; struct { - Type *a; - Type *b; + TemplClass *templ; + TemplClassInst *inst; TemplateMember *tmemb; } memberfunc; struct { @@ -83,6 +112,7 @@ typedef struct CI_Action { TemplFuncInstance *inst; } templatefunc; } u; + CI_ActionType actiontype; } CI_Action; typedef enum { @@ -96,20 +126,20 @@ typedef enum { extern CI_Action *cinline_tactionlist; extern void CInline_Init(void); -extern SInt32 CInline_GetLocalID(Object *obj); +extern SInt32 CInline_GetLocalID(Object *object); extern Boolean CInline_ExpressionHasSideEffect(ENode *expr); extern ENode *CInline_CopyExpression(ENode *expr, CInlineCopyMode mode); extern void CInline_SerializeStatement(Statement *stmt); extern Object *CInline_GetLocalObj(SInt32 id, Boolean flag); extern SInt16 CInline_GetStatementNumber(Statement *first, Statement *stmt); -extern void CInline_PackIFunctionData(CI_FuncData *packed, Statement *stmt, Object *obj); -extern void CInline_UnpackIFunctionData(Object *obj, CI_FuncData *packed, Statement *stmt); -extern void CInline_AddDefaultFunctionAction(Object *obj); -extern void CInline_AddInlineFunctionAction(Object *obj, TypeClass *tclass, FileOffsetInfo *fileoffset, TStream *stream, Boolean flag); -extern void CInline_AddMemberFunctionAction(Object *obj, Type *a, Type *b, TemplateMember *tmemb); -extern void CInline_AddTemplateFunctionAction(Object *obj, TemplateFunction *func, TemplFuncInstance *inst); -extern void CInline_ObjectAddrRef(Object *obj); -extern void CInline_GenFunc(Statement *stmt, Object *obj, UInt8 unk); +extern void CInline_PackIFunctionData(CI_FuncData *packed, Statement *stmt, Object *object); +extern void CInline_UnpackIFunctionData(Object *object, CI_FuncData *packed, Statement *firstStmt); +extern void CInline_AddDefaultFunctionAction(Object *object); +extern void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffsetInfo *fileoffset, TStream *stream, Boolean flag); +extern void CInline_AddMemberFunctionAction(Object *object, TemplClass *templ, TemplClassInst *inst, TemplateMember *tmemb); +extern void CInline_AddTemplateFunctionAction(Object *object, TemplateFunction *func, TemplFuncInstance *inst); +extern void CInline_ObjectAddrRef(Object *object); +extern void CInline_GenFunc(Statement *stmt, Object *object, UInt8 unk); extern Boolean CInline_CanFreeLHeap(void); extern Boolean CInline_GenerateDeferredFuncs(void); extern void CInline_Finish(void); |