diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-03-12 22:18:43 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 2d2c31cc18aa9af2cdf26fa462edf7a164d45328 (patch) | |
tree | 687402ac43f28260a3ac7b9934522ae891b09557 /include | |
parent | 385e2b95cb635976aded7368c6f7ac29585b38e7 (diff) |
Refactor ssa
Diffstat (limited to 'include')
-rw-r--r-- | include/ast.h | 3 | ||||
-rw-r--r-- | include/defs.h | 1 | ||||
-rw-r--r-- | include/ssa/ssa.h | 13 |
3 files changed, 14 insertions, 3 deletions
diff --git a/include/ast.h b/include/ast.h index 497488f..b63dab5 100644 --- a/include/ast.h +++ b/include/ast.h @@ -23,7 +23,6 @@ typedef struct String String; typedef struct Variable Variable; typedef struct Number Number; typedef struct Binop Binop; -typedef struct Scope Scope; typedef union { void *data; @@ -133,7 +132,5 @@ CHECK_RESULT int scope_init(Scope *self, ScopedAllocator *allocator); CHECK_RESULT int scope_add_child(Scope *self, Ast *child); /* longjump to compiler env on failure */ void scope_resolve(Scope *self, AstCompilerContext *context); -/* longjump to compiler env on failure */ -void scope_generate_ssa(Scope *self, AstCompilerContext *context); #endif diff --git a/include/defs.h b/include/defs.h index 6a9bca4..74f2411 100644 --- a/include/defs.h +++ b/include/defs.h @@ -4,5 +4,6 @@ typedef struct ParserThreadData ParserThreadData; typedef struct amal_compiler amal_compiler; typedef struct Parser Parser; +typedef struct Scope Scope; #endif diff --git a/include/ssa/ssa.h b/include/ssa/ssa.h index e5bd86b..a21b45a 100644 --- a/include/ssa/ssa.h +++ b/include/ssa/ssa.h @@ -4,6 +4,9 @@ #include "../std/buffer.h" #include "../std/hash_map.h" #include "../std/defs.h" +#include "../defs.h" + +#include <setjmp.h> typedef enum { SSA_ASSIGN_INTER, @@ -53,4 +56,14 @@ CHECK_RESULT int ssa_ins_func_end(Ssa *self); CHECK_RESULT int ssa_ins_push(Ssa *self, SsaRegister reg); CHECK_RESULT int ssa_ins_call(Ssa *self, SsaFuncIndex func, SsaRegister *result); + +typedef struct { + jmp_buf env; + Parser *parser; + Ssa ssa; +} SsaCompilerContext; + +/* longjump to compiler env on failure */ +void scope_generate_ssa(Scope *self, SsaCompilerContext *context); + #endif |