Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/tools/ci_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ run_examples() {
run_c3c compile examples/hash.c3
run_c3c compile examples/http_server.c3
run_c3c compile-only examples/levenshtein.c3
run_c3c compile-only --single-module=yes examples/levenshtein.c3 # --single-module test
run_c3c compile examples/load_world.c3
run_c3c compile-only examples/map.c3
run_c3c compile examples/mandelbrot.c3
Expand Down
22 changes: 18 additions & 4 deletions src/compiler/llvm_codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1692,11 +1692,25 @@ void **llvm_gen(Module** modules, int module_count)
vec_add(gen_contexts, llvm_gen_tests(modules, module_count, context));
}
int count = vec_size(gen_contexts);
for (int i = 1; i < count; i++)
while (count > 1)
{
GenContext *other = gen_contexts[i];
LLVMLinkModules2(first->module, other->module);
gencontext_destroy(other);
int new_count = 0;
for (int i = 0; i < count; i += 2)
{
if (i + 1 < count)
{
GenContext *dst = gen_contexts[i];
GenContext *src = gen_contexts[i + 1];
LLVMLinkModules2(dst->module, src->module);
gencontext_destroy(src);
gen_contexts[new_count++] = dst;
}
else
{
gen_contexts[new_count++] = gen_contexts[i];
}
}
count = new_count;
}
vec_resize(gen_contexts, 1);
return (void**)gen_contexts;
Expand Down
Loading