Commit dd662d21 by Alexis Hetu Committed by Alexis Hétu

SwiftShader on Fuchsia x64

This cl contains the necessary config and build changes to make SwiftShader work on Fuchsia x64. Passes all tests in content_unittests. Bug: chromium:739182 Change-Id: I7df44bd6b12b2560f18e4375f16ada3850f1d8a5 Reviewed-on: https://swiftshader-review.googlesource.com/20208Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent d7622ffd
......@@ -113,7 +113,7 @@ private:
const char *libEGL_lib[] = {"libswiftshader_libEGL.dylib", "libEGL_translator.dylib", "libEGL.so", "libEGL.dylib"};
#endif
#elif defined(__Fuchsia__)
const char *libEGL_lib[] = {"libEGL.so"};
const char *libEGL_lib[] = {"libswiftshader_libEGL.so", "libEGL.so"};
#else
#error "libEGL::loadExports unimplemented for this platform"
#endif
......
......@@ -299,7 +299,7 @@ private:
const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dylib", "libGLES_V2_translator.dylib", "libGLESv2.dylib"};
#endif
#elif defined(__Fuchsia__)
const char *libGLESv2_lib[] = {"libGLESv2.so"};
const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.so", "libGLESv2.so"};
#else
#error "libGLESv2::loadExports unimplemented for this platform"
#endif
......
......@@ -15,9 +15,7 @@
import("../swiftshader.gni")
declare_args() {
# Currently, Subzero is not used by default
# LLVM is still the default backend
use_swiftshader_with_subzero = is_win || is_linux || is_mac || is_chromeos
use_swiftshader_with_subzero = true
}
# Need a separate config to ensure the warnings are added to the end.
......@@ -59,6 +57,8 @@ config("swiftshader_subzero_common_private_config") {
include_dirs += [ "../../third_party/llvm-subzero/build/Windows/include/" ]
} else if (is_linux) {
include_dirs += [ "../../third_party/llvm-subzero/build/Linux/include/" ]
} else if (is_fuchsia) {
include_dirs += [ "../../third_party/llvm-subzero/build/Fuchsia/include/" ]
} else if (is_mac) {
include_dirs += [ "../../third_party/llvm-subzero/build/MacOS/include/" ]
}
......@@ -95,13 +95,17 @@ config("swiftshader_subzero_private_config") {
cflags += [ "-Wno-sign-compare" ]
}
}
} else if (is_linux || is_mac) {
} else if (is_linux || is_mac || is_fuchsia) {
cflags += [ "-Wno-macro-redefined" ]
}
if (is_clang) {
cflags += [ "-Wno-header-hygiene" ]
}
if (is_fuchsia) {
cflags += [ "-Wno-error" ]
}
}
config("swiftshader_reactor_with_subzero_private_config") {
......@@ -136,6 +140,10 @@ config("swiftshader_reactor_with_subzero_private_config") {
if (is_clang) {
cflags += [ "-Wno-header-hygiene" ]
}
if (is_fuchsia) {
cflags += [ "-Wno-error" ]
}
}
config("swiftshader_reactor_private_config") {
......
......@@ -50,6 +50,10 @@ config("swiftshader_llvm_private_config") {
}
}
if (is_fuchsia) {
cflags += [ "-Wno-error" ]
}
if (is_clang) {
cflags += [
"-msse2",
......
......@@ -157,10 +157,10 @@
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getrlimit' function. */
#define HAVE_GETRLIMIT 1
/* #undef HAVE_GETRLIMIT */
/* Define to 1 if you have the `getrusage' function. */
#define HAVE_GETRUSAGE 1
/* #undef HAVE_GETRUSAGE */
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
......@@ -345,7 +345,7 @@
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
/* #undef HAVE_SETRLIMIT */
/* Define if you have the shl_load function. */
#undef HAVE_SHL_LOAD
......@@ -431,7 +431,7 @@
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* #undef HAVE_SYS_RESOURCE_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
......
/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/
/* */
/* The LLVM Compiler Infrastructure */
/* */
/* This file is distributed under the University of Illinois Open Source */
/* License. See LICENSE.TXT for details. */
/* */
/*===----------------------------------------------------------------------===*/
/* This file controls the C++ ABI break introduced in LLVM public header. */
#ifndef LLVM_ABI_BREAKING_CHECKS_H
#define LLVM_ABI_BREAKING_CHECKS_H
/* Define to enable checks that alter the LLVM C++ ABI */
#define LLVM_ENABLE_ABI_BREAKING_CHECKS 1
/* Define to disable the link-time checking of mismatch for
LLVM_ENABLE_ABI_BREAKING_CHECKS */
#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1
#if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
// mismatch with LLVM
#if defined(_MSC_VER)
// Use pragma with MSVC
#define LLVM_XSTR(s) LLVM_STR(s)
#define LLVM_STR(s) #s
#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
#undef LLVM_XSTR
#undef LLVM_STR
#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
// FIXME: Implement checks without weak.
#elif defined(__cplusplus)
namespace llvm {
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
extern int EnableABIBreakingChecks;
__attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks;
#else
extern int DisableABIBreakingChecks;
__attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks;
#endif
}
#endif // _MSC_VER
#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
#endif
#ifndef CONFIG_H
#define CONFIG_H
/* Exported configuration */
#include "llvm/Config/llvm-config.h"
/* Bug report URL. */
#define BUG_REPORT_URL "http://llvm.org/bugs/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */
#define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */
#define ENABLE_CRASH_OVERRIDES 1
/* Define to 1 if you have the `backtrace' function. */
#define HAVE_BACKTRACE 1
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
/* #undef HAVE_CRASHREPORTERCLIENT_H */
/* can use __crashreporter_info__ */
#define HAVE_CRASHREPORTER_INFO 0
/* Define to 1 if you have the declaration of `arc4random', and to 0 if you
don't. */
#define HAVE_DECL_ARC4RANDOM 0
/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
don't. */
#define HAVE_DECL_FE_ALL_EXCEPT 1
/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you
don't. */
#define HAVE_DECL_FE_INEXACT 1
/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
don't. */
#define HAVE_DECL_STRERROR_S 0
/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */
#define HAVE_DIA_SDK 0
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define if dlopen() is available on this platform. */
#define HAVE_DLOPEN 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <fenv.h> header file. */
#define HAVE_FENV_H 1
/* Define if libffi is available on this platform. */
/* #undef HAVE_FFI_CALL */
/* Define to 1 if you have the <ffi/ffi.h> header file. */
/* #undef HAVE_FFI_FFI_H */
/* Define to 1 if you have the <ffi.h> header file. */
/* #undef HAVE_FFI_H */
/* Define to 1 if you have the `futimens' function. */
#define HAVE_FUTIMENS 1
/* Define to 1 if you have the `futimes' function. */
#define HAVE_FUTIMES 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getrlimit' function. */
/* #undef HAVE_GETRLIMIT */
/* Define to 1 if you have the `getrusage' function. */
/* #undef HAVE_GETRUSAGE */
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if the system has the type `int64_t'. */
#define HAVE_INT64_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isatty' function. */
#define HAVE_ISATTY 1
/* Define to 1 if you have the `edit' library (-ledit). */
/* #undef HAVE_LIBEDIT */
/* Define to 1 if you have the `psapi' library (-lpsapi). */
/* #undef HAVE_LIBPSAPI */
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the `shell32' library (-lshell32). */
/* #undef HAVE_LIBSHELL32 */
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <link.h> header file. */
#define HAVE_LINK_H 1
/* Define to 1 if you have the `lseek64' function. */
/* #undef HAVE_LSEEK64 */
/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */
/* Define to 1 if you have the `mallctl' function. */
/* #undef HAVE_MALLCTL */
/* Define to 1 if you have the `mallinfo' function. */
/* #undef HAVE_MALLINFO */
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <malloc/malloc.h> header file. */
/* #undef HAVE_MALLOC_MALLOC_H */
/* Define to 1 if you have the `malloc_zone_statistics' function. */
/* #undef HAVE_MALLOC_ZONE_STATISTICS */
/* Define to 1 if you have the `mkdtemp' function. */
#define HAVE_MKDTEMP 1
/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1
/* Define to 1 if you have the `mktemp' function. */
#define HAVE_MKTEMP 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the `posix_fallocate' function. */
#define HAVE_POSIX_FALLOCATE 1
/* Define to 1 if you have the `posix_spawn' function. */
#define HAVE_POSIX_SPAWN 1
/* Define to 1 if you have the `pread' function. */
#define HAVE_PREAD 1
/* Have pthread_getspecific */
#define HAVE_PTHREAD_GETSPECIFIC 1
/* Define to 1 if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1
/* Have pthread_mutex_lock */
#define HAVE_PTHREAD_MUTEX_LOCK 1
/* Have pthread_rwlock_init */
#define HAVE_PTHREAD_RWLOCK_INIT 1
/* Define to 1 if you have the `realpath' function. */
#define HAVE_REALPATH 1
/* Define to 1 if you have the `sbrk' function. */
/* #undef HAVE_SBRK */
/* Define to 1 if you have the `setenv' function. */
#define HAVE_SETENV 1
/* Define to 1 if you have the `setrlimit' function. */
/* #undef HAVE_SETRLIMIT */
/* Define to 1 if you have the `sigaltstack' function. */
#define HAVE_SIGALTSTACK 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strerror_r' function. */
#define HAVE_STRERROR_R 1
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#define HAVE_SYS_DIR_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
/* #undef HAVE_SYS_RESOURCE_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define if the setupterm() function is supported this platform. */
/* #undef HAVE_TERMINFO */
/* Define if the xar_open() function is supported this platform. */
/* #undef HAVE_LIBXAR */
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if the system has the type `uint64_t'. */
#define HAVE_UINT64_T 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if the system has the type `u_int64_t'. */
#define HAVE_U_INT64_T 1
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
/* #undef HAVE_VALGRIND_VALGRIND_H */
/* Define to 1 if you have the `writev' function. */
#define HAVE_WRITEV 1
/* Define to 1 if you have the <zlib.h> header file. */
#define HAVE_ZLIB_H 1
/* Have host's _alloca */
/* #undef HAVE__ALLOCA */
/* Define to 1 if you have the `_chsize_s' function. */
/* #undef HAVE__CHSIZE_S */
/* Define to 1 if you have the `_Unwind_Backtrace' function. */
#define HAVE__UNWIND_BACKTRACE 1
/* Have host's __alloca */
/* #undef HAVE___ALLOCA */
/* Have host's __ashldi3 */
/* #undef HAVE___ASHLDI3 */
/* Have host's __ashrdi3 */
/* #undef HAVE___ASHRDI3 */
/* Have host's __chkstk */
/* #undef HAVE___CHKSTK */
/* Have host's __chkstk_ms */
/* #undef HAVE___CHKSTK_MS */
/* Have host's __cmpdi2 */
/* #undef HAVE___CMPDI2 */
/* Have host's __divdi3 */
/* #undef HAVE___DIVDI3 */
/* Have host's __fixdfdi */
/* #undef HAVE___FIXDFDI */
/* Have host's __fixsfdi */
/* #undef HAVE___FIXSFDI */
/* Have host's __floatdidf */
/* #undef HAVE___FLOATDIDF */
/* Have host's __lshrdi3 */
/* #undef HAVE___LSHRDI3 */
/* Have host's __main */
/* #undef HAVE___MAIN */
/* Have host's __moddi3 */
/* #undef HAVE___MODDI3 */
/* Have host's __udivdi3 */
/* #undef HAVE___UDIVDI3 */
/* Have host's __umoddi3 */
/* #undef HAVE___UMODDI3 */
/* Have host's ___chkstk */
/* #undef HAVE____CHKSTK */
/* Have host's ___chkstk_ms */
/* #undef HAVE____CHKSTK_MS */
/* Linker version detected at compile time. */
/* #undef HOST_LINK_VERSION */
/* Define if we link Polly to the tools */
/* #undef LINK_POLLY_INTO_TOOLS */
/* Target triple LLVM will generate code for by default */
/* Doesn't use `cmakedefine` because it is allowed to be empty. */
#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64-unknown-linux-gnu"
/* Define if threads enabled */
#define LLVM_ENABLE_THREADS 1
/* Define if zlib compression is available */
#define LLVM_ENABLE_ZLIB 1
/* Has gcc/MSVC atomic intrinsics */
#define LLVM_HAS_ATOMICS 1
/* Host triple LLVM will be executed on */
#define LLVM_HOST_TRIPLE "x86_64-unknown-linux-gnu"
/* LLVM architecture name for the native architecture, if available */
#define LLVM_NATIVE_ARCH X86
/* LLVM name for the native AsmParser init function, if available */
#define LLVM_NATIVE_ASMPARSER LLVMInitializeX86AsmParser
/* LLVM name for the native AsmPrinter init function, if available */
#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
/* LLVM name for the native Disassembler init function, if available */
#define LLVM_NATIVE_DISASSEMBLER LLVMInitializeX86Disassembler
/* LLVM name for the native Target init function, if available */
#define LLVM_NATIVE_TARGET LLVMInitializeX86Target
/* LLVM name for the native TargetInfo init function, if available */
#define LLVM_NATIVE_TARGETINFO LLVMInitializeX86TargetInfo
/* LLVM name for the native target MC init function, if available */
#define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC
/* Define if this is Unixish platform */
#define LLVM_ON_UNIX 1
/* Define if this is Win32ish platform */
/* #undef LLVM_ON_WIN32 */
/* Installation prefix directory */
#define LLVM_PREFIX "/usr/local"
/* Define if we have the Intel JIT API runtime support library */
#define LLVM_USE_INTEL_JITEVENTS 0
/* Define if we have the oprofile JIT-support library */
#define LLVM_USE_OPROFILE 0
/* LLVM version information */
/* #undef LLVM_VERSION_INFO */
/* Major version of the LLVM API */
#define LLVM_VERSION_MAJOR 4
/* Minor version of the LLVM API */
#define LLVM_VERSION_MINOR 0
/* Patch version of the LLVM API */
#define LLVM_VERSION_PATCH 0
/* LLVM version string */
#define LLVM_VERSION_STRING "4.0.0svn"
/* Define to the extension used for shared libraries, say, ".so". */
#define LTDL_SHLIB_EXT ".so"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "http://llvm.org/bugs/"
/* Define to the full name of this package. */
#define PACKAGE_NAME "LLVM"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "LLVM 4.0.0svn"
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.0.0svn"
/* Define to the vendor of this package. */
/* #undef PACKAGE_VENDOR */
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to a function replacing strtoll */
/* #undef strtoll */
/* Define to a function implementing strtoull */
/* #undef strtoull */
/* Define to a function implementing stricmp */
/* #undef stricmp */
/* Define to a function implementing strdup */
/* #undef strdup */
#endif
/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/
/* */
/* The LLVM Compiler Infrastructure */
/* */
/* This file is distributed under the University of Illinois Open Source */
/* License. See LICENSE.TXT for details. */
/* */
/*===----------------------------------------------------------------------===*/
/* This file enumerates variables from the LLVM configuration so that they
can be in exported headers and won't override package specific directives.
This is a C header that can be included in the llvm-c headers. */
#ifndef LLVM_CONFIG_H
#define LLVM_CONFIG_H
/* Define if we link Polly to the tools */
/* #undef LINK_POLLY_INTO_TOOLS */
/* Target triple LLVM will generate code for by default */
#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64-unknown-linux-gnu"
/* Define if threads enabled */
#define LLVM_ENABLE_THREADS 1
/* Has gcc/MSVC atomic intrinsics */
#define LLVM_HAS_ATOMICS 1
/* Host triple LLVM will be executed on */
#define LLVM_HOST_TRIPLE "x86_64-unknown-linux-gnu"
/* LLVM architecture name for the native architecture, if available */
#define LLVM_NATIVE_ARCH X86
/* LLVM name for the native AsmParser init function, if available */
#define LLVM_NATIVE_ASMPARSER LLVMInitializeX86AsmParser
/* LLVM name for the native AsmPrinter init function, if available */
#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
/* LLVM name for the native Disassembler init function, if available */
#define LLVM_NATIVE_DISASSEMBLER LLVMInitializeX86Disassembler
/* LLVM name for the native Target init function, if available */
#define LLVM_NATIVE_TARGET LLVMInitializeX86Target
/* LLVM name for the native TargetInfo init function, if available */
#define LLVM_NATIVE_TARGETINFO LLVMInitializeX86TargetInfo
/* LLVM name for the native target MC init function, if available */
#define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC
/* Define if this is Unixish platform */
#define LLVM_ON_UNIX 1
/* Define if this is Win32ish platform */
/* #undef LLVM_ON_WIN32 */
/* Installation prefix directory */
#define LLVM_PREFIX "/usr/local"
/* Define if we have the Intel JIT API runtime support library */
#define LLVM_USE_INTEL_JITEVENTS 0
/* Define if we have the oprofile JIT-support library */
#define LLVM_USE_OPROFILE 0
/* Major version of the LLVM API */
#define LLVM_VERSION_MAJOR 4
/* Minor version of the LLVM API */
#define LLVM_VERSION_MINOR 0
/* Patch version of the LLVM API */
#define LLVM_VERSION_PATCH 0
/* LLVM version string */
#define LLVM_VERSION_STRING "4.0.0svn"
#endif
#ifdef GET_ATTR_ENUM
#undef GET_ATTR_ENUM
Alignment,
AllocSize,
AlwaysInline,
ArgMemOnly,
Builtin,
ByVal,
Cold,
Convergent,
Dereferenceable,
DereferenceableOrNull,
InAlloca,
InReg,
InaccessibleMemOnly,
InaccessibleMemOrArgMemOnly,
InlineHint,
JumpTable,
MinSize,
Naked,
Nest,
NoAlias,
NoBuiltin,
NoCapture,
NoDuplicate,
NoImplicitFloat,
NoInline,
NoRecurse,
NoRedZone,
NoReturn,
NoUnwind,
NonLazyBind,
NonNull,
OptimizeForSize,
OptimizeNone,
ReadNone,
ReadOnly,
Returned,
ReturnsTwice,
SExt,
SafeStack,
SanitizeAddress,
SanitizeMemory,
SanitizeThread,
StackAlignment,
StackProtect,
StackProtectReq,
StackProtectStrong,
StructRet,
SwiftError,
SwiftSelf,
UWTable,
WriteOnly,
ZExt,
#endif
#ifdef GET_ATTR_KIND_FROM_NAME
#undef GET_ATTR_KIND_FROM_NAME
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName) {
return StringSwitch<Attribute::AttrKind>(AttrName)
.Case("align", Attribute::Alignment)
.Case("allocsize", Attribute::AllocSize)
.Case("alwaysinline", Attribute::AlwaysInline)
.Case("argmemonly", Attribute::ArgMemOnly)
.Case("builtin", Attribute::Builtin)
.Case("byval", Attribute::ByVal)
.Case("cold", Attribute::Cold)
.Case("convergent", Attribute::Convergent)
.Case("dereferenceable", Attribute::Dereferenceable)
.Case("dereferenceable_or_null", Attribute::DereferenceableOrNull)
.Case("inalloca", Attribute::InAlloca)
.Case("inreg", Attribute::InReg)
.Case("inaccessiblememonly", Attribute::InaccessibleMemOnly)
.Case("inaccessiblemem_or_argmemonly", Attribute::InaccessibleMemOrArgMemOnly)
.Case("inlinehint", Attribute::InlineHint)
.Case("jumptable", Attribute::JumpTable)
.Case("minsize", Attribute::MinSize)
.Case("naked", Attribute::Naked)
.Case("nest", Attribute::Nest)
.Case("noalias", Attribute::NoAlias)
.Case("nobuiltin", Attribute::NoBuiltin)
.Case("nocapture", Attribute::NoCapture)
.Case("noduplicate", Attribute::NoDuplicate)
.Case("noimplicitfloat", Attribute::NoImplicitFloat)
.Case("noinline", Attribute::NoInline)
.Case("norecurse", Attribute::NoRecurse)
.Case("noredzone", Attribute::NoRedZone)
.Case("noreturn", Attribute::NoReturn)
.Case("nounwind", Attribute::NoUnwind)
.Case("nonlazybind", Attribute::NonLazyBind)
.Case("nonnull", Attribute::NonNull)
.Case("optsize", Attribute::OptimizeForSize)
.Case("optnone", Attribute::OptimizeNone)
.Case("readnone", Attribute::ReadNone)
.Case("readonly", Attribute::ReadOnly)
.Case("returned", Attribute::Returned)
.Case("returns_twice", Attribute::ReturnsTwice)
.Case("signext", Attribute::SExt)
.Case("safestack", Attribute::SafeStack)
.Case("sanitize_address", Attribute::SanitizeAddress)
.Case("sanitize_memory", Attribute::SanitizeMemory)
.Case("sanitize_thread", Attribute::SanitizeThread)
.Case("alignstack", Attribute::StackAlignment)
.Case("ssp", Attribute::StackProtect)
.Case("sspreq", Attribute::StackProtectReq)
.Case("sspstrong", Attribute::StackProtectStrong)
.Case("sret", Attribute::StructRet)
.Case("swifterror", Attribute::SwiftError)
.Case("swiftself", Attribute::SwiftSelf)
.Case("uwtable", Attribute::UWTable)
.Case("writeonly", Attribute::WriteOnly)
.Case("zeroext", Attribute::ZExt)
.Default(Attribute::None);
}
#endif
#ifdef GET_ATTR_COMPAT_FUNC
#undef GET_ATTR_COMPAT_FUNC
struct EnumAttr {
static bool isSet(const Function &Fn,
Attribute::AttrKind Kind) {
return Fn.hasFnAttribute(Kind);
}
static void set(Function &Fn,
Attribute::AttrKind Kind, bool Val) {
if (Val)
Fn.addFnAttr(Kind);
else
Fn.removeFnAttr(Kind);
}
};
struct StrBoolAttr {
static bool isSet(const Function &Fn,
StringRef Kind) {
auto A = Fn.getFnAttribute(Kind);
return A.getValueAsString().equals("true");
}
static void set(Function &Fn,
StringRef Kind, bool Val) {
Fn.addFnAttr(Kind, Val ? "true" : "false");
}
};
// EnumAttr classes
struct AlignmentAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Alignment;
}
};
struct AllocSizeAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::AllocSize;
}
};
struct AlwaysInlineAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::AlwaysInline;
}
};
struct ArgMemOnlyAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::ArgMemOnly;
}
};
struct BuiltinAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Builtin;
}
};
struct ByValAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::ByVal;
}
};
struct ColdAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Cold;
}
};
struct ConvergentAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Convergent;
}
};
struct DereferenceableAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Dereferenceable;
}
};
struct DereferenceableOrNullAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::DereferenceableOrNull;
}
};
struct InAllocaAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::InAlloca;
}
};
struct InRegAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::InReg;
}
};
struct InaccessibleMemOnlyAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::InaccessibleMemOnly;
}
};
struct InaccessibleMemOrArgMemOnlyAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::InaccessibleMemOrArgMemOnly;
}
};
struct InlineHintAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::InlineHint;
}
};
struct JumpTableAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::JumpTable;
}
};
struct MinSizeAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::MinSize;
}
};
struct NakedAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Naked;
}
};
struct NestAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Nest;
}
};
struct NoAliasAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoAlias;
}
};
struct NoBuiltinAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoBuiltin;
}
};
struct NoCaptureAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoCapture;
}
};
struct NoDuplicateAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoDuplicate;
}
};
struct NoImplicitFloatAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoImplicitFloat;
}
};
struct NoInlineAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoInline;
}
};
struct NoRecurseAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoRecurse;
}
};
struct NoRedZoneAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoRedZone;
}
};
struct NoReturnAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoReturn;
}
};
struct NoUnwindAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NoUnwind;
}
};
struct NonLazyBindAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NonLazyBind;
}
};
struct NonNullAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::NonNull;
}
};
struct OptimizeForSizeAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::OptimizeForSize;
}
};
struct OptimizeNoneAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::OptimizeNone;
}
};
struct ReadNoneAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::ReadNone;
}
};
struct ReadOnlyAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::ReadOnly;
}
};
struct ReturnedAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::Returned;
}
};
struct ReturnsTwiceAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::ReturnsTwice;
}
};
struct SExtAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SExt;
}
};
struct SafeStackAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SafeStack;
}
};
struct SanitizeAddressAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SanitizeAddress;
}
};
struct SanitizeMemoryAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SanitizeMemory;
}
};
struct SanitizeThreadAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SanitizeThread;
}
};
struct StackAlignmentAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::StackAlignment;
}
};
struct StackProtectAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::StackProtect;
}
};
struct StackProtectReqAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::StackProtectReq;
}
};
struct StackProtectStrongAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::StackProtectStrong;
}
};
struct StructRetAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::StructRet;
}
};
struct SwiftErrorAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SwiftError;
}
};
struct SwiftSelfAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::SwiftSelf;
}
};
struct UWTableAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::UWTable;
}
};
struct WriteOnlyAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::WriteOnly;
}
};
struct ZExtAttr : EnumAttr {
static enum Attribute::AttrKind getKind() {
return llvm::Attribute::ZExt;
}
};
// StrBoolAttr classes
struct LessPreciseFPMADAttr : StrBoolAttr {
static StringRef getKind() {
return "less-precise-fpmad";
}
};
struct NoInfsFPMathAttr : StrBoolAttr {
static StringRef getKind() {
return "no-infs-fp-math";
}
};
struct NoJumpTablesAttr : StrBoolAttr {
static StringRef getKind() {
return "no-jump-tables";
}
};
struct NoNansFPMathAttr : StrBoolAttr {
static StringRef getKind() {
return "no-nans-fp-math";
}
};
struct UnsafeFPMathAttr : StrBoolAttr {
static StringRef getKind() {
return "unsafe-fp-math";
}
};
static inline bool hasCompatibleFnAttrs(const Function &Caller,
const Function &Callee) {
bool Ret = true;
Ret &= isEqual<SanitizeAddressAttr>(Caller, Callee);
Ret &= isEqual<SanitizeThreadAttr>(Caller, Callee);
Ret &= isEqual<SanitizeMemoryAttr>(Caller, Callee);
Ret &= isEqual<SafeStackAttr>(Caller, Callee);
return Ret;
}
static inline void mergeFnAttrs(Function &Caller,
const Function &Callee) {
adjustCallerSSPLevel(Caller, Callee);
setAND<LessPreciseFPMADAttr>(Caller, Callee);
setAND<NoInfsFPMathAttr>(Caller, Callee);
setAND<NoNansFPMathAttr>(Caller, Callee);
setAND<UnsafeFPMathAttr>(Caller, Callee);
setOR<NoImplicitFloatAttr>(Caller, Callee);
setOR<NoJumpTablesAttr>(Caller, Callee);
}
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
/*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file contains definitions to figure out the size of _HOST_ data types.*|
|* This file is important because different host OS's define different macros,*|
|* which makes portability tough. This file exports the following *|
|* definitions: *|
|* *|
|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
|* *|
|* No library is required when using these functions. *|
|* *|
|*===----------------------------------------------------------------------===*/
/* Please leave this file C-compatible. */
#ifndef SUPPORT_DATATYPES_H
#define SUPPORT_DATATYPES_H
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UINT64_T 1
#define HAVE_U_INT64_T 1
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif
#ifdef __cplusplus
#include <cinttypes>
#else
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#endif
#ifdef __cplusplus
#include <cstdint>
#else
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#error "Compiler must provide an implementation of stdint.h"
#endif
#endif
#ifndef _MSC_VER
#if !defined(UINT32_MAX)
# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
"__STDC_LIMIT_MACROS before #including Support/DataTypes.h"
#endif
#if !defined(UINT32_C)
# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
"__STDC_CONSTANT_MACROS before #including Support/DataTypes.h"
#endif
/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
#include <sys/types.h>
#ifdef _AIX
// GCC is strict about defining large constants: they must have LL modifier.
#undef INT64_MAX
#undef INT64_MIN
#endif
/* Handle incorrect definition of uint64_t as u_int64_t */
#ifndef HAVE_UINT64_T
#ifdef HAVE_U_INT64_T
typedef u_int64_t uint64_t;
#else
# error "Don't have a definition for uint64_t on this platform"
#endif
#endif
#else /* _MSC_VER */
#ifdef __cplusplus
#include <cstdlib>
#include <cstddef>
#else
#include <stdlib.h>
#include <stddef.h>
#endif
#include <sys/types.h>
#if defined(_WIN64)
typedef signed __int64 ssize_t;
#else
typedef signed int ssize_t;
#endif /* _WIN64 */
#ifndef HAVE_INTTYPES_H
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIo64 "I64o"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#define PRId32 "d"
#define PRIi32 "i"
#define PRIo32 "o"
#define PRIu32 "u"
#define PRIx32 "x"
#define PRIX32 "X"
#endif /* HAVE_INTTYPES_H */
#endif /* _MSC_VER */
/* Set defaults for constants which we cannot find. */
#if !defined(INT64_MAX)
# define INT64_MAX 9223372036854775807LL
#endif
#if !defined(INT64_MIN)
# define INT64_MIN ((-INT64_MAX)-1)
#endif
#if !defined(UINT64_MAX)
# define UINT64_MAX 0xffffffffffffffffULL
#endif
#ifndef HUGE_VALF
#define HUGE_VALF (float)HUGE_VAL
#endif
#endif /* SUPPORT_DATATYPES_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment