diff options
author | Xinliang David Li <davidxl@google.com> | 2015-12-10 18:17:01 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2015-12-10 18:17:01 +0000 |
commit | 26bcd193a8c393d27450f21cf93613eb7e02f026 (patch) | |
tree | 38929c0e351c32ced9e05349007897203cf0bf4a | |
parent | 836f0ddb600f1e43dde312280c392c7ecc92c088 (diff) | |
download | bcm5719-llvm-26bcd193a8c393d27450f21cf93613eb7e02f026.tar.gz bcm5719-llvm-26bcd193a8c393d27450f21cf93613eb7e02f026.zip |
[PGO] Header file cleanup (NFC)
InstrProfiling.h file declares profile runtime public APIs.
It has become a dumping place for many different things, which
needs cleanups. In this change, core type declarations and
portability macros are moved to a new file InstrProfilingPort.h.
llvm-svn: 255270
-rw-r--r-- | compiler-rt/lib/profile/InstrProfiling.h | 42 | ||||
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingPort.h | 54 |
2 files changed, 55 insertions, 41 deletions
diff --git a/compiler-rt/lib/profile/InstrProfiling.h b/compiler-rt/lib/profile/InstrProfiling.h index f62a77bccf2..560af584f6e 100644 --- a/compiler-rt/lib/profile/InstrProfiling.h +++ b/compiler-rt/lib/profile/InstrProfiling.h @@ -10,47 +10,7 @@ #ifndef PROFILE_INSTRPROFILING_H_ #define PROFILE_INSTRPROFILING_H_ -#ifdef _MSC_VER -# define LLVM_ALIGNAS(x) __declspec(align(x)) -#elif __GNUC__ -#define LLVM_ALIGNAS(x) __attribute__((aligned(x))) -#endif - -#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden"))) -#define LLVM_SECTION(Sect) __attribute__((section(Sect))) - -#define PROF_ERR(Format, ...) \ - if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS")) \ - fprintf(stderr, Format, __VA_ARGS__); - -extern char *(*GetEnvHook)(const char *); - -#if defined(__FreeBSD__) && defined(__i386__) - -/* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to - * FreeBSD 10, r232261) when compiled in 32-bit mode. - */ -#define PRIu64 "llu" -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -typedef uint32_t uintptr_t; -#elif defined(__FreeBSD__) && defined(__x86_64__) -#define PRIu64 "lu" -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -typedef unsigned long int uintptr_t; - -#else /* defined(__FreeBSD__) && defined(__i386__) */ - -#include <inttypes.h> -#include <stdint.h> - -#endif /* defined(__FreeBSD__) && defined(__i386__) */ - +#include "InstrProfilingPort.h" #include "InstrProfData.inc" enum ValueKind { diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h new file mode 100644 index 00000000000..b75add8ff53 --- /dev/null +++ b/compiler-rt/lib/profile/InstrProfilingPort.h @@ -0,0 +1,54 @@ +/*===- InstrProfilingPort.h- Support library for PGO instrumentation ------===*\ +|* +|* The LLVM Compiler Infrastructure +|* +|* This file is distributed under the University of Illinois Open Source +|* License. See LICENSE.TXT for details. +|* +\*===----------------------------------------------------------------------===*/ + +#ifndef PROFILE_INSTRPROFILING_PORT_H_ +#define PROFILE_INSTRPROFILING_PORT_H_ + +#ifdef _MSC_VER +# define LLVM_ALIGNAS(x) __declspec(align(x)) +#elif __GNUC__ +#define LLVM_ALIGNAS(x) __attribute__((aligned(x))) +#endif + +#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden"))) +#define LLVM_SECTION(Sect) __attribute__((section(Sect))) + +#define PROF_ERR(Format, ...) \ + if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS")) \ + fprintf(stderr, Format, __VA_ARGS__); + +extern char *(*GetEnvHook)(const char *); + +#if defined(__FreeBSD__) && defined(__i386__) + +/* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to + * FreeBSD 10, r232261) when compiled in 32-bit mode. + */ +#define PRIu64 "llu" +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +typedef uint32_t uintptr_t; +#elif defined(__FreeBSD__) && defined(__x86_64__) +#define PRIu64 "lu" +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +typedef unsigned long int uintptr_t; + +#else /* defined(__FreeBSD__) && defined(__i386__) */ + +#include <inttypes.h> +#include <stdint.h> + +#endif /* defined(__FreeBSD__) && defined(__i386__) */ + +#endif /* PROFILE_INSTRPROFILING_PORT_H_ */ |