Reimplement opt stage

This commit is contained in:
gingerBill
2018-01-20 16:16:59 +00:00
parent 4e90644527
commit 8b288a2072
3 changed files with 34 additions and 40 deletions
+1 -3
View File
@@ -41,12 +41,10 @@ set linker_settings=%libs% %linker_flags%
del *.pdb > NUL 2> NUL del *.pdb > NUL 2> NUL
del *.ilk > NUL 2> NUL del *.ilk > NUL 2> NUL
rem odin run examples/node-lang/node-lang.odin && goto end_of_build
cl %compiler_settings% "src\main.cpp" ^ cl %compiler_settings% "src\main.cpp" ^
/link %linker_settings% -OUT:%exe_name% ^ /link %linker_settings% -OUT:%exe_name% ^
&& odin build examples/demo.odin -show-timings && odin run examples/demo.odin
rem && odin docs core/fmt.odin rem && odin docs core/fmt.odin
del *.obj > NUL 2> NUL del *.obj > NUL 2> NUL
+1 -5
View File
@@ -665,11 +665,7 @@ named_proc_parameters :: proc() {
} }
main :: proc() { main :: proc() {
Foo :: union { when true {
}
when false {
general_stuff(); general_stuff();
default_struct_values(); default_struct_values();
union_type(); union_type();
+32 -32
View File
@@ -719,42 +719,42 @@ int main(int arg_count, char **arg_ptr) {
i32 exit_code = 0; i32 exit_code = 0;
// timings_start_section(&timings, str_lit("llvm-opt")); timings_start_section(&timings, str_lit("llvm-opt"));
// #if defined(GB_SYSTEM_WINDOWS) #if defined(GB_SYSTEM_WINDOWS)
// // For more passes arguments: http://llvm.org/docs/Passes.html // For more passes arguments: http://llvm.org/docs/Passes.html
// exit_code = system_exec_command_line_app("llvm-opt", false, exit_code = system_exec_command_line_app("llvm-opt", false,
// "\"%.*sbin/opt\" \"%.*s\".ll -o \"%.*s\".bc %.*s " "\"%.*sbin/opt\" \"%.*s\".ll -o \"%.*s\".bc %.*s "
// "-mem2reg " "-mem2reg "
// "-memcpyopt " "-memcpyopt "
// "-die " "-die "
// "", "",
// LIT(build_context.ODIN_ROOT), LIT(build_context.ODIN_ROOT),
// LIT(output_base), LIT(output_base), LIT(output_base), LIT(output_base),
// LIT(build_context.opt_flags)); LIT(build_context.opt_flags));
// if (exit_code != 0) { if (exit_code != 0) {
// return exit_code; return exit_code;
// } }
// #else #else
// // NOTE(zangent): This is separate because it seems that LLVM tools are packaged // 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 // with the Windows version, while they will be system-provided on MacOS and GNU/Linux
// exit_code = system_exec_command_line_app("llvm-opt", false, exit_code = system_exec_command_line_app("llvm-opt", false,
// "opt \"%.*s.ll\" -o \"%.*s\".bc %.*s " "opt \"%.*s.ll\" -o \"%.*s\".bc %.*s "
// "-mem2reg " "-mem2reg "
// "-memcpyopt " "-memcpyopt "
// "-die " "-die "
// "", "",
// LIT(output_base), LIT(output_base), LIT(output_base), LIT(output_base),
// LIT(build_context.opt_flags)); LIT(build_context.opt_flags));
// if (exit_code != 0) { if (exit_code != 0) {
// return exit_code; return exit_code;
// } }
// #endif #endif
#if defined(GB_SYSTEM_WINDOWS) #if defined(GB_SYSTEM_WINDOWS)
timings_start_section(&timings, str_lit("llvm-llc")); timings_start_section(&timings, str_lit("llvm-llc"));
// For more arguments: http://llvm.org/docs/CommandGuide/llc.html // For more arguments: http://llvm.org/docs/CommandGuide/llc.html
exit_code = system_exec_command_line_app("llvm-llc", false, exit_code = system_exec_command_line_app("llvm-llc", false,
"\"%.*sbin/llc\" \"%.*s.ll\" -filetype=obj -O%d " "\"%.*sbin/llc\" \"%.*s.bc\" -filetype=obj -O%d "
"-o \"%.*s.obj\" " "-o \"%.*s.obj\" "
"%.*s " "%.*s "
// "-debug-pass=Arguments " // "-debug-pass=Arguments "
@@ -829,7 +829,7 @@ int main(int arg_count, char **arg_ptr) {
timings_start_section(&timings, str_lit("llvm-llc")); timings_start_section(&timings, str_lit("llvm-llc"));
// For more arguments: http://llvm.org/docs/CommandGuide/llc.html // For more arguments: http://llvm.org/docs/CommandGuide/llc.html
exit_code = system_exec_command_line_app("llc", false, exit_code = system_exec_command_line_app("llc", false,
"llc \"%.*s.ll\" -filetype=obj -relocation-model=pic -O%d " "llc \"%.*s.bc\" -filetype=obj -relocation-model=pic -O%d "
"%.*s " "%.*s "
// "-debug-pass=Arguments " // "-debug-pass=Arguments "
"%s" "%s"