diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-12 21:45:02 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-12 21:45:02 +0000 |
| commit | 4a8c37dd529e9f09583101f086833cec2c1b71ce (patch) | |
| tree | d2357ab108a7e3a12c11f3f634519192e49ac50e /src/llvm_backend.cpp | |
| parent | 3b22c6620cea89394ad7a2b80da5f2529a4fae20 (diff) | |
Prepare for arbitrary separate modules
Diffstat (limited to 'src/llvm_backend.cpp')
| -rw-r--r-- | src/llvm_backend.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index f0d51be73..aa49fd055 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -1488,7 +1488,12 @@ gb_internal String lb_filepath_ll_for_module(lbModule *m) { build_context.build_paths[BuildPath_Output].name ); - if (m->pkg) { + if (m->file) { + char buf[32] = {}; + isize n = gb_snprintf(buf, gb_size_of(buf), "-%u", m->file->id); + String suffix = make_string((u8 *)buf, n-1); + path = concatenate_strings(permanent_allocator(), path, suffix); + } else if (m->pkg) { path = concatenate3_strings(permanent_allocator(), path, STR_LIT("-"), m->pkg->name); } else if (USE_SEPARATE_MODULES) { path = concatenate_strings(permanent_allocator(), path, STR_LIT("-builtin")); @@ -1504,7 +1509,12 @@ gb_internal String lb_filepath_obj_for_module(lbModule *m) { build_context.build_paths[BuildPath_Output].name ); - if (m->pkg) { + if (m->file) { + char buf[32] = {}; + isize n = gb_snprintf(buf, gb_size_of(buf), "-%u", m->file->id); + String suffix = make_string((u8 *)buf, n-1); + path = concatenate_strings(permanent_allocator(), path, suffix); + } else if (m->pkg) { path = concatenate3_strings(permanent_allocator(), path, STR_LIT("-"), m->pkg->name); } @@ -1852,7 +1862,6 @@ gb_internal bool lb_generate_code(lbGenerator *gen) { isize worker_count = thread_count-1; bool do_threading = !!(LLVMIsMultithreaded() && USE_SEPARATE_MODULES && MULTITHREAD_OBJECT_GENERATION && worker_count > 0); - do_threading = false; lbModule *default_module = &gen->default_module; CheckerInfo *info = gen->info; @@ -2388,7 +2397,6 @@ gb_internal bool lb_generate_code(lbGenerator *gen) { if (lb_is_module_empty(m)) { continue; } - String filepath_ll = lb_filepath_ll_for_module(m); if (LLVMPrintModuleToFile(m->mod, cast(char const *)filepath_ll.text, &llvm_error)) { gb_printf_err("LLVM Error: %s\n", llvm_error); |