forked from OSchip/llvm-project
[profile] Flatten profile runtime - define platform-specific code in sources, not in the build system
llvm-svn: 206915
This commit is contained in:
parent
6a9cf2629a
commit
01be4280be
|
@ -1,27 +1,20 @@
|
||||||
add_custom_target(profile)
|
add_custom_target(profile)
|
||||||
|
|
||||||
if(APPLE)
|
set(PROFILE_SOURCES
|
||||||
set(PROFILE_SOURCES
|
GCDAProfiling.c
|
||||||
GCDAProfiling.c
|
InstrProfiling.c
|
||||||
InstrProfiling.c
|
InstrProfilingBuffer.c
|
||||||
InstrProfilingBuffer.c
|
InstrProfilingFile.c
|
||||||
InstrProfilingFile.c
|
InstrProfilingPlatformDarwin.c
|
||||||
InstrProfilingPlatformDarwin.c
|
InstrProfilingPlatformOther.c
|
||||||
InstrProfilingRuntime.cc)
|
InstrProfilingRuntime.cc)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
add_compiler_rt_osx_static_runtime(clang_rt.profile_osx
|
add_compiler_rt_osx_static_runtime(clang_rt.profile_osx
|
||||||
ARCH ${PROFILE_SUPPORTED_ARCH}
|
ARCH ${PROFILE_SUPPORTED_ARCH}
|
||||||
SOURCES ${PROFILE_SOURCES})
|
SOURCES ${PROFILE_SOURCES})
|
||||||
add_dependencies(profile clang_rt.profile_osx)
|
add_dependencies(profile clang_rt.profile_osx)
|
||||||
else()
|
else()
|
||||||
set(PROFILE_SOURCES
|
|
||||||
GCDAProfiling.c
|
|
||||||
InstrProfiling.c
|
|
||||||
InstrProfilingBuffer.c
|
|
||||||
InstrProfilingFile.c
|
|
||||||
InstrProfilingPlatformOther.c
|
|
||||||
InstrProfilingRuntime.cc)
|
|
||||||
|
|
||||||
foreach(arch ${PROFILE_SUPPORTED_ARCH})
|
foreach(arch ${PROFILE_SUPPORTED_ARCH})
|
||||||
add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC
|
add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC
|
||||||
SOURCES ${PROFILE_SOURCES})
|
SOURCES ${PROFILE_SOURCES})
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "InstrProfiling.h"
|
#include "InstrProfiling.h"
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
/* Use linker magic to find the bounds of the Data section. */
|
/* Use linker magic to find the bounds of the Data section. */
|
||||||
extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data");
|
extern __llvm_profile_data DataStart __asm("section$start$__DATA$__llvm_prf_data");
|
||||||
extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data");
|
extern __llvm_profile_data DataEnd __asm("section$end$__DATA$__llvm_prf_data");
|
||||||
|
@ -27,3 +28,4 @@ const char *__llvm_profile_names_begin(void) { return &NamesStart; }
|
||||||
const char *__llvm_profile_names_end(void) { return &NamesEnd; }
|
const char *__llvm_profile_names_end(void) { return &NamesEnd; }
|
||||||
uint64_t *__llvm_profile_counters_begin(void) { return &CountersStart; }
|
uint64_t *__llvm_profile_counters_begin(void) { return &CountersStart; }
|
||||||
uint64_t *__llvm_profile_counters_end(void) { return &CountersEnd; }
|
uint64_t *__llvm_profile_counters_end(void) { return &CountersEnd; }
|
||||||
|
#endif
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
\*===----------------------------------------------------------------------===*/
|
\*===----------------------------------------------------------------------===*/
|
||||||
|
|
||||||
#include "InstrProfiling.h"
|
#include "InstrProfiling.h"
|
||||||
|
|
||||||
|
#if !defined(__APPLE__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static const __llvm_profile_data *DataFirst = NULL;
|
static const __llvm_profile_data *DataFirst = NULL;
|
||||||
|
@ -62,3 +64,4 @@ const char *__llvm_profile_names_begin(void) { return NamesFirst; }
|
||||||
const char *__llvm_profile_names_end(void) { return NamesLast; }
|
const char *__llvm_profile_names_end(void) { return NamesLast; }
|
||||||
uint64_t *__llvm_profile_counters_begin(void) { return CountersFirst; }
|
uint64_t *__llvm_profile_counters_begin(void) { return CountersFirst; }
|
||||||
uint64_t *__llvm_profile_counters_end(void) { return CountersLast; }
|
uint64_t *__llvm_profile_counters_end(void) { return CountersLast; }
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue