llvm/openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h


//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _ITTNOTIFY_CONFIG_H_
#define _ITTNOTIFY_CONFIG_H_

/** @cond exclude_from_documentation */
#ifndef ITT_OS_WIN
#define ITT_OS_WIN
#endif /* ITT_OS_WIN */

#ifndef ITT_OS_LINUX
#define ITT_OS_LINUX
#endif /* ITT_OS_LINUX */

#ifndef ITT_OS_MAC
#define ITT_OS_MAC
#endif /* ITT_OS_MAC */

#ifndef ITT_OS_FREEBSD
#define ITT_OS_FREEBSD
#endif /* ITT_OS_FREEBSD */

#ifndef ITT_OS
#if defined WIN32 || defined _WIN32
#define ITT_OS
#elif defined(__APPLE__) && defined(__MACH__)
#define ITT_OS
#elif defined(__FreeBSD__)
#define ITT_OS
#else
#define ITT_OS
#endif
#endif /* ITT_OS */

#ifndef ITT_PLATFORM_WIN
#define ITT_PLATFORM_WIN
#endif /* ITT_PLATFORM_WIN */

#ifndef ITT_PLATFORM_POSIX
#define ITT_PLATFORM_POSIX
#endif /* ITT_PLATFORM_POSIX */

#ifndef ITT_PLATFORM_MAC
#define ITT_PLATFORM_MAC
#endif /* ITT_PLATFORM_MAC */

#ifndef ITT_PLATFORM_FREEBSD
#define ITT_PLATFORM_FREEBSD
#endif /* ITT_PLATFORM_FREEBSD */

#ifndef ITT_PLATFORM
#if ITT_OS == ITT_OS_WIN
#define ITT_PLATFORM
#elif ITT_OS == ITT_OS_MAC
#define ITT_PLATFORM
#elif ITT_OS == ITT_OS_FREEBSD
#define ITT_PLATFORM
#else
#define ITT_PLATFORM
#endif
#endif /* ITT_PLATFORM */

#if defined(_UNICODE) && !defined(UNICODE)
#define UNICODE
#endif

#include <stddef.h>
#if ITT_PLATFORM == ITT_PLATFORM_WIN
#include <tchar.h>
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
#include <stdint.h>
#if defined(UNICODE) || defined(_UNICODE)
#include <wchar.h>
#endif /* UNICODE || _UNICODE */
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */

#ifndef ITTAPI_CDECL
#if ITT_PLATFORM == ITT_PLATFORM_WIN
#define ITTAPI_CDECL
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
#if defined _M_IX86 || defined __i386__
#define ITTAPI_CDECL
#else /* _M_IX86 || __i386__ */
#define ITTAPI_CDECL
#endif /* _M_IX86 || __i386__ */
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
#endif /* ITTAPI_CDECL */

#ifndef STDCALL
#if ITT_PLATFORM == ITT_PLATFORM_WIN
#define STDCALL
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
#if defined _M_IX86 || defined __i386__
#define STDCALL
#else /* _M_IX86 || __i386__ */
#define STDCALL
#endif /* _M_IX86 || __i386__ */
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
#endif /* STDCALL */

#define ITTAPI
#define LIBITTAPI

/* TODO: Temporary for compatibility! */
#define ITTAPI_CALL
#define LIBITTAPI_CALL

#if ITT_PLATFORM == ITT_PLATFORM_WIN
/* use __forceinline (VC++ specific) */
#if defined(__MINGW32__) && !defined(__cplusplus)
#define ITT_INLINE
#else
#define ITT_INLINE
#endif /* __MINGW32__ */

#define ITT_INLINE_ATTRIBUTE
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
/*
 * Generally, functions are not inlined unless optimization is specified.
 * For functions declared inline, this attribute inlines the function even
 * if no optimization level was specified.
 */
#ifdef __STRICT_ANSI__
#define ITT_INLINE
#define ITT_INLINE_ATTRIBUTE
#else /* __STRICT_ANSI__ */
#define ITT_INLINE
#define ITT_INLINE_ATTRIBUTE
#endif /* __STRICT_ANSI__ */
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
/** @endcond */

#ifndef ITT_ARCH_IA32
#define ITT_ARCH_IA32
#endif /* ITT_ARCH_IA32 */

#ifndef ITT_ARCH_IA32E
#define ITT_ARCH_IA32E
#endif /* ITT_ARCH_IA32E */

#ifndef ITT_ARCH_IA64
#define ITT_ARCH_IA64
#endif /* ITT_ARCH_IA64 */

#ifndef ITT_ARCH_ARM
#define ITT_ARCH_ARM
#endif /* ITT_ARCH_ARM */

#ifndef ITT_ARCH_PPC64
#define ITT_ARCH_PPC64
#endif /* ITT_ARCH_PPC64 */

#ifndef ITT_ARCH_ARM64
#define ITT_ARCH_ARM64
#endif /* ITT_ARCH_ARM64 */

#ifndef ITT_ARCH_VE
#define ITT_ARCH_VE
#endif /* ITT_ARCH_VE */

#ifndef ITT_ARCH_S390X
#define ITT_ARCH_S390X
#endif /* ITT_ARCH_S390X */

#ifndef ITT_ARCH
#if defined _M_IX86 || defined __i386__
#define ITT_ARCH
#elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
#define ITT_ARCH
#elif defined _M_IA64 || defined __ia64__
#define ITT_ARCH
#elif defined _M_ARM || defined __arm__
#define ITT_ARCH
#elif defined __aarch64__
#define ITT_ARCH
#elif defined __powerpc64__
#define ITT_ARCH
#elif defined __ve__
#define ITT_ARCH
#elif defined __s390x__
#define ITT_ARCH
#endif
#endif

#ifdef __cplusplus
#define ITT_EXTERN_C
#define ITT_EXTERN_C_BEGIN
#define ITT_EXTERN_C_END
#else
#define ITT_EXTERN_C
#define ITT_EXTERN_C_BEGIN
#define ITT_EXTERN_C_END
#endif /* __cplusplus */

#define ITT_TO_STR_AUX(x)
#define ITT_TO_STR(x)

#define __ITT_BUILD_ASSERT(expr, suffix)
#define _ITT_BUILD_ASSERT(expr, suffix)
#define ITT_BUILD_ASSERT(expr)

#define ITT_MAGIC

/* Replace with snapshot date YYYYMMDD for promotion build. */
#define API_VERSION_BUILD

#ifndef API_VERSION_NUM
#define API_VERSION_NUM
#endif /* API_VERSION_NUM */

#define API_VERSION

/* OS communication functions */
#if ITT_PLATFORM == ITT_PLATFORM_WIN
#include <windows.h>
typedef HMODULE lib_t;
typedef DWORD TIDT;
typedef CRITICAL_SECTION mutex_t;
#ifdef __cplusplus
#define MUTEX_INITIALIZER
#else
#define MUTEX_INITIALIZER
#endif
#define strong_alias
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
#include <dlfcn.h>
#if defined(UNICODE) || defined(_UNICODE)
#include <wchar.h>
#endif /* UNICODE */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif /* _GNU_SOURCE */
#ifndef __USE_UNIX98
#define __USE_UNIX98
#endif /*__USE_UNIX98*/
#include <pthread.h>
lib_t;
TIDT;
mutex_t;
#define MUTEX_INITIALIZER
#define _strong_alias(name, aliasname)
#define strong_alias(name, aliasname)
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */

#if ITT_PLATFORM == ITT_PLATFORM_WIN
#define __itt_get_proc
#define __itt_mutex_init
#define __itt_mutex_lock
#define __itt_mutex_unlock
#define __itt_load_lib
#define __itt_unload_lib
#define __itt_system_error
#define __itt_fstrcmp
#define __itt_fstrnlen
#define __itt_fstrcpyn
#define __itt_fstrdup
#define __itt_thread_id
#define __itt_thread_yield
#ifndef ITT_SIMPLE_INIT
ITT_INLINE long
__itt_interlocked_increment(volatile long *ptr) ITT_INLINE_ATTRIBUTE;
ITT_INLINE long __itt_interlocked_increment(volatile long *ptr) {
  return InterlockedIncrement(ptr);
}
#endif /* ITT_SIMPLE_INIT */

#define DL_SYMBOLS
#define PTHREAD_SYMBOLS

