diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-08-14 22:19:39 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-08-14 22:19:39 +0100 |
| commit | 0f48a7d299a80c2e461bdcf5b37b5f624a48d7e8 (patch) | |
| tree | 09132199d7777f3f31623505e9867468d3f487d8 /src/codegen/ssa.cpp | |
| parent | 0edae8c8482dd4763737b01deb09a4732a2f35ec (diff) | |
#foreign "custom_name"; <N x i1> bugs (see test.ll and test2.ll)
Diffstat (limited to 'src/codegen/ssa.cpp')
| -rw-r--r-- | src/codegen/ssa.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/codegen/ssa.cpp b/src/codegen/ssa.cpp index 19b4f1e3e..f20100a8b 100644 --- a/src/codegen/ssa.cpp +++ b/src/codegen/ssa.cpp @@ -2067,6 +2067,9 @@ void ssa_build_stmt(ssaProcedure *proc, AstNode *node) { ssa_build_proc(value, proc); } else { String name = pd->name->Ident.token.string; + if (pd->foreign_name.len > 0) { + name = pd->foreign_name; + } Entity **found = map_get(&proc->module->info->definitions, hash_pointer(pd->name)); GB_ASSERT(found != NULL); @@ -2240,6 +2243,9 @@ void ssa_build_stmt(ssaProcedure *proc, AstNode *node) { case_ast_node(is, IfStmt, node); if (is->init != NULL) { + ssaBlock *init = ssa_add_block(proc, node, make_string("if.init")); + ssa_emit_jump(proc, init); + proc->curr_block = init; ssa_build_stmt(proc, is->init); } ssaBlock *then = ssa_add_block(proc, node, make_string("if.then")); @@ -2265,9 +2271,12 @@ void ssa_build_stmt(ssaProcedure *proc, AstNode *node) { case_ast_node(fs, ForStmt, node); if (fs->init != NULL) { + ssaBlock *init = ssa_add_block(proc, node, make_string("for.init")); + ssa_emit_jump(proc, init); + proc->curr_block = init; ssa_build_stmt(proc, fs->init); } - ssaBlock *body = ssa_add_block(proc, node, make_string("for.body")); + ssaBlock *body = ssa__make_block(proc, node, make_string("for.body")); ssaBlock *done = ssa__make_block(proc, node, make_string("for.done")); // NOTE(bill): Append later ssaBlock *loop = body; @@ -2283,6 +2292,7 @@ void ssa_build_stmt(ssaProcedure *proc, AstNode *node) { proc->curr_block = loop; if (loop != body) { ssa_build_cond(proc, fs->cond, body, done); + gb_array_append(proc->blocks, body); proc->curr_block = body; } |