|
#ifndef SLANG_LLVM_H |
|
#define SLANG_LLVM_H |
|
|
|
|
|
|
|
|
|
#define SLANG_DISABLE_EXCEPTIONS 1 |
|
|
|
#ifndef SLANG_PRELUDE_ASSERT |
|
# ifdef SLANG_PRELUDE_ENABLE_ASSERT |
|
extern "C" void assertFailure(const char* msg); |
|
# define SLANG_PRELUDE_EXPECT(VALUE, MSG) if(VALUE) {} else assertFailure("assertion failed: '" MSG "'") |
|
# define SLANG_PRELUDE_ASSERT(VALUE) SLANG_PRELUDE_EXPECT(VALUE, #VALUE) |
|
# else |
|
# define SLANG_PRELUDE_EXPECT(VALUE, MSG) |
|
# define SLANG_PRELUDE_ASSERT(x) |
|
# endif |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
typedef __PTRDIFF_TYPE__ ptrdiff_t; |
|
typedef __SIZE_TYPE__ size_t; |
|
typedef __SIZE_TYPE__ rsize_t; |
|
|
|
|
|
|
|
#if defined(__need_NULL) |
|
#undef NULL |
|
#ifdef __cplusplus |
|
# if !defined(__MINGW32__) && !defined(_MSC_VER) |
|
# define NULL __null |
|
# else |
|
# define NULL 0 |
|
# endif |
|
#else |
|
# define NULL ((void*)0) |
|
#endif |
|
#ifdef __cplusplus |
|
#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) |
|
namespace std { typedef decltype(nullptr) nullptr_t; } |
|
using ::std::nullptr_t; |
|
#endif |
|
#endif |
|
#undef __need_NULL |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __INT64_TYPE__ |
|
# ifndef __int8_t_defined |
|
typedef __INT64_TYPE__ int64_t; |
|
# endif |
|
typedef __UINT64_TYPE__ uint64_t; |
|
# define __int_least64_t int64_t |
|
# define __uint_least64_t uint64_t |
|
#endif |
|
|
|
#ifdef __int_least64_t |
|
typedef __int_least64_t int_least64_t; |
|
typedef __uint_least64_t uint_least64_t; |
|
typedef __int_least64_t int_fast64_t; |
|
typedef __uint_least64_t uint_fast64_t; |
|
#endif |
|
|
|
#ifdef __INT32_TYPE__ |
|
|
|
# ifndef __int8_t_defined |
|
typedef __INT32_TYPE__ int32_t; |
|
# endif |
|
|
|
# ifndef __uint32_t_defined |
|
# define __uint32_t_defined |
|
typedef __UINT32_TYPE__ uint32_t; |
|
# endif |
|
|
|
# define __int_least32_t int32_t |
|
# define __uint_least32_t uint32_t |
|
#endif |
|
|
|
#ifdef __int_least32_t |
|
typedef __int_least32_t int_least32_t; |
|
typedef __uint_least32_t uint_least32_t; |
|
typedef __int_least32_t int_fast32_t; |
|
typedef __uint_least32_t uint_fast32_t; |
|
#endif |
|
|
|
#ifdef __INT16_TYPE__ |
|
#ifndef __int8_t_defined |
|
typedef __INT16_TYPE__ int16_t; |
|
#endif |
|
typedef __UINT16_TYPE__ uint16_t; |
|
# define __int_least16_t int16_t |
|
# define __uint_least16_t uint16_t |
|
#endif |
|
|
|
#ifdef __int_least16_t |
|
typedef __int_least16_t int_least16_t; |
|
typedef __uint_least16_t uint_least16_t; |
|
typedef __int_least16_t int_fast16_t; |
|
typedef __uint_least16_t uint_fast16_t; |
|
#endif |
|
|
|
#ifdef __INT8_TYPE__ |
|
#ifndef __int8_t_defined |
|
typedef __INT8_TYPE__ int8_t; |
|
#endif |
|
typedef __UINT8_TYPE__ uint8_t; |
|
# define __int_least8_t int8_t |
|
# define __uint_least8_t uint8_t |
|
#endif |
|
|
|
#ifdef __int_least8_t |
|
typedef __int_least8_t int_least8_t; |
|
typedef __uint_least8_t uint_least8_t; |
|
typedef __int_least8_t int_fast8_t; |
|
typedef __uint_least8_t uint_fast8_t; |
|
#endif |
|
|
|
|
|
#ifndef __int8_t_defined |
|
# define __int8_t_defined |
|
#endif |
|
|
|
|
|
|
|
#define __stdint_join3(a,b,c) a ## b ## c |
|
|
|
#ifndef _INTPTR_T |
|
#ifndef __intptr_t_defined |
|
typedef __INTPTR_TYPE__ intptr_t; |
|
#define __intptr_t_defined |
|
#define _INTPTR_T |
|
#endif |
|
#endif |
|
|
|
#ifndef _UINTPTR_T |
|
typedef __UINTPTR_TYPE__ uintptr_t; |
|
#define _UINTPTR_T |
|
#endif |
|
|
|
|
|
|
|
typedef __INTMAX_TYPE__ intmax_t; |
|
typedef __UINTMAX_TYPE__ uintmax_t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define __int_c_join(a, b) a ## b |
|
#define __int_c(v, suffix) __int_c_join(v, suffix) |
|
#define __uint_c(v, suffix) __int_c_join(v##U, suffix) |
|
|
|
#ifdef __INT64_TYPE__ |
|
# ifdef __INT64_C_SUFFIX__ |
|
# define __int64_c_suffix __INT64_C_SUFFIX__ |
|
# else |
|
# undef __int64_c_suffix |
|
# endif |
|
#endif |
|
|
|
#ifdef __int_least64_t |
|
# ifdef __int64_c_suffix |
|
# define INT64_C(v) __int_c(v, __int64_c_suffix) |
|
# define UINT64_C(v) __uint_c(v, __int64_c_suffix) |
|
# else |
|
# define INT64_C(v) v |
|
# define UINT64_C(v) v ## U |
|
# endif |
|
#endif |
|
|
|
|
|
#ifdef __INT32_TYPE__ |
|
# ifdef __INT32_C_SUFFIX__ |
|
# define __int32_c_suffix __INT32_C_SUFFIX__ |
|
#else |
|
# undef __int32_c_suffix |
|
# endif |
|
#endif |
|
|
|
#ifdef __int_least32_t |
|
# ifdef __int32_c_suffix |
|
# define INT32_C(v) __int_c(v, __int32_c_suffix) |
|
# define UINT32_C(v) __uint_c(v, __int32_c_suffix) |
|
# else |
|
# define INT32_C(v) v |
|
# define UINT32_C(v) v ## U |
|
# endif |
|
#endif |
|
|
|
#ifdef __INT16_TYPE__ |
|
# ifdef __INT16_C_SUFFIX__ |
|
# define __int16_c_suffix __INT16_C_SUFFIX__ |
|
#else |
|
# undef __int16_c_suffix |
|
# endif |
|
#endif |
|
|
|
#ifdef __int_least16_t |
|
# ifdef __int16_c_suffix |
|
# define INT16_C(v) __int_c(v, __int16_c_suffix) |
|
# define UINT16_C(v) __uint_c(v, __int16_c_suffix) |
|
# else |
|
# define INT16_C(v) v |
|
# define UINT16_C(v) v ## U |
|
# endif |
|
#endif |
|
|
|
|
|
#ifdef __INT8_TYPE__ |
|
# ifdef __INT8_C_SUFFIX__ |
|
# define __int8_c_suffix __INT8_C_SUFFIX__ |
|
#else |
|
# undef __int8_c_suffix |
|
# endif |
|
#endif |
|
|
|
#ifdef __int_least8_t |
|
# ifdef __int8_c_suffix |
|
# define INT8_C(v) __int_c(v, __int8_c_suffix) |
|
# define UINT8_C(v) __uint_c(v, __int8_c_suffix) |
|
# else |
|
# define INT8_C(v) v |
|
# define UINT8_C(v) v ## U |
|
# endif |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __INT64_TYPE__ |
|
# define INT64_MAX INT64_C( 9223372036854775807) |
|
# define INT64_MIN (-INT64_C( 9223372036854775807)-1) |
|
# define UINT64_MAX UINT64_C(18446744073709551615) |
|
# define __INT_LEAST64_MIN INT64_MIN |
|
# define __INT_LEAST64_MAX INT64_MAX |
|
# define __UINT_LEAST64_MAX UINT64_MAX |
|
#endif |
|
|
|
#ifdef __INT_LEAST64_MIN |
|
# define INT_LEAST64_MIN __INT_LEAST64_MIN |
|
# define INT_LEAST64_MAX __INT_LEAST64_MAX |
|
# define UINT_LEAST64_MAX __UINT_LEAST64_MAX |
|
# define INT_FAST64_MIN __INT_LEAST64_MIN |
|
# define INT_FAST64_MAX __INT_LEAST64_MAX |
|
# define UINT_FAST64_MAX __UINT_LEAST64_MAX |
|
#endif |
|
|
|
#ifdef __INT32_TYPE__ |
|
# define INT32_MAX INT32_C(2147483647) |
|
# define INT32_MIN (-INT32_C(2147483647)-1) |
|
# define UINT32_MAX UINT32_C(4294967295) |
|
# define __INT_LEAST32_MIN INT32_MIN |
|
# define __INT_LEAST32_MAX INT32_MAX |
|
# define __UINT_LEAST32_MAX UINT32_MAX |
|
#endif |
|
|
|
#ifdef __INT_LEAST32_MIN |
|
# define INT_LEAST32_MIN __INT_LEAST32_MIN |
|
# define INT_LEAST32_MAX __INT_LEAST32_MAX |
|
# define UINT_LEAST32_MAX __UINT_LEAST32_MAX |
|
# define INT_FAST32_MIN __INT_LEAST32_MIN |
|
# define INT_FAST32_MAX __INT_LEAST32_MAX |
|
# define UINT_FAST32_MAX __UINT_LEAST32_MAX |
|
#endif |
|
|
|
#ifdef __INT16_TYPE__ |
|
#define INT16_MAX INT16_C(32767) |
|
#define INT16_MIN (-INT16_C(32767)-1) |
|
#define UINT16_MAX UINT16_C(65535) |
|
# define __INT_LEAST16_MIN INT16_MIN |
|
# define __INT_LEAST16_MAX INT16_MAX |
|
# define __UINT_LEAST16_MAX UINT16_MAX |
|
#endif |
|
|
|
#ifdef __INT_LEAST16_MIN |
|
# define INT_LEAST16_MIN __INT_LEAST16_MIN |
|
# define INT_LEAST16_MAX __INT_LEAST16_MAX |
|
# define UINT_LEAST16_MAX __UINT_LEAST16_MAX |
|
# define INT_FAST16_MIN __INT_LEAST16_MIN |
|
# define INT_FAST16_MAX __INT_LEAST16_MAX |
|
# define UINT_FAST16_MAX __UINT_LEAST16_MAX |
|
#endif |
|
|
|
|
|
#ifdef __INT8_TYPE__ |
|
# define INT8_MAX INT8_C(127) |
|
# define INT8_MIN (-INT8_C(127)-1) |
|
# define UINT8_MAX UINT8_C(255) |
|
# define __INT_LEAST8_MIN INT8_MIN |
|
# define __INT_LEAST8_MAX INT8_MAX |
|
# define __UINT_LEAST8_MAX UINT8_MAX |
|
#endif |
|
|
|
#ifdef __INT_LEAST8_MIN |
|
# define INT_LEAST8_MIN __INT_LEAST8_MIN |
|
# define INT_LEAST8_MAX __INT_LEAST8_MAX |
|
# define UINT_LEAST8_MAX __UINT_LEAST8_MAX |
|
# define INT_FAST8_MIN __INT_LEAST8_MIN |
|
# define INT_FAST8_MAX __INT_LEAST8_MAX |
|
# define UINT_FAST8_MAX __UINT_LEAST8_MAX |
|
#endif |
|
|
|
|
|
#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN) |
|
#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX) |
|
#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX) |
|
#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v)) |
|
#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v)) |
|
|
|
|
|
|
|
|
|
#define INTPTR_MIN (-__INTPTR_MAX__-1) |
|
#define INTPTR_MAX __INTPTR_MAX__ |
|
#define UINTPTR_MAX __UINTPTR_MAX__ |
|
#define PTRDIFF_MIN (-__PTRDIFF_MAX__-1) |
|
#define PTRDIFF_MAX __PTRDIFF_MAX__ |
|
#define SIZE_MAX __SIZE_MAX__ |
|
|
|
|
|
|
|
#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 |
|
#define RSIZE_MAX (SIZE_MAX >> 1) |
|
#endif |
|
|
|
|
|
#define INTMAX_MIN (-__INTMAX_MAX__-1) |
|
#define INTMAX_MAX __INTMAX_MAX__ |
|
#define UINTMAX_MAX __UINTMAX_MAX__ |
|
|
|
|
|
#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__) |
|
#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__) |
|
#ifdef __WINT_UNSIGNED__ |
|
# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0) |
|
# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__) |
|
#else |
|
# define WINT_MIN __INTN_MIN(__WINT_WIDTH__) |
|
# define WINT_MAX __INTN_MAX(__WINT_WIDTH__) |
|
#endif |
|
|
|
#ifndef WCHAR_MAX |
|
# define WCHAR_MAX __WCHAR_MAX__ |
|
#endif |
|
#ifndef WCHAR_MIN |
|
# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__) |
|
# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__) |
|
# else |
|
# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0) |
|
# endif |
|
#endif |
|
|
|
|
|
#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__) |
|
#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__) |
|
|
|
|
|
#endif |
|
|
|
|
|
|