X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FCompiler.h;h=1a49956e22526bbd57fa2cadb3c4bf58da0d1a81;hb=efdcf3d62d52a80c57b8629f294d308fe3d0d180;hp=e0a4e1fc18ead092aec12d747c49180a30fe7cb2;hpb=7bddff5443f7fae98d77df42d5ae3b73667c0e3b;p=oota-llvm.git diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index e0a4e1fc18e..1a49956e225 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -52,14 +52,14 @@ /// \macro LLVM_MSC_PREREQ /// \brief Is the compiler MSVC of at least the specified version? /// The common \param version values to check for are: -/// * 1700: Microsoft Visual Studio 2012 / 11.0 /// * 1800: Microsoft Visual Studio 2013 / 12.0 +/// * 1900: Microsoft Visual Studio 2015 / 14.0 #ifdef _MSC_VER #define LLVM_MSC_PREREQ(version) (_MSC_VER >= (version)) -// We require at least MSVC 2012. -#if !LLVM_MSC_PREREQ(1700) -#error LLVM requires at least MSVC 2012. +// We require at least MSVC 2013. +#if !LLVM_MSC_PREREQ(1800) +#error LLVM requires at least MSVC 2013. #endif #else @@ -82,16 +82,6 @@ #define LLVM_HAS_RVALUE_REFERENCE_THIS 0 #endif -/// \macro LLVM_HAS_VARIADIC_TEMPLATES -/// \brief Does this compiler support variadic templates. -/// -/// Implies LLVM_HAS_RVALUE_REFERENCES and the existence of std::forward. -#if __has_feature(cxx_variadic_templates) || LLVM_MSC_PREREQ(1800) -# define LLVM_HAS_VARIADIC_TEMPLATES 1 -#else -# define LLVM_HAS_VARIADIC_TEMPLATES 0 -#endif - /// Expands to '&' if r-value references are supported. /// /// This can be used to provide l-value/r-value overrides of member functions. @@ -102,24 +92,6 @@ #define LLVM_LVALUE_FUNCTION #endif -/// LLVM_DELETED_FUNCTION - Expands to = delete if the compiler supports it. -/// Use to mark functions as uncallable. Member functions with this should -/// be declared private so that some behavior is kept in C++03 mode. -/// -/// class DontCopy { -/// private: -/// DontCopy(const DontCopy&) LLVM_DELETED_FUNCTION; -/// DontCopy &operator =(const DontCopy&) LLVM_DELETED_FUNCTION; -/// public: -/// ... -/// }; -#if __has_feature(cxx_deleted_functions) || \ - defined(__GXX_EXPERIMENTAL_CXX0X__) || LLVM_MSC_PREREQ(1800) -#define LLVM_DELETED_FUNCTION = delete -#else -#define LLVM_DELETED_FUNCTION -#endif - #if __has_feature(cxx_constexpr) || defined(__GXX_EXPERIMENTAL_CXX0X__) # define LLVM_CONSTEXPR constexpr #else @@ -287,19 +259,12 @@ /// which causes the program to exit abnormally. #if __has_builtin(__builtin_trap) || LLVM_GNUC_PREREQ(4, 3, 0) # define LLVM_BUILTIN_TRAP __builtin_trap() -#elif defined(LLVM_ON_WIN32) -#if defined(_WIN64) -extern "C" __declspec(dllimport) void __stdcall RaiseException( - unsigned long, unsigned long, unsigned long, const unsigned long long *); -#else -extern "C" __declspec(dllimport) void __stdcall RaiseException( - unsigned long, unsigned long, unsigned long, const unsigned long *); -#endif -# define LLVM_BUILTIN_TRAP \ - do { \ - ::RaiseException(0x8000DEAD, 0x1 /*EXCEPTION_NONCONTINUABLE*/, 0, nullptr);\ - __assume(false); \ - } while (0) +#elif defined(_MSC_VER) +// The __debugbreak intrinsic is supported by MSVC, does not require forward +// declarations involving platform-specific typedefs (unlike RaiseException), +// results in a call to vectored exception handlers, and encodes to a short +// instruction that still causes the trapping behavior we want. +# define LLVM_BUILTIN_TRAP __debugbreak() #else # define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0 #endif @@ -316,6 +281,20 @@ extern "C" __declspec(dllimport) void __stdcall RaiseException( # define LLVM_ASSUME_ALIGNED(p, a) (p) #endif +/// \macro LLVM_ALIGNAS +/// \brief Used to specify a minimum alignment for a structure or variable. The +/// alignment must be a constant integer. +/// +/// Note that __declspec(align) has special quirks, it's not legal to pass a +/// structure with __declspec(align) as a formal parameter. +#ifdef _MSC_VER +# define LLVM_ALIGNAS(x) __declspec(align(x)) +#elif __GNUC__ && !__has_feature(cxx_alignas) && !LLVM_GNUC_PREREQ(4, 8, 0) +# define LLVM_ALIGNAS(x) __attribute__((aligned(x))) +#else +# define LLVM_ALIGNAS(x) alignas(x) +#endif + /// \macro LLVM_FUNCTION_NAME /// \brief Expands to __func__ on compilers which support it. Otherwise, /// expands to a compiler-dependent replacement. @@ -357,26 +336,6 @@ extern "C" __declspec(dllimport) void __stdcall RaiseException( # define LLVM_IS_UNALIGNED_ACCESS_FAST 0 #endif -/// \macro LLVM_EXPLICIT -/// \brief Expands to explicit on compilers which support explicit conversion -/// operators. Otherwise expands to nothing. -#if __has_feature(cxx_explicit_conversions) || \ - defined(__GXX_EXPERIMENTAL_CXX0X__) || LLVM_MSC_PREREQ(1800) -#define LLVM_EXPLICIT explicit -#else -#define LLVM_EXPLICIT -#endif - -/// \brief Does the compiler support generalized initializers (using braced -/// lists and std::initializer_list). While clang may claim it supports general -/// initializers, if we're using MSVC's headers, we might not have a usable -/// std::initializer list type from the STL. Disable this for now. -#if __has_feature(cxx_generalized_initializers) && !defined(_MSC_VER) -#define LLVM_HAS_INITIALIZER_LISTS 1 -#else -#define LLVM_HAS_INITIALIZER_LISTS 0 -#endif - /// \brief Mark debug helper function definitions like dump() that should not be /// stripped from debug builds. // FIXME: Move this to a private config.h as it's not usable in public headers.