stage1: clean up timing report in test mode

This commit is contained in:
Andrew Kelley 2018-09-11 20:54:39 -04:00
parent 04dc5cdaca
commit 7e9f25dd18
No known key found for this signature in database
GPG Key ID: 4E7CD66038A4D47C
2 changed files with 10 additions and 5 deletions

View File

@ -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);

View File

@ -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 {