Skip to content

Commit

Permalink
Merge pull request #35680 from JuliaLang/tb/llvm_pass_timings
Browse files Browse the repository at this point in the history
Report LLVM timings and statistics during teardown.
  • Loading branch information
maleadt committed May 3, 2020
2 parents 61dd0ae + 2846714 commit dd1e525
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@
// support
#include <llvm/ADT/SmallBitVector.h>
#include <llvm/ADT/Optional.h>
#include <llvm/ADT/Statistic.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/FormattedStream.h>
#include <llvm/Support/SourceMgr.h> // for llvmcall
#include <llvm/Transforms/Utils/Cloning.h> // for llvmcall inlining
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
#include <llvm/IR/Verifier.h> // for llvmcall validation
#include <llvm/IR/PassTimingInfo.h>
#include <llvm/Bitcode/BitcodeWriter.h>

// C API
Expand Down Expand Up @@ -7598,6 +7600,13 @@ extern "C" void jl_init_codegen(void)
jl_init_intrinsic_functions_codegen(m);
}

extern "C" void jl_teardown_codegen()
{
// output LLVM timings and statistics
reportAndResetTimings();
PrintStatistics();
}

// the rest of this file are convenience functions
// that are exported for assisting with debugging from gdb
extern "C" void jl_dump_llvm_value(void *v)
Expand Down
2 changes: 2 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ JL_DLLEXPORT void jl_atexit_hook(int exitcode)
#ifdef ENABLE_TIMINGS
jl_print_timings();
#endif

jl_teardown_codegen();
}

static void post_boot_hooks(void);
Expand Down
2 changes: 2 additions & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ void jl_init_uv(void);
void jl_init_debuginfo(void);
void jl_init_thread_heap(jl_ptls_t ptls);

void jl_teardown_codegen(void);

void _julia_init(JL_IMAGE_SEARCH rel);

void jl_set_base_ctx(char *__stk);
Expand Down

0 comments on commit dd1e525

Please sign in to comment.