summaryrefslogtreecommitdiff
path: root/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'codegen.c')
-rw-r--r--codegen.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/codegen.c b/codegen.c
index ae94d9f..bdc3cbf 100644
--- a/codegen.c
+++ b/codegen.c
@@ -100,6 +100,8 @@ static void emit_storage_loc(
case STO_IMM:
fprintf(outfile, "%llu", loc->value);
break;
+ case STO_UNRESOLVED:
+ CGEN_PANIC("can't emit unresolved storage location");
}
}
@@ -120,6 +122,8 @@ static bool locs_equal(
return strcmp(a->label, b->label) == 0;
case STO_FN:
return a->decl == b->decl;
+ case STO_UNRESOLVED:
+ return false;
}
CGEN_PANIC("unhandled storage type case");
}
@@ -176,6 +180,8 @@ static void emit_mov(
case STO_IMM:
CGEN_PANIC(
"can't move value into immediate value %lld", dst->loc.value);
+ case STO_UNRESOLVED:
+ CGEN_PANIC("can't move value into unresolved storage");
}
fprintf(outfile, "\n");
}
@@ -580,6 +586,7 @@ static void emit_fn_decl(FILE* outfile, const struct fn_decl_node* node) {
while (arg_decl != NULL) {
struct lval_def arg_dst =
make_stack_lval(outfile, &arg_decl->decl->type);
+ /* TODO: type checker should define vars, we just set their loc */
scope_define_var(
scope,
(struct var_def) {