diff options
| author | WormHeamer | 2025-08-07 00:50:01 -0400 |
|---|---|---|
| committer | WormHeamer | 2025-08-07 00:50:01 -0400 |
| commit | 9c5d50e5371cd26d7ae8fd896dc06fa9af684949 (patch) | |
| tree | 9140ba2ba6d6be752665cfb51ffb57262c4ba38e /ir.h | |
| parent | 632f2e43d43eaae936cc0567ef18bb25f94e1bdd (diff) | |
add if statements
Diffstat (limited to 'ir.h')
| -rw-r--r-- | ir.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |
