ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
host_defines.h
Go to the documentation of this file.
1#ifndef __HOST_DEFINES_H__
2#define __HOST_DEFINES_H__
3
4#ifdef __cplusplus
5
6extern "C"
7{
8#endif
9
10#if defined(__GNUC__) || defined(__CUDA_LIBDEVICE__)
11
12# define __no_return__ __attribute__((noreturn))
13
14# if defined(__CUDACC__) || defined(__CUDA_ARCH__)
15/* gcc allows users to define attributes with underscores,
16 e.g., __attribute__((__noinline__)).
17 Consider a non-CUDA source file (e.g. .cpp) that has the
18 above attribute specification, and includes this header file. In that case,
19 defining __noinline__ as below would cause a gcc compilation error.
20 Hence, only define __noinline__ when the code is being processed
21 by a CUDA compiler component.
22*/
23# define __noinline__ __attribute__((noinline))
24# endif /* __CUDACC__ || __CUDA_ARCH__ */
25
26# define __forceinline__ __inline__ __attribute__((always_inline))
27# define __align__(n) __attribute__((aligned(n)))
28# define __thread__ __thread
29# define __import__
30# define __export__
31# define __cdecl
32# define __annotate__(a) __attribute__((a))
33# define __location__(a) __annotate__(a)
34# define CUDARTAPI
35
36#elif defined(_MSC_VER)
37
38# if _MSC_VER >= 1400
39
40# define __restrict__ __restrict
41
42# else /* _MSC_VER >= 1400 */
43
44# define __restrict__
45
46# endif /* _MSC_VER >= 1400 */
47
48# define __inline__ __inline
49# define __no_return__ __declspec(noreturn)
50# define __noinline__ __declspec(noinline)
51# define __forceinline__ __forceinline
52# define __align__(n) __declspec(align(n))
53# define __thread__ __declspec(thread)
54# define __import__ __declspec(dllimport)
55# define __export__ __declspec(dllexport)
56# define __annotate__(a) __declspec(a)
57# define __location__(a) __annotate__(__##a##__)
58# define CUDARTAPI __stdcall
59
60#else /* __GNUC__ || __CUDA_LIBDEVICE__ */
61
62# define __inline__
63
64# if !defined(__align__)
65
66# error --- !!! UNKNOWN COMPILER: please provide a CUDA compatible definition for '__align__' !!! ---
67
68# endif /* !__align__ */
69
70# if !defined(CUDARTAPI)
71
72# error --- !!! UNKNOWN COMPILER: please provide a CUDA compatible definition for 'CUDARTAPI' !!! ---
73
74# endif /* !CUDARTAPI */
75
76#endif /* !__GNUC__ */
77
78#if !defined(__GNUC__) || __GNUC__ < 4 || \
79 (__GNUC__ == 4 && __GNUC_MINOR__ < 3 && !defined(__clang__))
80
81# define __specialization_static static
82
83#else /* !__GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) */
84
85# define __specialization_static
86
87#endif /* !__GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) \
88 */
89
90#if !defined(__CUDACC__) && !defined(__CUDABE__)
91
92# undef __annotate__
93# define __annotate__(a)
94
95#else /* !__CUDACC__ && !__CUDABE__ */
96
97# define __launch_bounds__(...) __annotate__(launch_bounds(__VA_ARGS__))
98
99#endif /* !__CUDACC__ && !__CUDABE__ */
100
101#if defined(__CUDACC__) || defined(__CUDABE__) || defined(__GNUC__) || \
102 defined(_WIN64)
103
104# define __builtin_align__(a) __align__(a)
105
106#else /* __CUDACC__ || __CUDABE__ || __GNUC__ || _WIN64 */
107
108# define __builtin_align__(a)
109
110#endif /* __CUDACC__ || __CUDABE__ || __GNUC__ || _WIN64 */
111
112#define __host__ __location__(host)
113#define __device__ __location__(device)
114#define __global__ __location__(global)
115#define __shared__ __location__(shared)
116#define __constant__ __location__(constant)
117#define __managed__ __location__(managed)
118
119#if defined(__CUDABE__) || !defined(__CUDACC__)
120# define __device_builtin__
121# define __device_builtin_texture_type__
122# define __device_builtin_surface_type__
123# define __cudart_builtin__
124#else /* __CUDABE__ || !__CUDACC__ */
125# define __device_builtin__ __location__(device_builtin)
126# define __device_builtin_texture_type__ \
127 __location__(device_builtin_texture_type)
128# define __device_builtin_surface_type__ \
129 __location__(device_builtin_surface_type)
130# define __cudart_builtin__ __location__(cudart_builtin)
131#endif /* __CUDABE__ || !__CUDACC__ */
132
133#ifdef __cplusplus
134}
135
136#endif
137
138#endif /* !__HOST_DEFINES_H__ */