mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Experiment with different uses of -use-separate-modules
This commit is contained in:
@@ -426,6 +426,7 @@ struct BuildContext {
|
|||||||
bool linker_map_file;
|
bool linker_map_file;
|
||||||
|
|
||||||
bool use_separate_modules;
|
bool use_separate_modules;
|
||||||
|
bool module_per_file;
|
||||||
bool no_threaded_checker;
|
bool no_threaded_checker;
|
||||||
|
|
||||||
bool show_debug_messages;
|
bool show_debug_messages;
|
||||||
|
|||||||
@@ -3437,7 +3437,11 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
|||||||
TIME_SECTION("LLVM Add Foreign Library Paths");
|
TIME_SECTION("LLVM Add Foreign Library Paths");
|
||||||
lb_add_foreign_library_paths(gen);
|
lb_add_foreign_library_paths(gen);
|
||||||
|
|
||||||
TIME_SECTION("LLVM Object Generation");
|
gbString label_object_generation = gb_string_make(heap_allocator(), "LLVM Object Generation");
|
||||||
|
if (gen->modules.count > 1) {
|
||||||
|
label_object_generation = gb_string_append_fmt(label_object_generation, " (%d modules)", gen->modules.count);
|
||||||
|
}
|
||||||
|
TIME_SECTION_WITH_LEN(label_object_generation, gb_string_length(label_object_generation));
|
||||||
|
|
||||||
if (build_context.ignore_llvm_build) {
|
if (build_context.ignore_llvm_build) {
|
||||||
gb_printf_err("LLVM object generation has been ignored!\n");
|
gb_printf_err("LLVM object generation has been ignored!\n");
|
||||||
|
|||||||
@@ -120,23 +120,22 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
|
|||||||
if (USE_SEPARATE_MODULES) {
|
if (USE_SEPARATE_MODULES) {
|
||||||
for (auto const &entry : gen->info->packages) {
|
for (auto const &entry : gen->info->packages) {
|
||||||
AstPackage *pkg = entry.value;
|
AstPackage *pkg = entry.value;
|
||||||
#if 1
|
|
||||||
auto m = gb_alloc_item(permanent_allocator(), lbModule);
|
auto m = gb_alloc_item(permanent_allocator(), lbModule);
|
||||||
m->pkg = pkg;
|
m->pkg = pkg;
|
||||||
m->gen = gen;
|
m->gen = gen;
|
||||||
map_set(&gen->modules, cast(void *)pkg, m);
|
map_set(&gen->modules, cast(void *)pkg, m);
|
||||||
lb_init_module(m, c);
|
lb_init_module(m, c);
|
||||||
#else
|
if (build_context.module_per_file) {
|
||||||
// NOTE(bill): Probably per file is not a good idea, so leave this for later
|
// NOTE(bill): Probably per file is not a good idea, so leave this for later
|
||||||
for (AstFile *file : pkg->files) {
|
for (AstFile *file : pkg->files) {
|
||||||
auto m = gb_alloc_item(permanent_allocator(), lbModule);
|
auto m = gb_alloc_item(permanent_allocator(), lbModule);
|
||||||
m->file = file;
|
m->file = file;
|
||||||
m->pkg = pkg;
|
m->pkg = pkg;
|
||||||
m->gen = gen;
|
m->gen = gen;
|
||||||
map_set(&gen->modules, cast(void *)file, m);
|
map_set(&gen->modules, cast(void *)file, m);
|
||||||
lb_init_module(m, c);
|
lb_init_module(m, c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -390,6 +390,7 @@ enum BuildFlagKind {
|
|||||||
BuildFlag_InternalIgnoreLazy,
|
BuildFlag_InternalIgnoreLazy,
|
||||||
BuildFlag_InternalIgnoreLLVMBuild,
|
BuildFlag_InternalIgnoreLLVMBuild,
|
||||||
BuildFlag_InternalIgnorePanic,
|
BuildFlag_InternalIgnorePanic,
|
||||||
|
BuildFlag_InternalModulePerFile,
|
||||||
|
|
||||||
BuildFlag_Tilde,
|
BuildFlag_Tilde,
|
||||||
|
|
||||||
@@ -591,7 +592,8 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
|||||||
|
|
||||||
add_flag(&build_flags, BuildFlag_InternalIgnoreLazy, str_lit("internal-ignore-lazy"), BuildFlagParam_None, Command_all);
|
add_flag(&build_flags, BuildFlag_InternalIgnoreLazy, str_lit("internal-ignore-lazy"), BuildFlagParam_None, Command_all);
|
||||||
add_flag(&build_flags, BuildFlag_InternalIgnoreLLVMBuild, str_lit("internal-ignore-llvm-build"),BuildFlagParam_None, Command_all);
|
add_flag(&build_flags, BuildFlag_InternalIgnoreLLVMBuild, str_lit("internal-ignore-llvm-build"),BuildFlagParam_None, Command_all);
|
||||||
add_flag(&build_flags, BuildFlag_InternalIgnorePanic, str_lit("internal-ignore-panic"), BuildFlagParam_None, Command_all);
|
add_flag(&build_flags, BuildFlag_InternalIgnorePanic, str_lit("internal-ignore-panic"), BuildFlagParam_None, Command_all);
|
||||||
|
add_flag(&build_flags, BuildFlag_InternalModulePerFile, str_lit("internal-module-per-file"), BuildFlagParam_None, Command_all);
|
||||||
|
|
||||||
#if ALLOW_TILDE
|
#if ALLOW_TILDE
|
||||||
add_flag(&build_flags, BuildFlag_Tilde, str_lit("tilde"), BuildFlagParam_None, Command__does_build);
|
add_flag(&build_flags, BuildFlag_Tilde, str_lit("tilde"), BuildFlagParam_None, Command__does_build);
|
||||||
@@ -1408,6 +1410,10 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
|||||||
case BuildFlag_InternalIgnorePanic:
|
case BuildFlag_InternalIgnorePanic:
|
||||||
build_context.ignore_panic = true;
|
build_context.ignore_panic = true;
|
||||||
break;
|
break;
|
||||||
|
case BuildFlag_InternalModulePerFile:
|
||||||
|
build_context.module_per_file = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case BuildFlag_Tilde:
|
case BuildFlag_Tilde:
|
||||||
build_context.tilde_backend = true;
|
build_context.tilde_backend = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user