summaryrefslogtreecommitdiff
path: root/ir.h
diff options
context:
space:
mode:
Diffstat (limited to 'ir.h')
-rw-r--r--ir.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/ir.h b/ir.h
index 251c198..ff75163 100644
--- a/ir.h
+++ b/ir.h
@@ -12,6 +12,7 @@ typedef enum {
T_TOP, /* may or may not be a constant */
T_CONST, /* known compile-time constant */
T_BOT, /* known not a constant */
+ T_CTRL /* bottom of control flow */
} TypeLevel;
typedef enum {
@@ -48,7 +49,7 @@ void type_err(struct Node *n, Lexer *l);
typedef enum {
N_NONE,
- N_START,
+ N_START, N_IF_ELSE, N_REGION, N_PHI, N_STOP,
N_PROJ,
N_RETURN,
N_KEEPALIVE,
@@ -101,9 +102,16 @@ typedef struct {
} Scope;
typedef struct {
+ Str name;
+ Node *node;
+} ScopeName;
+
+typedef DYNARR(ScopeName) ScopeNameList;
+
+typedef struct {
Arena arena;
Str name;
- Node *start, *stop, *keepalive;
+ Node *start, *stop, *ctrl, *keepalive;
Node *free_list;
Scope scope;
} Proc;
@@ -144,5 +152,6 @@ ScopeFrame *scope_pop(Scope *scope, Proc *proc);
NameBinding *scope_find(Scope *scope, Str name);
NameBinding *scope_bind(Scope *scope, Str name, Node *value, LexSpan pos, Proc *proc);
NameBinding *scope_update(Scope *scope, Str name, Node *to, Proc *proc);
+void scope_collect(Scope *scope, Proc *proc, ScopeNameList *nl, Arena *arena);
#endif