Update LLVM to r89205.

This commit is contained in:
Roman Divacky 2009-11-18 14:58:34 +00:00
parent 72cc50852b
commit 907da171cc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/llvm/dist/; revision=199481
637 changed files with 17276 additions and 7379 deletions

View File

@ -70,6 +70,9 @@ else( MSVC )
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
endif( MSVC )
set(C_INCLUDE_DIRS "" CACHE STRING
"Colon separated list of directories clang will search for headers.")
set(LLVM_TARGET_ARCH "host"
CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.")
@ -164,13 +167,19 @@ option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
set(ENABLE_PIC 0)
if( LLVM_ENABLE_PIC )
if( SUPPORTS_FPIC_FLAG )
message(STATUS "Building with -fPIC")
add_llvm_definitions(-fPIC)
set(ENABLE_PIC 1)
else( SUPPORTS_FPIC_FLAG )
message(STATUS "Warning: -fPIC not supported.")
endif()
if( XCODE )
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
# know how to disable this, so just force ENABLE_PIC off for now.
message(STATUS "Warning: -fPIC not supported with Xcode.")
else( XCODE )
if( SUPPORTS_FPIC_FLAG )
message(STATUS "Building with -fPIC")
add_llvm_definitions(-fPIC)
set(ENABLE_PIC 1)
else( SUPPORTS_FPIC_FLAG )
message(STATUS "Warning: -fPIC not supported.")
endif()
endif()
endif()
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )

View File

@ -32,7 +32,11 @@ ifeq ($(BUILD_DIRS_ONLY),1)
else
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
tools runtime docs unittests
OPTIONAL_DIRS := examples projects bindings
OPTIONAL_DIRS := projects bindings
endif
ifeq ($(BUILD_EXAMPLES),1)
OPTIONAL_DIRS += examples
endif
EXTRA_DIST := test unittests llvm.spec include win32 Xcode

View File

@ -313,6 +313,12 @@ endif
# Location of the plugin header file for gold.
BINUTILS_INCDIR := @BINUTILS_INCDIR@
C_INCLUDE_DIRS := @C_INCLUDE_DISR@
CXX_INCLUDE_ROOT := @CXX_INCLUDE_ROOT@
CXX_INCLUDE_ARCH := @CXX_INCLUDE_ARCH@
CXX_INCLUDE_32BIT_DIR = @CXX_INCLUDE_32BIT_DIR@
CXX_INCLUDE_64BIT_DIR = @CXX_INCLUDE_64BIT_DIR@
# When ENABLE_LLVMC_DYNAMIC is enabled, LLVMC will link libCompilerDriver
# dynamically. This is needed to make dynamic plugins work on some targets
# (Windows).

View File

@ -338,11 +338,19 @@ ifeq ($(ENABLE_OPTIMIZED),1)
KEEP_SYMBOLS := 1
endif
else
BuildMode := Debug
CXX.Flags += -g
C.Flags += -g
LD.Flags += -g
KEEP_SYMBOLS := 1
ifdef NO_DEBUG_SYMBOLS
BuildMode := Unoptimized
CXX.Flags +=
C.Flags +=
LD.Flags +=
KEEP_SYMBOLS := 1
else
BuildMode := Debug
CXX.Flags += -g
C.Flags += -g
LD.Flags += -g
KEEP_SYMBOLS := 1
endif
endif
ifeq ($(ENABLE_PROFILING),1)

View File

