diff options
| author | gingerBill <bill@gingerbill.org> | 2021-04-28 15:28:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-04-28 15:28:14 +0100 |
| commit | 71ac145f49efa816f49b462df3ec38288a57d776 (patch) | |
| tree | 2218d6d957b4fdc1037aa43dd53586145f75d6ea /src | |
| parent | e50ef33c2a194ff1bd5ff0f485f2e6664d6519b0 (diff) | |
Remove dead code related to old backend
Diffstat (limited to 'src')
| -rw-r--r-- | src/build_settings.cpp | 61 | ||||
| -rw-r--r-- | src/main.cpp | 95 |
2 files changed, 16 insertions, 140 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 82ed24f83..f48aa4999 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -173,8 +173,6 @@ struct BuildContext { String resource_filepath; String pdb_filepath; bool has_resource; - String opt_flags; - String llc_flags; String link_flags; String extra_linker_flags; String microarch; @@ -806,22 +804,12 @@ void init_build_context(TargetMetrics *cross_target) { bc->word_size = metrics->word_size; bc->max_align = metrics->max_align; bc->link_flags = str_lit(" "); - bc->opt_flags = str_lit(" "); - gbString llc_flags = gb_string_make_reserve(heap_allocator(), 64); - if (bc->ODIN_DEBUG) { - // llc_flags = gb_string_appendc(llc_flags, "-debug-compile "); - } - // NOTE(zangent): The linker flags to set the build architecture are different // across OSs. It doesn't make sense to allocate extra data on the heap // here, so I just #defined the linker flags to keep things concise. if (bc->metrics.arch == TargetArch_amd64) { - if (bc->microarch.len == 0) { - llc_flags = gb_string_appendc(llc_flags, "-march=x86-64 "); - } - switch (bc->metrics.os) { case TargetOs_windows: bc->link_flags = str_lit("/machine:x64 "); @@ -836,10 +824,6 @@ void init_build_context(TargetMetrics *cross_target) { break; } } else if (bc->metrics.arch == TargetArch_386) { - if (bc->microarch.len == 0) { - llc_flags = gb_string_appendc(llc_flags, "-march=x86 "); - } - switch (bc->metrics.os) { case TargetOs_windows: bc->link_flags = str_lit("/machine:x86 "); @@ -856,10 +840,6 @@ void init_build_context(TargetMetrics *cross_target) { break; } } else if (bc->metrics.arch == TargetArch_arm64) { - if (bc->microarch.len == 0) { - llc_flags = gb_string_appendc(llc_flags, "-march=arm64 "); - } - switch (bc->metrics.os) { case TargetOs_darwin: bc->link_flags = str_lit("-arch arm64 "); @@ -872,50 +852,9 @@ void init_build_context(TargetMetrics *cross_target) { gb_printf_err("Compiler Error: Unsupported architecture\n");; gb_exit(1); } - llc_flags = gb_string_appendc(llc_flags, " "); - bc->optimization_level = gb_clamp(bc->optimization_level, 0, 3); - gbString opt_flags = gb_string_make_reserve(heap_allocator(), 64); - - if (bc->microarch.len != 0) { - opt_flags = gb_string_appendc(opt_flags, "-march="); - opt_flags = gb_string_append_length(opt_flags, bc->microarch.text, bc->microarch.len); - opt_flags = gb_string_appendc(opt_flags, " "); - - // llc_flags = gb_string_appendc(opt_flags, "-march="); - // llc_flags = gb_string_append_length(llc_flags, bc->microarch.text, bc->microarch.len); - // llc_flags = gb_string_appendc(llc_flags, " "); - } - - - if (bc->optimization_level != 0) { - opt_flags = gb_string_append_fmt(opt_flags, "-O%d ", bc->optimization_level); - // NOTE(lachsinc): The following options were previously passed during call - // to opt in main.cpp:exec_llvm_opt(). - // -die: Dead instruction elimination - // -memcpyopt: MemCpy optimization - } - if (bc->ODIN_DEBUG == false) { - opt_flags = gb_string_appendc(opt_flags, "-mem2reg -die "); - } - - - - - - // NOTE(lachsinc): This optimization option was previously required to get - // around an issue in fmt.odin. Thank bp for tracking it down! Leaving for now until the issue - // is resolved and confirmed by Bill. Maybe it should be readded in non-debug builds. - // if (bc->ODIN_DEBUG == false) { - // opt_flags = gb_string_appendc(opt_flags, "-mem2reg "); - // } - - bc->opt_flags = make_string_c(opt_flags); - bc->llc_flags = make_string_c(llc_flags); - - #undef LINK_FLAG_X64 #undef LINK_FLAG_386 } diff --git a/src/main.cpp b/src/main.cpp index 251616b56..427653feb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -265,22 +265,22 @@ i32 linker_stage(lbGenerator *gen) { LIT(build_context.resource_filepath) ); - if(result == 0) { - result = system_exec_command_line_app("msvc-link", - "\"%.*slink.exe\" %s \"%.*s.res\" -OUT:\"%.*s.%s\" %s " - "/nologo /incremental:no /opt:ref /subsystem:%s " - " %.*s " - " %.*s " - " %s " - "", - LIT(find_result.vs_exe_path), object_files, LIT(output_base), LIT(output_base), output_ext, - link_settings, - subsystem_str, - LIT(build_context.link_flags), - LIT(build_context.extra_linker_flags), - lib_str - ); - } + if (result == 0) { + result = system_exec_command_line_app("msvc-link", + "\"%.*slink.exe\" %s \"%.*s.res\" -OUT:\"%.*s.%s\" %s " + "/nologo /incremental:no /opt:ref /subsystem:%s " + " %.*s " + " %.*s " + " %s " + "", + LIT(find_result.vs_exe_path), object_files, LIT(output_base), LIT(output_base), output_ext, + link_settings, + subsystem_str, + LIT(build_context.link_flags), + LIT(build_context.extra_linker_flags), + lib_str + ); + } } else { result = system_exec_command_line_app("msvc-link", "\"%.*slink.exe\" %s -OUT:\"%.*s.%s\" %s " @@ -1535,69 +1535,6 @@ void remove_temp_files(String output_base) { } - - -i32 exec_llvm_opt(String output_base) { -#if defined(GB_SYSTEM_WINDOWS) - // For more passes arguments: http://llvm.org/docs/Passes.html - - return system_exec_command_line_app("llvm-opt", - "\"%.*sbin/opt\" \"%.*s.ll\" -o \"%.*s_memcpy_pass.bc\" -memcpyopt" - "", - LIT(build_context.ODIN_ROOT), - LIT(output_base), LIT(output_base)) - - || system_exec_command_line_app("llvm-opt", - "\"%.*sbin/opt\" \"%.*s_memcpy_pass.bc\" -o \"%.*s.bc\" %.*s " - "", - LIT(build_context.ODIN_ROOT), - LIT(output_base), LIT(output_base), - LIT(build_context.opt_flags)); -#else - // NOTE(zangent): This is separate because it seems that LLVM tools are packaged - // with the Windows version, while they will be system-provided on MacOS and GNU/Linux - - return system_exec_command_line_app("llvm-opt", - "opt \"%.*s.ll\" -o \"%.*s_memcpy_pass.bc\" -memcpyopt" - "", - LIT(output_base), LIT(output_base)) - - || system_exec_command_line_app("llvm-opt", - "opt \"%.*s_memcpy_pass.bc\" -o \"%.*s.bc\" %.*s " - "", - LIT(output_base), LIT(output_base), - LIT(build_context.opt_flags)); -#endif -} - -i32 exec_llvm_llc(String output_base) { - // For more arguments: http://llvm.org/docs/CommandGuide/llc.html -#if defined(GB_SYSTEM_WINDOWS) - return system_exec_command_line_app("llvm-llc", - "\"%.*sbin\\llc\" \"%.*s.bc\" -filetype=obj -O%d " - "-o \"%.*s.obj\" " - "%.*s" - "", - LIT(build_context.ODIN_ROOT), - LIT(output_base), - build_context.optimization_level, - LIT(output_base), - LIT(build_context.llc_flags)); -#else - // NOTE(zangent): Linux / Unix is unfinished and not tested very well. - return system_exec_command_line_app("llc", - "llc \"%.*s.bc\" -filetype=obj -relocation-model=pic -O%d " - "%.*s " - "%s%.*s", - LIT(output_base), - build_context.optimization_level, - LIT(build_context.llc_flags), - build_context.cross_compiling ? "-mtriple=" : "", - cast(int)(build_context.cross_compiling ? build_context.metrics.target_triplet.len : 0), - build_context.metrics.target_triplet.text); -#endif -} - void print_show_help(String const arg0, String const &command) { print_usage_line(0, "%.*s is a tool for managing Odin source code", LIT(arg0)); print_usage_line(0, "Usage"); |