From d9f652919961a2947452ad3c4af4659f3d2fb330 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 24 Aug 2019 23:31:14 +0200 Subject: Add if/else/elseif/while, including the final assembly --- include/ssa/ssa.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include/ssa') diff --git a/include/ssa/ssa.h b/include/ssa/ssa.h index ed147bf..9d6949d 100644 --- a/include/ssa/ssa.h +++ b/include/ssa/ssa.h @@ -28,7 +28,8 @@ typedef enum { SSA_CALL_EXTERN, SSA_JUMP_ZERO, SSA_JUMP, - SSA_RET + SSA_RET, + SSA_LABEL } SsaInstruction; typedef enum { @@ -61,6 +62,7 @@ typedef u16 SsaStringIndex; typedef u16 SsaExternFuncIndex; typedef u16 SsaExportFuncIndex; typedef u16 SsaFuncIndex; +typedef u16 SsaLabelIndex; typedef struct { Buffer/*instruction data*/ instructions; @@ -78,6 +80,7 @@ typedef struct { SsaRegister reg_counter; SsaRegister param_counter; SsaFuncIndex func_counter; + SsaLabelIndex label_counter; Parser *parser; /* Borrowed */ } Ssa; @@ -111,11 +114,11 @@ typedef struct { typedef struct { SsaRegister condition_reg; - JumpOffset jump_offset; + SsaLabelIndex target_label; } SsaInsJumpZero; typedef struct { - JumpOffset jump_offset; + SsaLabelIndex target_label; } SsaInsJump; /* None of these functions are thread-safe */ -- cgit v1.2.3