From 7e9f25dd18b7da750e547de94a779e3c14c07d94 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 11 Sep 2018 20:54:39 -0400 Subject: [PATCH] stage1: clean up timing report in test mode --- src/codegen.cpp | 7 +++++-- src/main.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index af42f324b..96e979f9d 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -6388,9 +6388,9 @@ static void do_code_gen(CodeGen *g) { char *error = nullptr; LLVMVerifyModule(g->module, LLVMAbortProcessAction, &error); #endif +} - codegen_add_time_event(g, "LLVM Emit Output"); - +static void zig_llvm_emit_output(CodeGen *g) { bool is_small = g->build_mode == BuildModeSmallRelease; Buf *output_path = &g->o_file_output_path; @@ -8228,6 +8228,9 @@ void codegen_build_and_link(CodeGen *g) { codegen_add_time_event(g, "Code Generation"); do_code_gen(g); + codegen_add_time_event(g, "LLVM Emit Output"); + zig_llvm_emit_output(g); + if (g->want_h_file) { codegen_add_time_event(g, "Generate .h"); gen_h_file(g); diff --git a/src/main.cpp b/src/main.cpp index e4019f10d..1751fabfe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -971,6 +971,11 @@ int main(int argc, char **argv) { g->enable_cache = get_cache_opt(enable_cache, false); codegen_build_and_link(g); + + if (timing_info) { + codegen_print_timing_report(g, stdout); + } + Buf *test_exe_path_unresolved = &g->output_file_path; Buf *test_exe_path = buf_alloc(); *test_exe_path = os_path_resolve(&test_exe_path_unresolved, 1); @@ -981,7 +986,6 @@ int main(int argc, char **argv) { } } - if (!target_can_exec(&native, target)) { fprintf(stderr, "Created %s but skipping execution because it is non-native.\n", buf_ptr(test_exe_path)); @@ -1003,8 +1007,6 @@ int main(int argc, char **argv) { if (term.how != TerminationIdClean || term.code != 0) { fprintf(stderr, "\nTests failed. Use the following command to reproduce the failure:\n"); fprintf(stderr, "%s\n", buf_ptr(test_exe_path)); - } else if (timing_info) { - codegen_print_timing_report(g, stdout); } return (term.how == TerminationIdClean) ? term.code : -1; } else {