Vendor import of llvm trunk r241361:
https://llvm.org/svn/llvm-project/llvm/trunk@241361
This commit is contained in:
parent
3a0822f094
commit
1a82d4c088
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/llvm/dist/; revision=285163 svn path=/vendor/llvm/llvm-trunk-r241361/; revision=285164; tag=vendor/llvm/llvm-trunk-r241361
4
.gitignore
vendored
4
.gitignore
vendored
@ -43,9 +43,7 @@ autoconf/autom4te.cache
|
||||
# Directories to ignore (do not add trailing '/'s, they skip symlinks).
|
||||
#==============================================================================#
|
||||
# External projects that are tracked independently.
|
||||
projects/*
|
||||
!projects/CMakeLists.txt
|
||||
!projects/Makefile
|
||||
projects/*/
|
||||
# Clang, which is tracked independently.
|
||||
tools/clang
|
||||
# LLDB, which is tracked independently.
|
||||
|
@ -530,7 +530,7 @@ endif()
|
||||
# check its symbols. This is wasteful (the check was done when foo.so
|
||||
# was created) and can fail since it is not the dynamic linker and
|
||||
# doesn't know how to handle search paths correctly.
|
||||
if (UNIX AND NOT APPLE)
|
||||
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
|
||||
endif()
|
||||
|
@ -65,6 +65,10 @@ N: Hal Finkel
|
||||
E: hfinkel@anl.gov
|
||||
D: BBVectorize, the loop reroller, alias analysis and the PowerPC target
|
||||
|
||||
N: Dan Gohman
|
||||
E: sunfish@mozilla.com
|
||||
D: WebAssembly Backend (lib/Target/WebAssembly/*)
|
||||
|
||||
N: Renato Golin
|
||||
E: renato.golin@linaro.org
|
||||
D: ARM Linux support
|
||||
|
@ -152,8 +152,9 @@ E: foldr@codedgers.com
|
||||
D: Author of llvmc2
|
||||
|
||||
N: Dan Gohman
|
||||
E: dan433584@gmail.com
|
||||
E: sunfish@mozilla.com
|
||||
D: Miscellaneous bug fixes
|
||||
D: WebAssembly Backend
|
||||
|
||||
N: David Goodwin
|
||||
E: david@goodwinz.net
|
||||
|
@ -58,20 +58,9 @@ LLVM_OBJ_ROOT := $(call realpath, @abs_top_builddir@)
|
||||
PROJ_SRC_ROOT := $(LLVM_SRC_ROOT)
|
||||
PROJ_SRC_DIR := $(LLVM_SRC_ROOT)$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))
|
||||
|
||||
# FIXME: This is temporary during the grace period where in-source builds are
|
||||
# deprecated. Convert to a hard error when that period is up.
|
||||
#
|
||||
# See: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150323/268067.html
|
||||
ifeq ($(LLVM_SRC_ROOT), $(LLVM_OBJ_ROOT))
|
||||
$(warning ######################################################################################)
|
||||
$(warning # #)
|
||||
$(warning # WARNING #)
|
||||
$(warning # #)
|
||||
$(warning # In-source builds are deprecated. #)
|
||||
$(warning # #)
|
||||
$(warning # Please configure from a separate build directory! #)
|
||||
$(warning # #)
|
||||
$(warning ######################################################################################)
|
||||
$(error In-source builds are not allowed. Please configure from a separate build directory!)
|
||||
endif
|
||||
|
||||
ifneq ($(CLANG_SRC_ROOT),)
|
||||
|
@ -75,15 +75,7 @@ fi
|
||||
|
||||
dnl Quit if it is an in-source build
|
||||
if test ${srcdir} == "." ; then
|
||||
AC_MSG_WARN([**************************************************************************************])
|
||||
AC_MSG_WARN([* *])
|
||||
AC_MSG_WARN([* WARNING *])
|
||||
AC_MSG_WARN([* *])
|
||||
AC_MSG_WARN([* In-source builds are deprecated. *])
|
||||
AC_MSG_WARN([* *])
|
||||
AC_MSG_WARN([* Please configure from a separate build directory! *])
|
||||
AC_MSG_WARN([* *])
|
||||
AC_MSG_WARN([**************************************************************************************])
|
||||
AC_MSG_ERROR([In-source builds are not allowed. Please configure from a separate build directory!])
|
||||
fi
|
||||
|
||||
dnl Default to empty (i.e. assigning the null string to) CFLAGS and CXXFLAGS,
|
||||
@ -445,6 +437,7 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
|
||||
hexagon-*) llvm_cv_target_arch="Hexagon" ;;
|
||||
nvptx-*) llvm_cv_target_arch="NVPTX" ;;
|
||||
s390x-*) llvm_cv_target_arch="SystemZ" ;;
|
||||
wasm*-*) llvm_cv_target_arch="WebAssembly" ;;
|
||||
*) llvm_cv_target_arch="Unknown" ;;
|
||||
esac])
|
||||
|
||||
@ -480,6 +473,7 @@ case $host in
|
||||
msp430-*) host_arch="MSP430" ;;
|
||||
hexagon-*) host_arch="Hexagon" ;;
|
||||
s390x-*) host_arch="SystemZ" ;;
|
||||
wasm*-*) host_arch="WebAssembly" ;;
|
||||
*) host_arch="Unknown" ;;
|
||||
esac
|
||||
|
||||
@ -812,6 +806,7 @@ else
|
||||
Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
NVPTX) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
SystemZ) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
||||
WebAssembly) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
esac
|
||||
fi
|
||||
@ -1105,7 +1100,7 @@ TARGETS_TO_BUILD=""
|
||||
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
|
||||
[Build specific host targets: all or target1,target2,... Valid targets are:
|
||||
host, x86, x86_64, sparc, powerpc, arm64, arm, aarch64, mips, hexagon,
|
||||
xcore, msp430, nvptx, systemz, r600, bpf, and cpp (default=all)]),,
|
||||
xcore, msp430, nvptx, systemz, r600, bpf, wasm, and cpp (default=all)]),,
|
||||
enableval=all)
|
||||
if test "$enableval" = host-only ; then
|
||||
enableval=host
|
||||
@ -1134,6 +1129,7 @@ case "$enableval" in
|
||||
systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
|
||||
amdgpu) TARGETS_TO_BUILD="AMDGPU $TARGETS_TO_BUILD" ;;
|
||||
r600) TARGETS_TO_BUILD="AMDGPU $TARGETS_TO_BUILD" ;;
|
||||
wasm) TARGETS_TO_BUILD="WebAssembly $TARGETS_TO_BUILD" ;;
|
||||
host) case "$llvm_cv_target_arch" in
|
||||
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
@ -1147,6 +1143,7 @@ case "$enableval" in
|
||||
Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
|
||||
NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
|
||||
SystemZ) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
|
||||
WebAssembly) TARGETS_TO_BUILD="WebAssembly $TARGETS_TO_BUILD" ;;
|
||||
*) AC_MSG_ERROR([Can not set target to build]) ;;
|
||||
esac ;;
|
||||
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
|
||||
@ -1631,7 +1628,6 @@ dnl===-----------------------------------------------------------------------===
|
||||
|
||||
AC_CHECK_LIB(m,sin)
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
AC_CHECK_LIB(imagehlp, main)
|
||||
AC_CHECK_LIB(ole32, main)
|
||||
AC_CHECK_LIB(psapi, main)
|
||||
AC_CHECK_LIB(shell32, main)
|
||||
|
@ -43,11 +43,11 @@ external run_static_dtors : llexecutionengine -> unit
|
||||
= "llvm_ee_run_static_dtors"
|
||||
external data_layout : llexecutionengine -> Llvm_target.DataLayout.t
|
||||
= "llvm_ee_get_data_layout"
|
||||
external add_global_mapping_ : Llvm.llvalue -> int64 -> llexecutionengine -> unit
|
||||
external add_global_mapping_ : Llvm.llvalue -> nativeint -> llexecutionengine -> unit
|
||||
= "llvm_ee_add_global_mapping"
|
||||
external get_global_value_address_ : string -> llexecutionengine -> int64
|
||||
external get_global_value_address_ : string -> llexecutionengine -> nativeint
|
||||
= "llvm_ee_get_global_value_address"
|
||||
external get_function_address_ : string -> llexecutionengine -> int64
|
||||
external get_function_address_ : string -> llexecutionengine -> nativeint
|
||||
= "llvm_ee_get_function_address"
|
||||
|
||||
let add_global_mapping llval ptr ee =
|
||||
@ -55,14 +55,14 @@ let add_global_mapping llval ptr ee =
|
||||
|
||||
let get_global_value_address name typ ee =
|
||||
let vptr = get_global_value_address_ name ee in
|
||||
if Int64.to_int vptr <> 0 then
|
||||
if Nativeint.to_int vptr <> 0 then
|
||||
let open Ctypes in !@ (coerce (ptr void) (ptr typ) (ptr_of_raw_address vptr))
|
||||
else
|
||||
raise (Error ("Value " ^ name ^ " not found"))
|
||||
|
||||
let get_function_address name typ ee =
|
||||
let fptr = get_function_address_ name ee in
|
||||
if Int64.to_int fptr <> 0 then
|
||||
if Nativeint.to_int fptr <> 0 then
|
||||
let open Ctypes in coerce (ptr void) typ (ptr_of_raw_address fptr)
|
||||
else
|
||||
raise (Error ("Function " ^ name ^ " not found"))
|
||||
|
@ -358,6 +358,10 @@ elseif (LLVM_NATIVE_ARCH MATCHES "hexagon")
|
||||
set(LLVM_NATIVE_ARCH Hexagon)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "s390x")
|
||||
set(LLVM_NATIVE_ARCH SystemZ)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "wasm32")
|
||||
set(LLVM_NATIVE_ARCH WebAssembly)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "wasm64")
|
||||
set(LLVM_NATIVE_ARCH WebAssembly)
|
||||
else ()
|
||||
message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
|
||||
endif ()
|
||||
@ -393,12 +397,10 @@ else ()
|
||||
endif ()
|
||||
|
||||
if( MINGW )
|
||||
set(HAVE_LIBIMAGEHLP 1)
|
||||
set(HAVE_LIBPSAPI 1)
|
||||
set(HAVE_LIBSHELL32 1)
|
||||
# TODO: Check existence of libraries.
|
||||
# include(CheckLibraryExists)
|
||||
# CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP)
|
||||
endif( MINGW )
|
||||
|
||||
if (NOT HAVE_STRTOLL)
|
||||
@ -546,13 +548,13 @@ else()
|
||||
if( OCAML_VERSION VERSION_LESS "4.00.0" )
|
||||
message(STATUS "OCaml bindings disabled, need OCaml >=4.00.0.")
|
||||
else()
|
||||
find_ocamlfind_package(ctypes VERSION 0.3 OPTIONAL)
|
||||
find_ocamlfind_package(ctypes VERSION 0.4 OPTIONAL)
|
||||
if( HAVE_OCAML_CTYPES )
|
||||
message(STATUS "OCaml bindings enabled.")
|
||||
find_ocamlfind_package(oUnit VERSION 2 OPTIONAL)
|
||||
set(LLVM_BINDINGS "${LLVM_BINDINGS} ocaml")
|
||||
else()
|
||||
message(STATUS "OCaml bindings disabled, need ctypes >=0.3.")
|
||||
message(STATUS "OCaml bindings disabled, need ctypes >=0.4.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -83,8 +83,13 @@ function(add_llvm_symbol_exports target_name export_file)
|
||||
DEPENDS ${export_file}
|
||||
VERBATIM
|
||||
COMMENT "Creating export file for ${target_name}")
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
|
||||
else()
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
|
||||
endif()
|
||||
else()
|
||||
set(native_export_file "${target_name}.def")
|
||||
|
||||
@ -163,7 +168,7 @@ function(add_link_opts target_name)
|
||||
|
||||
# Pass -O3 to the linker. This enabled different optimizations on different
|
||||
# linkers.
|
||||
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32))
|
||||
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|SunOS" OR WIN32))
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,-O3")
|
||||
endif()
|
||||
@ -181,6 +186,9 @@ function(add_link_opts target_name)
|
||||
# ld64's implementation of -dead_strip breaks tools that use plugins.
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,-dead_strip")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,-z -Wl,discard-unused=sections")
|
||||
elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD)
|
||||
# Object files are compiled with -ffunction-data-sections.
|
||||
# Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks
|
||||
@ -495,11 +503,17 @@ macro(add_llvm_library name)
|
||||
else()
|
||||
llvm_add_library(${name} ${ARGN})
|
||||
endif()
|
||||
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
|
||||
# The gtest libraries should not be installed or exported as a target
|
||||
if ("${name}" STREQUAL gtest OR "${name}" STREQUAL gtest_main)
|
||||
set(_is_gtest TRUE)
|
||||
else()
|
||||
set(_is_gtest FALSE)
|
||||
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
|
||||
endif()
|
||||
|
||||
if( EXCLUDE_FROM_ALL )
|
||||
set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||
else()
|
||||
elseif(NOT _is_gtest)
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
|
||||
if(ARG_SHARED OR BUILD_SHARED_LIBS)
|
||||
if(WIN32 OR CYGWIN)
|
||||
|
@ -308,9 +308,9 @@ if( MSVC )
|
||||
-wd4805 # Suppress 'unsafe mix of type <type> and type <type> in operation'
|
||||
-wd4204 # Suppress 'nonstandard extension used : non-constant aggregate initializer'
|
||||
|
||||
# Idelly, we'd like this warning to be enabled, but MSVC 2013 doesn't
|
||||
# Ideally, we'd like this warning to be enabled, but MSVC 2013 doesn't
|
||||
# support the 'aligned' attribute in the way that clang sources requires (for
|
||||
# any code that uses the LLVM_ALIGNAS marco), so this is must be disabled to
|
||||
# any code that uses the LLVM_ALIGNAS macro), so this is must be disabled to
|
||||
# avoid unwanted alignment warnings.
|
||||
# When we switch to requiring a version of MSVC that supports the 'alignas'
|
||||
# specifier (MSVC 2015?) this warning can be re-enabled.
|
||||
|
@ -47,6 +47,12 @@ ifeq ($(LLVM_LIBS_TO_EXPORT),Error)
|
||||
$(error llvm-config --libs failed)
|
||||
endif
|
||||
|
||||
# Strip out gtest and gtest_main from LLVM_LIBS_TO_EXPORT, these are not
|
||||
# installed and won't be available from the install tree.
|
||||
# FIXME: If we used llvm-config from the install tree this wouldn't be
|
||||
# necessary.
|
||||
LLVM_LIBS_TO_EXPORT := $(filter-out gtest gtest_main,$(LLVM_LIBS_TO_EXPORT))
|
||||
|
||||
ifndef LLVM_LIBS_TO_EXPORT
|
||||
$(error LLVM_LIBS_TO_EXPORT cannot be empty)
|
||||
endif
|
||||
@ -54,11 +60,27 @@ endif
|
||||
|
||||
OBJMODS := LLVMConfig.cmake LLVMConfigVersion.cmake LLVMExports.cmake
|
||||
|
||||
LLVM_CONFIG_CODE := \
|
||||
\# Compute the CMake directory from the LLVMConfig.cmake file location.\n\
|
||||
get_filename_component(_LLVM_CMAKE_DIR "$${CMAKE_CURRENT_LIST_FILE}" PATH)\n\
|
||||
\# Compute the installation prefix from the LLVMConfig.cmake file location.\n\
|
||||
get_filename_component(LLVM_INSTALL_PREFIX "$${CMAKE_CURRENT_LIST_FILE}" PATH)\n
|
||||
|
||||
# Compute number of levels (typically 3 - ``share/llvm/cmake/``) to PROJ_prefix
|
||||
# from PROJ_cmake, then emit the appropriate number of calls to
|
||||
# get_filename_components(). Note this assumes there are no spaces in the
|
||||
# cmake_path_suffix variable.
|
||||
cmake_path_suffix := $(subst $(PROJ_prefix),,$(subst $(DESTDIR),,$(PROJ_cmake)))
|
||||
cmake_path_dirs := $(subst /, ,$(cmake_path_suffix))
|
||||
LLVM_CONFIG_CODE += $(foreach __not_used,$(cmake_path_dirs),get_filename_component(LLVM_INSTALL_PREFIX "$${LLVM_INSTALL_PREFIX}" PATH)\n)
|
||||
|
||||
LLVM_CONFIG_CODE += set(_LLVM_LIBRARY_DIR "$${LLVM_INSTALL_PREFIX}\/lib")
|
||||
|
||||
$(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in Makefile $(LLVMBuildCMakeFrag)
|
||||
$(Echo) 'Generating LLVM CMake package config file'
|
||||
$(Verb) ( \
|
||||
cat $< | sed \
|
||||
-e 's/@LLVM_CONFIG_CODE@/set(LLVM_INSTALL_PREFIX "'"$(subst /,\/,$(PROJ_prefix))"'")/' \
|
||||
-e 's/@LLVM_CONFIG_CODE@/$(LLVM_CONFIG_CODE)/' \
|
||||
-e 's/@LLVM_VERSION_MAJOR@/'"$(LLVM_VERSION_MAJOR)"'/' \
|
||||
-e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \
|
||||
-e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
|
||||
@ -81,17 +103,20 @@ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in Makefile $(LLVMBuildCMakeF
|
||||
-e 's/@LLVM_ON_UNIX@/'"$(LLVM_ON_UNIX)"'/' \
|
||||
-e 's/@LLVM_ON_WIN32@/'"$(LLVM_ON_WIN32)"'/' \
|
||||
-e 's/@LLVM_LIBDIR_SUFFIX@//' \
|
||||
-e 's/@LLVM_CONFIG_INCLUDE_DIRS@/'"$(subst /,\/,$(PROJ_includedir))"'/' \
|
||||
-e 's/@LLVM_CONFIG_LIBRARY_DIRS@/'"$(subst /,\/,$(PROJ_libdir))"'/' \
|
||||
-e 's/@LLVM_CONFIG_CMAKE_DIR@/'"$(subst /,\/,$(PROJ_cmake))"'/' \
|
||||
-e 's/@LLVM_CONFIG_TOOLS_BINARY_DIR@/'"$(subst /,\/,$(PROJ_bindir))"'/' \
|
||||
-e 's#@LLVM_CONFIG_INCLUDE_DIRS@#$${LLVM_INSTALL_PREFIX}/include#' \
|
||||
-e 's#@LLVM_CONFIG_LIBRARY_DIRS@#$${_LLVM_LIBRARY_DIR}#' \
|
||||
-e 's#@LLVM_CONFIG_CMAKE_DIR@#$${_LLVM_CMAKE_DIR}#' \
|
||||
-e 's#@LLVM_CONFIG_TOOLS_BINARY_DIR@#$${LLVM_INSTALL_PREFIX}/bin#' \
|
||||
-e 's/@LLVM_CONFIG_EXPORTS_FILE@/$${LLVM_CMAKE_DIR}\/LLVMExports.cmake/' \
|
||||
-e 's/@all_llvm_lib_deps@//' \
|
||||
&& \
|
||||
grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" \
|
||||
( grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" | \
|
||||
grep -v LLVMBUILD_LIB_DEPS_gtest ) && \
|
||||
echo 'unset(_LLVM_CMAKE_DIR)' && \
|
||||
echo 'unset(_LLVM_LIBRARY_DIR)' \
|
||||
) > $@
|
||||
|
||||
$(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in
|
||||
$(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in Makefile
|
||||
$(Echo) 'Generating LLVM CMake package version file'
|
||||
$(Verb) cat $< | sed \
|
||||
-e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
|
||||
@ -100,13 +125,13 @@ $(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in
|
||||
-e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
|
||||
> $@
|
||||
|
||||
$(PROJ_OBJ_DIR)/LLVMExports.cmake: $(LLVMBuildCMakeExportsFrag)
|
||||
$(PROJ_OBJ_DIR)/LLVMExports.cmake: $(LLVMBuildCMakeExportsFrag) Makefile
|
||||
$(Echo) 'Generating LLVM CMake target exports file'
|
||||
$(Verb) ( \
|
||||
echo '# LLVM CMake target exports. Do not include directly.' && \
|
||||
for lib in $(LLVM_LIBS_TO_EXPORT); do \
|
||||
echo 'add_library('"$$lib"' STATIC IMPORTED)' && \
|
||||
echo 'set_property(TARGET '"$$lib"' PROPERTY IMPORTED_LOCATION "'"$(PROJ_libdir)/lib$$lib.a"'")' ; \
|
||||
echo 'set_property(TARGET '"$$lib"' PROPERTY IMPORTED_LOCATION "$${_LLVM_LIBRARY_DIR}/'lib$$lib.a'")' ; \
|
||||
done && \
|
||||
cat "$(LLVMBuildCMakeExportsFrag)" && \
|
||||
echo 'set_property(TARGET LLVMSupport APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES '"$(subst -l,,$(LIBS))"')' \
|
||||
|
29
configure
vendored
29
configure
vendored
@ -1463,7 +1463,7 @@ Optional Features:
|
||||
target1,target2,... Valid targets are: host, x86,
|
||||
x86_64, sparc, powerpc, arm64, arm, aarch64, mips,
|
||||
hexagon, xcore, msp430, nvptx, systemz, r600, bpf,
|
||||
and cpp (default=all)
|
||||
wasm, and cpp (default=all)
|
||||
--enable-experimental-targets
|
||||
Build experimental host targets: disable or
|
||||
target1,target2,... (default=disable)
|
||||
@ -2033,24 +2033,9 @@ echo "$as_me: error: Already configured in ${srcdir}" >&2;}
|
||||
fi
|
||||
|
||||
if test ${srcdir} == "." ; then
|
||||
{ echo "$as_me:$LINENO: WARNING: **************************************************************************************" >&5
|
||||
echo "$as_me: WARNING: **************************************************************************************" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * *" >&5
|
||||
echo "$as_me: WARNING: * *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * WARNING *" >&5
|
||||
echo "$as_me: WARNING: * WARNING *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * *" >&5
|
||||
echo "$as_me: WARNING: * *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * In-source builds are deprecated. *" >&5
|
||||
echo "$as_me: WARNING: * In-source builds are deprecated. *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * *" >&5
|
||||
echo "$as_me: WARNING: * *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * Please configure from a separate build directory! *" >&5
|
||||
echo "$as_me: WARNING: * Please configure from a separate build directory! *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: * *" >&5
|
||||
echo "$as_me: WARNING: * *" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: **************************************************************************************" >&5
|
||||
echo "$as_me: WARNING: **************************************************************************************" >&2;}
|
||||
{ { echo "$as_me:$LINENO: error: In-source builds are not allowed. Please configure from a separate build directory!" >&5
|
||||
echo "$as_me: error: In-source builds are not allowed. Please configure from a separate build directory!" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
: ${CFLAGS=}
|
||||
@ -4207,6 +4192,7 @@ else
|
||||
hexagon-*) llvm_cv_target_arch="Hexagon" ;;
|
||||
nvptx-*) llvm_cv_target_arch="NVPTX" ;;
|
||||
s390x-*) llvm_cv_target_arch="SystemZ" ;;
|
||||
wasm*-*) llvm_cv_target_arch="WebAssembly" ;;
|
||||
*) llvm_cv_target_arch="Unknown" ;;
|
||||
esac
|
||||
fi
|
||||
@ -4243,6 +4229,7 @@ case $host in
|
||||
msp430-*) host_arch="MSP430" ;;
|
||||
hexagon-*) host_arch="Hexagon" ;;
|
||||
s390x-*) host_arch="SystemZ" ;;
|
||||
wasm*-*) host_arch="WebAssembly" ;;
|
||||
*) host_arch="Unknown" ;;
|
||||
esac
|
||||
|
||||
@ -5169,6 +5156,8 @@ else
|
||||
NVPTX) TARGET_HAS_JIT=0
|
||||
;;
|
||||
SystemZ) TARGET_HAS_JIT=1
|
||||
;;
|
||||
WebAssembly) TARGET_HAS_JIT=0
|
||||
;;
|
||||
*) TARGET_HAS_JIT=0
|
||||
;;
|
||||
@ -5667,6 +5656,7 @@ case "$enableval" in
|
||||
systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
|
||||
amdgpu) TARGETS_TO_BUILD="AMDGPU $TARGETS_TO_BUILD" ;;
|
||||
r600) TARGETS_TO_BUILD="AMDGPU $TARGETS_TO_BUILD" ;;
|
||||
wasm) TARGETS_TO_BUILD="WebAssembly $TARGETS_TO_BUILD" ;;
|
||||
host) case "$llvm_cv_target_arch" in
|
||||
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
@ -5680,6 +5670,7 @@ case "$enableval" in
|
||||
Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
|
||||
NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
|
||||
SystemZ) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
|
||||
WebAssembly) TARGETS_TO_BUILD="WebAssembly $TARGETS_TO_BUILD" ;;
|
||||
*) { { echo "$as_me:$LINENO: error: Can not set target to build" >&5
|
||||
echo "$as_me: error: Can not set target to build" >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
@ -92,3 +92,86 @@ strings:
|
||||
v_mul_i32_i24 v1, v2, v3
|
||||
v_mul_i32_i24_e32 v1, v2, v3
|
||||
v_mul_i32_i24_e64 v1, v2, v3
|
||||
|
||||
Assembler Directives
|
||||
--------------------
|
||||
|
||||
.hsa_code_object_version major, minor
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
*major* and *minor* are integers that specify the version of the HSA code
|
||||
object that will be generated by the assembler. This value will be stored
|
||||
in an entry of the .note section.
|
||||
|
||||
.hsa_code_object_isa [major, minor, stepping, vendor, arch]
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
*major*, *minor*, and *stepping* are all integers that describe the instruction
|
||||
set architecture (ISA) version of the assembly program.
|
||||
|
||||
*vendor* and *arch* are quoted strings. *vendor* should always be equal to
|
||||
"AMD" and *arch* should always be equal to "AMDGPU".
|
||||
|
||||
If no arguments are specified, then the assembler will derive the ISA version,
|
||||
*vendor*, and *arch* from the value of the -mcpu option that is passed to the
|
||||
assembler.
|
||||
|
||||
ISA version, *vendor*, and *arch* will all be stored in a single entry of the
|
||||
.note section.
|
||||
|
||||
.amd_kernel_code_t
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This directive marks the beginning of a list of key / value pairs that are used
|
||||
to specify the amd_kernel_code_t object that will be emitted by the assembler.
|
||||
The list must be terminated by the *.end_amd_kernel_code_t* directive. For
|
||||
any amd_kernel_code_t values that are unspecified a default value will be
|
||||
used. The default value for all keys is 0, with the following exceptions:
|
||||
|
||||
- *kernel_code_version_major* defaults to 1.
|
||||
- *machine_kind* defaults to 1.
|
||||
- *machine_version_major*, *machine_version_minor*, and
|
||||
*machine_version_stepping* are derived from the value of the -mcpu option
|
||||
that is passed to the assembler.
|
||||
- *kernel_code_entry_byte_offset* defaults to 256.
|
||||
- *wavefront_size* defaults to 6.
|
||||
- *kernarg_segment_alignment*, *group_segment_alignment*, and
|
||||
*private_segment_alignment* default to 4. Note that alignments are specified
|
||||
as a power of two, so a value of **n** means an alignment of 2^ **n**.
|
||||
|
||||
The *.amd_kernel_code_t* directive must be placed immediately after the
|
||||
function label and before any instructions.
|
||||
|
||||
For a full list of amd_kernel_code_t keys, see the examples in
|
||||
test/CodeGen/AMDGPU/hsa.s. For an explanation of the meanings of the different
|
||||
keys, see the comments in lib/Target/AMDGPU/AmdKernelCodeT.h
|
||||
|
||||
Here is an example of a minimal amd_kernel_code_t specification:
|
||||
|
||||
.. code-block:: nasm
|
||||
|
||||
.hsa_code_object_version 1,0
|
||||
.hsa_code_object_isa
|
||||
|
||||
.text
|
||||
|
||||
hello_world:
|
||||
|
||||
.amd_kernel_code_t
|
||||
enable_sgpr_kernarg_segment_ptr = 1
|
||||
is_ptr64 = 1
|
||||
compute_pgm_rsrc1_vgprs = 0
|
||||
compute_pgm_rsrc1_sgprs = 0
|
||||
compute_pgm_rsrc2_user_sgpr = 2
|
||||
kernarg_segment_byte_size = 8
|
||||
wavefront_sgpr_count = 2
|
||||
workitem_vgpr_count = 3
|
||||
.end_amd_kernel_code_t
|
||||
|
||||
s_load_dwordx2 s[0:1], s[0:1] 0x0
|
||||
v_mov_b32 v0, 3.14159
|
||||
s_waitcnt lgkmcnt(0)
|
||||
v_mov_b32 v1, s0
|
||||
v_mov_b32 v2, s1
|
||||
flat_store_dword v0, v[1:2]
|
||||
s_endpgm
|
||||
|
@ -286,8 +286,8 @@ Mod/Ref result, simply return whatever the superclass computes. For example:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size,
|
||||
const Value *V2, unsigned V2Size) {
|
||||
AliasResult alias(const Value *V1, unsigned V1Size,
|
||||
const Value *V2, unsigned V2Size) {
|
||||
if (...)
|
||||
return NoAlias;
|
||||
...
|
||||
|
@ -327,8 +327,8 @@ LLVM-specific variables
|
||||
|
||||
**LLVM_USE_SANITIZER**:STRING
|
||||
Define the sanitizer used to build LLVM binaries and tests. Possible values
|
||||
are ``Address``, ``Memory``, ``MemoryWithOrigins`` and ``Undefined``.
|
||||
Defaults to empty string.
|
||||
are ``Address``, ``Memory``, ``MemoryWithOrigins``, ``Undefined``, ``Thread``,
|
||||
and ``Address;Undefined``. Defaults to empty string.
|
||||
|
||||
**LLVM_PARALLEL_COMPILE_JOBS**:STRING
|
||||
Define the maximum number of concurrent compilation jobs.
|
||||
|
@ -749,7 +749,7 @@ The SelectionDAG is a Directed-Acyclic-Graph whose nodes are instances of the
|
||||
``SDNode`` class. The primary payload of the ``SDNode`` is its operation code
|
||||
(Opcode) that indicates what operation the node performs and the operands to the
|
||||
operation. The various operation node types are described at the top of the
|
||||
``include/llvm/CodeGen/SelectionDAGNodes.h`` file.
|
||||
``include/llvm/CodeGen/ISDOpcodes.h`` file.
|
||||
|
||||
Although most operations define a single value, each node in the graph may
|
||||
define multiple values. For example, a combined div/rem operation will define
|
||||
@ -829,7 +829,7 @@ One great way to visualize what is going on here is to take advantage of a few
|
||||
LLC command line options. The following options pop up a window displaying the
|
||||
SelectionDAG at specific times (if you only get errors printed to the console
|
||||
while using this, you probably `need to configure your
|
||||
system <ProgrammersManual.html#ViewGraph>`_ to add support for it).
|
||||
system <ProgrammersManual.html#viewing-graphs-while-debugging-code>`_ to add support for it).
|
||||
|
||||
* ``-view-dag-combine1-dags`` displays the DAG after being built, before the
|
||||
first optimization pass.
|
||||
|
@ -26,5 +26,5 @@ OPTIONS
|
||||
EXIT STATUS
|
||||
-----------
|
||||
|
||||
:program:`llvm-dwarfdump` returns 0. Other exit codes imply internal
|
||||
program error.
|
||||
:program:`llvm-dwarfdump` returns 0 if the input files were parsed and dumped
|
||||
successfully. Otherwise, it returns 1.
|
||||
|
@ -49,6 +49,79 @@ The format of this section is
|
||||
FunctionFaultInfo[NumFaultingPCs] {
|
||||
uint32 : FaultKind = FaultMaps::FaultingLoad (only legal value currently)
|
||||
uint32 : FaultingPCOffset
|
||||
uint32 : handlerPCOffset
|
||||
uint32 : HandlerPCOffset
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
The ``ImplicitNullChecks`` pass
|
||||
===============================
|
||||
|
||||
The ``ImplicitNullChecks`` pass transforms explicit control flow for
|
||||
checking if a pointer is ``null``, like:
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
%ptr = call i32* @get_ptr()
|
||||
%ptr_is_null = icmp i32* %ptr, null
|
||||
br i1 %ptr_is_null, label %is_null, label %not_null, !make.implicit !0
|
||||
|
||||
not_null:
|
||||
%t = load i32, i32* %ptr
|
||||
br label %do_something_with_t
|
||||
|
||||
is_null:
|
||||
call void @HFC()
|
||||
unreachable
|
||||
|
||||
!0 = !{}
|
||||
|
||||
to control flow implicit in the instruction loading or storing through
|
||||
the pointer being null checked:
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
%ptr = call i32* @get_ptr()
|
||||
%t = load i32, i32* %ptr ;; handler-pc = label %is_null
|
||||
br label %do_something_with_t
|
||||
|
||||
is_null:
|
||||
call void @HFC()
|
||||
unreachable
|
||||
|
||||
This transform happens at the ``MachineInstr`` level, not the LLVM IR
|
||||
level (so the above example is only representative, not literal). The
|
||||
``ImplicitNullChecks`` pass runs during codegen, if
|
||||
``-enable-implicit-null-checks`` is passed to ``llc``.
|
||||
|
||||
The ``ImplicitNullChecks`` pass adds entries to the
|
||||
``__llvm_faultmaps`` section described above as needed.
|
||||
|
||||
``make.implicit`` metadata
|
||||
--------------------------
|
||||
|
||||
Making null checks implicit is an aggressive optimization, and it can
|
||||
be a net performance pessimization if too many memory operations end
|
||||
up faulting because of it. A language runtime typically needs to
|
||||
ensure that only a negligible number of implicit null checks actually
|
||||
fault once the application has reached a steady state. A standard way
|
||||
of doing this is by healing failed implicit null checks into explicit
|
||||
null checks via code patching or recompilation. It follows that there
|
||||
are two requirements an explicit null check needs to satisfy for it to
|
||||
be profitable to convert it to an implicit null check:
|
||||
|
||||
1. The case where the pointer is actually null (i.e. the "failing"
|
||||
case) is extremely rare.
|
||||
|
||||
2. The failing path heals the implicit null check into an explicit
|
||||
null check so that the application does not repeatedly page
|
||||
fault.
|
||||
|
||||
The frontend is expected to mark branches that satisfy (1) and (2)
|
||||
using a ``!make.implicit`` metadata node (the actual content of the
|
||||
metadata node is ignored). Only branches that are marked with
|
||||
``!make.implicit`` metadata are considered as candidates for
|
||||
conversion into implicit null checks.
|
||||
|
||||
(Note that while we could deal with (1) using profiling data, dealing
|
||||
with (2) requires some information not present in branch profiles.)
|
||||
|
@ -326,7 +326,11 @@ Easy steps for installing GCC 4.8.2:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
% wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
|
||||
% wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
|
||||
% wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2.sig
|
||||
% wget https://ftp.gnu.org/gnu/gnu-keyring.gpg
|
||||
% signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-4.8.2.tar.bz2.sig`
|
||||
% if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi
|
||||
% tar -xvjf gcc-4.8.2.tar.bz2
|
||||
% cd gcc-4.8.2
|
||||
% ./contrib/download_prerequisites
|
||||
|
@ -823,9 +823,11 @@ with the same name. This is necessary because both globals belong to different
|
||||
COMDAT groups and COMDATs, at the object file level, are represented by
|
||||
sections.
|
||||
|
||||
Note that certain IR constructs like global variables and functions may create
|
||||
COMDATs in the object file in addition to any which are specified using COMDAT
|
||||
IR. This arises, for example, when a global variable has linkonce_odr linkage.
|
||||
Note that certain IR constructs like global variables and functions may
|
||||
create COMDATs in the object file in addition to any which are specified using
|
||||
COMDAT IR. This arises when the code generator is configured to emit globals
|
||||
in individual sections (e.g. when `-data-sections` or `-function-sections`
|
||||
is supplied to `llc`).
|
||||
|
||||
.. _namedmetadatastructure:
|
||||
|
||||
@ -3640,7 +3642,7 @@ will be partially unrolled.
|
||||
'``llvm.loop.unroll.disable``' Metadata
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This metadata either disables loop unrolling. The metadata has a single operand
|
||||
This metadata disables loop unrolling. The metadata has a single operand
|
||||
which is the string ``llvm.loop.unroll.disable``. For example:
|
||||
|
||||
.. code-block:: llvm
|
||||
@ -3650,7 +3652,7 @@ which is the string ``llvm.loop.unroll.disable``. For example:
|
||||
'``llvm.loop.unroll.runtime.disable``' Metadata
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This metadata either disables runtime loop unrolling. The metadata has a single
|
||||
This metadata disables runtime loop unrolling. The metadata has a single
|
||||
operand which is the string ``llvm.loop.unroll.runtime.disable``. For example:
|
||||
|
||||
.. code-block:: llvm
|
||||
@ -3660,8 +3662,8 @@ operand which is the string ``llvm.loop.unroll.runtime.disable``. For example:
|
||||
'``llvm.loop.unroll.full``' Metadata
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This metadata either suggests that the loop should be unrolled fully. The
|
||||
metadata has a single operand which is the string ``llvm.loop.unroll.disable``.
|
||||
This metadata suggests that the loop should be unrolled fully. The
|
||||
metadata has a single operand which is the string ``llvm.loop.unroll.full``.
|
||||
For example:
|
||||
|
||||
.. code-block:: llvm
|
||||
|
@ -60,26 +60,28 @@ to upload your patch):
|
||||
To upload a new patch:
|
||||
|
||||
* Click *Differential*.
|
||||
* Click *Create Diff*.
|
||||
* Paste the text diff or upload the patch file.
|
||||
Note that TODO
|
||||
* Click *+ Create Diff*.
|
||||
* Paste the text diff or browse to the patch file. Click *Create Diff*.
|
||||
* Leave the Repository field blank.
|
||||
* Leave the drop down on *Create a new Revision...* and click *Continue*.
|
||||
* Enter a descriptive title and summary. The title and summary are usually
|
||||
in the form of a :ref:`commit message <commit messages>`.
|
||||
* Add reviewers and mailing
|
||||
lists that you want to be included in the review. If your patch is
|
||||
for LLVM, add llvm-commits as a subscriber; if your patch is for Clang,
|
||||
for LLVM, add llvm-commits as a Subscriber; if your patch is for Clang,
|
||||
add cfe-commits.
|
||||
* Leave the Repository and Project fields blank.
|
||||
* Click *Save*.
|
||||
|
||||
To submit an updated patch:
|
||||
|
||||
* Click *Differential*.
|
||||
* Click *Create Diff*.
|
||||
* Paste the updated diff.
|
||||
* Click *+ Create Diff*.
|
||||
* Paste the updated diff or browse to the updated patch file. Click *Create Diff*.
|
||||
* Select the review you want to from the *Attach To* dropdown and click
|
||||
*Continue*.
|
||||
* Click *Save*.
|
||||
* Leave the Repository and Project fields blank.
|
||||
* Add comments about the changes in the new diff. Click *Save*.
|
||||
|
||||
Reviewing code with Phabricator
|
||||
-------------------------------
|
||||
|
@ -1168,7 +1168,6 @@ class KaleidoscopeJIT {
|
||||
|
||||
KaleidoscopeJIT(SessionContext &Session)
|
||||
: Session(Session),
|
||||
Mang(Session.getTarget().getDataLayout()),
|
||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||
LazyEmitLayer(CompileLayer),
|
||||
CompileCallbacks(LazyEmitLayer, CCMgrMemMgr, Session.getLLVMContext(),
|
||||
@ -1179,7 +1178,8 @@ class KaleidoscopeJIT {
|
||||
std::string MangledName;
|
||||
{
|
||||
raw_string_ostream MangledNameStream(MangledName);
|
||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
||||
Mangler::getNameWithPrefix(MangledNameStream, Name,
|
||||
*Session.getTarget().getDataLayout());
|
||||
}
|
||||
return MangledName;
|
||||
}
|
||||
@ -1306,7 +1306,6 @@ class KaleidoscopeJIT {
|
||||
}
|
||||
|
||||
SessionContext &Session;
|
||||
Mangler Mang;
|
||||
SectionMemoryManager CCMgrMemMgr;
|
||||
ObjLayerT ObjectLayer;
|
||||
CompileLayerT CompileLayer;
|
||||
|
@ -1160,14 +1160,14 @@ class KaleidoscopeJIT {
|
||||
typedef CompileLayerT::ModuleSetHandleT ModuleHandleT;
|
||||
|
||||
KaleidoscopeJIT(SessionContext &Session)
|
||||
: Mang(Session.getTarget().getDataLayout()),
|
||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}
|
||||
: DL(*Session.getTarget().getDataLayout()),
|
||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}
|
||||
|
||||
std::string mangle(const std::string &Name) {
|
||||
std::string MangledName;
|
||||
{
|
||||
raw_string_ostream MangledNameStream(MangledName);
|
||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
||||
Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
|
||||
}
|
||||
return MangledName;
|
||||
}
|
||||
@ -1201,8 +1201,7 @@ class KaleidoscopeJIT {
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Mangler Mang;
|
||||
const DataLayout &DL;
|
||||
ObjLayerT ObjectLayer;
|
||||
CompileLayerT CompileLayer;
|
||||
};
|
||||
|
@ -1162,15 +1162,15 @@ class KaleidoscopeJIT {
|
||||
typedef LazyEmitLayerT::ModuleSetHandleT ModuleHandleT;
|
||||
|
||||
KaleidoscopeJIT(SessionContext &Session)
|
||||
: Mang(Session.getTarget().getDataLayout()),
|
||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||
LazyEmitLayer(CompileLayer) {}
|
||||
: DL(*Session.getTarget().getDataLayout()),
|
||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||
LazyEmitLayer(CompileLayer) {}
|
||||
|
||||
std::string mangle(const std::string &Name) {
|
||||
std::string MangledName;
|
||||
{
|
||||
raw_string_ostream MangledNameStream(MangledName);
|
||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
||||
Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
|
||||
}
|
||||
return MangledName;
|
||||
}
|
||||
@ -1204,8 +1204,7 @@ class KaleidoscopeJIT {
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Mangler Mang;
|
||||
const DataLayout &DL;
|
||||
ObjLayerT ObjectLayer;
|
||||
CompileLayerT CompileLayer;
|
||||
LazyEmitLayerT LazyEmitLayer;
|
||||
|
@ -1162,7 +1162,6 @@ class KaleidoscopeJIT {
|
||||
|
||||
KaleidoscopeJIT(SessionContext &Session)
|
||||
: Session(Session),
|
||||
Mang(Session.getTarget().getDataLayout()),
|
||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||
LazyEmitLayer(CompileLayer) {}
|
||||
|
||||
@ -1170,7 +1169,8 @@ class KaleidoscopeJIT {
|
||||
std::string MangledName;
|
||||
{
|
||||
raw_string_ostream MangledNameStream(MangledName);
|
||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
||||
Mangler::getNameWithPrefix(MangledNameStream, Name,
|
||||
*Session.getTarget().getDataLayout());
|
||||
}
|
||||
return MangledName;
|
||||
}
|
||||
@ -1236,7 +1236,6 @@ class KaleidoscopeJIT {
|
||||
}
|
||||
|
||||
SessionContext &Session;
|
||||
Mangler Mang;
|
||||
ObjLayerT ObjectLayer;
|
||||
CompileLayerT CompileLayer;
|
||||
LazyEmitLayerT LazyEmitLayer;
|
||||
|
@ -40,7 +40,7 @@ typedef bool lto_bool_t;
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LTO_API_VERSION 15
|
||||
#define LTO_API_VERSION 16
|
||||
|
||||
/**
|
||||
* \since prior to LTO_API_VERSION=3
|
||||
@ -280,39 +280,15 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of dependent libraries in the object module.
|
||||
* Returns the module's linker options.
|
||||
*
|
||||
* \since LTO_API_VERSION=8
|
||||
*/
|
||||
extern unsigned int
|
||||
lto_module_get_num_deplibs(lto_module_t mod);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ith dependent library in the module.
|
||||
* The linker options may consist of multiple flags. It is the linker's
|
||||
* responsibility to split the flags using a platform-specific mechanism.
|
||||
*
|
||||
* \since LTO_API_VERSION=8
|
||||
* \since LTO_API_VERSION=16
|
||||
*/
|
||||
extern const char*
|
||||
lto_module_get_deplib(lto_module_t mod, unsigned int index);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of linker options in the object module.
|
||||
*
|
||||
* \since LTO_API_VERSION=8
|
||||
*/
|
||||
extern unsigned int
|
||||
lto_module_get_num_linkeropts(lto_module_t mod);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ith linker option in the module.
|
||||
*
|
||||
* \since LTO_API_VERSION=8
|
||||
*/
|
||||
extern const char*
|
||||
lto_module_get_linkeropt(lto_module_t mod, unsigned int index);
|
||||
lto_module_get_linkeropts(lto_module_t mod);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1038,7 +1038,9 @@ class APInt {
|
||||
/// the validity of the less-than relationship.
|
||||
///
|
||||
/// \returns true if *this < RHS when considered unsigned.
|
||||
bool ult(uint64_t RHS) const { return ult(APInt(getBitWidth(), RHS)); }
|
||||
bool ult(uint64_t RHS) const {
|
||||
return getActiveBits() > 64 ? false : getZExtValue() < RHS;
|
||||
}
|
||||
|
||||
/// \brief Signed less than comparison
|
||||
///
|
||||
@ -1054,7 +1056,9 @@ class APInt {
|
||||
/// the validity of the less-than relationship.
|
||||
///
|
||||
/// \returns true if *this < RHS when considered signed.
|
||||
bool slt(uint64_t RHS) const { return slt(APInt(getBitWidth(), RHS)); }
|
||||
bool slt(int64_t RHS) const {
|
||||
return getMinSignedBits() > 64 ? isNegative() : getSExtValue() < RHS;
|
||||
}
|
||||
|
||||
/// \brief Unsigned less or equal comparison
|
||||
///
|
||||
@ -1070,7 +1074,7 @@ class APInt {
|
||||
/// the validity of the less-or-equal relationship.
|
||||
///
|
||||
/// \returns true if *this <= RHS when considered unsigned.
|
||||
bool ule(uint64_t RHS) const { return ule(APInt(getBitWidth(), RHS)); }
|
||||
bool ule(uint64_t RHS) const { return !ugt(RHS); }
|
||||
|
||||
/// \brief Signed less or equal comparison
|
||||
///
|
||||
@ -1086,7 +1090,7 @@ class APInt {
|
||||
/// validity of the less-or-equal relationship.
|
||||
///
|
||||
/// \returns true if *this <= RHS when considered signed.
|
||||
bool sle(uint64_t RHS) const { return sle(APInt(getBitWidth(), RHS)); }
|
||||
bool sle(uint64_t RHS) const { return !sgt(RHS); }
|
||||
|
||||
/// \brief Unsigned greather than comparison
|
||||
///
|
||||
@ -1102,7 +1106,9 @@ class APInt {
|
||||
/// the validity of the greater-than relationship.
|
||||
///
|
||||
/// \returns true if *this > RHS when considered unsigned.
|
||||
bool ugt(uint64_t RHS) const { return ugt(APInt(getBitWidth(), RHS)); }
|
||||
bool ugt(uint64_t RHS) const {
|
||||
return getActiveBits() > 64 ? true : getZExtValue() > RHS;
|
||||
}
|
||||
|
||||
/// \brief Signed greather than comparison
|
||||
///
|
||||
@ -1118,7 +1124,9 @@ class APInt {
|
||||
/// the validity of the greater-than relationship.
|
||||
///
|
||||
/// \returns true if *this > RHS when considered signed.
|
||||
bool sgt(uint64_t RHS) const { return sgt(APInt(getBitWidth(), RHS)); }
|
||||
bool sgt(int64_t RHS) const {
|
||||
return getMinSignedBits() > 64 ? !isNegative() : getSExtValue() > RHS;
|
||||
}
|
||||
|
||||
/// \brief Unsigned greater or equal comparison
|
||||
///
|
||||
@ -1134,7 +1142,7 @@ class APInt {
|
||||
/// the validity of the greater-or-equal relationship.
|
||||
///
|
||||
/// \returns true if *this >= RHS when considered unsigned.
|
||||
bool uge(uint64_t RHS) const { return uge(APInt(getBitWidth(), RHS)); }
|
||||
bool uge(uint64_t RHS) const { return !ult(RHS); }
|
||||
|
||||
/// \brief Signed greather or equal comparison
|
||||
///
|
||||
@ -1150,7 +1158,7 @@ class APInt {
|
||||
/// the validity of the greater-or-equal relationship.
|
||||
///
|
||||
/// \returns true if *this >= RHS when considered signed.
|
||||
bool sge(uint64_t RHS) const { return sge(APInt(getBitWidth(), RHS)); }
|
||||
bool sge(int64_t RHS) const { return !slt(RHS); }
|
||||
|
||||
/// This operation tests if there are any pairs of corresponding bits
|
||||
/// between this APInt and RHS that are both set.
|
||||
@ -1896,11 +1904,11 @@ inline APInt Xor(const APInt &LHS, const APInt &RHS) { return LHS ^ RHS; }
|
||||
/// Performs a bitwise complement operation on APInt.
|
||||
inline APInt Not(const APInt &APIVal) { return ~APIVal; }
|
||||
|
||||
} // namespace APIntOps
|
||||
} // End of APIntOps namespace
|
||||
|
||||
// See friend declaration above. This additional declaration is required in
|
||||
// order to compile LLVM with IBM xlC compiler.
|
||||
hash_code hash_value(const APInt &Arg);
|
||||
} // namespace llvm
|
||||
} // End of llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -33,6 +33,15 @@ class APSInt : public APInt {
|
||||
explicit APSInt(APInt I, bool isUnsigned = true)
|
||||
: APInt(std::move(I)), IsUnsigned(isUnsigned) {}
|
||||
|
||||
/// Construct an APSInt from a string representation.
|
||||
///
|
||||
/// This constructor interprets the string \p Str using the radix of 10.
|
||||
/// The interpretation stops at the end of the string. The bit width of the
|
||||
/// constructed APSInt is determined automatically.
|
||||
///
|
||||
/// \param Str the string to be interpreted.
|
||||
explicit APSInt(StringRef Str);
|
||||
|
||||
APSInt &operator=(APInt RHS) {
|
||||
// Retain our current sign.
|
||||
APInt::operator=(std::move(RHS));
|
||||
|
@ -286,6 +286,11 @@ namespace llvm {
|
||||
return MutableArrayRef<T>(data()+N, M);
|
||||
}
|
||||
|
||||
MutableArrayRef<T> drop_back(unsigned N) const {
|
||||
assert(this->size() >= N && "Dropping more elements than exist");
|
||||
return slice(0, this->size() - N);
|
||||
}
|
||||
|
||||
/// @}
|
||||
/// @name Operator Overloads
|
||||
/// @{
|
||||
@ -361,6 +366,6 @@ namespace llvm {
|
||||
template <typename T> struct isPodLike<ArrayRef<T> > {
|
||||
static const bool value = true;
|
||||
};
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -568,7 +568,7 @@ class BitVector {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
namespace std {
|
||||
/// Implement std::swap in terms of BitVector swap.
|
||||
|
@ -42,7 +42,7 @@ struct DenseMapPair : public std::pair<KeyT, ValueT> {
|
||||
ValueT &getSecond() { return std::pair<KeyT, ValueT>::second; }
|
||||
const ValueT &getSecond() const { return std::pair<KeyT, ValueT>::second; }
|
||||
};
|
||||
} // namespace detail
|
||||
}
|
||||
|
||||
template <
|
||||
typename KeyT, typename ValueT, typename KeyInfoT = DenseMapInfo<KeyT>,
|
||||
|
@ -14,6 +14,8 @@
|
||||
#ifndef LLVM_ADT_DENSEMAPINFO_H
|
||||
#define LLVM_ADT_DENSEMAPINFO_H
|
||||
|
||||
#include "llvm/ADT/Hashing.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/PointerLikeTypeTraits.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
|
||||
@ -163,6 +165,31 @@ struct DenseMapInfo<std::pair<T, U> > {
|
||||
}
|
||||
};
|
||||
|
||||
// Provide DenseMapInfo for StringRefs.
|
||||
template <> struct DenseMapInfo<StringRef> {
|
||||
static inline StringRef getEmptyKey() {
|
||||
return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)),
|
||||
0);
|
||||
}
|
||||
static inline StringRef getTombstoneKey() {
|
||||
return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)),
|
||||
0);
|
||||
}
|
||||
static unsigned getHashValue(StringRef Val) {
|
||||
assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!");
|
||||
assert(Val.data() != getTombstoneKey().data() &&
|
||||
"Cannot hash the tombstone key!");
|
||||
return (unsigned)(hash_value(Val));
|
||||
}
|
||||
static bool isEqual(StringRef LHS, StringRef RHS) {
|
||||
if (RHS.data() == getEmptyKey().data())
|
||||
return LHS.data() == getEmptyKey().data();
|
||||
if (RHS.data() == getTombstoneKey().data())
|
||||
return LHS.data() == getTombstoneKey().data();
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ template <typename KeyT> class DenseSetPair : public DenseSetEmpty {
|
||||
DenseSetEmpty &getSecond() { return *this; }
|
||||
const DenseSetEmpty &getSecond() const { return *this; }
|
||||
};
|
||||
} // namespace detail
|
||||
}
|
||||
|
||||
/// DenseSet - This implements a dense probed hash-table based set.
|
||||
template<typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT> >
|
||||
|
@ -288,6 +288,6 @@ iterator_range<idf_ext_iterator<T, SetTy>> inverse_depth_first_ext(const T& G,
|
||||
return make_range(idf_ext_begin(G, S), idf_ext_end(G, S));
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -278,6 +278,6 @@ class EquivalenceClasses {
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -101,6 +101,6 @@ struct GraphTraits<Inverse<Inverse<T> > > {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -80,6 +80,6 @@ template <typename T, typename ToIndexT = llvm::identity<unsigned> >
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -83,6 +83,6 @@ class IntEqClasses {
|
||||
void uncompress();
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -204,6 +204,6 @@ void operator>=(const Optional<T> &X, const Optional<U> &Y);
|
||||
template<typename T, typename U>
|
||||
void operator>(const Optional<T> &X, const Optional<U> &Y);
|
||||
|
||||
} // namespace llvm
|
||||
} // end llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -507,6 +507,6 @@ namespace llvm {
|
||||
RHS.template get<U>()));
|
||||
}
|
||||
};
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -295,6 +295,6 @@ class ReversePostOrderTraversal {
|
||||
rpo_iterator end() { return Blocks.rend(); }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -79,6 +79,6 @@ class PriorityQueue : public std::priority_queue<T, Sequence, Compare> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -240,6 +240,6 @@ template <class T> scc_iterator<Inverse<T> > scc_end(const Inverse<T> &G) {
|
||||
return scc_iterator<Inverse<T> >::end(G);
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -417,6 +417,6 @@ template <typename T> struct deref {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -66,6 +66,6 @@ void set_subtract(S1Ty &S1, const S2Ty &S2) {
|
||||
S1.erase(*SI);
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -225,7 +225,7 @@ class SmallSetVector : public SetVector<T, SmallVector<T, N>, SmallSet<T, N> > {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
// vim: sw=2 ai
|
||||
#endif
|
||||
|
@ -588,7 +588,7 @@ operator^(const SmallBitVector &LHS, const SmallBitVector &RHS) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
namespace std {
|
||||
/// Implement std::swap in terms of BitVector swap.
|
||||
|
@ -334,7 +334,7 @@ class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
namespace std {
|
||||
/// Implement std::swap in terms of SmallPtrSet swap.
|
||||
|
@ -292,6 +292,6 @@ class SmallString : public SmallVector<char, InternalLen> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -924,7 +924,7 @@ static inline size_t capacity_in_bytes(const SmallVector<T, N> &X) {
|
||||
return X.capacity_in_bytes();
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
namespace std {
|
||||
/// Implement std::swap in terms of SmallVector swap.
|
||||
@ -940,6 +940,6 @@ namespace std {
|
||||
swap(llvm::SmallVector<T, N> &LHS, llvm::SmallVector<T, N> &RHS) {
|
||||
LHS.swap(RHS);
|
||||
}
|
||||
} // namespace std
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -176,6 +176,6 @@ void PrintStatistics();
|
||||
/// \brief Print statistics to the given output stream.
|
||||
void PrintStatistics(raw_ostream &OS);
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -207,6 +207,6 @@ inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) {
|
||||
return join_impl(Begin, End, Separator, tag());
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -447,6 +447,6 @@ class StringMapIterator : public StringMapConstIterator<ValueTy> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -566,6 +566,6 @@ namespace llvm {
|
||||
// StringRefs can be treated like a POD type.
|
||||
template <typename T> struct isPodLike;
|
||||
template <> struct isPodLike<StringRef> { static const bool value = true; };
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -29,6 +29,6 @@ namespace llvm {
|
||||
return base::insert(std::make_pair(Key, '\0'));
|
||||
}
|
||||
};
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif // LLVM_ADT_STRINGSET_H
|
||||
|
@ -85,7 +85,9 @@ class Triple {
|
||||
spir64, // SPIR: standard portable IR for OpenCL 64-bit version
|
||||
kalimba, // Kalimba: generic kalimba
|
||||
shave, // SHAVE: Movidius vector VLIW processors
|
||||
LastArchType = shave
|
||||
wasm32, // WebAssembly with 32-bit pointers
|
||||
wasm64, // WebAssembly with 64-bit pointers
|
||||
LastArchType = wasm64
|
||||
};
|
||||
enum SubArchType {
|
||||
NoSubArch,
|
||||
@ -609,7 +611,7 @@ class Triple {
|
||||
/// @}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -537,6 +537,6 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// @}
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -97,6 +97,6 @@ unsigned ComputeEditDistance(ArrayRef<T> FromArray, ArrayRef<T> ToArray,
|
||||
return Result;
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -655,7 +655,7 @@ struct ilist : public iplist<NodeTy> {
|
||||
void resize(size_type newsize) { resize(newsize, NodeTy()); }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
namespace std {
|
||||
// Ensure that swap uses the fast list swap...
|
||||
|
@ -101,6 +101,6 @@ class ilist_node : private ilist_half_node<NodeTy> {
|
||||
/// @}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -162,6 +162,8 @@ class iterator_adaptor_base
|
||||
int>::type = 0)
|
||||
: I(std::forward<U &&>(u)) {}
|
||||
|
||||
const WrappedIteratorT &wrapped() const { return I; }
|
||||
|
||||
public:
|
||||
typedef DifferenceTypeT difference_type;
|
||||
|
||||
@ -239,6 +241,6 @@ struct pointee_iterator
|
||||
T &operator*() const { return **this->I; }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -51,6 +51,6 @@ template <class T> iterator_range<T> make_range(T x, T y) {
|
||||
template <typename T> iterator_range<T> make_range(std::pair<T, T> p) {
|
||||
return iterator_range<T>(std::move(p.first), std::move(p.second));
|
||||
}
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -56,6 +56,34 @@ class MemTransferInst;
|
||||
class MemIntrinsic;
|
||||
class DominatorTree;
|
||||
|
||||
/// The possible results of an alias query.
|
||||
///
|
||||
/// These results are always computed between two MemoryLocation objects as
|
||||
/// a query to some alias analysis.
|
||||
///
|
||||
/// Note that these are unscoped enumerations because we would like to support
|
||||
/// implicitly testing a result for the existence of any possible aliasing with
|
||||
/// a conversion to bool, but an "enum class" doesn't support this. The
|
||||
/// canonical names from the literature are suffixed and unique anyways, and so
|
||||
/// they serve as global constants in LLVM for these results.
|
||||
///
|
||||
/// See docs/AliasAnalysis.html for more information on the specific meanings
|
||||
/// of these values.
|
||||
enum AliasResult {
|
||||
/// The two locations do not alias at all.
|
||||
///
|
||||
/// This value is arranged to convert to false, while all other values
|
||||
/// convert to true. This allows a boolean context to convert the result to
|
||||
/// a binary flag indicating whether there is the possibility of aliasing.
|
||||
NoAlias = 0,
|
||||
/// The two locations may or may not alias. This is the least precise result.
|
||||
MayAlias,
|
||||
/// The two locations alias, but only due to a partial overlap.
|
||||
PartialAlias,
|
||||
/// The two locations precisely alias each other.
|
||||
MustAlias,
|
||||
};
|
||||
|
||||
class AliasAnalysis {
|
||||
protected:
|
||||
const DataLayout *DL;
|
||||
@ -95,22 +123,6 @@ class AliasAnalysis {
|
||||
/// Alias Queries...
|
||||
///
|
||||
|
||||
/// Alias analysis result - Either we know for sure that it does not alias, we
|
||||
/// know for sure it must alias, or we don't know anything: The two pointers
|
||||
/// _might_ alias. This enum is designed so you can do things like:
|
||||
/// if (AA.alias(P1, P2)) { ... }
|
||||
/// to check to see if two pointers might alias.
|
||||
///
|
||||
/// See docs/AliasAnalysis.html for more information on the specific meanings
|
||||
/// of these values.
|
||||
///
|
||||
enum AliasResult {
|
||||
NoAlias = 0, ///< No dependencies.
|
||||
MayAlias, ///< Anything goes.
|
||||
PartialAlias, ///< Pointers differ, but pointees overlap.
|
||||
MustAlias ///< Pointers are equal.
|
||||
};
|
||||
|
||||
/// alias - The main low level interface to the alias analysis implementation.
|
||||
/// Returns an AliasResult indicating whether the two pointers are aliased to
|
||||
/// each other. This is the interface that must be implemented by specific
|
||||
@ -558,6 +570,6 @@ bool isIdentifiedObject(const Value *V);
|
||||
/// IdentifiedObjects.
|
||||
bool isIdentifiedFunctionLocal(const Value *V);
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -117,24 +117,30 @@ class AliasSet : public ilist_node<AliasSet> {
|
||||
// AliasSets forwarding to it.
|
||||
unsigned RefCount : 28;
|
||||
|
||||
/// AccessType - Keep track of whether this alias set merely refers to the
|
||||
/// locations of memory, whether it modifies the memory, or whether it does
|
||||
/// both. The lattice goes from "NoModRef" to either Refs or Mods, then to
|
||||
/// ModRef as necessary.
|
||||
/// The kinds of access this alias set models.
|
||||
///
|
||||
enum AccessType {
|
||||
NoModRef = 0, Refs = 1, // Ref = bit 1
|
||||
Mods = 2, ModRef = 3 // Mod = bit 2
|
||||
/// We keep track of whether this alias set merely refers to the locations of
|
||||
/// memory (and not any particular access), whether it modifies or references
|
||||
/// the memory, or whether it does both. The lattice goes from "NoAccess" to
|
||||
/// either RefAccess or ModAccess, then to ModRefAccess as necessary.
|
||||
enum AccessLattice {
|
||||
NoAccess = 0,
|
||||
RefAccess = 1,
|
||||
ModAccess = 2,
|
||||
ModRefAccess = RefAccess | ModAccess
|
||||
};
|
||||
unsigned AccessTy : 2;
|
||||
unsigned Access : 2;
|
||||
|
||||
/// AliasType - Keep track the relationships between the pointers in the set.
|
||||
/// Lattice goes from MustAlias to MayAlias.
|
||||
/// The kind of alias relationship between pointers of the set.
|
||||
///
|
||||
enum AliasType {
|
||||
MustAlias = 0, MayAlias = 1
|
||||
/// These represent conservatively correct alias results between any members
|
||||
/// of the set. We represent these independently of the values of alias
|
||||
/// results in order to pack it into a single bit. Lattice goes from
|
||||
/// MustAlias to MayAlias.
|
||||
enum AliasLattice {
|
||||
SetMustAlias = 0, SetMayAlias = 1
|
||||
};
|
||||
unsigned AliasTy : 1;
|
||||
unsigned Alias : 1;
|
||||
|
||||
// Volatile - True if this alias set contains volatile loads or stores.
|
||||
bool Volatile : 1;
|
||||
@ -153,10 +159,10 @@ class AliasSet : public ilist_node<AliasSet> {
|
||||
|
||||
public:
|
||||
/// Accessors...
|
||||
bool isRef() const { return AccessTy & Refs; }
|
||||
bool isMod() const { return AccessTy & Mods; }
|
||||
bool isMustAlias() const { return AliasTy == MustAlias; }
|
||||
bool isMayAlias() const { return AliasTy == MayAlias; }
|
||||
bool isRef() const { return Access & RefAccess; }
|
||||
bool isMod() const { return Access & ModAccess; }
|
||||
bool isMustAlias() const { return Alias == SetMustAlias; }
|
||||
bool isMayAlias() const { return Alias == SetMayAlias; }
|
||||
|
||||
// isVolatile - Return true if this alias set contains volatile loads or
|
||||
// stores.
|
||||
@ -218,7 +224,7 @@ class AliasSet : public ilist_node<AliasSet> {
|
||||
friend struct ilist_sentinel_traits<AliasSet>;
|
||||
AliasSet()
|
||||
: PtrList(nullptr), PtrListEnd(&PtrList), Forward(nullptr), RefCount(0),
|
||||
AccessTy(NoModRef), AliasTy(MustAlias), Volatile(false) {
|
||||
Access(NoAccess), Alias(SetMustAlias), Volatile(false) {
|
||||
}
|
||||
|
||||
AliasSet(const AliasSet &AS) = delete;
|
||||
@ -419,11 +425,11 @@ class AliasSetTracker {
|
||||
}
|
||||
|
||||
AliasSet &addPointer(Value *P, uint64_t Size, const AAMDNodes &AAInfo,
|
||||
AliasSet::AccessType E,
|
||||
AliasSet::AccessLattice E,
|
||||
bool &NewSet) {
|
||||
NewSet = false;
|
||||
AliasSet &AS = getAliasSetForPointer(P, Size, AAInfo, &NewSet);
|
||||
AS.AccessTy |= E;
|
||||
AS.Access |= E;
|
||||
return AS;
|
||||
}
|
||||
AliasSet *findAliasSetForPointer(const Value *Ptr, uint64_t Size,
|
||||
@ -437,6 +443,6 @@ inline raw_ostream& operator<<(raw_ostream &OS, const AliasSetTracker &AST) {
|
||||
return OS;
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -63,6 +63,6 @@ class BlockFrequencyInfo : public FunctionPass {
|
||||
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -628,7 +628,7 @@ void IrreducibleGraph::addEdges(const BlockNode &Node,
|
||||
else
|
||||
addBlockEdges(*this, Irr, OuterLoop);
|
||||
}
|
||||
} // namespace bfi_detail
|
||||
}
|
||||
|
||||
/// \brief Shared implementation for block frequency analysis.
|
||||
///
|
||||
@ -1133,7 +1133,7 @@ template <class BT> struct BlockEdgesAdder {
|
||||
G.addEdge(Irr, BFI.getNode(*I), OuterLoop);
|
||||
}
|
||||
};
|
||||
} // namespace bfi_detail
|
||||
}
|
||||
template <class BT>
|
||||
void BlockFrequencyInfoImpl<BT>::computeIrreducibleMass(
|
||||
LoopData *OuterLoop, std::list<LoopData>::iterator Insert) {
|
||||
|
@ -158,6 +158,6 @@ class BranchProbabilityInfo : public FunctionPass {
|
||||
bool calcInvokeHeuristics(BasicBlock *BB);
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -78,6 +78,17 @@ bool isPotentiallyReachable(const BasicBlock *From, const BasicBlock *To,
|
||||
const DominatorTree *DT = nullptr,
|
||||
const LoopInfo *LI = nullptr);
|
||||
|
||||
} // namespace llvm
|
||||
/// \brief Determine whether there is at least one path from a block in
|
||||
/// 'Worklist' to 'StopBB', returning true if uncertain.
|
||||
///
|
||||
/// Determine whether there is a path from at least one block in Worklist to
|
||||
/// StopBB within a single function. Returns false only if we can prove that
|
||||
/// once any block in 'Worklist' has been reached then 'StopBB' can not be
|
||||
/// executed. Conservatively returns true.
|
||||
bool isPotentiallyReachableFromMany(SmallVectorImpl<BasicBlock *> &Worklist,
|
||||
BasicBlock *StopBB,
|
||||
const DominatorTree *DT = nullptr,
|
||||
const LoopInfo *LI = nullptr);
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
namespace llvm {
|
||||
class FunctionPass;
|
||||
|
@ -485,6 +485,6 @@ CGSCCToFunctionPassAdaptor<FunctionPassT>
|
||||
createCGSCCToFunctionPassAdaptor(FunctionPassT Pass) {
|
||||
return CGSCCToFunctionPassAdaptor<FunctionPassT>(std::move(Pass));
|
||||
}
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -481,6 +481,6 @@ struct GraphTraits<const CallGraph *> : public GraphTraits<
|
||||
static const CallGraphNode &CGdereference(PairTy P) { return *P.second; }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -102,6 +102,6 @@ class CallGraphSCC {
|
||||
iterator end() const { return Nodes.end(); }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -102,6 +102,6 @@ struct CodeMetrics {
|
||||
SmallPtrSetImpl<const Value *> &EphValues);
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -97,6 +97,6 @@ bool canConstantFoldCallTo(const Function *F);
|
||||
/// with the specified arguments, returning null if unsuccessful.
|
||||
Constant *ConstantFoldCall(Function *F, ArrayRef<Constant *> Operands,
|
||||
const TargetLibraryInfo *TLI = nullptr);
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -25,6 +25,6 @@ namespace llvm {
|
||||
FunctionPass *createPostDomOnlyPrinterPass();
|
||||
FunctionPass *createPostDomViewerPass();
|
||||
FunctionPass *createPostDomOnlyViewerPass();
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -205,6 +205,6 @@ class DominanceFrontier : public FunctionPass {
|
||||
EXTERN_TEMPLATE_INSTANTIATION(class DominanceFrontierBase<BasicBlock>);
|
||||
EXTERN_TEMPLATE_INSTANTIATION(class ForwardDominanceFrontierBase<BasicBlock>);
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -221,6 +221,6 @@ ForwardDominanceFrontierBase<BlockT>::calculate(const DomTreeT &DT,
|
||||
return *Result;
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -178,6 +178,6 @@ class IVUsers : public LoopPass {
|
||||
|
||||
Pass *createIVUsersPass();
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ namespace InlineConstants {
|
||||
/// Do not inline functions which allocate this many bytes on the stack
|
||||
/// when the caller is recursive.
|
||||
const unsigned TotalAllocaSizeRecursiveCaller = 1024;
|
||||
} // namespace InlineConstants
|
||||
}
|
||||
|
||||
/// \brief Represents the cost of inlining a function.
|
||||
///
|
||||
@ -138,6 +138,6 @@ class InlineCostAnalysis : public CallGraphSCCPass {
|
||||
bool isInlineViable(Function &Callee);
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -145,6 +145,6 @@ template <> struct GraphTraits<Inverse<Interval*> > {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -263,6 +263,6 @@ inline interval_part_interval_iterator intervals_end(IntervalPartition &IP) {
|
||||
return interval_part_interval_iterator();
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -106,6 +106,6 @@ class IntervalPartition : public FunctionPass {
|
||||
void updatePredecessors(Interval *Int);
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -92,5 +92,5 @@ class IDFCalculator {
|
||||
const SmallPtrSetImpl<BasicBlock *> *DefBlocks;
|
||||
SmallVector<BasicBlock *, 32> PHIBlocks;
|
||||
};
|
||||
} // namespace llvm
|
||||
}
|
||||
#endif
|
||||
|
@ -66,6 +66,6 @@ class JumpInstrTableInfo : public ImmutablePass {
|
||||
/// bound specifies the maximum number of bytes needed to represent an
|
||||
/// unconditional jump or a trap instruction in the back end currently in use.
|
||||
ModulePass *createJumpInstrTableInfoPass(unsigned Bound);
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif /* LLVM_ANALYSIS_JUMPINSTRTABLEINFO_H */
|
||||
|
@ -569,6 +569,6 @@ class LazyCallGraphPrinterPass {
|
||||
static StringRef name() { return "LazyCallGraphPrinterPass"; }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -66,6 +66,6 @@ namespace llvm {
|
||||
ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc);
|
||||
};
|
||||
} // namespace llvm
|
||||
} // End of llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -44,6 +44,6 @@ void lintFunction(
|
||||
const Function &F ///< The function to be checked
|
||||
);
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -52,6 +52,6 @@ Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,
|
||||
AliasAnalysis *AA = nullptr,
|
||||
AAMDNodes *AATags = nullptr);
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -555,6 +555,6 @@ class LoopAccessAnalysis : public FunctionPass {
|
||||
DominatorTree *DT;
|
||||
LoopInfo *LI;
|
||||
};
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -763,6 +763,6 @@ class LoopInfoWrapperPass : public FunctionPass {
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -535,6 +535,6 @@ void LoopInfoBase<BlockT, LoopT>::verify() const {
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -169,6 +169,6 @@ class LPPassManager : public FunctionPass, public PMDataManager {
|
||||
Loop *CurrentLoop;
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -262,6 +262,6 @@ class ObjectSizeOffsetEvaluator
|
||||
SizeOffsetEvalType visitInstruction(Instruction &I);
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -445,6 +445,6 @@ namespace llvm {
|
||||
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -137,6 +137,6 @@ template <> struct DenseMapInfo<MemoryLocation> {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -173,6 +173,6 @@ namespace llvm {
|
||||
//
|
||||
FunctionPass *createMemDerefPrinter();
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -112,6 +112,6 @@ template <> struct GraphTraits<PostDominatorTree*>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -280,6 +280,6 @@ class PtrUseVisitor : protected InstVisitor<DerivedT>,
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -906,5 +906,5 @@ EXTERN_TEMPLATE_INSTANTIATION(class RegionBase<RegionTraits<Function>>);
|
||||
EXTERN_TEMPLATE_INSTANTIATION(class RegionNodeBase<RegionTraits<Function>>);
|
||||
EXTERN_TEMPLATE_INSTANTIATION(class RegionInfoBase<RegionTraits<Function>>);
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
#endif
|
||||
|
@ -123,6 +123,6 @@ class RGPassManager : public FunctionPass, public PMDataManager {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user