From 9cee5e0e92e34348ca9a798c81b51a3497154e3f Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 20 Mar 2014 18:43:09 +0000 Subject: PGO: Moving files for clarity llvm-svn: 204373 --- compiler-rt/lib/profile/CMakeLists.txt | 4 +- compiler-rt/lib/profile/InstrProfilingDarwin.c | 25 --------- compiler-rt/lib/profile/InstrProfilingDefault.c | 59 ---------------------- .../lib/profile/InstrProfilingPlatformDarwin.c | 25 +++++++++ .../lib/profile/InstrProfilingPlatformOther.c | 59 ++++++++++++++++++++++ 5 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 compiler-rt/lib/profile/InstrProfilingDarwin.c delete mode 100644 compiler-rt/lib/profile/InstrProfilingDefault.c create mode 100644 compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c create mode 100644 compiler-rt/lib/profile/InstrProfilingPlatformOther.c (limited to 'compiler-rt/lib') diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt index e0e816d2cbe..7de9c5e4b9b 100644 --- a/compiler-rt/lib/profile/CMakeLists.txt +++ b/compiler-rt/lib/profile/CMakeLists.txt @@ -6,7 +6,7 @@ if(APPLE) set(PROFILE_SOURCES GCDAProfiling.c InstrProfiling.c - InstrProfilingDarwin.c + InstrProfilingPlatformDarwin.c InstrProfilingExtras.c) add_compiler_rt_osx_static_runtime(clang_rt.profile_osx @@ -17,7 +17,7 @@ else() set(PROFILE_SOURCES GCDAProfiling.c InstrProfiling.c - InstrProfilingDefault.c + InstrProfilingPlatformOther.c InstrProfilingExtras.c) foreach(arch ${PROFILE_SUPPORTED_ARCH}) diff --git a/compiler-rt/lib/profile/InstrProfilingDarwin.c b/compiler-rt/lib/profile/InstrProfilingDarwin.c deleted file mode 100644 index de388ee5ebd..00000000000 --- a/compiler-rt/lib/profile/InstrProfilingDarwin.c +++ /dev/null @@ -1,25 +0,0 @@ -/*===- InstrProfilingDarwin.c - Profile data on Darwin --------------------===*\ -|* -|* The LLVM Compiler Infrastructure -|* -|* This file is distributed under the University of Illinois Open Source -|* License. See LICENSE.TXT for details. -|* -\*===----------------------------------------------------------------------===*/ - -#include "InstrProfiling.h" - -/* Use linker magic to find the bounds of the Data section. */ -extern __llvm_pgo_data DataStart __asm("section$start$__DATA$__llvm_pgo_data"); -extern __llvm_pgo_data DataEnd __asm("section$end$__DATA$__llvm_pgo_data"); -extern char NamesStart __asm("section$start$__DATA$__llvm_pgo_names"); -extern char NamesEnd __asm("section$end$__DATA$__llvm_pgo_names"); -extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_pgo_cnts"); -extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_pgo_cnts"); - -const __llvm_pgo_data *__llvm_pgo_data_begin() { return &DataStart; } -const __llvm_pgo_data *__llvm_pgo_data_end() { return &DataEnd; } -const char *__llvm_pgo_names_begin() { return &NamesStart; } -const char *__llvm_pgo_names_end() { return &NamesEnd; } -const uint64_t *__llvm_pgo_counters_begin() { return &CountersStart; } -const uint64_t *__llvm_pgo_counters_end() { return &CountersEnd; } diff --git a/compiler-rt/lib/profile/InstrProfilingDefault.c b/compiler-rt/lib/profile/InstrProfilingDefault.c deleted file mode 100644 index d39f39f3718..00000000000 --- a/compiler-rt/lib/profile/InstrProfilingDefault.c +++ /dev/null @@ -1,59 +0,0 @@ -/*===- InstrProfilingDefault.c - Profile data default platfrom ------------===*\ -|* -|* The LLVM Compiler Infrastructure -|* -|* This file is distributed under the University of Illinois Open Source -|* License. See LICENSE.TXT for details. -|* -\*===----------------------------------------------------------------------===*/ - -#include "InstrProfiling.h" - -static const __llvm_pgo_data *DataFirst = NULL; -static const __llvm_pgo_data *DataLast = NULL; -static const char *NamesFirst = NULL; -static const char *NamesLast = NULL; -static const uint64_t *CountersFirst = NULL; -static const uint64_t *CountersLast = NULL; - -/*! - * \brief Register an instrumented function. - * - * Calls to this are emitted by clang with -fprofile-instr-generate. Such - * calls are only required (and only emitted) on targets where we haven't - * implemented linker magic to find the bounds of the sections. - */ -void __llvm_pgo_register_function(void *Data_) { - /* TODO: Only emit this function if we can't use linker magic. */ - const __llvm_pgo_data *Data = (__llvm_pgo_data*)Data_; - if (!DataFirst) { - DataFirst = Data; - DataLast = Data + 1; - NamesFirst = Data->Name; - NamesLast = Data->Name + Data->NameSize; - CountersFirst = Data->Counters; - CountersLast = Data->Counters + Data->NumCounters; - return; - } - -#define UPDATE_FIRST(First, New) \ - First = New < First ? New : First - UPDATE_FIRST(DataFirst, Data); - UPDATE_FIRST(NamesFirst, Data->Name); - UPDATE_FIRST(CountersFirst, Data->Counters); -#undef UPDATE_FIRST - -#define UPDATE_LAST(Last, New) \ - Last = New > Last ? New : Last - UPDATE_LAST(DataLast, Data + 1); - UPDATE_LAST(NamesLast, Data->Name + Data->NameSize); - UPDATE_LAST(CountersLast, Data->Counters + Data->NumCounters); -#undef UPDATE_LAST -} - -const __llvm_pgo_data *__llvm_pgo_data_begin() { return DataFirst; } -const __llvm_pgo_data *__llvm_pgo_data_end() { return DataLast; } -const char *__llvm_pgo_names_begin() { return NamesFirst; } -const char *__llvm_pgo_names_end() { return NamesLast; } -const uint64_t *__llvm_pgo_counters_begin() { return CountersFirst; } -const uint64_t *__llvm_pgo_counters_end() { return CountersLast; } diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c b/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c new file mode 100644 index 00000000000..de388ee5ebd --- /dev/null +++ b/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c @@ -0,0 +1,25 @@ +/*===- InstrProfilingDarwin.c - Profile data on Darwin --------------------===*\ +|* +|* The LLVM Compiler Infrastructure +|* +|* This file is distributed under the University of Illinois Open Source +|* License. See LICENSE.TXT for details. +|* +\*===----------------------------------------------------------------------===*/ + +#include "InstrProfiling.h" + +/* Use linker magic to find the bounds of the Data section. */ +extern __llvm_pgo_data DataStart __asm("section$start$__DATA$__llvm_pgo_data"); +extern __llvm_pgo_data DataEnd __asm("section$end$__DATA$__llvm_pgo_data"); +extern char NamesStart __asm("section$start$__DATA$__llvm_pgo_names"); +extern char NamesEnd __asm("section$end$__DATA$__llvm_pgo_names"); +extern uint64_t CountersStart __asm("section$start$__DATA$__llvm_pgo_cnts"); +extern uint64_t CountersEnd __asm("section$end$__DATA$__llvm_pgo_cnts"); + +const __llvm_pgo_data *__llvm_pgo_data_begin() { return &DataStart; } +const __llvm_pgo_data *__llvm_pgo_data_end() { return &DataEnd; } +const char *__llvm_pgo_names_begin() { return &NamesStart; } +const char *__llvm_pgo_names_end() { return &NamesEnd; } +const uint64_t *__llvm_pgo_counters_begin() { return &CountersStart; } +const uint64_t *__llvm_pgo_counters_end() { return &CountersEnd; } diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c new file mode 100644 index 00000000000..d39f39f3718 --- /dev/null +++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c @@ -0,0 +1,59 @@ +/*===- InstrProfilingDefault.c - Profile data default platfrom ------------===*\ +|* +|* The LLVM Compiler Infrastructure +|* +|* This file is distributed under the University of Illinois Open Source +|* License. See LICENSE.TXT for details. +|* +\*===----------------------------------------------------------------------===*/ + +#include "InstrProfiling.h" + +static const __llvm_pgo_data *DataFirst = NULL; +static const __llvm_pgo_data *DataLast = NULL; +static const char *NamesFirst = NULL; +static const char *NamesLast = NULL; +static const uint64_t *CountersFirst = NULL; +static const uint64_t *CountersLast = NULL; + +/*! + * \brief Register an instrumented function. + * + * Calls to this are emitted by clang with -fprofile-instr-generate. Such + * calls are only required (and only emitted) on targets where we haven't + * implemented linker magic to find the bounds of the sections. + */ +void __llvm_pgo_register_function(void *Data_) { + /* TODO: Only emit this function if we can't use linker magic. */ + const __llvm_pgo_data *Data = (__llvm_pgo_data*)Data_; + if (!DataFirst) { + DataFirst = Data; + DataLast = Data + 1; + NamesFirst = Data->Name; + NamesLast = Data->Name + Data->NameSize; + CountersFirst = Data->Counters; + CountersLast = Data->Counters + Data->NumCounters; + return; + } + +#define UPDATE_FIRST(First, New) \ + First = New < First ? New : First + UPDATE_FIRST(DataFirst, Data); + UPDATE_FIRST(NamesFirst, Data->Name); + UPDATE_FIRST(CountersFirst, Data->Counters); +#undef UPDATE_FIRST + +#define UPDATE_LAST(Last, New) \ + Last = New > Last ? New : Last + UPDATE_LAST(DataLast, Data + 1); + UPDATE_LAST(NamesLast, Data->Name + Data->NameSize); + UPDATE_LAST(CountersLast, Data->Counters + Data->NumCounters); +#undef UPDATE_LAST +} + +const __llvm_pgo_data *__llvm_pgo_data_begin() { return DataFirst; } +const __llvm_pgo_data *__llvm_pgo_data_end() { return DataLast; } +const char *__llvm_pgo_names_begin() { return NamesFirst; } +const char *__llvm_pgo_names_end() { return NamesLast; } +const uint64_t *__llvm_pgo_counters_begin() { return CountersFirst; } +const uint64_t *__llvm_pgo_counters_end() { return CountersLast; } -- cgit v1.2.3