@ -667,6 +667,41 @@ case "$withval" in
*) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
esac
AC_ARG_WITH(c-include-dir,
AS_HELP_STRING([--with-c-include-dirs],
[Colon separated list of directories clang will search for headers]),,
withval="")
AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval",
[Directories clang will search for headers])
AC_ARG_WITH(cxx-include-root,
AS_HELP_STRING([--with-cxx-include-root],
[Directory with the libstdc++ headers.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_ROOT,"$withval",
[Directory with the libstdc++ headers.])
AC_ARG_WITH(cxx-include-arch,
AS_HELP_STRING([--with-cxx-include-arch],
[Architecture of the libstdc++ headers.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_ARCH,"$withval",
[Arch the libstdc++ headers.])
AC_ARG_WITH(cxx-include-32bit-dir,
AS_HELP_STRING([--with-cxx-include-32bit-dir],
[32 bit multilib dir.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_32BIT_DIR,"$withval",
[32 bit multilib directory.])
AC_ARG_WITH(cxx-include-64bit-dir,
AS_HELP_STRING([--with-cxx-include-64bit-dir],
[64 bit multilib directory.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_64BIT_DIR,"$withval",
[64 bit multilib directory.])
dnl Allow linking of LLVM with GPLv3 binutils code.
AC_ARG_WITH(binutils-include,
AS_HELP_STRING([--with-binutils-include],

View File

@ -4,6 +4,11 @@ include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckCXXSourceCompiles)
if( UNIX )
# Used by check_symbol_exists:
set(CMAKE_REQUIRED_LIBRARIES m)
endif()
# Helper macros and functions
macro(add_cxx_include result files)
set(${result} "")
@ -39,7 +44,9 @@ check_include_file(malloc.h HAVE_MALLOC_H)
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_file(memory.h HAVE_MEMORY_H)
check_include_file(ndir.h HAVE_NDIR_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
if( NOT LLVM_ON_WIN32 )
check_include_file(pthread.h HAVE_PTHREAD_H)
endif()
check_include_file(setjmp.h HAVE_SETJMP_H)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(stdint.h HAVE_STDINT_H)
@ -63,10 +70,12 @@ check_include_file(utime.h HAVE_UTIME_H)
check_include_file(windows.h HAVE_WINDOWS_H)
# library checks
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
check_library_exists(dl dlopen "" HAVE_LIBDL)
if( NOT LLVM_ON_WIN32 )
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
check_library_exists(dl dlopen "" HAVE_LIBDL)
endif()
# function checks
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
@ -80,13 +89,16 @@ check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
check_symbol_exists(ceilf math.h HAVE_CEILF)
check_symbol_exists(floorf math.h HAVE_FLOORF)
check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF)
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
check_symbol_exists(malloc_zone_statistics malloc/malloc.h
HAVE_MALLOC_ZONE_STATISTICS)
check_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP)
check_symbol_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP)
check_symbol_exists(mktemp "stdlib.h;unistd.h" HAVE_MKTEMP)
check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
if( NOT LLVM_ON_WIN32 )
check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
endif()
check_symbol_exists(sbrk unistd.h HAVE_SBRK)
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
check_symbol_exists(strerror string.h HAVE_STRERROR)
@ -120,6 +132,27 @@ endif()
check_type_exists(uint64_t "${headers}" HAVE_UINT64_T)
check_type_exists(u_int64_t "${headers}" HAVE_U_INT64_T)
# available programs checks
function(llvm_find_program name)
string(TOUPPER ${name} NAME)
find_program(LLVM_PATH_${NAME} ${name})
mark_as_advanced(LLVM_PATH_${NAME})
if(LLVM_PATH_${NAME})
set(HAVE_${NAME} 1 CACHE INTERNAL "Is ${name} available ?")
mark_as_advanced(HAVE_${NAME})
else(LLVM_PATH_${NAME})
set(HAVE_${NAME} "" CACHE INTERNAL "Is ${name} available ?")
endif(LLVM_PATH_${NAME})
endfunction()
llvm_find_program(gv)
llvm_find_program(circo)
llvm_find_program(twopi)
llvm_find_program(neato)
llvm_find_program(fdp)
llvm_find_program(dot)
llvm_find_program(dotty)
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
include(CheckAtomic)
@ -132,7 +165,9 @@ endif()
include(GetTargetTriple)
get_target_triple(LLVM_HOSTTRIPLE)
message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}")
# FIXME: We don't distinguish the target and the host. :(
set(TARGET_TRIPLE "${LLVM_HOSTTRIPLE}")
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)

View File

@ -22,6 +22,28 @@ macro(add_llvm_library name)
endmacro(add_llvm_library name)
macro(add_llvm_loadable_module name)
if( NOT LLVM_ON_UNIX )
message(STATUS "Loadable modules not supported on this platform.
${name} ignored.")
else()
llvm_process_sources( ALL_FILES ${ARGN} )
add_library( ${name} MODULE ${ALL_FILES} )
set_target_properties( ${name} PROPERTIES PREFIX "" )
if (APPLE)
# Darwin-specific linker flags for loadable modules.
set_target_properties(${name} PROPERTIES
LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
endif()
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
endmacro(add_llvm_loadable_module name)
macro(add_llvm_executable name)
llvm_process_sources( ALL_FILES ${ARGN} )
add_executable(${name} ${ALL_FILES})

View File

@ -4,12 +4,12 @@
function( get_target_triple var )
if( MSVC )
if( CMAKE_CL_64 )
set( ${var} "x86_64-pc-win32" PARENT_SCOPE )
set( value "x86_64-pc-win32" )
else()
set( ${var} "i686-pc-win32" PARENT_SCOPE )
set( value "i686-pc-win32" )
endif()
elseif( MINGW AND NOT MSYS )
set( ${var} "i686-pc-mingw32" PARENT_SCOPE )
set( value "i686-pc-mingw32" )
else( MSVC )
set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
execute_process(COMMAND sh ${config_guess}
@ -19,7 +19,8 @@ function( get_target_triple var )
if( NOT TT_RV EQUAL 0 )
message(FATAL_ERROR "Failed to execute ${config_guess}")
endif( NOT TT_RV EQUAL 0 )
set( ${var} ${TT_OUT} PARENT_SCOPE )
message(STATUS "Target triple: ${${var}}")
set( value ${TT_OUT} )
endif( MSVC )
set( ${var} ${value} PARENT_SCOPE )
message(STATUS "Target triple: ${value}")
endfunction( get_target_triple var )

View File

@ -24,7 +24,6 @@ set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMHello LLVMCore LLVMSupport LLVMSystem)
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTransformUtils)
set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMSystem LLVMTarget)

126
configure vendored
View File

@ -1603,6 +1603,14 @@ Optional Packages:
--with-extra-options Specify additional options to compile LLVM with
--with-ocaml-libdir Specify install location for ocaml bindings (default
is stdlib)
--with-c-include-dirs Colon separated list of directories clang will
search for headers
--with-cxx-include-root Directory with the libstdc++ headers.
--with-cxx-include-arch Architecture of the libstdc++ headers.
--with-cxx-include-32bit-dir
32 bit multilib dir.
--with-cxx-include-64bit-dir
64 bit multilib directory.
--with-binutils-include Specify path to binutils/include/ containing
plugin-api.h file for gold plugin.
--with-tclinclude directory where tcl headers are
@ -5272,6 +5280,76 @@ echo "$as_me: error: Invalid path for --with-ocaml-libdir. Provide full path" >&
esac
# Check whether --with-c-include-dir was given.
if test "${with_c_include_dir+set}" = set; then
withval=$with_c_include_dir;
else
withval=""
fi
cat >>confdefs.h <<_ACEOF
#define C_INCLUDE_DIRS "$withval"
_ACEOF
# Check whether --with-cxx-include-root was given.
if test "${with_cxx_include_root+set}" = set; then
withval=$with_cxx_include_root;
else
withval=""
fi
cat >>confdefs.h <<_ACEOF
#define CXX_INCLUDE_ROOT "$withval"
_ACEOF
# Check whether --with-cxx-include-arch was given.
if test "${with_cxx_include_arch+set}" = set; then
withval=$with_cxx_include_arch;
else
withval=""
fi
cat >>confdefs.h <<_ACEOF
#define CXX_INCLUDE_ARCH "$withval"
_ACEOF
# Check whether --with-cxx-include-32bit-dir was given.
if test "${with_cxx_include_32bit_dir+set}" = set; then
withval=$with_cxx_include_32bit_dir;
else
withval=""
fi
cat >>confdefs.h <<_ACEOF
#define CXX_INCLUDE_32BIT_DIR "$withval"
_ACEOF
# Check whether --with-cxx-include-64bit-dir was given.
if test "${with_cxx_include_64bit_dir+set}" = set; then
withval=$with_cxx_include_64bit_dir;
else
withval=""
fi
cat >>confdefs.h <<_ACEOF
#define CXX_INCLUDE_64BIT_DIR "$withval"
_ACEOF
# Check whether --with-binutils-include was given.
if test "${with_binutils_include+set}" = set; then
withval=$with_binutils_include;
@ -11036,7 +11114,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11039 "configure"
#line 11117 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13180,7 +13258,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 13183 "configure"' > conftest.$ac_ext
echo '#line 13261 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -14898,11 +14976,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14901: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14979: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14905: \$? = $ac_status" >&5
echo "$as_me:14983: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -15166,11 +15244,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15169: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15247: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15173: \$? = $ac_status" >&5
echo "$as_me:15251: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -15270,11 +15348,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15273: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15351: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15277: \$? = $ac_status" >&5
echo "$as_me:15355: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -17722,7 +17800,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17725 "configure"
#line 17803 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17822,7 +17900,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17825 "configure"
#line 17903 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -20190,11 +20268,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20193: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20271: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:20197: \$? = $ac_status" >&5
echo "$as_me:20275: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -20294,11 +20372,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20297: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20375: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:20301: \$? = $ac_status" >&5
echo "$as_me:20379: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -21864,11 +21942,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:21867: $lt_compile\"" >&5)
(eval echo "\"\$as_me:21945: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:21871: \$? = $ac_status" >&5
echo "$as_me:21949: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -21968,11 +22046,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:21971: $lt_compile\"" >&5)
(eval echo "\"\$as_me:22049: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:21975: \$? = $ac_status" >&5
echo "$as_me:22053: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -24203,11 +24281,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:24206: $lt_compile\"" >&5)
(eval echo "\"\$as_me:24284: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:24210: \$? = $ac_status" >&5
echo "$as_me:24288: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -24471,11 +24549,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:24474: $lt_compile\"" >&5)
(eval echo "\"\$as_me:24552: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:24478: \$? = $ac_status" >&5
echo "$as_me:24556: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -24575,11 +24653,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:24578: $lt_compile\"" >&5)
(eval echo "\"\$as_me:24656: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:24582: \$? = $ac_status" >&5
echo "$as_me:24660: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized

View File

@ -36,6 +36,9 @@ Finally, B<lit> also supports additional options for only running a subset of
the options specified on the command line, see L<"SELECTION OPTIONS"> for
more information.
Users interested in the B<lit> architecture or designing a B<lit> testing
implementation should see L<"LIT ARCHITECTURE">
=head1 GENERAL OPTIONS
=over
@ -146,6 +149,11 @@ List the discovered test suites as part of the standard output.
Run Tcl scripts internally (instead of converting to shell scripts).
=item B<--repeat>=I<N>
Run each test I<N> times. Currently this is primarily useful for timing tests,
other results are not collated in any reasonable fashion.
=back
=head1 EXIT STATUS
@ -222,6 +230,119 @@ Depending on the test format tests may produce additional information about
their status (generally only for failures). See the L<Output|"LIT OUTPUT">
section for more information.
=head1 LIT INFRASTRUCTURE
This section describes the B<lit> testing architecture for users interested in
creating a new B<lit> testing implementation, or extending an existing one.
B<lit> proper is primarily an infrastructure for discovering and running
arbitrary tests, and to expose a single convenient interface to these
tests. B<lit> itself doesn't contain know how to run tests, rather this logic is
defined by I<test suites>.
=head2 TEST SUITES
As described in L<"TEST DISCOVERY">, tests are always located inside a I<test
suite>. Test suites serve to define the format of the tests they contain, the
logic for finding those tests, and any additional information to run the tests.
B<lit> identifies test suites as directories containing I<lit.cfg> or
I<lit.site.cfg> files (see also B<--config-prefix>. Test suites are initially
discovered by recursively searching up the directory hierarchy for all the input
files passed on the command line. You can use B<--show-suites> to display the
discovered test suites at startup.
Once a test suite is discovered, its config file is loaded. Config files
themselves are just Python modules which will be executed. When the config file
is executed, two important global variables are predefined:
=over
=item B<lit>
The global B<lit> configuration object (a I<LitConfig> instance), which defines
the builtin test formats, global configuration parameters, and other helper
routines for implementing test configurations.
=item B<config>
This is the config object (a I<TestingConfig> instance) for the test suite,
which the config file is expected to populate. The following variables are also
available on the I<config> object, some of which must be set by the config and
others are optional or predefined:
B<name> I<[required]> The name of the test suite, for use in reports and
diagnostics.
B<test_format> I<[required]> The test format object which will be used to
discover and run tests in the test suite. Generally this will be a builtin test
format available from the I<lit.formats> module.
B<test_src_root> The filesystem path to the test suite root. For out-of-dir
builds this is the directory that will be scanned for tests.
B<test_exec_root> For out-of-dir builds, the path to the test suite root inside
the object directory. This is where tests will be run and temporary output files
places.
B<environment> A dictionary representing the environment to use when executing
tests in the suite.
B<suffixes> For B<lit> test formats which scan directories for tests, this
variable as a list of suffixes to identify test files. Used by: I<ShTest>,
I<TclTest>.
B<substitutions> For B<lit> test formats which substitute variables into a test
script, the list of substitutions to perform. Used by: I<ShTest>, I<TclTest>.
B<unsupported> Mark an unsupported directory, all tests within it will be
reported as unsupported. Used by: I<ShTest>, I<TclTest>.
B<parent> The parent configuration, this is the config object for the directory
containing the test suite, or None.
B<on_clone> The config is actually cloned for every subdirectory inside a test
suite, to allow local configuration on a per-directory basis. The I<on_clone>
variable can be set to a Python function which will be called whenever a
configuration is cloned (for a subdirectory). The function should takes three
arguments: (1) the parent configuration, (2) the new configuration (which the
I<on_clone> function will generally modify), and (3) the test path to the new
directory being scanned.
=back
=head2 TEST DISCOVERY
Once test suites are located, B<lit> recursively traverses the source directory
(following I<test_src_root>) looking for tests. When B<lit> enters a
sub-directory, it first checks to see if a nest test suite is defined in that
directory. If so, it loads that test suite recursively, otherwise it
instantiates a local test config for the directory (see L<"LOCAL CONFIGURATION
FILES">).
Tests are identified by the test suite they are contained within, and the
relative path inside that suite. Note that the relative path may not refer to an
actual file on disk; some test formats (such as I<GoogleTest>) define "virtual
tests" which have a path that contains both the path to the actual test file and
a subpath to identify the virtual test.
=head2 LOCAL CONFIGURATION FILES
When B<lit> loads a subdirectory in a test suite, it instantiates a local test
configuration by cloning the configuration for the parent direction -- the root
of this configuration chain will always be a test suite. Once the test
configuration is cloned B<lit> checks for a I<lit.local.cfg> file in the
subdirectory. If present, this file will be loaded and can be used to specialize
the configuration for each individual directory. This facility can be used to
define subdirectories of optional tests, or to change other configuration
parameters -- for example, to change the test format, or the suffixes which
identify test files.
=head2 LIT EXAMPLE TESTS
The B<lit> distribution contains several example implementations of test suites
in the I<ExampleTests> directory.
=head1 SEE ALSO
L<valgrind(1)>

View File

@ -1215,6 +1215,13 @@ target datalayout = "<i>layout specification</i>"
<dt><tt>s<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
<dd>This specifies the alignment for a stack object of a given bit
<i>size</i>.</dd>
<dt><tt>n<i>size1</i>:<i>size2</i>:<i>size3</i>...</tt></dt>
<dd>This specifies a set of native integer widths for the target CPU
in bits. For example, it might contain "n32" for 32-bit PowerPC,
"n32:64" for PowerPC 64, or "n8:16:32:64" for X86-64. Elements of
this set are considered to support most general arithmetic
operations efficiently.</dd>
</dl>
<p>When constructing the data layout for a given target, LLVM starts with a
@ -1569,12 +1576,12 @@ Classifications</a> </div>
</tr>
</table>
<p>Note that 'variable sized arrays' can be implemented in LLVM with a zero
length array. Normally, accesses past the end of an array are undefined in
LLVM (e.g. it is illegal to access the 5th element of a 3 element array). As
a special case, however, zero length arrays are recognized to be variable
length. This allows implementation of 'pascal style arrays' with the LLVM
type "<tt>{ i32, [0 x float]}</tt>", for example.</p>
<p>There is no restriction on indexing beyond the end of the array implied by
a static type (though there are restrictions on indexing beyond the bounds
of an allocated object in some cases). This means that single-dimension
'variable sized array' addressing can be implemented in LLVM with a zero
length array type. An implementation of 'pascal style arrays' in LLVM could
use the type "<tt>{ i32, [0 x float]}</tt>", for example.</p>
<p>Note that the code generator does not yet support large aggregate types to be
used as function return types. The specific limit on how large an aggregate
@ -7278,7 +7285,7 @@ LLVM</a>.</p>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2009-11-02 01:25:26 +0100 (Mon, 02 Nov 2009) $
Last modified: $Date: 2009-11-09 20:01:53 +0100 (Mon, 09 Nov 2009) $
</address>
</body>

View File

@ -774,7 +774,7 @@ DW_TAG_return_variable = 258
<p>This intrinsic is used to provide correspondence between the source file and
the generated code. The first argument is the line number (base 1), second
argument is the column number (0 if unknown) and the third argument the
source <tt>%<a href="#format_compile_units">llvm.dbg.compile_unit</a>.
source <tt>%<a href="#format_compile_units">llvm.dbg.compile_unit</a></tt>.
Code following a call to this intrinsic will
have been defined in close proximity of the line, column and file. This
information holds until the next call
@ -1813,7 +1813,7 @@ enum Trees {
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $
Last modified: $Date: 2009-11-17 14:13:59 +0100 (Tue, 17 Nov 2009) $
</address>
</body>

View File

@ -31,9 +31,6 @@ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM);
/** See llvm::createCFGSimplificationPass function. */
void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM);
/** See llvm::createCondPropagationPass function. */
void LLVMAddCondPropagationPass(LLVMPassManagerRef PM);
/** See llvm::createDeadStoreEliminationPass function. */
void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM);

View File

@ -14,8 +14,9 @@
#ifndef LLVM_ADT_DENSEMAP_H
#define LLVM_ADT_DENSEMAP_H
#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/type_traits.h"
#include "llvm/ADT/DenseMapInfo.h"
#include <iterator>
#include <new>
@ -27,12 +28,8 @@ namespace llvm {
template<typename KeyT, typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
typename ValueInfoT = DenseMapInfo<ValueT> >
typename ValueInfoT = DenseMapInfo<ValueT>, bool IsConst = false>
class DenseMapIterator;
template<typename KeyT, typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
typename ValueInfoT = DenseMapInfo<ValueT> >
class DenseMapConstIterator;
template<typename KeyT, typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
@ -73,7 +70,8 @@ class DenseMap {
}
typedef DenseMapIterator<KeyT, ValueT, KeyInfoT> iterator;
typedef DenseMapConstIterator<KeyT, ValueT, KeyInfoT> const_iterator;
typedef DenseMapIterator<KeyT, ValueT,
KeyInfoT, ValueInfoT, true> const_iterator;
inline iterator begin() {
return iterator(Buckets, Buckets+NumBuckets);
}
@ -426,32 +424,47 @@ class DenseMap {
}
};
template<typename KeyT, typename ValueT, typename KeyInfoT, typename ValueInfoT>
class DenseMapIterator :
public std::iterator<std::forward_iterator_tag, std::pair<KeyT, ValueT>,
ptrdiff_t> {
typedef std::pair<KeyT, ValueT> BucketT;
protected:
const BucketT *Ptr, *End;
template<typename KeyT, typename ValueT,
typename KeyInfoT, typename ValueInfoT, bool IsConst>
class DenseMapIterator {
typedef std::pair<KeyT, ValueT> Bucket;
typedef DenseMapIterator<KeyT, ValueT,
KeyInfoT, ValueInfoT, true> ConstIterator;
friend class DenseMapIterator<KeyT, ValueT, KeyInfoT, ValueInfoT, true>;
public:
typedef ptrdiff_t difference_type;
typedef typename conditional<IsConst, const Bucket, Bucket>::type value_type;
typedef value_type *pointer;
typedef value_type &reference;
typedef std::forward_iterator_tag iterator_category;
private:
pointer Ptr, End;
public:
DenseMapIterator() : Ptr(0), End(0) {}
DenseMapIterator(const BucketT *Pos, const BucketT *E) : Ptr(Pos), End(E) {
DenseMapIterator(pointer Pos, pointer E) : Ptr(Pos), End(E) {
AdvancePastEmptyBuckets();
}
std::pair<KeyT, ValueT> &operator*() const {
return *const_cast<BucketT*>(Ptr);
// If IsConst is true this is a converting constructor from iterator to
// const_iterator and the default copy constructor is used.
// Otherwise this is a copy constructor for iterator.
DenseMapIterator(const DenseMapIterator<KeyT, ValueT,
KeyInfoT, ValueInfoT, false>& I)
: Ptr(I.Ptr), End(I.End) {}
reference operator*() const {
return *Ptr;
}
std::pair<KeyT, ValueT> *operator->() const {
return const_cast<BucketT*>(Ptr);
pointer operator->() const {
return Ptr;
}
bool operator==(const DenseMapIterator &RHS) const {
return Ptr == RHS.Ptr;
bool operator==(const ConstIterator &RHS) const {
return Ptr == RHS.operator->();
}
bool operator!=(const DenseMapIterator &RHS) const {
return Ptr != RHS.Ptr;
bool operator!=(const ConstIterator &RHS) const {
return Ptr != RHS.operator->();
}
inline DenseMapIterator& operator++() { // Preincrement
@ -475,22 +488,6 @@ class DenseMapIterator :
}
};
template<typename KeyT, typename ValueT, typename KeyInfoT, typename ValueInfoT>
class DenseMapConstIterator : public DenseMapIterator<KeyT, ValueT, KeyInfoT> {
public:
DenseMapConstIterator() : DenseMapIterator<KeyT, ValueT, KeyInfoT>() {}
DenseMapConstIterator(const std::pair<KeyT, ValueT> *Pos,
const std::pair<KeyT, ValueT> *E)
: DenseMapIterator<KeyT, ValueT, KeyInfoT>(Pos, E) {
}
const std::pair<KeyT, ValueT> &operator*() const {
return *this->Ptr;
}
const std::pair<KeyT, ValueT> *operator->() const {
return this->Ptr;
}
};
} // end namespace llvm
#endif

View File

@ -30,7 +30,7 @@ struct GraphTraits {
// typedef NodeType - Type of Node in the graph
// typedef ChildIteratorType - Type used to iterate over children in graph
// static NodeType *getEntryNode(GraphType *)
// static NodeType *getEntryNode(const GraphType &)
// Return the entry node of the graph
// static ChildIteratorType child_begin(NodeType *)

View File

@ -102,8 +102,8 @@ class ImmutableMap {
}
private:
Factory(const Factory& RHS) {};
void operator=(const Factory& RHS) {};
Factory(const Factory& RHS); // DO NOT IMPLEMENT
void operator=(const Factory& RHS); // DO NOT IMPLEMENT
};
friend class Factory;

View File

@ -988,8 +988,8 @@ class ImmutableSet {
BumpPtrAllocator& getAllocator() { return F.getAllocator(); }
private:
Factory(const Factory& RHS) {}
void operator=(const Factory& RHS) {}
Factory(const Factory& RHS); // DO NOT IMPLEMENT
void operator=(const Factory& RHS); // DO NOT IMPLEMENT
};
friend class Factory;

View File

@ -186,8 +186,9 @@ namespace llvm {
int is() const {
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
return Val.is<InnerUnion>() && Val.get<InnerUnion>().is<T>();
return Val.is<T>();
return Val.template is<InnerUnion>() &&
Val.template get<InnerUnion>().template is<T>();
return Val.template is<T>();
}
/// get<T>() - Return the value of the specified pointer type. If the
@ -197,9 +198,9 @@ namespace llvm {
assert(is<T>() && "Invalid accessor called");
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
return Val.get<InnerUnion>().get<T>();
return Val.template get<InnerUnion>().template get<T>();
return Val.get<T>();
return Val.template get<T>();
}
/// dyn_cast<T>() - If the current value is of the specified pointer type,
@ -291,8 +292,10 @@ namespace llvm {
int is() const {
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
return Val.is<InnerUnion1>() && Val.get<InnerUnion1>().is<T>();
return Val.is<InnerUnion2>() && Val.get<InnerUnion2>().is<T>();
return Val.template is<InnerUnion1>() &&
Val.template get<InnerUnion1>().template is<T>();
return Val.template is<InnerUnion2>() &&
Val.template get<InnerUnion2>().template is<T>();
}
/// get<T>() - Return the value of the specified pointer type. If the
@ -302,9 +305,9 @@ namespace llvm {
assert(is<T>() && "Invalid accessor called");
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
return Val.get<InnerUnion1>().get<T>();
return Val.template get<InnerUnion1>().template get<T>();
return Val.get<InnerUnion2>().get<T>();
return Val.template get<InnerUnion2>().template get<T>();
}
/// dyn_cast<T>() - If the current value is of the specified pointer type,

View File

@ -14,6 +14,7 @@
#ifndef LLVM_ADT_PRIORITY_QUEUE_H
#define LLVM_ADT_PRIORITY_QUEUE_H
#include <algorithm>
#include <queue>
namespace llvm {

View File

@ -136,8 +136,8 @@ class scc_iterator
typedef scc_iterator<GraphT, GT> _Self;
// Provide static "constructors"...
static inline _Self begin(GraphT& G) { return _Self(GT::getEntryNode(G)); }
static inline _Self end (GraphT& G) { return _Self(); }
static inline _Self begin(const GraphT& G) { return _Self(GT::getEntryNode(G)); }
static inline _Self end (const GraphT& G) { return _Self(); }
// Direct loop termination test (I.fini() is more efficient than I == end())
inline bool fini() const {
@ -186,15 +186,25 @@ class scc_iterator
// Global constructor for the SCC iterator.
template <class T>
scc_iterator<T> scc_begin(T G) {
scc_iterator<T> scc_begin(const T& G) {
return scc_iterator<T>::begin(G);
}
template <class T>
scc_iterator<T> scc_end(T G) {
scc_iterator<T> scc_end(const T& G) {
return scc_iterator<T>::end(G);
}
template <class T>
scc_iterator<Inverse<T> > scc_begin(const Inverse<T>& G) {
return scc_iterator<Inverse<T> >::begin(G);
}
template <class T>
scc_iterator<Inverse<T> > scc_end(const Inverse<T>& G) {
return scc_iterator<Inverse<T> >::end(G);
}
} // End llvm namespace
#endif

View File

@ -270,6 +270,14 @@ static inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
get_array_pad_sort_comparator(*Start));
}
template<class IteratorTy>
static inline void array_pod_sort(IteratorTy Start, IteratorTy End,
int (*Compare)(const void*, const void*)) {
// Don't dereference start iterator of empty sequence.
if (Start == End) return;
qsort(&*Start, End-Start, sizeof(*Start), Compare);
}
} // End llvm namespace
#endif

View File

@ -96,12 +96,12 @@ class StringMapImpl {
/// specified bucket will be non-null. Otherwise, it will be null. In either
/// case, the FullHashValue field of the bucket will be set to the hash value
/// of the string.
unsigned LookupBucketFor(const StringRef &Key);
unsigned LookupBucketFor(StringRef Key);
/// FindKey - Look up the bucket that contains the specified key. If it exists
/// in the map, return the bucket number of the key. Otherwise return -1.
/// This does not modify the map.
int FindKey(const StringRef &Key) const;
int FindKey(StringRef Key) const;
/// RemoveKey - Remove the specified StringMapEntry from the table, but do not
/// delete it. This aborts if the value isn't in the table.
@ -109,7 +109,7 @@ class StringMapImpl {
/// RemoveKey - Remove the StringMapEntry for the specified key from the
/// table, returning it. If the key is not in the table, this returns null.
StringMapEntryBase *RemoveKey(const StringRef &Key);
StringMapEntryBase *RemoveKey(StringRef Key);
private:
void init(unsigned Size);
public:
@ -282,13 +282,13 @@ class StringMap : public StringMapImpl {
return const_iterator(TheTable+NumBuckets, true);
}
iterator find(const StringRef &Key) {
iterator find(StringRef Key) {
int Bucket = FindKey(Key);
if (Bucket == -1) return end();
return iterator(TheTable+Bucket);
}
const_iterator find(const StringRef &Key) const {
const_iterator find(StringRef Key) const {
int Bucket = FindKey(Key);
if (Bucket == -1) return end();
return const_iterator(TheTable+Bucket);
@ -296,18 +296,18 @@ class StringMap : public StringMapImpl {
/// lookup - Return the entry for the specified key, or a default
/// constructed value if no such entry exists.
ValueTy lookup(const StringRef &Key) const {
ValueTy lookup(StringRef Key) const {
const_iterator it = find(Key);
if (it != end())
return it->second;
return ValueTy();
}
ValueTy& operator[](const StringRef &Key) {
ValueTy& operator[](StringRef Key) {
return GetOrCreateValue(Key).getValue();
}
size_type count(const StringRef &Key) const {
size_type count(StringRef Key) const {
return find(Key) == end() ? 0 : 1;
}
@ -350,7 +350,7 @@ class StringMap : public StringMapImpl {
/// exists, return it. Otherwise, default construct a value, insert it, and
/// return.
template <typename InitTy>
StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key,
StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key,
InitTy Val) {
unsigned BucketNo = LookupBucketFor(Key);
ItemBucket &Bucket = TheTable[BucketNo];
@ -373,7 +373,7 @@ class StringMap : public StringMapImpl {
return *NewItem;
}
StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key) {
StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key) {
return GetOrCreateValue(Key, ValueTy());
}
@ -401,7 +401,7 @@ class StringMap : public StringMapImpl {
V.Destroy(Allocator);
}
bool erase(const StringRef &Key) {
bool erase(StringRef Key) {
iterator I = find(Key);
if (I == end()) return false;
erase(I);

View File

@ -16,6 +16,8 @@
#include <string>
namespace llvm {
template<typename T>
class SmallVectorImpl;
/// StringRef - Represent a constant reference to a string, i.e. a character
/// array and a length, which need not be null terminated.
@ -46,7 +48,7 @@ namespace llvm {
/// Construct a string ref from a cstring.
/*implicit*/ StringRef(const char *Str)
: Data(Str) { if (Str) Length = ::strlen(Str); else Length = 0; }
: Data(Str), Length(::strlen(Str)) {}
/// Construct a string ref from a pointer and length.
/*implicit*/ StringRef(const char *data, size_t length)
@ -54,7 +56,7 @@ namespace llvm {
/// Construct a string ref from an std::string.
/*implicit*/ StringRef(const std::string &Str)
: Data(Str.c_str()), Length(Str.length()) {}
: Data(Str.data()), Length(Str.length()) {}
/// @}
/// @name Iterators
@ -92,14 +94,19 @@ namespace llvm {
/// equals - Check for string equality, this is more efficient than
/// compare() when the relative ordering of inequal strings isn't needed.
bool equals(const StringRef &RHS) const {
bool equals(StringRef RHS) const {
return (Length == RHS.Length &&
memcmp(Data, RHS.Data, RHS.Length) == 0);
}
/// equals_lower - Check for string equality, ignoring case.
bool equals_lower(StringRef RHS) const {
return Length == RHS.Length && compare_lower(RHS) == 0;
}
/// compare - Compare two strings; the result is -1, 0, or 1 if this string
/// is lexicographically less than, equal to, or greater than the \arg RHS.
int compare(const StringRef &RHS) const {
int compare(StringRef RHS) const {
// Check the prefix for a mismatch.
if (int Res = memcmp(Data, RHS.Data, std::min(Length, RHS.Length)))
return Res < 0 ? -1 : 1;
@ -110,6 +117,9 @@ namespace llvm {
return Length < RHS.Length ? -1 : 1;
}
/// compare_lower - Compare two strings, ignoring case.
int compare_lower(StringRef RHS) const;
/// str - Get the contents as an std::string.
std::string str() const { return std::string(Data, Length); }
@ -135,12 +145,12 @@ namespace llvm {
/// @{
/// startswith - Check if this string starts with the given \arg Prefix.
bool startswith(const StringRef &Prefix) const {
bool startswith(StringRef Prefix) const {
return substr(0, Prefix.Length).equals(Prefix);
}
/// endswith - Check if this string ends with the given \arg Suffix.
bool endswith(const StringRef &Suffix) const {
bool endswith(StringRef Suffix) const {
return slice(size() - Suffix.Length, size()).equals(Suffix);
}
@ -152,8 +162,8 @@ namespace llvm {
///
/// \return - The index of the first occurence of \arg C, or npos if not
/// found.
size_t find(char C) const {
for (size_t i = 0, e = Length; i != e; ++i)
size_t find(char C, size_t From = 0) const {
for (size_t i = std::min(From, Length), e = Length; i != e; ++i)
if (Data[i] == C)
return i;
return npos;
@ -163,7 +173,7 @@ namespace llvm {
///
/// \return - The index of the first occurence of \arg Str, or npos if not
/// found.
size_t find(const StringRef &Str) const;
size_t find(StringRef Str, size_t From = 0) const;
/// rfind - Search for the last character \arg C in the string.
///
@ -184,19 +194,27 @@ namespace llvm {
///
/// \return - The index of the last occurence of \arg Str, or npos if not
/// found.
size_t rfind(const StringRef &Str) const;
size_t rfind(StringRef Str) const;
/// find_first_of - Find the first instance of the specified character or
/// return npos if not in string. Same as find.
size_type find_first_of(char C) const { return find(C); }
/// find_first_of - Find the first character in the string that is \arg C,
/// or npos if not found. Same as find.
size_type find_first_of(char C, size_t = 0) const { return find(C); }
/// find_first_of - Find the first character from the string 'Chars' in the
/// current string or return npos if not in string.
size_type find_first_of(StringRef Chars) const;
/// find_first_of - Find the first character in the string that is in \arg
/// Chars, or npos if not found.
///
/// Note: O(size() * Chars.size())
size_type find_first_of(StringRef Chars, size_t From = 0) const;
/// find_first_not_of - Find the first character in the string that is not
/// in the string 'Chars' or return npos if all are in string. Same as find.
size_type find_first_not_of(StringRef Chars) const;
/// \arg C or npos if not found.
size_type find_first_not_of(char C, size_t From = 0) const;
/// find_first_not_of - Find the first character in the string that is not
/// in the string \arg Chars, or npos if not found.
///
/// Note: O(size() * Chars.size())
size_type find_first_not_of(StringRef Chars, size_t From = 0) const;
/// @}
/// @name Helpful Algorithms
@ -213,7 +231,7 @@ namespace llvm {
/// count - Return the number of non-overlapped occurrences of \arg Str in
/// the string.
size_t count(const StringRef &Str) const;
size_t count(StringRef Str) const;
/// getAsInteger - Parse the current string as an integer of the specified
/// radix. If Radix is specified as zero, this does radix autosensing using
@ -281,6 +299,42 @@ namespace llvm {
return std::make_pair(slice(0, Idx), slice(Idx+1, npos));
}
/// split - Split into two substrings around the first occurence of a
/// separator string.
///
/// If \arg Separator is in the string, then the result is a pair (LHS, RHS)
/// such that (*this == LHS + Separator + RHS) is true and RHS is
/// maximal. If \arg Separator is not in the string, then the result is a
/// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
///
/// \param Separator - The string to split on.
/// \return - The split substrings.
std::pair<StringRef, StringRef> split(StringRef Separator) const {
size_t Idx = find(Separator);
if (Idx == npos)
return std::make_pair(*this, StringRef());
return std::make_pair(slice(0, Idx), slice(Idx + Separator.size(), npos));
}
/// split - Split into substrings around the occurences of a separator
/// string.
///
/// Each substring is stored in \arg A. If \arg MaxSplit is >= 0, at most
/// \arg MaxSplit splits are done and consequently <= \arg MaxSplit
/// elements are added to A.
/// If \arg KeepEmpty is false, empty strings are not added to \arg A. They
/// still count when considering \arg MaxSplit
/// An useful invariant is that
/// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
///
/// \param A - Where to put the substrings.
/// \param Separator - The string to split on.
/// \param MaxSplit - The maximum number of times the string is split.
/// \parm KeepEmpty - True if empty substring should be added.
void split(SmallVectorImpl<StringRef> &A,
StringRef Separator, int MaxSplit = -1,
bool KeepEmpty = true) const;
/// rsplit - Split into two substrings around the last occurence of a
/// separator character.
///
@ -304,27 +358,27 @@ namespace llvm {
/// @name StringRef Comparison Operators
/// @{
inline bool operator==(const StringRef &LHS, const StringRef &RHS) {
inline bool operator==(StringRef LHS, StringRef RHS) {
return LHS.equals(RHS);
}
inline bool operator!=(const StringRef &LHS, const StringRef &RHS) {
inline bool operator!=(StringRef LHS, StringRef RHS) {
return !(LHS == RHS);
}
inline bool operator<(const StringRef &LHS, const StringRef &RHS) {
inline bool operator<(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) == -1;
}
inline bool operator<=(const StringRef &LHS, const StringRef &RHS) {
inline bool operator<=(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) != 1;
}
inline bool operator>(const StringRef &LHS, const StringRef &RHS) {
inline bool operator>(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) == 1;
}
inline bool operator>=(const StringRef &LHS, const StringRef &RHS) {
inline bool operator>=(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) != -1;
}

View File

@ -65,6 +65,33 @@ class StringSwitch {
return *this;
}
template<unsigned N0, unsigned N1>
StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
const T& Value) {
return Case(S0, Value).Case(S1, Value);
}
template<unsigned N0, unsigned N1, unsigned N2>
StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
const char (&S2)[N2], const T& Value) {
return Case(S0, Value).Case(S1, Value).Case(S2, Value);
}
template<unsigned N0, unsigned N1, unsigned N2, unsigned N3>
StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
const char (&S2)[N2], const char (&S3)[N3],
const T& Value) {
return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value);
}
template<unsigned N0, unsigned N1, unsigned N2, unsigned N3, unsigned N4>
StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
const char (&S2)[N2], const char (&S3)[N3],
const char (&S4)[N4], const T& Value) {
return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value)
.Case(S4, Value);
}
T Default(const T& Value) {
if (ResultKnown)
return Result;

View File

@ -18,6 +18,7 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/Support/DOTGraphTraits.h"
#include <cassert>
#include <vector>
namespace llvm {

View File

@ -94,6 +94,7 @@ class Triple {
MinGW64,
NetBSD,
OpenBSD,
Psp,
Solaris,
Win32,
Haiku
@ -160,6 +161,8 @@ class Triple {
/// @name Direct Component Access
/// @{
const std::string &str() const { return Data; }
const std::string &getTriple() const { return Data; }
/// getArchName - Get the architecture (first) component of the
@ -218,23 +221,27 @@ class Triple {
/// setArchName - Set the architecture (first) component of the
/// triple by name.
void setArchName(const StringRef &Str);
void setArchName(StringRef Str);
/// setVendorName - Set the vendor (second) component of the triple
/// by name.
void setVendorName(const StringRef &Str);
void setVendorName(StringRef Str);
/// setOSName - Set the operating system (third) component of the
/// triple by name.
void setOSName(const StringRef &Str);
void setOSName(StringRef Str);
/// setEnvironmentName - Set the optional environment (fourth)
/// component of the triple by name.
void setEnvironmentName(const StringRef &Str);
void setEnvironmentName(StringRef Str);
/// setOSAndEnvironmentName - Set the operating system and optional
/// environment components with a single string.
void setOSAndEnvironmentName(const StringRef &Str);
void setOSAndEnvironmentName(StringRef Str);
/// getArchNameForAssembler - Get an architecture name that is understood by the
/// target assembler.
const char *getArchNameForAssembler();
/// @}
/// @name Static helpers for IDs.
@ -265,12 +272,12 @@ class Triple {
/// getArchTypeForLLVMName - The canonical type for the given LLVM
/// architecture name (e.g., "x86").
static ArchType getArchTypeForLLVMName(const StringRef &Str);
static ArchType getArchTypeForLLVMName(StringRef Str);
/// getArchTypeForDarwinArchName - Get the architecture type for a "Darwin"
/// architecture name, for example as accepted by "gcc -arch" (see also
/// arch(3)).
static ArchType getArchTypeForDarwinArchName(const StringRef &Str);
static ArchType getArchTypeForDarwinArchName(StringRef Str);
/// @}
};

View File

@ -71,6 +71,18 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
if (const BranchInst *BI = dyn_cast<BranchInst>(Node->getTerminator()))
if (BI->isConditional())
return (I == succ_begin(Node)) ? "T" : "F";
// Label source of switch edges with the associated value.
if (const SwitchInst *SI = dyn_cast<SwitchInst>(Node->getTerminator())) {
unsigned SuccNo = I.getSuccessorIndex();
if (SuccNo == 0) return "def";
std::string Str;
raw_string_ostream OS(Str);
OS << SI->getCaseValue(SuccNo)->getValue();
return OS.str();
}
return "";
}
};

View File

@ -26,20 +26,18 @@ namespace llvm {
class TargetData;
class Function;
class Type;
class LLVMContext;
/// ConstantFoldInstruction - Attempt to constant fold the specified
/// instruction. If successful, the constant result is returned, if not, null
/// is returned. Note that this function can only fail when attempting to fold
/// instructions like loads and stores, which have no constant expression form.
///
Constant *ConstantFoldInstruction(Instruction *I, LLVMContext &Context,
const TargetData *TD = 0);
Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
/// using the specified TargetData. If successful, the constant result is
/// result is returned, if not, null is returned.
Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
const TargetData *TD = 0);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
@ -49,8 +47,7 @@ Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
/// form.
///
Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
Constant*const * Ops, unsigned NumOps,
LLVMContext &Context,
Constant *const *Ops, unsigned NumOps,
const TargetData *TD = 0);
/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare
@ -58,8 +55,7 @@ Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
/// returns a constant expression of the specified operands.
///
Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
Constant*const * Ops, unsigned NumOps,
LLVMContext &Context,
Constant *LHS, Constant *RHS,
const TargetData *TD = 0);
/// ConstantFoldLoadFromConstPtr - Return the value that a load from C would
@ -79,7 +75,7 @@ bool canConstantFoldCallTo(const Function *F);
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
/// with the specified arguments, returning null if unsuccessful.
Constant *
ConstantFoldCall(Function *F, Constant* const* Operands, unsigned NumOperands);
ConstantFoldCall(Function *F, Constant *const *Operands, unsigned NumOperands);
}
#endif

View File

@ -26,8 +26,6 @@
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ValueHandle.h"
#define ATTACH_DEBUG_INFO_TO_AN_INSN 1
namespace llvm {
class BasicBlock;
class Constant;
@ -46,9 +44,11 @@ namespace llvm {
class Instruction;
class LLVMContext;
/// DIDescriptor - A thin wraper around MDNode to access encoded debug info. This should not
/// be stored in a container, because underly MDNode may change in certain situations.
class DIDescriptor {
protected:
TrackingVH<MDNode> DbgNode;
MDNode *DbgNode;
/// DIDescriptor constructor. If the specified node is non-null, check
/// to make sure that the tag in the descriptor matches 'RequiredTag'. If
@ -468,15 +468,8 @@ namespace llvm {
Module &M;
LLVMContext& VMContext;
// Cached values for uniquing and faster lookups.
const Type *EmptyStructPtr; // "{}*".
Function *StopPointFn; // llvm.dbg.stoppoint
Function *FuncStartFn; // llvm.dbg.func.start
Function *RegionStartFn; // llvm.dbg.region.start
Function *RegionEndFn; // llvm.dbg.region.end
Function *DeclareFn; // llvm.dbg.declare
StringMap<Constant*> StringCache;
DenseMap<Constant*, DIDescriptor> SimpleConstantCache;
DIFactory(const DIFactory &); // DO NOT IMPLEMENT
void operator=(const DIFactory&); // DO NOT IMPLEMENT
@ -496,26 +489,26 @@ namespace llvm {
/// CreateCompileUnit - Create a new descriptor for the specified compile
/// unit.
DICompileUnit CreateCompileUnit(unsigned LangID,
StringRef Filenae,
StringRef Directory,
StringRef Producer,
const char * Filename,
const char * Directory,
const char * Producer,
bool isMain = false,
bool isOptimized = false,
const char *Flags = "",
unsigned RunTimeVer = 0);
/// CreateEnumerator - Create a single enumerator value.
DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
DIEnumerator CreateEnumerator(const char * Name, uint64_t Val);
/// CreateBasicType - Create a basic type like int, float, etc.
DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
DIBasicType CreateBasicType(DIDescriptor Context, const char * Name,
DICompileUnit CompileUnit, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
unsigned Encoding);
/// CreateBasicType - Create a basic type like int, float, etc.
DIBasicType CreateBasicTypeEx(DIDescriptor Context, StringRef Name,
DIBasicType CreateBasicTypeEx(DIDescriptor Context, const char * Name,
DICompileUnit CompileUnit, unsigned LineNumber,
Constant *SizeInBits, Constant *AlignInBits,
Constant *OffsetInBits, unsigned Flags,
@ -524,7 +517,7 @@ namespace llvm {
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
StringRef Name,
const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
@ -534,7 +527,7 @@ namespace llvm {
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedTypeEx(unsigned Tag, DIDescriptor Context,
StringRef Name,
const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
Constant *SizeInBits, Constant *AlignInBits,
@ -543,7 +536,7 @@ namespace llvm {
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
StringRef Name,
const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
uint64_t SizeInBits,
@ -555,7 +548,7 @@ namespace llvm {
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
StringRef Name,
const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
Constant *SizeInBits,
@ -567,25 +560,25 @@ namespace llvm {
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
StringRef DisplayName,
StringRef LinkageName,
DISubprogram CreateSubprogram(DIDescriptor Context, const char * Name,
const char * DisplayName,
const char * LinkageName,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type, bool isLocalToUnit,
bool isDefinition);
/// CreateGlobalVariable - Create a new descriptor for the specified global.
DIGlobalVariable
CreateGlobalVariable(DIDescriptor Context, StringRef Name,
StringRef DisplayName,
StringRef LinkageName,
CreateGlobalVariable(DIDescriptor Context, const char * Name,
const char * DisplayName,
const char * LinkageName,
DICompileUnit CompileUnit,
unsigned LineNo, DIType Type, bool isLocalToUnit,
bool isDefinition, llvm::GlobalVariable *GV);
/// CreateVariable - Create a new descriptor for the specified variable.
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
StringRef Name,
const char * Name,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type);
@ -605,30 +598,13 @@ namespace llvm {
DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
DIScope S, DILocation OrigLoc);
/// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
/// inserting it at the end of the specified basic block.
void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo,
BasicBlock *BB);
/// InsertSubprogramStart - Create a new llvm.dbg.func.start intrinsic to
/// mark the start of the specified subprogram.
void InsertSubprogramStart(DISubprogram SP, BasicBlock *BB);
/// InsertRegionStart - Insert a new llvm.dbg.region.start intrinsic call to
/// mark the start of a region for the specified scoping descriptor.
void InsertRegionStart(DIDescriptor D, BasicBlock *BB);
/// InsertRegionEnd - Insert a new llvm.dbg.region.end intrinsic call to
/// mark the end of a region for the specified scoping descriptor.
void InsertRegionEnd(DIDescriptor D, BasicBlock *BB);
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
BasicBlock *InsertAtEnd);
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
void InsertDeclare(llvm::Value *Storage, DIVariable D,
BasicBlock *InsertAtEnd);
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
void InsertDeclare(llvm::Value *Storage, DIVariable D,
Instruction *InsertBefore);
Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
Instruction *InsertBefore);
private:
Constant *GetTagConstant(unsigned TAG);
@ -693,12 +669,6 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
DebugLocTracker &DebugLocInfo);
/// isInlinedFnStart - Return true if FSI is starting an inlined function.
bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn);
/// isInlinedFnEnd - Return true if REI is ending an inlined function.
bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn);
/// DebugInfoFinder - This object collects DebugInfo from a module.
class DebugInfoFinder {
public:
@ -716,21 +686,12 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
/// processSubprogram - Process DISubprogram.
void processSubprogram(DISubprogram SP);
/// processStopPoint - Process DbgStopPointInst.
void processStopPoint(DbgStopPointInst *SPI);
/// processFuncStart - Process DbgFuncStartInst.
void processFuncStart(DbgFuncStartInst *FSI);
/// processRegionStart - Process DbgRegionStart.
void processRegionStart(DbgRegionStartInst *DRS);
/// processRegionEnd - Process DbgRegionEnd.
void processRegionEnd(DbgRegionEndInst *DRE);
/// processDeclare - Process DbgDeclareInst.
void processDeclare(DbgDeclareInst *DDI);
/// processLocation - Process DILocation.
void processLocation(DILocation Loc);
/// addCompileUnit - Add compile unit into CUs.
bool addCompileUnit(DICompileUnit CU);

View File

@ -310,7 +310,6 @@ class DominatorTreeBase : public DominatorBase<NodeT> {
if (DomTreeNodes.size() != OtherDomTreeNodes.size())
return true;
SmallPtrSet<const NodeT *,4> MyBBs;
for (typename DomTreeNodeMapType::const_iterator
I = this->DomTreeNodes.begin(),
E = this->DomTreeNodes.end(); I != E; ++I) {

View File

@ -161,6 +161,10 @@ struct IVUsersOfOneStride : public ilist_node<IVUsersOfOneStride> {
void addUser(const SCEV *Offset, Instruction *User, Value *Operand) {
Users.push_back(new IVStrideUse(this, Offset, User, Operand));
}
void removeUser(IVStrideUse *User) {
Users.erase(User);
}
};
class IVUsers : public LoopPass {
@ -201,6 +205,9 @@ class IVUsers : public LoopPass {
/// return true. Otherwise, return false.
bool AddUsersIfInteresting(Instruction *I);
void AddUser(const SCEV *Stride, const SCEV *Offset,
Instruction *User, Value *Operand);
/// getReplacementExpr - Return a SCEV expression which computes the
/// value of the OperandValToReplace of the given IVStrideUse.
const SCEV *getReplacementExpr(const IVStrideUse &U) const;

View File

@ -0,0 +1,74 @@
//===-- InstructionSimplify.h - Fold instructions into simpler forms ------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares routines for folding instructions into simpler forms that
// do not require creating new instructions. For example, this does constant
// folding, and can handle identities like (X&0)->0.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
namespace llvm {
class Instruction;
class Value;
class TargetData;
/// SimplifyAndInst - Given operands for an And, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyAndInst(Value *LHS, Value *RHS,
const TargetData *TD = 0);
/// SimplifyOrInst - Given operands for an Or, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyOrInst(Value *LHS, Value *RHS,
const TargetData *TD = 0);
/// SimplifyICmpInst - Given operands for an ICmpInst, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
const TargetData *TD = 0);
/// SimplifyFCmpInst - Given operands for an FCmpInst, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
const TargetData *TD = 0);
//=== Helper functions for higher up the class hierarchy.
/// SimplifyCmpInst - Given operands for a CmpInst, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
const TargetData *TD = 0);
/// SimplifyBinOp - Given operands for a BinaryOperator, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
const TargetData *TD = 0);
/// SimplifyInstruction - See if we can compute a simplified version of this
/// instruction. If not, this returns null.
Value *SimplifyInstruction(Instruction *I, const TargetData *TD = 0);
/// ReplaceAndSimplifyAllUses - Perform From->replaceAllUsesWith(To) and then
/// delete the From instruction. In addition to a basic RAUW, this does a
/// recursive simplification of the updated instructions. This catches
/// things where one simplification exposes other opportunities. This only
/// simplifies and deletes scalar operations, it does not change the CFG.
///
void ReplaceAndSimplifyAllUses(Instruction *From, Value *To,
const TargetData *TD = 0);
} // end namespace llvm
#endif

View File

@ -0,0 +1,73 @@
//===- LazyValueInfo.h - Value constraint analysis --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the interface for lazy computation of value constraint
// information.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_ANALYSIS_LIVEVALUES_H
#define LLVM_ANALYSIS_LIVEVALUES_H
#include "llvm/Pass.h"
namespace llvm {
class Constant;
class TargetData;
class Value;
/// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
/// information.
class LazyValueInfo : public FunctionPass {
class TargetData *TD;
void *PImpl;
LazyValueInfo(const LazyValueInfo&); // DO NOT IMPLEMENT.
void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT.
public:
static char ID;
LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
/// Tristate - This is used to return true/false/dunno results.
enum Tristate {
Unknown = -1, False = 0, True = 1
};
// Public query interface.
/// getPredicateOnEdge - Determine whether the specified value comparison
/// with a constant is known to be true or false on the specified CFG edge.
/// Pred is a CmpInst predicate.
Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
BasicBlock *FromBB, BasicBlock *ToBB);
/// getConstant - Determine whether the specified value is known to be a
/// constant at the end of the specified block. Return null if not.
Constant *getConstant(Value *V, BasicBlock *BB);
/// getConstantOnEdge - Determine whether the specified value is known to be a
/// constant on the specified edge. Return null if not.
Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB);
// Implementation boilerplate.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
virtual void releaseMemory();
virtual bool runOnFunction(Function &F);
};
} // end namespace llvm
#endif

View File

@ -94,10 +94,6 @@ class LiveValues : public FunctionPass {
bool isKilledInBlock(const Value *V, const BasicBlock *BB);
};
/// createLiveValuesPass - This creates an instance of the LiveValues pass.
///
FunctionPass *createLiveValuesPass();
}
} // end namespace llvm
#endif

View File

@ -114,8 +114,8 @@ class LoopBase {
block_iterator block_begin() const { return Blocks.begin(); }
block_iterator block_end() const { return Blocks.end(); }
/// isLoopExiting - True if terminator in the block can branch to another block
/// that is outside of the current loop.
/// isLoopExiting - True if terminator in the block can branch to another
/// block that is outside of the current loop.
///
bool isLoopExiting(const BlockT *BB) const {
typedef GraphTraits<BlockT*> BlockTraits;
@ -572,6 +572,10 @@ class Loop : public LoopBase<BasicBlock, Loop> {
/// normal form.
bool isLoopSimplifyForm() const;
/// hasDedicatedExits - Return true if no exit block for the loop
/// has a predecessor that is outside the loop.
bool hasDedicatedExits() const;
/// getUniqueExitBlocks - Return all unique successor blocks of this loop.
/// These are the blocks _outside of the current loop_ which are branched to.
/// This assumes that loop is in canonical form.

View File

@ -17,7 +17,6 @@
namespace llvm {
class CallInst;
class LLVMContext;
class PointerType;
class TargetData;
class Type;
@ -29,54 +28,52 @@ class Value;
/// isMalloc - Returns true if the value is either a malloc call or a bitcast of
/// the result of a malloc call
bool isMalloc(const Value* I);
bool isMalloc(const Value *I);
/// extractMallocCall - Returns the corresponding CallInst if the instruction
/// is a malloc call. Since CallInst::CreateMalloc() only creates calls, we
/// ignore InvokeInst here.
const CallInst* extractMallocCall(const Value* I);
CallInst* extractMallocCall(Value* I);
const CallInst *extractMallocCall(const Value *I);
CallInst *extractMallocCall(Value *I);
/// extractMallocCallFromBitCast - Returns the corresponding CallInst if the
/// instruction is a bitcast of the result of a malloc call.
const CallInst* extractMallocCallFromBitCast(const Value* I);
CallInst* extractMallocCallFromBitCast(Value* I);
const CallInst *extractMallocCallFromBitCast(const Value *I);
CallInst *extractMallocCallFromBitCast(Value *I);
/// isArrayMalloc - Returns the corresponding CallInst if the instruction
/// is a call to malloc whose array size can be determined and the array size
/// is not constant 1. Otherwise, return NULL.
CallInst* isArrayMalloc(Value* I, LLVMContext &Context, const TargetData* TD);
const CallInst* isArrayMalloc(const Value* I, LLVMContext &Context,
const TargetData* TD);
const CallInst *isArrayMalloc(const Value *I, const TargetData *TD);
/// getMallocType - Returns the PointerType resulting from the malloc call.
/// The PointerType depends on the number of bitcast uses of the malloc call:
/// 0: PointerType is the malloc calls' return type.
/// 1: PointerType is the bitcast's result type.
/// >1: Unique PointerType cannot be determined, return NULL.
const PointerType* getMallocType(const CallInst* CI);
const PointerType *getMallocType(const CallInst *CI);
/// getMallocAllocatedType - Returns the Type allocated by malloc call.
/// The Type depends on the number of bitcast uses of the malloc call:
/// 0: PointerType is the malloc calls' return type.
/// 1: PointerType is the bitcast's result type.
/// >1: Unique PointerType cannot be determined, return NULL.
const Type* getMallocAllocatedType(const CallInst* CI);
const Type *getMallocAllocatedType(const CallInst *CI);
/// getMallocArraySize - Returns the array size of a malloc call. If the
/// argument passed to malloc is a multiple of the size of the malloced type,
/// then return that multiple. For non-array mallocs, the multiple is
/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be
/// determined.
Value* getMallocArraySize(CallInst* CI, LLVMContext &Context,
const TargetData* TD);
Value *getMallocArraySize(CallInst *CI, const TargetData *TD,
bool LookThroughSExt = false);
//===----------------------------------------------------------------------===//
// free Call Utility Functions.
//
/// isFreeCall - Returns true if the the value is a call to the builtin free()
bool isFreeCall(const Value* I);
bool isFreeCall(const Value *I);
} // End llvm namespace

View File

@ -139,6 +139,12 @@ namespace llvm {
// createLiveValuesPass - This creates an instance of the LiveValues pass.
//
FunctionPass *createLiveValuesPass();
//===--------------------------------------------------------------------===//
//
/// createLazyValueInfoPass - This creates an instance of the LazyValueInfo
/// pass.
FunctionPass *createLazyValueInfoPass();
//===--------------------------------------------------------------------===//
//

View File

@ -38,8 +38,7 @@ namespace llvm {
friend struct SCEVVisitor<SCEVExpander, Value*>;
public:
explicit SCEVExpander(ScalarEvolution &se)
: SE(se), Builder(se.getContext(),
TargetFolder(se.TD, se.getContext())) {}
: SE(se), Builder(se.getContext(), TargetFolder(se.TD)) {}
/// clear - Erase the contents of the InsertedExpressions map so that users
/// trying to expand the same expression into multiple BasicBlocks or

View File

@ -153,7 +153,7 @@ class SparseSolver {
/// value. If an value is not in the map, it is returned as untracked,
/// unlike the getOrInitValueState method.
LatticeVal getLatticeState(Value *V) const {
DenseMap<Value*, LatticeVal>::iterator I = ValueState.find(V);
DenseMap<Value*, LatticeVal>::const_iterator I = ValueState.find(V);
return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
}

View File

@ -63,6 +63,15 @@ namespace llvm {
unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0,
unsigned Depth = 0);
/// ComputeMultiple - This function computes the integer multiple of Base that
/// equals V. If successful, it returns true and returns the multiple in
/// Multiple. If unsuccessful, it returns false. Also, if V can be
/// simplified to an integer, then the simplified V is returned in Val. Look
/// through sext only if LookThroughSExt=true.
bool ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,
bool LookThroughSExt = false,
unsigned Depth = 0);
/// CannotBeNegativeZero - Return true if we can prove that the specified FP
/// value is never equal to -0.0.
///

View File

@ -247,7 +247,7 @@ class BasicBlock : public Value, // Basic blocks are data objects also
/// almost never 2, and inconceivably 3 or more.
void AdjustBlockAddressRefCount(int Amt) {
SubclassData += Amt;
assert((int)(char)SubclassData >= 0 && "Refcount wrap-around");
assert((int)(signed char)SubclassData >= 0 && "Refcount wrap-around");
}
};

View File

@ -294,7 +294,7 @@ class BitstreamWriter {
/// known to exist at the end of the the record.
template<typename uintty>
void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
const StringRef &Blob) {
StringRef Blob) {
const char *BlobData = Blob.data();
unsigned BlobLen = (unsigned) Blob.size();
unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
@ -422,7 +422,7 @@ class BitstreamWriter {
/// of the record.
template<typename uintty>
void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
const StringRef &Blob) {
StringRef Blob) {
EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
}
template<typename uintty>
@ -435,7 +435,7 @@ class BitstreamWriter {
/// that end with an array.
template<typename uintty>
void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
const StringRef &Array) {
StringRef Array) {
EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
}
template<typename uintty>

View File

@ -86,6 +86,14 @@ namespace llvm {
DwarfWriter *DW;
public:
/// Flags to specify different kinds of comments to output in
/// assembly code. These flags carry semantic information not
/// otherwise easily derivable from the IR text.
///
enum CommentFlag {
ReloadReuse = 0x1
};
/// Output stream on which we're printing assembly code.
///
formatted_raw_ostream &O;
@ -172,11 +180,11 @@ namespace llvm {
/// EmitStartOfAsmFile - This virtual method can be overridden by targets
/// that want to emit something at the start of their file.
virtual void EmitStartOfAsmFile(Module &M) {}
virtual void EmitStartOfAsmFile(Module &) {}
/// EmitEndOfAsmFile - This virtual method can be overridden by targets that
/// want to emit something at the end of their file.
virtual void EmitEndOfAsmFile(Module &M) {}
virtual void EmitEndOfAsmFile(Module &) {}
/// doFinalization - Shut down the asmprinter. If you override this in your
/// pass, you must make sure to call it explicitly.
@ -373,10 +381,10 @@ namespace llvm {
/// printImplicitDef - This method prints the specified machine instruction
/// that is an implicit def.
virtual void printImplicitDef(const MachineInstr *MI) const;
void printImplicitDef(const MachineInstr *MI) const;
/// printKill - This method prints the specified kill machine instruction.
virtual void printKill(const MachineInstr *MI) const;
void printKill(const MachineInstr *MI) const;
/// printPICJumpTableSetLabel - This method prints a set label for the
/// specified MachineBasicBlock for a jumptable entry.

View File

@ -15,6 +15,7 @@
#ifndef LLVM_CODEGEN_BINARYOBJECT_H
#define LLVM_CODEGEN_BINARYOBJECT_H
#include "llvm/CodeGen/MachineRelocation.h"
#include "llvm/System/DataTypes.h"
#include <string>
@ -22,7 +23,6 @@
namespace llvm {
class MachineRelocation;
typedef std::vector<uint8_t> BinaryData;
class BinaryObject {

View File

@ -183,6 +183,13 @@ class CCState {
void AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
CCAssignFn Fn);
/// CheckReturn - Analyze the return values of a function, returning
/// true if the return can be performed without sret-demotion, and
/// false otherwise.
bool CheckReturn(const SmallVectorImpl<EVT> &OutTys,
const SmallVectorImpl<ISD::ArgFlagsTy> &ArgsFlags,
CCAssignFn Fn);
/// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
/// incorporating info about the passed values into this state.
void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,

View File

@ -64,22 +64,22 @@ class VISIBILITY_HIDDEN ISelUpdater : public SelectionDAG::DAGUpdateListener {
/// ReplaceUses - replace all uses of the old node F with the use
/// of the new node T.
void ReplaceUses(SDValue F, SDValue T) DISABLE_INLINE {
DISABLE_INLINE void ReplaceUses(SDValue F, SDValue T) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISU);
}
/// ReplaceUses - replace all uses of the old nodes F with the use
/// of the new nodes T.
void ReplaceUses(const SDValue *F, const SDValue *T,
unsigned Num) DISABLE_INLINE {
DISABLE_INLINE void ReplaceUses(const SDValue *F, const SDValue *T,
unsigned Num) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesOfValuesWith(F, T, Num, &ISU);
}
/// ReplaceUses - replace all uses of the old node F with the use
/// of the new node T.
void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {
DISABLE_INLINE void ReplaceUses(SDNode *F, SDNode *T) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesWith(F, T, &ISU);
}

View File

@ -87,31 +87,15 @@ class DwarfWriter : public ImmutablePass {
/// the source line list.
unsigned RecordSourceLine(unsigned Line, unsigned Col, MDNode *Scope);
/// RecordRegionStart - Indicate the start of a region.
unsigned RecordRegionStart(MDNode *N);
/// RecordRegionEnd - Indicate the end of a region.
unsigned RecordRegionEnd(MDNode *N);
/// getRecordSourceLineCount - Count source lines.
unsigned getRecordSourceLineCount();
/// RecordVariable - Indicate the declaration of a local variable.
///
void RecordVariable(MDNode *N, unsigned FrameIndex);
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
/// be emitted.
bool ShouldEmitDwarfDebug() const;
//// RecordInlinedFnStart - Indicate the start of a inlined function.
unsigned RecordInlinedFnStart(DISubprogram SP, DICompileUnit CU,
unsigned Line, unsigned Col);
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
unsigned RecordInlinedFnEnd(DISubprogram SP);
void SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L);
void SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L);
void BeginScope(const MachineInstr *MI, unsigned Label);
void EndScope(const MachineInstr *MI);
};
} // end llvm namespace

View File

@ -16,6 +16,7 @@
#define LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
#include "llvm/CodeGen/GCs.h"
#include <cstdlib>
namespace {
struct ForceAsmWriterLinking {

View File

@ -189,20 +189,8 @@ namespace llvm {
return indexes_->getMBBFromIndex(index);
}
bool hasGapBeforeInstr(SlotIndex index) {
return indexes_->hasGapBeforeInstr(index);
}
bool hasGapAfterInstr(SlotIndex index) {
return indexes_->hasGapAfterInstr(index);
}
SlotIndex findGapBeforeInstr(SlotIndex index, bool furthest = false) {
return indexes_->findGapBeforeInstr(index, furthest);
}
void InsertMachineInstrInMaps(MachineInstr *MI, SlotIndex Index) {
indexes_->insertMachineInstrInMaps(MI, Index);
SlotIndex InsertMachineInstrInMaps(MachineInstr *MI) {
return indexes_->insertMachineInstrInMaps(MI);
}
void RemoveMachineInstrFromMaps(MachineInstr *MI) {
@ -219,7 +207,7 @@ namespace llvm {
}
void renumber() {
indexes_->renumber();
indexes_->renumberIndexes();
}
BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; }
@ -290,9 +278,10 @@ namespace llvm {
/// computeIntervals - Compute live intervals.
void computeIntervals();
bool isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt,
SmallVector<MachineInstr*,16> &IdentCopies,
SmallVector<MachineInstr*,16> &OtherCopies);
bool isSafeAndProfitableToCoalesce(LiveInterval &DstInt,
LiveInterval &SrcInt,
SmallVector<MachineInstr*,16> &IdentCopies,
SmallVector<MachineInstr*,16> &OtherCopies);
void performEarlyCoalescing();

View File

@ -103,7 +103,10 @@ class LiveVariables : public MachineFunctionPass {
Kills.erase(I);
return true;
}
/// findKill - Find a kill instruction in MBB. Return NULL if none is found.
MachineInstr *findKill(const MachineBasicBlock *MBB) const;
void dump() const;
};
@ -263,6 +266,12 @@ class LiveVariables : public MachineFunctionPass {
void HandleVirtRegDef(unsigned reg, MachineInstr *MI);
void HandleVirtRegUse(unsigned reg, MachineBasicBlock *MBB,
MachineInstr *MI);
/// addNewBlock - Add a new basic block BB as an empty succcessor to
/// DomBB. All variables that are live out of DomBB will be marked as passing
/// live through BB. This method assumes that the machine code is still in SSA
/// form.
void addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB);
};
} // End llvm namespace

View File

@ -15,6 +15,8 @@
#ifndef LLVM_CODEGEN_MACHO_RELOCATION_H
#define LLVM_CODEGEN_MACHO_RELOCATION_H
#include "llvm/System/DataTypes.h"
namespace llvm {
/// MachORelocation - This struct contains information about each relocation

View File

@ -225,7 +225,13 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
/// potential fall-throughs at the end of the block.
void moveBefore(MachineBasicBlock *NewAfter);
void moveAfter(MachineBasicBlock *NewBefore);
/// updateTerminator - Update the terminator instructions in block to account
/// for changes to the layout. If the block previously used a fallthrough,
/// it may now need a branch, and if it previously used branching it may now
/// be able to use a fallthrough.
void updateTerminator();
// Machine-CFG mutators
/// addSuccessor - Add succ as a successor of this MachineBasicBlock.
@ -246,7 +252,7 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
/// transferSuccessors - Transfers all the successors from MBB to this
/// machine basic block (i.e., copies all the successors fromMBB and
/// remove all the successors fromBB).
/// remove all the successors from fromMBB).
void transferSuccessors(MachineBasicBlock *fromMBB);
/// isSuccessor - Return true if the specified MBB is a successor of this
@ -352,6 +358,8 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t);
//===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
//===--------------------------------------------------------------------===//

View File

@ -17,6 +17,8 @@
#ifndef EE_MACHINE_CODE_INFO_H
#define EE_MACHINE_CODE_INFO_H
#include "llvm/System/DataTypes.h"
namespace llvm {
class MachineCodeInfo {

View File

@ -23,8 +23,6 @@
namespace llvm {
inline void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t) { }
template<>
inline void DominatorTreeBase<MachineBasicBlock>::addRoot(MachineBasicBlock* MBB) {
this->Roots.push_back(MBB);

View File

@ -15,9 +15,11 @@
#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/System/DataTypes.h"
#include <cassert>
#include <limits>
#include <vector>
namespace llvm {
@ -106,8 +108,8 @@ class MachineFrameInfo {
// cannot alias any other memory objects.
bool isSpillSlot;
StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false,
bool isSS = false)
StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM,
bool isSS)
: SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM),
isSpillSlot(isSS) {}
};
@ -182,6 +184,10 @@ class MachineFrameInfo {
/// CSIValid - Has CSInfo been set yet?
bool CSIValid;
/// SpillObjects - A vector indicating which frame indices refer to
/// spill slots.
SmallVector<bool, 8> SpillObjects;
/// MMI - This field is set (via setMachineModuleInfo) by a module info
/// consumer (ex. DwarfWriter) to indicate that frame layout information
/// should be acquired. Typically, it's the responsibility of the target's
@ -192,6 +198,7 @@ class MachineFrameInfo {
/// TargetFrameInfo - Target information about frame layout.
///
const TargetFrameInfo &TFI;
public:
explicit MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
@ -341,7 +348,7 @@ class MachineFrameInfo {
/// index with a negative value.
///
int CreateFixedObject(uint64_t Size, int64_t SPOffset,
bool Immutable = true);
bool Immutable, bool isSS);
/// isFixedObjectIndex - Returns true if the specified index corresponds to a
@ -374,13 +381,25 @@ class MachineFrameInfo {
return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
}
/// CreateStackObject - Create a new statically sized stack object, returning
/// a nonnegative identifier to represent it.
/// CreateStackObject - Create a new statically sized stack object,
/// returning a nonnegative identifier to represent it.
///
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS = false) {
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS) {
assert(Size != 0 && "Cannot allocate zero size stack objects!");
Objects.push_back(StackObject(Size, Alignment, 0, false, isSS));
return (int)Objects.size()-NumFixedObjects-1;
int Index = (int)Objects.size()-NumFixedObjects-1;
assert(Index >= 0 && "Bad frame index!");
return Index;
}
/// CreateSpillStackObject - Create a new statically sized stack
/// object that represents a spill slot, returning a nonnegative
/// identifier to represent it.
///
int CreateSpillStackObject(uint64_t Size, unsigned Alignment) {
CreateStackObject(Size, Alignment, true);
int Index = (int)Objects.size()-NumFixedObjects-1;
return Index;
}
/// RemoveStackObject - Remove or mark dead a statically sized stack object.
@ -397,10 +416,10 @@ class MachineFrameInfo {
///
int CreateVariableSizedObject() {
HasVarSizedObjects = true;
Objects.push_back(StackObject(0, 1));
Objects.push_back(StackObject(0, 1, 0, false, false));
return (int)Objects.size()-NumFixedObjects-1;
}
/// getCalleeSavedInfo - Returns a reference to call saved info vector for the
/// current function.
const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {

View File

@ -23,7 +23,6 @@
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Recycler.h"
#include <map>
namespace llvm {
@ -115,6 +114,9 @@ class MachineFunction {
// The alignment of the function.
unsigned Alignment;
MachineFunction(const MachineFunction &); // intentionally unimplemented
void operator=(const MachineFunction&); // intentionally unimplemented
public:
MachineFunction(Function *Fn, const TargetMachine &TM);
~MachineFunction();
@ -229,6 +231,10 @@ class MachineFunction {
///
void dump() const;
/// verify - Run the current MachineFunction through the machine code
/// verifier, useful for debugger use.
void verify() const;
// Provide accessors for the MachineBasicBlock list...
typedef BasicBlockListType::iterator iterator;
typedef BasicBlockListType::const_iterator const_iterator;

View File

@ -31,7 +31,7 @@ struct MachineFunctionAnalysis : public FunctionPass {
public:
static char ID;
explicit MachineFunctionAnalysis(TargetMachine &tm,
explicit MachineFunctionAnalysis(const TargetMachine &tm,
CodeGenOpt::Level OL = CodeGenOpt::Default);
~MachineFunctionAnalysis();

View File

@ -19,6 +19,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/Target/TargetInstrDesc.h"
#include "llvm/Support/DebugLoc.h"
@ -45,6 +46,13 @@ class MachineInstr : public ilist_node<MachineInstr> {
unsigned short NumImplicitOps; // Number of implicit operands (which
// are determined at construction time).
unsigned short AsmPrinterFlags; // Various bits of information used by
// the AsmPrinter to emit helpful
// comments. This is *not* semantic
// information. Do not use this for
// anything other than to convey comment
// information to AsmPrinter.
std::vector<MachineOperand> Operands; // the operands
mmo_iterator MemRefs; // information on memory references
mmo_iterator MemRefsEnd;
@ -107,6 +115,22 @@ class MachineInstr : public ilist_node<MachineInstr> {
const MachineBasicBlock* getParent() const { return Parent; }
MachineBasicBlock* getParent() { return Parent; }
/// getAsmPrinterFlags - Return the asm printer flags bitvector.
///
unsigned short getAsmPrinterFlags() const { return AsmPrinterFlags; }
/// getAsmPrinterFlag - Return whether an AsmPrinter flag is set.
///
bool getAsmPrinterFlag(AsmPrinter::CommentFlag Flag) const {
return AsmPrinterFlags & Flag;
}
/// setAsmPrinterFlag - Set a flag for the AsmPrinter.
///
void setAsmPrinterFlag(unsigned short Flag) {
AsmPrinterFlags |= Flag;
}
/// getDebugLoc - Returns the debug location id of this MachineInstr.
///
DebugLoc getDebugLoc() const { return debugLoc; }

View File

@ -69,6 +69,11 @@ class MachineJumpTableInfo {
/// the jump tables to branch to New instead.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New);
/// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
/// the jump table to branch to New instead.
bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old,
MachineBasicBlock *New);
/// getEntrySize - Returns the size of an individual field in a jump table.
///
unsigned getEntrySize() const { return EntrySize; }

View File

@ -16,6 +16,8 @@
#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H
#define LLVM_CODEGEN_MACHINEMEMOPERAND_H
#include "llvm/System/DataTypes.h"
namespace llvm {
class Value;

View File

@ -44,8 +44,6 @@
#include "llvm/Pass.h"
#include "llvm/Metadata.h"
#define ATTACH_DEBUG_INFO_TO_AN_INSN 1
namespace llvm {
//===----------------------------------------------------------------------===//
@ -150,7 +148,8 @@ class MachineModuleInfo : public ImmutablePass {
public:
static char ID; // Pass identification, replacement for typeid
typedef SmallVector< std::pair<TrackingVH<MDNode>, unsigned>, 4 >
typedef std::pair<unsigned, TrackingVH<MDNode> > UnsignedAndMDNodePair;
typedef SmallVector< std::pair<TrackingVH<MDNode>, UnsignedAndMDNodePair>, 4>
VariableDbgInfoMapTy;
VariableDbgInfoMapTy VariableDbgInfo;
@ -336,8 +335,8 @@ class MachineModuleInfo : public ImmutablePass {
/// setVariableDbgInfo - Collect information used to emit debugging information
/// of a variable.
void setVariableDbgInfo(MDNode *N, unsigned S) {
VariableDbgInfo.push_back(std::make_pair(N, S));
void setVariableDbgInfo(MDNode *N, unsigned Slot, MDNode *Scope) {
VariableDbgInfo.push_back(std::make_pair(N, std::make_pair(Slot, Scope)));
}
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfo; }

View File

@ -243,6 +243,12 @@ class MachineRegisterInfo {
return true;
return false;
}
bool isLiveOut(unsigned Reg) const {
for (liveout_iterator I = liveout_begin(), E = liveout_end(); I != E; ++I)
if (*I == Reg)
return true;
return false;
}
private:
void HandleVRegListReallocation();

View File

@ -65,7 +65,7 @@ class MachineRelocation {
unsigned TargetReloType : 6; // The target relocation ID
AddressType AddrType : 4; // The field of Target to use
bool NeedStub : 1; // True if this relocation requires a stub
bool MayNeedFarStub : 1; // True if this relocation may require a far-stub
bool GOTRelative : 1; // Should this relocation be relative to the GOT?
bool TargetResolve : 1; // True if target should resolve the address
@ -81,7 +81,7 @@ class MachineRelocation {
///
static MachineRelocation getGV(uintptr_t offset, unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
bool NeedStub = 0,
bool MayNeedFarStub = 0,
bool GOTrelative = 0) {
assert((RelocationType & ~63) == 0 && "Relocation type too large!");
MachineRelocation Result;
@ -89,7 +89,7 @@ class MachineRelocation {
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isGV;
Result.NeedStub = NeedStub;
Result.MayNeedFarStub = MayNeedFarStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.GV = GV;
@ -101,7 +101,7 @@ class MachineRelocation {
static MachineRelocation getIndirectSymbol(uintptr_t offset,
unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
bool NeedStub = 0,
bool MayNeedFarStub = 0,
bool GOTrelative = 0) {
assert((RelocationType & ~63) == 0 && "Relocation type too large!");
MachineRelocation Result;
@ -109,7 +109,7 @@ class MachineRelocation {
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isIndirectSym;
Result.NeedStub = NeedStub;
Result.MayNeedFarStub = MayNeedFarStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.GV = GV;
@ -126,7 +126,7 @@ class MachineRelocation {
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isBB;
Result.NeedStub = false;
Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = false;
Result.Target.MBB = MBB;
@ -145,7 +145,7 @@ class MachineRelocation {
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isExtSym;
Result.NeedStub = true;
Result.MayNeedFarStub = true;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.ExtSym = ES;
@ -164,7 +164,7 @@ class MachineRelocation {
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isConstPool;
Result.NeedStub = false;
Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = letTargetResolve;
Result.Target.Index = CPI;
@ -183,7 +183,7 @@ class MachineRelocation {
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isJumpTable;
Result.NeedStub = false;
Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = letTargetResolve;
Result.Target.Index = JTI;
@ -258,12 +258,14 @@ class MachineRelocation {
return GOTRelative;
}
/// doesntNeedStub - This function returns true if the JIT for this target
/// target is capable of directly handling the relocated GlobalValue reference
/// without using either a stub function or issuing an extra load to get the
/// GV address.
bool doesntNeedStub() const {
return !NeedStub;
/// mayNeedFarStub - This function returns true if the JIT for this target may
/// need either a stub function or an indirect global-variable load to handle
/// the relocated GlobalValue reference. For example, the x86-64 call
/// instruction can only call functions within +/-2GB of the call site.
/// Anything farther away needs a longer mov+call sequence, which can't just
/// be written on top of the existing call.
bool mayNeedFarStub() const {
return MayNeedFarStub;
}
/// letTargetResolve - Return true if the target JITInfo is usually

View File

@ -32,7 +32,7 @@ namespace llvm {
virtual void printCustom(raw_ostream &O) const;
public:
PseudoSourceValue();
explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
/// isConstant - Test whether the memory pointed to by this
/// PseudoSourceValue has a constant value.
@ -52,7 +52,8 @@ namespace llvm {
///
static inline bool classof(const PseudoSourceValue *) { return true; }
static inline bool classof(const Value *V) {
return V->getValueID() == PseudoSourceValueVal;
return V->getValueID() == PseudoSourceValueVal ||
V->getValueID() == FixedStackPseudoSourceValueVal;
}
/// A pseudo source value referencing a fixed stack frame entry,
@ -76,6 +77,36 @@ namespace llvm {
/// constant, this doesn't need to identify a specific jump table.
static const PseudoSourceValue *getJumpTable();
};
/// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
/// for holding FixedStack values, which must include a frame
/// index.
class FixedStackPseudoSourceValue : public PseudoSourceValue {
const int FI;
public:
explicit FixedStackPseudoSourceValue(int fi) :
PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
/// classof - Methods for support type inquiry through isa, cast, and
/// dyn_cast:
///
static inline bool classof(const FixedStackPseudoSourceValue *) {
return true;
}
static inline bool classof(const Value *V) {
return V->getValueID() == FixedStackPseudoSourceValueVal;
}
virtual bool isConstant(const MachineFrameInfo *MFI) const;
virtual bool isAliased(const MachineFrameInfo *MFI) const;
virtual bool mayAlias(const MachineFrameInfo *) const;
virtual void printCustom(raw_ostream &OS) const;
int getFrameIndex() const { return FI; }
};
} // End llvm namespace
#endif

View File

@ -41,22 +41,27 @@ namespace RTLIB {
SRA_I32,
SRA_I64,
SRA_I128,
MUL_I8,
MUL_I16,
MUL_I32,
MUL_I64,
MUL_I128,
SDIV_I8,
SDIV_I16,
SDIV_I32,
SDIV_I64,
SDIV_I128,
UDIV_I8,
UDIV_I16,
UDIV_I32,
UDIV_I64,
UDIV_I128,
SREM_I8,
SREM_I16,
SREM_I32,
SREM_I64,
SREM_I128,
UREM_I8,
UREM_I16,
UREM_I32,
UREM_I64,

View File

@ -1953,10 +1953,10 @@ class BuildVectorSDNode : public SDNode {
/// that value are zero, and the corresponding bits in the SplatUndef mask
/// are set. The SplatBitSize value is set to the splat element size in
/// bits. HasAnyUndefs is set to true if any bits in the vector are
/// undefined.
/// undefined. isBigEndian describes the endianness of the target.
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
unsigned &SplatBitSize, bool &HasAnyUndefs,
unsigned MinSplatBits = 0);
unsigned MinSplatBits = 0, bool isBigEndian = false);
static inline bool classof(const BuildVectorSDNode *) { return true; }
static inline bool classof(const SDNode *N) {

View File

@ -39,9 +39,6 @@ namespace llvm {
class IndexListEntry {
private:
static std::auto_ptr<IndexListEntry> emptyKeyEntry,
tombstoneKeyEntry;
typedef enum { EMPTY_KEY, TOMBSTONE_KEY } ReservedEntryType;
static const unsigned EMPTY_KEY_INDEX = ~0U & ~3U,
TOMBSTONE_KEY_INDEX = ~0U & ~7U;
@ -49,6 +46,10 @@ namespace llvm {
MachineInstr *mi;
unsigned index;
protected:
typedef enum { EMPTY_KEY, TOMBSTONE_KEY } ReservedEntryType;
// This constructor is only to be used by getEmptyKeyEntry
// & getTombstoneKeyEntry. It sets index to the given
// value and mi to zero.
@ -58,6 +59,8 @@ namespace llvm {
case TOMBSTONE_KEY: index = TOMBSTONE_KEY_INDEX; break;
default: assert(false && "Invalid value for constructor.");
}
next = this;
prev = this;
}
public:
@ -70,36 +73,45 @@ namespace llvm {
}
MachineInstr* getInstr() const { return mi; }
void setInstr(MachineInstr *mi) { this->mi = mi; }
void setInstr(MachineInstr *mi) {
assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
"Attempt to modify reserved index.");
this->mi = mi;
}
unsigned getIndex() const { return index; }
void setIndex(unsigned index) { this->index = index; }
void setIndex(unsigned index) {
assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
"Attempt to set index to invalid value.");
assert(this->index != EMPTY_KEY_INDEX &&
this->index != TOMBSTONE_KEY_INDEX &&
"Attempt to reset reserved index value.");
this->index = index;
}
IndexListEntry* getNext() { return next; }
const IndexListEntry* getNext() const { return next; }
void setNext(IndexListEntry *next) { this->next = next; }
void setNext(IndexListEntry *next) {
assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
"Attempt to modify reserved index.");
this->next = next;
}
IndexListEntry* getPrev() { return prev; }
const IndexListEntry* getPrev() const { return prev; }
void setPrev(IndexListEntry *prev) { this->prev = prev; }
void setPrev(IndexListEntry *prev) {
assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
"Attempt to modify reserved index.");
this->prev = prev;
}
// This function returns the index list entry that is to be used for empty
// SlotIndex keys.
static IndexListEntry* getEmptyKeyEntry() {
if (emptyKeyEntry.get() == 0) {
emptyKeyEntry.reset(new IndexListEntry(EMPTY_KEY));
}
return emptyKeyEntry.get();
}
static IndexListEntry* getEmptyKeyEntry();
// This function returns the index list entry that is to be used for
// tombstone SlotIndex keys.
static IndexListEntry* getTombstoneKeyEntry() {
if (tombstoneKeyEntry.get() == 0) {
tombstoneKeyEntry.reset(new IndexListEntry(TOMBSTONE_KEY));
}
return tombstoneKeyEntry.get();
}
static IndexListEntry* getTombstoneKeyEntry();
};
// Specialize PointerLikeTypeTraits for IndexListEntry.
@ -118,7 +130,7 @@ namespace llvm {
/// SlotIndex - An opaque wrapper around machine indexes.
class SlotIndex {
friend class SlotIndexes;
friend class DenseMapInfo<SlotIndex>;
friend struct DenseMapInfo<SlotIndex>;
private:
static const unsigned PHI_BIT = 1 << 2;
@ -475,7 +487,7 @@ namespace llvm {
void dump() const;
/// Renumber the index list, providing space for new instructions.
void renumber();
void renumberIndexes();
/// Returns the zero index for this analysis.
SlotIndex getZeroIndex() {
@ -635,99 +647,89 @@ namespace llvm {
return 0;
}
/// Returns true if there is a gap in the numbering before the given index.
bool hasGapBeforeInstr(SlotIndex index) {
index = index.getBaseIndex();
SlotIndex prevIndex = index.getPrevIndex();
if (prevIndex == getZeroIndex())
return false;
/// Insert the given machine instruction into the mapping. Returns the
/// assigned index.
SlotIndex insertMachineInstrInMaps(MachineInstr *mi,
bool *deferredRenumber = 0) {
assert(mi2iMap.find(mi) == mi2iMap.end() && "Instr already indexed.");
if (getInstructionFromIndex(prevIndex) == 0)
return true;
MachineBasicBlock *mbb = mi->getParent();
if (prevIndex.distance(index) >= 2 * SlotIndex::NUM)
return true;
assert(mbb != 0 && "Instr must be added to function.");
return false;
}
MBB2IdxMap::iterator mbbRangeItr = mbb2IdxMap.find(mbb);
/// Returns true if there is a gap in the numbering after the given index.
bool hasGapAfterInstr(SlotIndex index) const {
// Not implemented yet.
assert(false &&
"SlotIndexes::hasGapAfterInstr(SlotIndex) not implemented yet.");
return false;
}
assert(mbbRangeItr != mbb2IdxMap.end() &&
"Instruction's parent MBB has not been added to SlotIndexes.");
/// findGapBeforeInstr - Find an empty instruction slot before the
/// specified index. If "Furthest" is true, find one that's furthest
/// away from the index (but before any index that's occupied).
// FIXME: This whole method should go away in future. It should
// always be possible to insert code between existing indices.
SlotIndex findGapBeforeInstr(SlotIndex index, bool furthest = false) {
if (index == getZeroIndex())
return getInvalidIndex();
MachineBasicBlock::iterator miItr(mi);
bool needRenumber = false;
IndexListEntry *newEntry;
index = index.getBaseIndex();
SlotIndex prevIndex = index.getPrevIndex();
if (prevIndex == getZeroIndex())
return getInvalidIndex();
// Try to reuse existing index objects with null-instrs.
if (getInstructionFromIndex(prevIndex) == 0) {
if (furthest) {
while (getInstructionFromIndex(prevIndex) == 0 &&
prevIndex != getZeroIndex()) {
prevIndex = prevIndex.getPrevIndex();
}
prevIndex = prevIndex.getNextIndex();
}
assert(getInstructionFromIndex(prevIndex) == 0 && "Index list is broken.");
return prevIndex;
IndexListEntry *prevEntry;
if (miItr == mbb->begin()) {
// If mi is at the mbb beginning, get the prev index from the mbb.
prevEntry = &mbbRangeItr->second.first.entry();
} else {
// Otherwise get it from the previous instr.
MachineBasicBlock::iterator pItr(prior(miItr));
prevEntry = &getInstructionIndex(pItr).entry();
}
int dist = prevIndex.distance(index);
// Get next entry from previous entry.
IndexListEntry *nextEntry = prevEntry->getNext();
// Double check that the spacing between this instruction and
// the last is sane.
assert(dist >= SlotIndex::NUM &&
"Distance between indexes too small.");
// Get a number for the new instr, or 0 if there's no room currently.
// In the latter case we'll force a renumber later.
unsigned dist = nextEntry->getIndex() - prevEntry->getIndex();
unsigned newNumber = dist > SlotIndex::NUM ?
prevEntry->getIndex() + ((dist >> 1) & ~3U) : 0;
// If there's no gap return an invalid index.
if (dist < 2*SlotIndex::NUM) {
return getInvalidIndex();
if (newNumber == 0) {
needRenumber = true;
}
// Otherwise insert new index entries into the list using the
// gap in the numbering.
IndexListEntry *newEntry =
createEntry(0, prevIndex.entry().getIndex() + SlotIndex::NUM);
// Insert a new list entry for mi.
newEntry = createEntry(mi, newNumber);
insert(nextEntry, newEntry);
SlotIndex newIndex(newEntry, SlotIndex::LOAD);
mi2iMap.insert(std::make_pair(mi, newIndex));
insert(&index.entry(), newEntry);
if (miItr == mbb->end()) {
// If this is the last instr in the MBB then we need to fix up the bb
// range:
mbbRangeItr->second.second = SlotIndex(newEntry, SlotIndex::STORE);
}
// And return a pointer to the entry at the start of the gap.
return index.getPrevIndex();
// Renumber if we need to.
if (needRenumber) {
if (deferredRenumber == 0)
renumberIndexes();
else
*deferredRenumber = true;
}
return newIndex;
}
/// Insert the given machine instruction into the mapping at the given
/// index.
void insertMachineInstrInMaps(MachineInstr *mi, SlotIndex index) {
index = index.getBaseIndex();
IndexListEntry *miEntry = &index.entry();
assert(miEntry->getInstr() == 0 && "Index already in use.");
miEntry->setInstr(mi);
/// Add all instructions in the vector to the index list. This method will
/// defer renumbering until all instrs have been added, and should be
/// preferred when adding multiple instrs.
void insertMachineInstrsInMaps(SmallVectorImpl<MachineInstr*> &mis) {
bool renumber = false;
assert(mi2iMap.find(mi) == mi2iMap.end() &&
"MachineInstr already has an index.");
for (SmallVectorImpl<MachineInstr*>::iterator
miItr = mis.begin(), miEnd = mis.end();
miItr != miEnd; ++miItr) {
insertMachineInstrInMaps(*miItr, &renumber);
}
mi2iMap.insert(std::make_pair(mi, index));
if (renumber)
renumberIndexes();
}
/// Remove the given machine instruction from the mapping.
void removeMachineInstrFromMaps(MachineInstr *mi) {
// remove index -> MachineInstr and

View File

@ -25,10 +25,11 @@ extern llvm::cl::opt<std::string> OutputFilename;
extern llvm::cl::opt<std::string> TempDirname;
extern llvm::cl::list<std::string> Languages;
extern llvm::cl::opt<bool> DryRun;
extern llvm::cl::opt<bool> Time;
extern llvm::cl::opt<bool> VerboseMode;
extern llvm::cl::opt<bool> CheckGraph;
extern llvm::cl::opt<bool> WriteGraph;
extern llvm::cl::opt<bool> ViewGraph;
extern llvm::cl::opt<bool> WriteGraph;
extern llvm::cl::opt<SaveTempsEnum::Values> SaveTemps;
#endif // LLVM_INCLUDE_COMPILER_DRIVER_BUILTIN_OPTIONS_H

View File

@ -9,6 +9,21 @@
/* Define if CBE is enabled for printf %a output */
#undef ENABLE_CBE_PRINTF_A
/* Directories clang will search for headers */
#define C_INCLUDE_DIRS "${C_INCLUDE_DIRS}"
/* Directory clang will search for libstdc++ headers */
#define CXX_INCLUDE_ROOT "${CXX_INCLUDE_ROOT}"
/* Architecture of libstdc++ headers */
#define CXX_INCLUDE_ARCH "${CXX_INCLUDE_ARCH}"
/* 32 bit multilib directory */
#define CXX_INCLUDE_32BIT_DIR "${CXX_INCLUDE_32BIT_DIR}"
/* 64 bit multilib directory */
#define CXX_INCLUDE_64BIT_DIR "${CXX_INCLUDE_64BIT_DIR}"
/* Define if position independent code is enabled */
#cmakedefine ENABLE_PIC ${ENABLE_PIC}
@ -48,6 +63,9 @@
/* Define to 1 if you have the `ceilf' function. */
#cmakedefine HAVE_CEILF ${HAVE_CEILF}
/* Define if the neat program is available */
#cmakedefine HAVE_CIRCO ${HAVE_CIRCO}
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
@ -77,10 +95,10 @@
#cmakedefine HAVE_DL_H ${HAVE_DL_H}
/* Define if the dot program is available */
#undef HAVE_DOT
#cmakedefine HAVE_DOT ${HAVE_DOT}
/* Define if the dotty program is available */
#undef HAVE_DOTTY
#cmakedefine HAVE_DOTTY ${HAVE_DOTTY}
/* Define if you have the _dyld_func_lookup function. */
#undef HAVE_DYLD
@ -97,6 +115,9 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
/* Define if the neat program is available */
#cmakedefine HAVE_FDP ${HAVE_FDP}
/* Set to 1 if the finite function is found in <ieeefp.h> */
#cmakedefine HAVE_FINITE_IN_IEEEFP_H ${HAVE_FINITE_IN_IEEEFP_H}
@ -137,7 +158,7 @@
#undef HAVE_GRAPHVIZ
/* Define if the gv program is available */
#undef HAVE_GV
#cmakedefine HAVE_GV ${HAVE_GV}
/* Define to 1 if you have the `index' function. */
#undef HAVE_INDEX
@ -247,7 +268,10 @@
#cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H}
/* Define to 1 if you have the `nearbyintf' function. */
#undef HAVE_NEARBYINTF
#cmakedefine HAVE_NEARBYINTF ${HAVE_NEARBYINTF}
/* Define if the neat program is available */
#cmakedefine HAVE_NEATO ${HAVE_NEATO}
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
@ -410,6 +434,9 @@
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#cmakedefine HAVE_SYS_WAIT_H ${HAVE_SYS_WAIT_H}
/* Define if the neat program is available */
#cmakedefine HAVE_TWOPI ${HAVE_TWOPI}
/* Define to 1 if the system has the type `uint64_t'. */
#undef HAVE_UINT64_T
@ -467,17 +494,29 @@
/* Added by Kevin -- Maximum path length */
#cmakedefine MAXPATHLEN ${MAXPATHLEN}
/* Define to path to circo program if found or 'echo circo' otherwise */
#cmakedefine LLVM_PATH_CIRCO "${LLVM_PATH_CIRCO}"
/* Define to path to dot program if found or 'echo dot' otherwise */
#undef LLVM_PATH_DOT
#cmakedefine LLVM_PATH_DOT "${LLVM_PATH_DOT}"
/* Define to path to dotty program if found or 'echo dotty' otherwise */
#undef LLVM_PATH_DOTTY
#cmakedefine LLVM_PATH_DOTTY "${LLVM_PATH_DOTTY}"
/* Define to path to fdp program if found or 'echo fdp' otherwise */
#cmakedefine LLVM_PATH_FDP "${LLVM_PATH_FDP}"
/* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */
#undef LLVM_PATH_GRAPHVIZ
/* Define to path to gv program if found or 'echo gv' otherwise */
#undef LLVM_PATH_GV
#cmakedefine LLVM_PATH_GV "${LLVM_PATH_GV}"
/* Define to path to neato program if found or 'echo neato' otherwise */
#cmakedefine LLVM_PATH_NEATO "${LLVM_PATH_NEATO}"
/* Define to path to twopi program if found or 'echo twopi' otherwise */
#cmakedefine LLVM_PATH_TWOPI "${LLVM_PATH_TWOPI}"
/* Installation prefix directory */
#undef LLVM_PREFIX

View File

@ -8,9 +8,24 @@
*/
#undef CRAY_STACKSEG_END
/* 32 bit multilib directory. */
#undef CXX_INCLUDE_32BIT_DIR
/* 64 bit multilib directory. */
#undef CXX_INCLUDE_64BIT_DIR
/* Arch the libstdc++ headers. */
#undef CXX_INCLUDE_ARCH
/* Directory with the libstdc++ headers. */
#undef CXX_INCLUDE_ROOT
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Directories clang will search for headers */
#undef C_INCLUDE_DIRS
/* Define if CBE is enabled for printf %a output */
#undef ENABLE_CBE_PRINTF_A

View File

@ -86,7 +86,7 @@ class ConstantInt : public Constant {
/// Return a ConstantInt constructed from the string strStart with the given
/// radix.
static ConstantInt *get(const IntegerType *Ty, const StringRef &Str,
static ConstantInt *get(const IntegerType *Ty, StringRef Str,
uint8_t radix);
/// If Ty is a vector type, return a Constant with a splat of the given
@ -255,7 +255,7 @@ class ConstantFP : public Constant {
/// only be used for simple constant values like 2.0/1.0 etc, that are
/// known-valid both as host double and as the target format.
static Constant *get(const Type* Ty, double V);
static Constant *get(const Type* Ty, const StringRef &Str);
static Constant *get(const Type* Ty, StringRef Str);
static ConstantFP *get(LLVMContext &Context, const APFloat &V);
static ConstantFP *getNegativeZero(const Type* Ty);
static ConstantFP *getInfinity(const Type *Ty, bool Negative = false);
@ -353,7 +353,7 @@ class ConstantArray : public Constant {
/// of the array by one (you've been warned). However, in some situations
/// this is not desired so if AddNull==false then the string is copied without
/// null termination.
static Constant *get(LLVMContext &Context, const StringRef &Initializer,
static Constant *get(LLVMContext &Context, StringRef Initializer,
bool AddNull = true);
/// Transparently provide more efficient getOperand methods.

View File

@ -91,7 +91,6 @@ class ExecutionEngine {
bool CompilingLazily;
bool GVCompilationDisabled;
bool SymbolSearchingDisabled;
bool DlsymStubsEnabled;
friend class EngineBuilder; // To allow access to JITCtor and InterpCtor.
@ -114,7 +113,8 @@ class ExecutionEngine {
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
bool GVsWithCode);
bool GVsWithCode,
CodeModel::Model CMM);
static ExecutionEngine *(*InterpCtor)(ModuleProvider *MP,
std::string *ErrorStr);
@ -174,7 +174,9 @@ class ExecutionEngine {
JITMemoryManager *JMM = 0,
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default,
bool GVsWithCode = true);
bool GVsWithCode = true,
CodeModel::Model CMM =
CodeModel::Default);
/// addModuleProvider - Add a ModuleProvider to the list of modules that we
/// can JIT from. Note that this takes ownership of the ModuleProvider: when
@ -369,15 +371,7 @@ class ExecutionEngine {
bool isSymbolSearchingDisabled() const {
return SymbolSearchingDisabled;
}
/// EnableDlsymStubs -
void EnableDlsymStubs(bool Enabled = true) {
DlsymStubsEnabled = Enabled;
}
bool areDlsymStubsEnabled() const {
return DlsymStubsEnabled;
}
/// InstallLazyFunctionCreator - If an unknown function is needed, the
/// specified function pointer is invoked to create it. If it returns null,
/// the JIT will abort.
@ -434,6 +428,7 @@ class EngineBuilder {
CodeGenOpt::Level OptLevel;
JITMemoryManager *JMM;
bool AllocateGVsWithCode;
CodeModel::Model CMModel;
/// InitEngine - Does the common initialization of default options.
///
@ -443,6 +438,7 @@ class EngineBuilder {
OptLevel = CodeGenOpt::Default;
JMM = NULL;
AllocateGVsWithCode = false;
CMModel = CodeModel::Default;
}
public:
@ -487,6 +483,13 @@ class EngineBuilder {
return *this;
}
/// setCodeModel - Set the CodeModel that the ExecutionEngine target
/// data is using. Defaults to target specific default "CodeModel::Default".
EngineBuilder &setCodeModel(CodeModel::Model M) {
CMModel = M;
return *this;
}
/// setAllocateGVsWithCode - Sets whether global values should be allocated
/// into the same buffer as code. For most applications this should be set
/// to false. Allocating globals with code breaks freeMachineCodeForFunction

View File

@ -71,17 +71,6 @@ class JITMemoryManager {
/// return a pointer to its base.
virtual uint8_t *getGOTBase() const = 0;
/// SetDlsymTable - If the JIT must be able to relocate stubs after they have
/// been emitted, potentially because they are being copied to a process
/// where external symbols live at different addresses than in the JITing
/// process, allocate a table with sufficient information to do so.
virtual void SetDlsymTable(void *ptr) = 0;
/// getDlsymTable - If this is managing a table of entries so that stubs to
/// external symbols can be later relocated, this method should return a
/// pointer to it.
virtual void *getDlsymTable() const = 0;
/// NeedsExactSize - If the memory manager requires to know the size of the
/// objects to be emitted
bool NeedsExactSize() const {

View File

@ -23,6 +23,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Argument.h"
#include "llvm/Attributes.h"
#include "llvm/Support/Compiler.h"
namespace llvm {
@ -148,7 +149,7 @@ class Function : public GlobalValue,
/// The particular intrinsic functions which correspond to this value are
/// defined in llvm/Intrinsics.h.
///
unsigned getIntrinsicID() const;
unsigned getIntrinsicID() const ATTRIBUTE_READONLY;
bool isIntrinsic() const { return getIntrinsicID() != 0; }
/// getCallingConv()/setCallingConv(CC) - These method get and set the

View File

@ -90,7 +90,7 @@ class GlobalValue : public Constant {
bool hasSection() const { return !Section.empty(); }
const std::string &getSection() const { return Section; }
void setSection(const StringRef &S) { Section = S; }
void setSection(StringRef S) { Section = S; }
/// If the usage is empty (except transitively dead constants), then this
/// global value can can be safely deleted since the destructor will

View File

@ -28,7 +28,6 @@ namespace llvm {
class Module;
class Constant;
class LLVMContext;
template<typename ValueSubClass, typename ItemParentClass>
class SymbolTableListTraits;
@ -50,8 +49,7 @@ class GlobalVariable : public GlobalValue, public ilist_node<GlobalVariable> {
}
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
GlobalVariable(LLVMContext &Context, const Type *Ty, bool isConstant,
LinkageTypes Linkage,
GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer = 0, const Twine &Name = "",
bool ThreadLocal = false, unsigned AddressSpace = 0);
/// GlobalVariable ctor - This creates a global and inserts it before the
@ -101,18 +99,10 @@ class GlobalVariable : public GlobalValue, public ilist_node<GlobalVariable> {
assert(hasInitializer() && "GV doesn't have initializer!");
return static_cast<Constant*>(Op<0>().get());
}
inline void setInitializer(Constant *CPV) {
if (CPV == 0) {
if (hasInitializer()) {
Op<0>().set(0);
NumOperands = 0;
}
} else {
if (!hasInitializer())
NumOperands = 1;
Op<0>().set(CPV);
}
}
/// setInitializer - Sets the initializer for this global variable, removing
/// any existing initializer if InitVal==NULL. If this GV has type T*, the
/// initializer must have type T.
void setInitializer(Constant *InitVal);
/// If the value is a global constant, its value is immutable throughout the
/// runtime execution of the program. Assigning a value into the constant

View File

@ -33,16 +33,16 @@ class InlineAsm : public Value {
bool HasSideEffects;
bool IsAlignStack;
InlineAsm(const FunctionType *Ty, const StringRef &AsmString,
const StringRef &Constraints, bool hasSideEffects,
InlineAsm(const FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false);
virtual ~InlineAsm();
public:
/// InlineAsm::get - Return the the specified uniqued inline asm string.
///
static InlineAsm *get(const FunctionType *Ty, const StringRef &AsmString,
const StringRef &Constraints, bool hasSideEffects,
static InlineAsm *get(const FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false);
bool hasSideEffects() const { return HasSideEffects; }
@ -65,7 +65,7 @@ class InlineAsm : public Value {
/// the specified constraint string is legal for the type. This returns true
/// if legal, false if not.
///
static bool Verify(const FunctionType *Ty, const StringRef &Constraints);
static bool Verify(const FunctionType *Ty, StringRef Constraints);
// Constraint String Parsing
enum ConstraintPrefix {
@ -110,7 +110,7 @@ class InlineAsm : public Value {
/// Parse - Analyze the specified string (e.g. "=*&{eax}") and fill in the
/// fields in this structure. If the constraint string is not understood,
/// return true, otherwise return false.
bool Parse(const StringRef &Str,
bool Parse(StringRef Str,
std::vector<InlineAsm::ConstraintInfo> &ConstraintsSoFar);
};
@ -118,7 +118,7 @@ class InlineAsm : public Value {
/// constraints and their prefixes. If this returns an empty vector, and if
/// the constraint string itself isn't empty, there was an error parsing.
static std::vector<ConstraintInfo>
ParseConstraints(const StringRef &ConstraintString);
ParseConstraints(StringRef ConstraintString);
/// ParseConstraints - Parse the constraints of this inlineasm object,
/// returning them the same way that ParseConstraints(str) does.

View File

@ -214,6 +214,27 @@ class BinaryOperator : public Instruction {
return BO;
}
/// CreateNUWAdd - Create an Add operator with the NUW flag set.
///
static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateAdd(V1, V2, Name);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, BB);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWAdd(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateAdd(V1, V2, Name, I);
BO->setHasNoUnsignedWrap(true);
return BO;
}
/// CreateNSWSub - Create an Sub operator with the NSW flag set.
///
static BinaryOperator *CreateNSWSub(Value *V1, Value *V2,
@ -235,6 +256,27 @@ class BinaryOperator : public Instruction {
return BO;
}
/// CreateNUWSub - Create an Sub operator with the NUW flag set.
///
static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
const Twine &Name = "") {
BinaryOperator *BO = CreateSub(V1, V2, Name);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
const Twine &Name, BasicBlock *BB) {
BinaryOperator *BO = CreateSub(V1, V2, Name, BB);
BO->setHasNoUnsignedWrap(true);
return BO;
}
static BinaryOperator *CreateNUWSub(Value *V1, Value *V2,
const Twine &Name, Instruction *I) {
BinaryOperator *BO = CreateSub(V1, V2, Name, I);
BO->setHasNoUnsignedWrap(true);
return BO;
}
/// CreateExactSDiv - Create an SDiv operator with the exact flag set.
///
static BinaryOperator *CreateExactSDiv(Value *V1, Value *V2,
@ -658,7 +700,7 @@ class CmpInst: public Instruction {
/// @brief Create a CmpInst
static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
Value *S2, const Twine &Name, BasicBlock *InsertAtEnd);
/// @brief Get the opcode casted to the right type
OtherOps getOpcode() const {
return static_cast<OtherOps>(Instruction::getOpcode());
@ -670,6 +712,18 @@ class CmpInst: public Instruction {
/// @brief Set the predicate for this instruction to the specified value.
void setPredicate(Predicate P) { SubclassData = P; }
static bool isFPPredicate(Predicate P) {
return P >= FIRST_FCMP_PREDICATE && P <= LAST_FCMP_PREDICATE;
}
static bool isIntPredicate(Predicate P) {
return P >= FIRST_ICMP_PREDICATE && P <= LAST_ICMP_PREDICATE;
}
bool isFPPredicate() const { return isFPPredicate(getPredicate()); }
bool isIntPredicate() const { return isIntPredicate(getPredicate()); }
/// For example, EQ -> NE, UGT -> ULE, SLT -> SGE,
/// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
/// @returns the inverse predicate for the instruction's current predicate.

View File

@ -320,6 +320,28 @@ namespace llvm {
}
};
/// MemoryUseIntrinsic - This is the common base class for the memory use
/// marker intrinsics.
///
struct MemoryUseIntrinsic : public IntrinsicInst {
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MemoryUseIntrinsic *) { return true; }
static inline bool classof(const IntrinsicInst *I) {
switch (I->getIntrinsicID()) {
case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end:
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
return true;
default: return false;
}
}
static inline bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
};
}
#endif

View File

@ -484,13 +484,13 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
// Misc.
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse2_packsswb_128 : GCCBuiltin<"__builtin_ia32_packsswb128">,
Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
llvm_v8i16_ty], [IntrNoMem]>;
def int_x86_sse2_packssdw_128 : GCCBuiltin<"__builtin_ia32_packssdw128">,
Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty,
llvm_v4i32_ty], [IntrNoMem]>;
def int_x86_sse2_packuswb_128 : GCCBuiltin<"__builtin_ia32_packuswb128">,
Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
llvm_v8i16_ty], [IntrNoMem]>;
def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">,
Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;

View File

@ -82,6 +82,7 @@ namespace {
(void) llvm::createInternalizePass(false);
(void) llvm::createLCSSAPass();
(void) llvm::createLICMPass();
(void) llvm::createLazyValueInfoPass();
(void) llvm::createLiveValuesPass();
(void) llvm::createLoopDependenceAnalysisPass();
(void) llvm::createLoopExtractorPass();
@ -119,7 +120,6 @@ namespace {
(void) llvm::createTailDuplicationPass();
(void) llvm::createJumpThreadingPass();
(void) llvm::createUnifyFunctionExitNodesPass();
(void) llvm::createCondPropagationPass();
(void) llvm::createNullProfilerRSPass();
(void) llvm::createRSProfilingPass();
(void) llvm::createInstCountPass();

View File

@ -65,8 +65,8 @@ class Linker {
/// Construct the Linker with an empty module which will be given the
/// name \p progname. \p progname will also be used for error messages.
/// @brief Construct with empty module
Linker(const StringRef &progname, ///< name of tool running linker
const StringRef &modulename, ///< name of linker's end-result module
Linker(StringRef progname, ///< name of tool running linker
StringRef modulename, ///< name of linker's end-result module
LLVMContext &C, ///< Context for global info
unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
);
@ -74,7 +74,7 @@ class Linker {
/// Construct the Linker with a previously defined module, \p aModule. Use
/// \p progname for the name of the program in error messages.
/// @brief Construct with existing module
Linker(const StringRef& progname, Module* aModule, unsigned Flags = 0);
Linker(StringRef progname, Module* aModule, unsigned Flags = 0);
/// Destruct the Linker.
/// @brief Destructor
@ -214,8 +214,8 @@ class Linker {
/// @returns true if an error occurs, false otherwise
/// @brief Link one library into the module
bool LinkInLibrary (
const StringRef &Library, ///< The library to link in
bool& is_native ///< Indicates if lib a native library
StringRef Library, ///< The library to link in
bool& is_native ///< Indicates if lib a native library
);
/// This function links one bitcode archive, \p Filename, into the module.
@ -267,7 +267,7 @@ class Linker {
/// will be empty (i.e. sys::Path::isEmpty() will return true).
/// @returns A sys::Path to the found library
/// @brief Find a library from its short name.
sys::Path FindLib(const StringRef &Filename);
sys::Path FindLib(StringRef Filename);
/// @}
/// @name Implementation
@ -277,9 +277,9 @@ class Linker {
/// Module it contains (wrapped in an auto_ptr), or 0 if an error occurs.
std::auto_ptr<Module> LoadObject(const sys::Path& FN);
bool warning(const StringRef &message);
bool error(const StringRef &message);
void verbose(const StringRef &message);
bool warning(StringRef message);
bool error(StringRef message);
void verbose(StringRef message);
/// @}
/// @name Data

View File

@ -56,7 +56,7 @@ struct AsmToken {
public:
AsmToken() {}
AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0)
AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0)
: Kind(_Kind), Str(_Str), IntVal(_IntVal) {}
TokenKind getKind() const { return Kind; }

View File

@ -49,7 +49,7 @@ namespace llvm {
/// CreateSymbol - Create a new symbol with the specified @param Name.
///
/// @param Name - The symbol name, which must be unique across all symbols.
MCSymbol *CreateSymbol(const StringRef &Name);
MCSymbol *CreateSymbol(StringRef Name);
/// GetOrCreateSymbol - Lookup the symbol inside with the specified
/// @param Name. If it exists, return it. If not, create a forward
@ -58,7 +58,7 @@ namespace llvm {
/// @param Name - The symbol name, which must be unique across all symbols.
/// @param IsTemporary - Whether this symbol is an assembler temporary,
/// which should not survive into the symbol table for the translation unit.
MCSymbol *GetOrCreateSymbol(const StringRef &Name);
MCSymbol *GetOrCreateSymbol(StringRef Name);
MCSymbol *GetOrCreateSymbol(const Twine &Name);
/// CreateTemporarySymbol - Create a new temporary symbol with the specified
@ -67,10 +67,10 @@ namespace llvm {
/// @param Name - The symbol name, for debugging purposes only, temporary
/// symbols do not surive assembly. If non-empty the name must be unique
/// across all symbols.
MCSymbol *CreateTemporarySymbol(const StringRef &Name = "");
MCSymbol *CreateTemporarySymbol(StringRef Name = "");
/// LookupSymbol - Get the symbol for @param Name, or null.
MCSymbol *LookupSymbol(const StringRef &Name) const;
MCSymbol *LookupSymbol(StringRef Name) const;
/// @}

View File

@ -120,7 +120,7 @@ class MCSymbolRefExpr : public MCExpr {
/// @{
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
static const MCSymbolRefExpr *Create(StringRef Name, MCContext &Ctx);
/// @}
/// @name Accessors

View File

@ -51,13 +51,13 @@ namespace llvm {
/// of a syntactic one.
bool IsDirective;
MCSectionCOFF(const StringRef &name, bool isDirective, SectionKind K)
MCSectionCOFF(StringRef name, bool isDirective, SectionKind K)
: MCSection(K), Name(name), IsDirective(isDirective) {
}
public:
static MCSectionCOFF *Create(const StringRef &Name, bool IsDirective,
SectionKind K, MCContext &Ctx);
static MCSectionCOFF *Create(StringRef Name, bool IsDirective,
SectionKind K, MCContext &Ctx);
const std::string &getName() const { return Name; }
bool isDirective() const { return IsDirective; }

View File

@ -35,13 +35,13 @@ class MCSectionELF : public MCSection {
bool IsExplicit;
protected:
MCSectionELF(const StringRef &Section, unsigned type, unsigned flags,
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
SectionKind K, bool isExplicit)
: MCSection(K), SectionName(Section.str()), Type(type), Flags(flags),
IsExplicit(isExplicit) {}
public:
static MCSectionELF *Create(const StringRef &Section, unsigned Type,
static MCSectionELF *Create(StringRef Section, unsigned Type,
unsigned Flags, SectionKind K, bool isExplicit,
MCContext &Ctx);

View File

@ -33,7 +33,7 @@ class MCSectionMachO : public MCSection {
/// size of stubs, for example.
unsigned Reserved2;
MCSectionMachO(const StringRef &Segment, const StringRef &Section,
MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K)
: MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
@ -52,8 +52,8 @@ class MCSectionMachO : public MCSection {
}
public:
static MCSectionMachO *Create(const StringRef &Segment,
const StringRef &Section,
static MCSectionMachO *Create(StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K, MCContext &Ctx);

View File

@ -155,7 +155,7 @@ namespace llvm {
///
/// This is used to implement assembler directives such as .byte, .ascii,
/// etc.
virtual void EmitBytes(const StringRef &Data) = 0;
virtual void EmitBytes(StringRef Data) = 0;
/// EmitValue - Emit the expression @param Value into the output as a native
/// integer of the given @param Size bytes.

View File

@ -56,7 +56,7 @@ namespace llvm {
private: // MCContext creates and uniques these.
friend class MCContext;
MCSymbol(const StringRef &_Name, bool _IsTemporary)
MCSymbol(StringRef _Name, bool _IsTemporary)
: Name(_Name), Section(0), Value(0), IsTemporary(_IsTemporary) {}
MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT

View File

@ -60,6 +60,7 @@ class MDString : public MetadataBase {
public:
static MDString *get(LLVMContext &Context, StringRef Str);
static MDString *get(LLVMContext &Context, const char *Str);
StringRef getString() const { return Str; }

View File

@ -154,7 +154,7 @@ class Module {
public:
/// The Module constructor. Note that there is no default constructor. You
/// must provide a name for the module upon construction.
explicit Module(const StringRef &ModuleID, LLVMContext& C);
explicit Module(StringRef ModuleID, LLVMContext& C);
/// The module destructor. This will dropAllReferences.
~Module();
@ -196,20 +196,20 @@ class Module {
public:
/// Set the module identifier.
void setModuleIdentifier(const StringRef &ID) { ModuleID = ID; }
void setModuleIdentifier(StringRef ID) { ModuleID = ID; }
/// Set the data layout
void setDataLayout(const StringRef &DL) { DataLayout = DL; }
void setDataLayout(StringRef DL) { DataLayout = DL; }
/// Set the target triple.
void setTargetTriple(const StringRef &T) { TargetTriple = T; }
void setTargetTriple(StringRef T) { TargetTriple = T; }
/// Set the module-scope inline assembly blocks.
void setModuleInlineAsm(const StringRef &Asm) { GlobalScopeAsm = Asm; }
void setModuleInlineAsm(StringRef Asm) { GlobalScopeAsm = Asm; }
/// Append to the module-scope inline assembly blocks, automatically
/// appending a newline to the end.
void appendModuleInlineAsm(const StringRef &Asm) {
void appendModuleInlineAsm(StringRef Asm) {
GlobalScopeAsm += Asm;
GlobalScopeAsm += '\n';
}
@ -221,7 +221,7 @@ class Module {
/// getNamedValue - Return the first global value in the module with
/// the specified name, of arbitrary type. This method returns null
/// if a global with the specified name is not found.
GlobalValue *getNamedValue(const StringRef &Name) const;
GlobalValue *getNamedValue(StringRef Name) const;
/// @}
/// @name Function Accessors
@ -236,10 +236,10 @@ class Module {
/// the existing function.
/// 4. Finally, the function exists but has the wrong prototype: return the
/// function with a constantexpr cast to the right prototype.
Constant *getOrInsertFunction(const StringRef &Name, const FunctionType *T,
Constant *getOrInsertFunction(StringRef Name, const FunctionType *T,
AttrListPtr AttributeList);
Constant *getOrInsertFunction(const StringRef &Name, const FunctionType *T);
Constant *getOrInsertFunction(StringRef Name, const FunctionType *T);
/// getOrInsertFunction - Look up the specified function in the module symbol
/// table. If it does not exist, add a prototype for the function and return
@ -248,21 +248,21 @@ class Module {
/// named function has a different type. This version of the method takes a
/// null terminated list of function arguments, which makes it easier for
/// clients to use.
Constant *getOrInsertFunction(const StringRef &Name,
Constant *getOrInsertFunction(StringRef Name,
AttrListPtr AttributeList,
const Type *RetTy, ...) END_WITH_NULL;
/// getOrInsertFunction - Same as above, but without the attributes.
Constant *getOrInsertFunction(const StringRef &Name, const Type *RetTy, ...)
Constant *getOrInsertFunction(StringRef Name, const Type *RetTy, ...)
END_WITH_NULL;
Constant *getOrInsertTargetIntrinsic(const StringRef &Name,
Constant *getOrInsertTargetIntrinsic(StringRef Name,
const FunctionType *Ty,
AttrListPtr AttributeList);
/// getFunction - Look up the specified function in the module symbol table.
/// If it does not exist, return null.
Function *getFunction(const StringRef &Name) const;
Function *getFunction(StringRef Name) const;
/// @}
/// @name Global Variable Accessors
@ -272,13 +272,13 @@ class Module {
/// symbol table. If it does not exist, return null. If AllowInternal is set
/// to true, this function will return types that have InternalLinkage. By
/// default, these types are not returned.
GlobalVariable *getGlobalVariable(const StringRef &Name,
GlobalVariable *getGlobalVariable(StringRef Name,
bool AllowInternal = false) const;
/// getNamedGlobal - Return the first global variable in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
GlobalVariable *getNamedGlobal(const StringRef &Name) const {
GlobalVariable *getNamedGlobal(StringRef Name) const {
return getGlobalVariable(Name, true);
}
@ -289,7 +289,7 @@ class Module {
/// with a constantexpr cast to the right type.
/// 3. Finally, if the existing global is the correct delclaration, return
/// the existing global.
Constant *getOrInsertGlobal(const StringRef &Name, const Type *Ty);
Constant *getOrInsertGlobal(StringRef Name, const Type *Ty);
/// @}
/// @name Global Alias Accessors
@ -298,7 +298,7 @@ class Module {
/// getNamedAlias - Return the first global alias in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
GlobalAlias *getNamedAlias(const StringRef &Name) const;
GlobalAlias *getNamedAlias(StringRef Name) const;
/// @}
/// @name Named Metadata Accessors
@ -307,12 +307,12 @@ class Module {
/// getNamedMetadata - Return the first NamedMDNode in the module with the
/// specified name. This method returns null if a NamedMDNode with the
/// specified name is not found.
NamedMDNode *getNamedMetadata(const StringRef &Name) const;
NamedMDNode *getNamedMetadata(StringRef Name) const;
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a
/// NamedMDNode with the specified name is not found.
NamedMDNode *getOrInsertNamedMetadata(const StringRef &Name);
NamedMDNode *getOrInsertNamedMetadata(StringRef Name);
/// @}
/// @name Type Accessors
@ -321,7 +321,7 @@ class Module {
/// addTypeName - Insert an entry in the symbol table mapping Str to Type. If
/// there is already an entry for this name, true is returned and the symbol
/// table is not modified.
bool addTypeName(const StringRef &Name, const Type *Ty);
bool addTypeName(StringRef Name, const Type *Ty);
/// getTypeName - If there is at least one entry in the symbol table for the
/// specified type, return it.
@ -329,7 +329,7 @@ class Module {
/// getTypeByName - Return the type with the specified name in this module, or
/// null if there is none by that name.
const Type *getTypeByName(const StringRef &Name) const;
const Type *getTypeByName(StringRef Name) const;
/// @}
/// @name Direct access to the globals list, functions list, and symbol table
@ -415,9 +415,9 @@ class Module {
/// @brief Returns the number of items in the list of libraries.
inline size_t lib_size() const { return LibraryList.size(); }
/// @brief Add a library to the list of dependent libraries
void addLibrary(const StringRef &Lib);
void addLibrary(StringRef Lib);
/// @brief Remove a library from the list of dependent libraries
void removeLibrary(const StringRef &Lib);
void removeLibrary(StringRef Lib);
/// @brief Get all the libraries
inline const LibraryListType& getLibraries() const { return LibraryList; }

View File

@ -167,7 +167,7 @@ class Pass {
// lookupPassInfo - Return the pass info object for the pass with the given
// argument string, or null if it is not known.
static const PassInfo *lookupPassInfo(const StringRef &Arg);
static const PassInfo *lookupPassInfo(StringRef Arg);
/// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
/// get analysis information that might be around, for example to update it.

View File

@ -22,6 +22,7 @@
#include <vector>
#include "llvm/Pass.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
namespace llvm {
@ -95,7 +96,7 @@ class AnalysisUsage {
// This can be useful when a pass is trivially preserved, but may not be
// linked in. Be careful about spelling!
//
AnalysisUsage &addPreserved(const StringRef &Arg) {
AnalysisUsage &addPreserved(StringRef Arg) {
const PassInfo *PI = Pass::lookupPassInfo(Arg);
// If the pass exists, preserve it. Otherwise silently do nothing.
if (PI) Preserved.push_back(PI);

View File

@ -284,11 +284,11 @@ class PMDataManager {
void removeNotPreservedAnalysis(Pass *P);
/// Remove dead passes used by P.
void removeDeadPasses(Pass *P, const StringRef &Msg,
void removeDeadPasses(Pass *P, StringRef Msg,
enum PassDebuggingString);
/// Remove P.
void freePass(Pass *P, const StringRef &Msg,
void freePass(Pass *P, StringRef Msg,
enum PassDebuggingString);
/// Add pass P into the PassVector. Update
@ -344,7 +344,7 @@ class PMDataManager {
void dumpLastUses(Pass *P, unsigned Offset) const;
void dumpPassArguments() const;
void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
enum PassDebuggingString S2, const StringRef &Msg);
enum PassDebuggingString S2, StringRef Msg);
void dumpRequiredSet(const Pass *P) const;
void dumpPreservedSet(const Pass *P) const;
@ -388,8 +388,8 @@ class PMDataManager {
bool isPassDebuggingExecutionsOrMore() const;
private:
void dumpAnalysisUsage(const StringRef &Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const;
void dumpAnalysisUsage(StringRef Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const;
// Set of available Analysis. This information is used while scheduling
// pass. If a pass requires an analysis which is not not available then

View File

@ -495,7 +495,8 @@ class parser : public generic_parser_base {
//--------------------------------------------------
// basic_parser - Super class of parsers to provide boilerplate code
//
struct basic_parser_impl { // non-template implementation of basic_parser<t>
class basic_parser_impl { // non-template implementation of basic_parser<t>
public:
virtual ~basic_parser_impl() {}
enum ValueExpected getValueExpectedFlagDefault() const {
@ -525,7 +526,8 @@ struct basic_parser_impl { // non-template implementation of basic_parser<t>
// a typedef for the provided data type.
//
template<class DataType>
struct basic_parser : public basic_parser_impl {
class basic_parser : public basic_parser_impl {
public:
typedef DataType parser_data_type;
};
@ -779,6 +781,8 @@ class opt_storage {
DataType &getValue() { check(); return *Location; }
const DataType &getValue() const { check(); return *Location; }
operator DataType() const { return this->getValue(); }
};
@ -814,6 +818,8 @@ class opt_storage<DataType, false, false> {
DataType &getValue() { return Value; }
DataType getValue() const { return Value; }
operator DataType() const { return getValue(); }
// If the datatype is a pointer, support -> on it.
DataType operator->() const { return Value; }
};
@ -863,8 +869,6 @@ class opt : public Option,
ParserClass &getParser() { return Parser; }
operator DataType() const { return this->getValue(); }
template<class T>
DataType &operator=(const T &Val) {
this->setValue(Val);

View File

@ -29,6 +29,18 @@
#define ATTRIBUTE_USED
#endif
#ifdef __GNUC__ // aka 'ATTRIBUTE_CONST' but following LLVM Conventions.
#define ATTRIBUTE_READNONE __attribute__((__const__))
#else
#define ATTRIBUTE_READNONE
#endif
#ifdef __GNUC__ // aka 'ATTRIBUTE_PURE' but following LLVM Conventions.
#define ATTRIBUTE_READONLY __attribute__((__pure__))
#else
#define ATTRIBUTE_READONLY
#endif
#if (__GNUC__ >= 4)
#define BUILTIN_EXPECT(EXPR, VALUE) __builtin_expect((EXPR), (VALUE))
#else
@ -52,12 +64,16 @@
// method "not for inlining".
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#define DISABLE_INLINE __attribute__((noinline))
#elif defined(_MSC_VER)
#define DISABLE_INLINE __declspec(noinline)
#else
#define DISABLE_INLINE
#endif
#ifdef __GNUC__
#define NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER)
#define NORETURN __declspec(noreturn)
#else
#define NORETURN
#endif

View File

@ -18,7 +18,6 @@
#define LLVM_SUPPORT_CONSTANTFOLDER_H
#include "llvm/Constants.h"
#include "llvm/Instruction.h"
#include "llvm/InstrTypes.h"
namespace llvm {

View File

@ -187,6 +187,14 @@ class ConstantRange {
/// truncated to the specified type.
ConstantRange truncate(uint32_t BitWidth) const;
/// zextOrTrunc - make this range have the bit width given by \p BitWidth. The
/// value is zero extended, truncated, or left alone to make it that width.
ConstantRange zextOrTrunc(uint32_t BitWidth) const;
/// sextOrTrunc - make this range have the bit width given by \p BitWidth. The
/// value is sign extended, truncated, or left alone to make it that width.
ConstantRange sextOrTrunc(uint32_t BitWidth) const;
/// add - Return a new range representing the possible values resulting
/// from an addition of a value in this range and a value in Other.
ConstantRange add(const ConstantRange &Other) const;
@ -209,6 +217,18 @@ class ConstantRange {
/// TODO: This isn't fully implemented yet.
ConstantRange udiv(const ConstantRange &Other) const;
/// shl - Return a new range representing the possible values resulting
/// from a left shift of a value in this range by the Amount value.
ConstantRange shl(const ConstantRange &Amount) const;
/// ashr - Return a new range representing the possible values resulting from
/// an arithmetic right shift of a value in this range by the Amount value.
ConstantRange ashr(const ConstantRange &Amount) const;
/// shr - Return a new range representing the possible values resulting
/// from a logical right shift of a value in this range by the Amount value.
ConstantRange lshr(const ConstantRange &Amount) const;
/// print - Print out the bounds to a stream...
///
void print(raw_ostream &OS) const;

Some files were not shown because too many files have changed in this diff Show More