diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-20 19:23:53 +0000 | 
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-20 19:23:53 +0000 | 
| commit | 775c178a90d8859a5da939d738fad248fde6edcd (patch) | |
| tree | d17e6c76c1c82ebde6a55a4d38537ebd90f279c7 /compiler-rt/lib/profile/InstrProfilingExtras.c | |
| parent | 5188e91cd4c7463029654119860e972541e8dd42 (diff) | |
| download | bcm5719-llvm-775c178a90d8859a5da939d738fad248fde6edcd.tar.gz bcm5719-llvm-775c178a90d8859a5da939d738fad248fde6edcd.zip | |
PGO: Add explicit static initialization
Instead of relying on explicit static initialization from translation
units, create a new file, InstrProfilingRuntime.cc, with an
__llvm_pgo_runtime variable.  After this commit (and its pair in clang),
the driver will create a use of this variable.  Unless the user defines
their own version, the new object file will get pulled in, including
that C++ static initialization that calls
__llvm_pgo_register_write_atexit.
The result is that, at least on Darwin, static initialization typically
consists of a single function call, which registers a writeout functino
atexit.  Furthermore, users can skip even this behaviour by defining
their own __llvm_pgo_runtime.
<rdar://problem/15943240>
llvm-svn: 204380
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfilingExtras.c')
| -rw-r--r-- | compiler-rt/lib/profile/InstrProfilingExtras.c | 5 | 
1 files changed, 0 insertions, 5 deletions
| diff --git a/compiler-rt/lib/profile/InstrProfilingExtras.c b/compiler-rt/lib/profile/InstrProfilingExtras.c index 03399a3477f..45a7f8ce52c 100644 --- a/compiler-rt/lib/profile/InstrProfilingExtras.c +++ b/compiler-rt/lib/profile/InstrProfilingExtras.c @@ -9,7 +9,6 @@  #include "InstrProfiling.h" -/*! \brief Write instrumentation data to the given file. */  void __llvm_pgo_write_file(const char *OutputName) {    /* TODO: Requires libc: move to separate translation unit. */    FILE *OutputFile; @@ -26,7 +25,6 @@ void __llvm_pgo_write_file(const char *OutputName) {    fclose(OutputFile);  } -/*! \brief Write instrumentation data to the default file. */  void __llvm_pgo_write_default_file() {    /* TODO: Requires libc: move to separate translation unit. */    const char *OutputName = getenv("LLVM_PROFILE_FILE"); @@ -35,9 +33,6 @@ void __llvm_pgo_write_default_file() {    __llvm_pgo_write_file(OutputName);  } -/*! - * \brief Register to write instrumentation data to the default file at exit. - */  void __llvm_pgo_register_write_atexit() {    /* TODO: Requires libc: move to separate translation unit. */    static int HasBeenRegistered = 0; | 