#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
#define __itt_get_proc(lib, name)
#define __itt_mutex_init(mutex)
#define __itt_mutex_lock(mutex)
#define __itt_mutex_unlock(mutex)
#define __itt_load_lib(name)
#define __itt_unload_lib(handle)
#define __itt_system_error()
#define __itt_fstrcmp(s1, s2)

/* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */
#ifdef SDL_STRNLEN_S
#define __itt_fstrnlen
#else
#define __itt_fstrnlen(s, l)
#endif /* SDL_STRNLEN_S */
#ifdef SDL_STRNCPY_S
#define __itt_fstrcpyn
#else
#define __itt_fstrcpyn(s1, b, s2, l)
#endif /* SDL_STRNCPY_S */

#define __itt_fstrdup(s)
#define __itt_thread_id()
#define __itt_thread_yield()
#if ITT_ARCH == ITT_ARCH_IA64
#ifdef __INTEL_COMPILER
#define __TBB_machine_fetchadd4
#else /* __INTEL_COMPILER */
/* TODO: Add Support for not Intel compilers for IA-64 architecture */
#endif /* __INTEL_COMPILER */
#elif ITT_ARCH == ITT_ARCH_IA32 ||                                             \
    ITT_ARCH == ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */
ITT_INLINE long __TBB_machine_fetchadd4(volatile void *ptr,
                                        long addend) ITT_INLINE_ATTRIBUTE;
ITT_INLINE long __TBB_machine_fetchadd4(volatile void *ptr, long addend) {}
#else
#define __TBB_machine_fetchadd4
#endif /* ITT_ARCH==ITT_ARCH_IA64 */
#ifndef ITT_SIMPLE_INIT
ITT_INLINE long
__itt_interlocked_increment(volatile long *ptr) ITT_INLINE_ATTRIBUTE;
ITT_INLINE long __itt_interlocked_increment(volatile long *ptr) {}
#endif /* ITT_SIMPLE_INIT */

void *dlopen(const char *, int) __attribute__((weak));
void *dlsym(void *, const char *) __attribute__((weak));
int dlclose(void *) __attribute__((weak));
#define DL_SYMBOLS

int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *)
    __attribute__((weak));
int pthread_mutex_lock(pthread_mutex_t *) __attribute__((weak));
int pthread_mutex_unlock(pthread_mutex_t *) __attribute__((weak));
int pthread_mutex_destroy(pthread_mutex_t *) __attribute__((weak));
int pthread_mutexattr_init(pthread_mutexattr_t *) __attribute__((weak));
int pthread_mutexattr_settype(pthread_mutexattr_t *, int) __attribute__((weak));
int pthread_mutexattr_destroy(pthread_mutexattr_t *) __attribute__((weak));
pthread_t pthread_self(void) __attribute__((weak));
#define PTHREAD_SYMBOLS

#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */

__itt_collection_state;

__itt_thread_state;

#pragma pack(push, 8)

__itt_thread_info;

#include "ittnotify_types.h" /* For __itt_group_id definition */

__itt_api_info_20101001;

__itt_api_info;

__itt_counter_info_t;

struct ___itt_domain;
struct ___itt_string_handle;
struct ___itt_histogram;

__itt_global;

#pragma pack(pop)

#define NEW_THREAD_INFO_W(gptr, h, h_tail, t, s, n)

#define NEW_THREAD_INFO_A(gptr, h, h_tail, t, s, n)

#define NEW_DOMAIN_W(gptr, h, h_tail, name)

#define NEW_DOMAIN_A(gptr, h, h_tail, name)

#define NEW_STRING_HANDLE_W(gptr, h, h_tail, name)

#define NEW_STRING_HANDLE_A(gptr, h, h_tail, name)

#define NEW_COUNTER_W(gptr, h, h_tail, name, domain, type)

#define NEW_COUNTER_A(gptr, h, h_tail, name, domain, type)

#define NEW_HISTOGRAM_W(gptr, h, h_tail, domain, name, x_type, y_type)

#define NEW_HISTOGRAM_A(gptr, h, h_tail, domain, name, x_type, y_type)

#endif /* _ITTNOTIFY_CONFIG_H_ */