From 27ce5eb0de9f792f3e433bcb239c07d79371cf45 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 10 Sep 2021 16:31:26 -0400 Subject: First Slang LLVM integration (#1934) * #include an absolute path didn't work - because paths were taken to always be relative. * First integration with 'slang-llvm'. * Fix project. * Fix test output. * First pass assert support. * Add inline impls for min and max. * Add abs inline abs impl for llvm. * Make abs not use ternary op * Fix typo in slang-llvm.h * Sundary fixes to make remaining tests using llvm backend pass. --- prelude/slang-cpp-prelude.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'prelude/slang-cpp-prelude.h') diff --git a/prelude/slang-cpp-prelude.h b/prelude/slang-cpp-prelude.h index ffd18cf32..76ff16590 100644 --- a/prelude/slang-cpp-prelude.h +++ b/prelude/slang-cpp-prelude.h @@ -5,17 +5,22 @@ // to use the version in the std namespace. // https://stackoverflow.com/questions/39130040/cmath-hides-isnan-in-math-h-in-c14-c11 -#if SLANG_GCC_FAMILY && __GNUC__ < 6 -# include -# define SLANG_PRELUDE_STD std:: -#else -# include -# define SLANG_PRELUDE_STD -#endif - -#include -#include -#include +#ifdef SLANG_LLVM +# include "slang-llvm.h" +#else // SLANG_LLVM +# if SLANG_GCC_FAMILY && __GNUC__ < 6 +# include +# define SLANG_PRELUDE_STD std:: +# else +# include +# define SLANG_PRELUDE_STD +# endif + +# include +# include +# include +# include +#endif // SLANG_LLVM #if defined(_MSC_VER) # define SLANG_PRELUDE_SHARED_LIB_EXPORT __declspec(dllexport) @@ -26,8 +31,12 @@ #ifdef __cplusplus # define SLANG_PRELUDE_EXTERN_C extern "C" +# define SLANG_PRELUDE_EXTERN_C_START extern "C" { +# define SLANG_PRELUDE_EXTERN_C_END } #else # define SLANG_PRELUDE_EXTERN_C +# define SLANG_PRELUDE_EXTERN_C_START +# define SLANG_PRELUDE_EXTERN_C_END #endif #define SLANG_PRELUDE_EXPORT SLANG_PRELUDE_EXTERN_C SLANG_PRELUDE_SHARED_LIB_EXPORT -- cgit v1.2.3