]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/lib/profile/InstrProfilingPort.h
e07f5987873084ab895afb80bab8440329c1b259
1 /*===- InstrProfilingPort.h- Support library for PGO instrumentation ------===*\
3 |* The LLVM Compiler Infrastructure
5 |* This file is distributed under the University of Illinois Open Source
6 |* License. See LICENSE.TXT for details.
8 \*===----------------------------------------------------------------------===*/
10 #ifndef PROFILE_INSTRPROFILING_PORT_H_
11 #define PROFILE_INSTRPROFILING_PORT_H_
14 #define COMPILER_RT_ALIGNAS(x) __declspec(align(x))
15 #define COMPILER_RT_VISIBILITY
16 #define COMPILER_RT_WEAK __declspec(selectany)
18 #define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x)))
19 #define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden")))
20 #define COMPILER_RT_WEAK __attribute__((weak))
23 #define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect)))
25 #if COMPILER_RT_HAS_ATOMICS == 1
29 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV) \
30 (InterlockedCompareExchange64((LONGLONG volatile *)Ptr, (LONGLONG)NewV, \
31 (LONGLONG)OldV) == (LONGLONG)OldV)
32 #else /* !defined(_WIN64) */
33 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV) \
34 (InterlockedCompareExchange((LONG volatile *)Ptr, (LONG)NewV, (LONG)OldV) == \
37 #else /* !defined(_MSC_VER) */
38 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV) \
39 __sync_bool_compare_and_swap(Ptr, OldV, NewV)
41 #else /* COMPILER_RT_HAS_ATOMICS != 1 */
42 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV) \
43 BoolCmpXchg((void **)Ptr, OldV, NewV)
46 #define PROF_ERR(Format, ...) \
47 if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS")) \
48 fprintf(stderr, Format, __VA_ARGS__);
50 #if defined(__FreeBSD__)
53 #include <sys/types.h>
55 #else /* defined(__FreeBSD__) */
60 #endif /* defined(__FreeBSD__) && defined(__i386__) */
62 #endif /* PROFILE_INSTRPROFILING_PORT_H_ */