diff options
| author | gingerBill <bill+github@gingerbill.org> | 2016-08-11 21:53:44 +0100 |
|---|---|---|
| committer | gingerBill <bill+github@gingerbill.org> | 2016-08-11 21:53:44 +0100 |
| commit | 19cc77dad301225754bdc797e2bd55f580775048 (patch) | |
| tree | ad00dfa171745b5c66d0e00391aa2f21c48d2872 /src/codegen/codegen.cpp | |
| parent | 4c467b118d12ca6fabd018e4c0295096fa4d399b (diff) | |
Code generation for procedure literals
Diffstat (limited to 'src/codegen/codegen.cpp')
| -rw-r--r-- | src/codegen/codegen.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/codegen/codegen.cpp b/src/codegen/codegen.cpp index cde7951df..678013385 100644 --- a/src/codegen/codegen.cpp +++ b/src/codegen/codegen.cpp @@ -36,11 +36,13 @@ void ssa_gen_destroy(ssaGen *s) { void ssa_gen_code(ssaGen *s) { if (v_zero == NULL) { - v_zero = ssa_make_value_constant(gb_heap_allocator(), t_int, make_exact_value_integer(0)); - v_one = ssa_make_value_constant(gb_heap_allocator(), t_int, make_exact_value_integer(1)); - v_zero32 = ssa_make_value_constant(gb_heap_allocator(), t_i32, make_exact_value_integer(0)); - v_one32 = ssa_make_value_constant(gb_heap_allocator(), t_i32, make_exact_value_integer(1)); - v_two32 = ssa_make_value_constant(gb_heap_allocator(), t_i32, make_exact_value_integer(2)); + v_zero = ssa_make_value_constant(gb_heap_allocator(), t_int, make_exact_value_integer(0)); + v_one = ssa_make_value_constant(gb_heap_allocator(), t_int, make_exact_value_integer(1)); + v_zero32 = ssa_make_value_constant(gb_heap_allocator(), t_i32, make_exact_value_integer(0)); + v_one32 = ssa_make_value_constant(gb_heap_allocator(), t_i32, make_exact_value_integer(1)); + v_two32 = ssa_make_value_constant(gb_heap_allocator(), t_i32, make_exact_value_integer(2)); + v_false = ssa_make_value_constant(gb_heap_allocator(), t_bool, make_exact_value_bool(false)); + v_true = ssa_make_value_constant(gb_heap_allocator(), t_bool, make_exact_value_bool(true)); } ssaModule *m = &s->module; @@ -76,7 +78,8 @@ void ssa_gen_code(ssaGen *s) { } break; case Entity_Procedure: { - ssaValue *p = ssa_make_value_procedure(a, e, decl, m); + AstNode *body = decl->proc_decl->ProcDecl.body; + ssaValue *p = ssa_make_value_procedure(a, m, e->type, decl->type_expr, body, e->token.string); map_set(&m->values, hash_pointer(e), p); map_set(&m->members, hash_string(name), p); } break; @@ -87,7 +90,7 @@ void ssa_gen_code(ssaGen *s) { auto *entry = &m->members.entries[i]; ssaValue *v = entry->value; if (v->kind == ssaValue_Proc) - ssa_build_proc(v); + ssa_build_proc(v, NULL); } // m->layout = make_string("e-p:64:64:64"); |