aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ast.h3
-rw-r--r--include/defs.h1
-rw-r--r--include/ssa/ssa.h13
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