mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Merge pull request #181 from VectorCamp/bugfix/fix-clang15-compilation-errors
Fix clang 15,16 compilation errors on all platforms, refactor CMake build system
This commit is contained in:
commit
aa8af2621b
689
CMakeLists.txt
689
CMakeLists.txt
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
cmake_minimum_required (VERSION 3.18.4)
|
||||
|
||||
project (vectorscan C CXX)
|
||||
|
||||
@ -7,6 +7,11 @@ set (HS_MINOR_VERSION 4)
|
||||
set (HS_PATCH_VERSION 10)
|
||||
set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION})
|
||||
|
||||
string (TIMESTAMP BUILD_DATE "%Y-%m-%d")
|
||||
message(STATUS "Build date: ${BUILD_DATE}")
|
||||
|
||||
# Dependencies check
|
||||
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
@ -19,10 +24,19 @@ INCLUDE (CheckSymbolExists)
|
||||
include (CMakeDependentOption)
|
||||
include (GNUInstallDirs)
|
||||
include (${CMAKE_MODULE_PATH}/platform.cmake)
|
||||
include (${CMAKE_MODULE_PATH}/boost.cmake)
|
||||
include (${CMAKE_MODULE_PATH}/ragel.cmake)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
find_program(RAGEL ragel)
|
||||
|
||||
if(${RAGEL} STREQUAL "RAGEL-NOTFOUND")
|
||||
message(FATAL_ERROR "Ragel state machine compiler not found")
|
||||
endif()
|
||||
|
||||
# Build type check
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Default build type 'Release with debug info'")
|
||||
set(CMAKE_BUILD_TYPE RELWITHDEBINFO CACHE STRING "" FORCE )
|
||||
@ -55,220 +69,72 @@ foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${LIBDIR}")
|
||||
endforeach (OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
|
||||
|
||||
|
||||
if(CMAKE_GENERATOR STREQUAL Xcode)
|
||||
set(XCODE TRUE)
|
||||
endif()
|
||||
|
||||
# older versions of cmake don't know things support isystem
|
||||
if (XCODE OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR 1)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/src)
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
include_directories(SYSTEM include)
|
||||
|
||||
include (${CMAKE_MODULE_PATH}/boost.cmake)
|
||||
# Compiler detection
|
||||
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
find_program(RAGEL ragel)
|
||||
include (${CMAKE_MODULE_PATH}/compiler.cmake)
|
||||
|
||||
if(NOT Python_Interpreter_FOUND)
|
||||
message(FATAL_ERROR "No python interpreter found")
|
||||
# CMake options
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED)
|
||||
message(FATAL_ERROR "This option is no longer supported, please set at least one of BUILD_STATIC_LIBS and BUILD_SHARED_LIBS")
|
||||
endif()
|
||||
|
||||
# allow for reproducible builds - python for portability
|
||||
if (DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
execute_process(
|
||||
COMMAND "${PYTHON}" "${CMAKE_MODULE_PATH}/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}"
|
||||
OUTPUT_VARIABLE BUILD_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else ()
|
||||
string (TIMESTAMP BUILD_DATE "%Y-%m-%d")
|
||||
endif ()
|
||||
message(STATUS "Build date: ${BUILD_DATE}")
|
||||
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
||||
option(BUILD_STATIC_LIBS "Build static libs" OFF)
|
||||
|
||||
|
||||
if(${RAGEL} STREQUAL "RAGEL-NOTFOUND")
|
||||
message(FATAL_ERROR "Ragel state machine compiler not found")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
message(STATUS "Building shared libraries")
|
||||
endif()
|
||||
|
||||
option(DEBUG_OUTPUT "Enable debug output (warning: very verbose)" FALSE)
|
||||
|
||||
if(DEBUG_OUTPUT)
|
||||
add_definitions(-DDEBUG)
|
||||
set(RELEASE_BUILD FALSE)
|
||||
endif(DEBUG_OUTPUT)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libs instead of static" OFF)
|
||||
option(BUILD_STATIC_AND_SHARED "Build shared libs as well as static" OFF)
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
message(STATUS "Building shared libraries")
|
||||
else()
|
||||
message(STATUS "Building static libraries")
|
||||
if (BUILD_STATIC_LIBS)
|
||||
message(STATUS "Building static libraries")
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
# build static libs
|
||||
set(BUILD_STATIC_LIBS ON)
|
||||
mark_as_advanced(BUILD_STATIC_LIBS)
|
||||
endif ()
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(DUMP_SUPPORT "Dump code support; normally on, except in release builds" ON "NOT RELEASE_BUILD" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_ASSERTS "Disable assert(); Asserts are enabled in debug builds, disabled in release builds" OFF "NOT RELEASE_BUILD" ON)
|
||||
|
||||
option(DEBUG_OUTPUT "Enable debug output (warning: very verbose)" OFF)
|
||||
if(DEBUG_OUTPUT)
|
||||
add_definitions(-DDEBUG)
|
||||
set(RELEASE_BUILD FALSE)
|
||||
endif(DEBUG_OUTPUT)
|
||||
|
||||
|
||||
#for config
|
||||
if (RELEASE_BUILD)
|
||||
set(HS_OPTIMIZE ON)
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
|
||||
include (${CMAKE_MODULE_PATH}/sanitize.cmake)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(DUMP_SUPPORT "Dump code support; normally on, except in release builds" ON "NOT RELEASE_BUILD" OFF)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_ASSERTS "Disable assert(); Asserts are enabled in debug builds, disabled in release builds" OFF "NOT RELEASE_BUILD" ON)
|
||||
|
||||
option(BUILD_AVX512 "Experimental: support avx512 in the fat runtime" OFF)
|
||||
|
||||
option(BUILD_AVX512VBMI "Experimental: support avx512vbmi in the fat runtime" OFF)
|
||||
|
||||
if (BUILD_AVX512VBMI)
|
||||
set(BUILD_AVX512 ON)
|
||||
endif ()
|
||||
|
||||
# TODO: per platform config files?
|
||||
|
||||
# remove CMake's idea of optimisation
|
||||
foreach (CONFIG ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(REGEX REPLACE "-O[^ ]*" "" CMAKE_C_FLAGS_${CONFIG} "${CMAKE_C_FLAGS_${CONFIG}}")
|
||||
string(REGEX REPLACE "-O[^ ]*" "" CMAKE_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
|
||||
endforeach ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
set(SKYLAKE_FLAG "-xCORE-AVX512")
|
||||
else ()
|
||||
set(SKYLAKE_FLAG "-march=skylake-avx512")
|
||||
set(ICELAKE_FLAG "-march=icelake-server")
|
||||
endif ()
|
||||
|
||||
if(ARCH_PPC64EL)
|
||||
set(ARCH_FLAG mcpu)
|
||||
else()
|
||||
set(ARCH_FLAG march)
|
||||
endif()
|
||||
|
||||
# Detect best GNUCC_ARCH to tune for
|
||||
if (CMAKE_COMPILER_IS_GNUCC AND NOT CROSS_COMPILE)
|
||||
message(STATUS "gcc version ${CMAKE_C_COMPILER_VERSION}")
|
||||
|
||||
# If gcc doesn't recognise the host cpu, then mtune=native becomes
|
||||
# generic, which isn't very good in some cases. march=native looks at
|
||||
# cpuid info and then chooses the best microarch it can (and replaces
|
||||
# the flag), so use that for tune.
|
||||
|
||||
set(TUNE_FLAG "mtune")
|
||||
set(GNUCC_TUNE "")
|
||||
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
|
||||
|
||||
# arg1 might exist if using ccache
|
||||
string (STRIP "${CMAKE_C_COMPILER_ARG1}" CC_ARG1)
|
||||
set (EXEC_ARGS ${CC_ARG1} -c -Q --help=target -${ARCH_FLAG}=native -${TUNE_FLAG}=native)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
|
||||
OUTPUT_VARIABLE _GCC_OUTPUT)
|
||||
set(_GCC_OUTPUT_TUNE ${_GCC_OUTPUT})
|
||||
string(FIND "${_GCC_OUTPUT}" "${ARCH_FLAG}=" POS)
|
||||
string(SUBSTRING "${_GCC_OUTPUT}" ${POS} -1 _GCC_OUTPUT)
|
||||
string(REGEX REPLACE "${ARCH_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_ARCH "${_GCC_OUTPUT}")
|
||||
|
||||
string(FIND "${_GCC_OUTPUT_TUNE}" "${TUNE_FLAG}=" POS_TUNE)
|
||||
string(SUBSTRING "${_GCC_OUTPUT_TUNE}" ${POS_TUNE} -1 _GCC_OUTPUT_TUNE)
|
||||
string(REGEX REPLACE "${TUNE_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_TUNE "${_GCC_OUTPUT_TUNE}")
|
||||
|
||||
string(FIND "${GNUCC_ARCH}" "sve" POS_SVE)
|
||||
string(FIND "${GNUCC_ARCH}" "sve2" POS_SVE2)
|
||||
string(FIND "${GNUCC_ARCH}" "sve2-bitperm" POS_SVE2_BITPERM)
|
||||
if(NOT POS_SVE2_BITPERM EQUAL 0)
|
||||
set(SVE2_BITPERM_FOUND 1)
|
||||
set(SVE2_FOUND 1)
|
||||
set(SVE_FOUND 1)
|
||||
elseif(NOT POS_SVE2 EQUAL 0)
|
||||
set(SVE2_FOUND 1)
|
||||
set(SVE_FOUND 1)
|
||||
elseif (NOT POS_SVE EQUAL 0)
|
||||
set(SVE_FOUND 1)
|
||||
set(SVE2_BITPERM_FOUND 1)
|
||||
endif()
|
||||
|
||||
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
|
||||
|
||||
# test the parsed flag
|
||||
set (EXEC_ARGS ${CC_ARG1} -E - -${ARCH_FLAG}=${GNUCC_ARCH} -${TUNE_FLAG}=${GNUCC_TUNE})
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
|
||||
OUTPUT_QUIET ERROR_QUIET
|
||||
INPUT_FILE /dev/null
|
||||
RESULT_VARIABLE GNUCC_TUNE_TEST)
|
||||
if (NOT GNUCC_TUNE_TEST EQUAL 0)
|
||||
message(WARNING "Something went wrong determining gcc tune: -mtune=${GNUCC_TUNE} not valid, falling back to -mtune=native")
|
||||
set(GNUCC_TUNE native)
|
||||
else()
|
||||
set(GNUCC_TUNE ${GNUCC_TUNE})
|
||||
message(STATUS "gcc will tune for ${GNUCC_ARCH}, ${GNUCC_TUNE}")
|
||||
endif()
|
||||
elseif (CMAKE_COMPILER_IS_CLANG AND NOT CROSS_COMPILE)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_AARCH64)
|
||||
set(GNUCC_ARCH armv8)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_ARM32)
|
||||
set(GNUCC_ARCH armv7a)
|
||||
set(TUNE_FLAG generic)
|
||||
else()
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG generic)
|
||||
endif()
|
||||
message(STATUS "clang will tune for ${GNUCC_ARCH}, ${TUNE_FLAG}")
|
||||
elseif (CROSS_COMPILE)
|
||||
set(GNUCC_ARCH generic)
|
||||
set(TUNE_FLAG generic)
|
||||
endif()
|
||||
# Detect OS and if Fat Runtime is available
|
||||
include (${CMAKE_MODULE_PATH}/osdetection.cmake)
|
||||
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
if (NOT FAT_RUNTIME)
|
||||
if (BUILD_AVX512)
|
||||
set(ARCH_C_FLAGS "${SKYLAKE_FLAG}")
|
||||
set(ARCH_CXX_FLAGS "${SKYLAKE_FLAG}")
|
||||
elseif (BUILD_AVX2)
|
||||
set(ARCH_C_FLAGS "-mavx2")
|
||||
set(ARCH_CXX_FLAGS "-mavx2")
|
||||
else()
|
||||
set(ARCH_C_FLAGS "-msse4.2")
|
||||
set(ARCH_CXX_FLAGS "-msse4.2")
|
||||
endif()
|
||||
else()
|
||||
set(ARCH_C_FLAGS "-msse4.2")
|
||||
set(ARCH_CXX_FLAGS "-msse4.2")
|
||||
endif()
|
||||
endif()
|
||||
include (${CMAKE_MODULE_PATH}/cflags-x86.cmake)
|
||||
set(ARCH_FLAG march)
|
||||
elseif (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
include (${CMAKE_MODULE_PATH}/cflags-arm.cmake)
|
||||
set(ARCH_FLAG march)
|
||||
elseif (ARCH_PPC64EL)
|
||||
include (${CMAKE_MODULE_PATH}/cflags-ppc64le.cmake)
|
||||
set(ARCH_FLAG mcpu)
|
||||
endif ()
|
||||
|
||||
if (ARCH_AARCH64)
|
||||
if (NOT FAT_RUNTIME)
|
||||
if (BUILD_SVE2_BITPERM AND NOT SVE2_BITPERM_FOUND)
|
||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2-bitperm")
|
||||
elseif (BUILD_SVE2 AND NOT SVE2_FOUND)
|
||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2")
|
||||
elseif (BUILD_SVE AND NOT SVE_FOUND)
|
||||
set(GNUCC_ARCH "${GNUCC_ARCH}+sve")
|
||||
endif ()
|
||||
else()
|
||||
set(ARCH_C_FLAGS "")
|
||||
set(ARCH_CXX_FLAGS "")
|
||||
endif()
|
||||
endif(ARCH_AARCH64)
|
||||
# Detect Native arch flags if requested
|
||||
include (${CMAKE_MODULE_PATH}/archdetect.cmake)
|
||||
|
||||
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
|
||||
message(STATUS "ARCH_CXX_FLAGS : ${ARCH_CXX_FLAGS}")
|
||||
# Configure Compiler flags (Generic)
|
||||
|
||||
include (${CMAKE_MODULE_PATH}/sanitize.cmake)
|
||||
|
||||
if (NOT FAT_RUNTIME)
|
||||
if (GNUCC_TUNE)
|
||||
@ -280,14 +146,14 @@ if (NOT FAT_RUNTIME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# compiler version checks TODO: test more compilers
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(GNUCXX_MINVER "9")
|
||||
message(STATUS "g++ version ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNUCXX_MINVER)
|
||||
message(FATAL_ERROR "A minimum of g++ ${GNUCXX_MINVER} is required for C++17 support")
|
||||
endif()
|
||||
endif()
|
||||
# remove CMake's idea of optimisation
|
||||
foreach (CONFIG ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(REGEX REPLACE "-O[^ ]*" "" CMAKE_C_FLAGS_${CONFIG} "${CMAKE_C_FLAGS_${CONFIG}}")
|
||||
string(REGEX REPLACE "-O[^ ]*" "" CMAKE_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
|
||||
endforeach ()
|
||||
|
||||
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
|
||||
message(STATUS "ARCH_CXX_FLAGS : ${ARCH_CXX_FLAGS}")
|
||||
|
||||
if(RELEASE_BUILD)
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES MINSIZEREL)
|
||||
@ -302,256 +168,13 @@ else()
|
||||
set(OPT_CXX_FLAG "-O0")
|
||||
endif(RELEASE_BUILD)
|
||||
|
||||
# set compiler flags - more are tested and added later
|
||||
set(EXTRA_C_FLAGS "${OPT_C_FLAG} -std=c17 -Wall -Wextra -Wshadow -Wcast-qual -fno-strict-aliasing")
|
||||
set(EXTRA_CXX_FLAGS "${OPT_CXX_FLAG} -std=c++17 -Wall -Wextra -Wshadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing")
|
||||
if (NOT CMAKE_COMPILER_IS_CLANG)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-new-ttp-matching")
|
||||
endif()
|
||||
|
||||
if (NOT RELEASE_BUILD)
|
||||
# -Werror is most useful during development, don't potentially break
|
||||
# release builds
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror")
|
||||
if (CMAKE_COMPILER_IS_CLANG)
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER "13.0")
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-unused-but-set-variable")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (DISABLE_ASSERTS)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -DNDEBUG")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -DNDEBUG")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# spurious warnings?
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-array-bounds -Wno-maybe-uninitialized")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-maybe-uninitialized")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fabi-version=0")
|
||||
endif ()
|
||||
# don't complain about abi
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-abi")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-abi")
|
||||
endif()
|
||||
|
||||
if (NOT(ARCH_IA32 AND RELEASE_BUILD))
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fno-omit-frame-pointer")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-omit-frame-pointer")
|
||||
endif()
|
||||
|
||||
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
CHECK_INCLUDE_FILES(intrin.h HAVE_C_INTRIN_H)
|
||||
CHECK_INCLUDE_FILE_CXX(intrin.h HAVE_CXX_INTRIN_H)
|
||||
CHECK_INCLUDE_FILES(x86intrin.h HAVE_C_X86INTRIN_H)
|
||||
CHECK_INCLUDE_FILE_CXX(x86intrin.h HAVE_CXX_X86INTRIN_H)
|
||||
elseif (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_C_ARM_NEON_H)
|
||||
if (BUILD_SVE OR BUILD_SVE2 OR BUILD_SVE2_BITPERM)
|
||||
set(CMAKE_REQUIRED_FLAGS ${ARCH_CXX_FLAGS})
|
||||
CHECK_INCLUDE_FILE_CXX(arm_sve.h HAVE_C_ARM_SVE_H)
|
||||
if (NOT HAVE_C_ARM_SVE_H)
|
||||
message(FATAL_ERROR "arm_sve.h is required to build for SVE.")
|
||||
endif()
|
||||
endif()
|
||||
elseif (ARCH_PPC64EL)
|
||||
CHECK_INCLUDE_FILE_CXX(altivec.h HAVE_C_PPC64EL_ALTIVEC_H)
|
||||
endif()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
|
||||
CHECK_FUNCTION_EXISTS(_aligned_malloc HAVE__ALIGNED_MALLOC)
|
||||
|
||||
# these end up in the config file
|
||||
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
|
||||
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
|
||||
|
||||
# are we using libc++
|
||||
CHECK_CXX_SYMBOL_EXISTS(_LIBCPP_VERSION ciso646 HAVE_LIBCPP)
|
||||
|
||||
if (RELEASE_BUILD)
|
||||
if (HAS_C_HIDDEN)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fvisibility=hidden")
|
||||
endif()
|
||||
if (HAS_CXX_HIDDEN)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fvisibility=hidden")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND FAT_RUNTIME MATCHES "ON")
|
||||
message("Fat Runtime for ${GNUCC_ARCH}")
|
||||
# This is a Linux-only feature for now - requires platform support
|
||||
# elsewhere
|
||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||
if (CMAKE_C_COMPILER_IS_CLANG AND CMAKE_C_COMPILER_VERSION VERSION_LESS "3.9")
|
||||
message (STATUS "Clang v3.9 or higher required for fat runtime, cannot build fat runtime")
|
||||
set (FAT_RUNTIME_REQUISITES FALSE)
|
||||
elseif (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
|
||||
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
|
||||
message (STATUS "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
|
||||
set (FAT_RUNTIME_REQUISITES FALSE)
|
||||
else()
|
||||
include (${CMAKE_MODULE_PATH}/attrib.cmake)
|
||||
if (NOT HAS_C_ATTR_IFUNC)
|
||||
message(STATUS "Compiler does not support ifunc attribute, cannot build fat runtime")
|
||||
set (FAT_RUNTIME_REQUISITES FALSE)
|
||||
else ()
|
||||
set (FAT_RUNTIME_REQUISITES TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT FAT_RUNTIME_REQUISITES OR NOT RELEASE_BUILD)
|
||||
set (FAT_RUNTIME OFF)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
include (${CMAKE_MODULE_PATH}/arch.cmake)
|
||||
|
||||
# testing a builtin takes a little more work
|
||||
CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED)
|
||||
CHECK_CXX_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CXX_BUILTIN_ASSUME_ALIGNED)
|
||||
# Clang does not use __builtin_constant_p() the same way as gcc
|
||||
if (NOT CMAKE_COMPILER_IS_CLANG)
|
||||
CHECK_C_SOURCE_COMPILES("int main(void) { __builtin_constant_p(0); }" HAVE__BUILTIN_CONSTANT_P)
|
||||
endif()
|
||||
|
||||
set(C_FLAGS_TO_CHECK
|
||||
# Variable length arrays are way bad, most especially at run time
|
||||
"-Wvla"
|
||||
# Pointer arith on void pointers is doing it wrong.
|
||||
"-Wpointer-arith"
|
||||
# Build our C code with -Wstrict-prototypes -Wmissing-prototypes
|
||||
"-Wstrict-prototypes"
|
||||
"-Wmissing-prototypes"
|
||||
)
|
||||
foreach (FLAG ${C_FLAGS_TO_CHECK})
|
||||
# munge the name so it doesn't break things
|
||||
string(REPLACE "-" "_" FNAME C_FLAG${FLAG})
|
||||
CHECK_C_COMPILER_FLAG("${FLAG}" ${FNAME})
|
||||
if (${FNAME})
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} ${FLAG}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CXX_FLAGS_TO_CHECK
|
||||
"-Wvla"
|
||||
"-Wpointer-arith"
|
||||
)
|
||||
foreach (FLAG ${CXX_FLAGS_TO_CHECK})
|
||||
string(REPLACE "-" "_" FNAME CXX_FLAG${FLAG})
|
||||
CHECK_CXX_COMPILER_FLAG("${FLAG}" ${FNAME})
|
||||
if (${FNAME})
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} ${FLAG}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# self-assign should be thrown away, but clang whinges
|
||||
CHECK_C_COMPILER_FLAG("-Wself-assign" CC_SELF_ASSIGN)
|
||||
if (CC_SELF_ASSIGN)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-self-assign")
|
||||
endif()
|
||||
CHECK_CXX_COMPILER_FLAG("-Wself-assign" CXX_SELF_ASSIGN)
|
||||
if (CXX_SELF_ASSIGN)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-self-assign")
|
||||
endif()
|
||||
|
||||
# clang gets up in our face for going paren crazy with macros
|
||||
CHECK_C_COMPILER_FLAG("-Wparentheses-equality" CC_PAREN_EQUALITY)
|
||||
if (CC_PAREN_EQUALITY)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-parentheses-equality")
|
||||
endif()
|
||||
|
||||
# clang complains about unused const vars in our Ragel-generated code.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-const-variable" CXX_UNUSED_CONST_VAR)
|
||||
if (CXX_UNUSED_CONST_VAR)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-const-variable")
|
||||
endif()
|
||||
|
||||
# clang-14 complains about unused-but-set variable.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-but-set-variable" CXX_UNUSED_BUT_SET_VAR)
|
||||
if (CXX_UNUSED_BUT_SET_VAR)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif()
|
||||
|
||||
# clang-14 complains about using bitwise operator instead of logical ones.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
|
||||
endif()
|
||||
|
||||
# gcc 6 complains about type attributes that get ignored, like alignment
|
||||
CHECK_CXX_COMPILER_FLAG("-Wignored-attributes" CXX_IGNORED_ATTR)
|
||||
if (CXX_IGNORED_ATTR)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-ignored-attributes")
|
||||
endif()
|
||||
|
||||
# gcc 9 complains about redundant move for returned variable
|
||||
CHECK_CXX_COMPILER_FLAG("-Wredundant-move" CXX_REDUNDANT_MOVE)
|
||||
if (CXX_REDUNDANT_MOVE)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-redundant-move")
|
||||
endif()
|
||||
|
||||
# note this for later
|
||||
# g++ doesn't have this flag but clang does
|
||||
CHECK_CXX_COMPILER_FLAG("-Wweak-vtables" CXX_WEAK_VTABLES)
|
||||
if (CXX_WEAK_VTABLES)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wweak-vtables")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wmissing-declarations" CXX_MISSING_DECLARATIONS)
|
||||
if (CXX_MISSING_DECLARATIONS)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wmissing-declarations")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-local-typedefs" CXX_UNUSED_LOCAL_TYPEDEFS)
|
||||
|
||||
# gcc5 complains about this
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-variable" CXX_WUNUSED_VARIABLE)
|
||||
|
||||
# gcc 10 complains about this
|
||||
CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW)
|
||||
CHECK_CXX_COMPILER_FLAG("-Wstringop-overflow" CXX_STRINGOP_OVERFLOW)
|
||||
if(CC_STRINGOP_OVERFLOW OR CXX_STRINGOP_OVERFLOW)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-stringop-overflow")
|
||||
endif()
|
||||
include (${CMAKE_MODULE_PATH}/cflags-generic.cmake)
|
||||
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
set(LINUX TRUE)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(FREEBSD true)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
|
||||
|
||||
if (FAT_RUNTIME)
|
||||
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||
else()
|
||||
message(STATUS "Building runtime for multiple microarchitectures")
|
||||
endif()
|
||||
else()
|
||||
if (CROSS_COMPILE)
|
||||
message(STATUS "Building for target CPU: ${ARCH_C_FLAGS}")
|
||||
else()
|
||||
message(STATUS "Building for current host CPU: ${ARCH_C_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_CXX_FLAGS}")
|
||||
|
||||
add_subdirectory(doc/dev-reference)
|
||||
|
||||
# PCRE check, we have a fixed requirement for PCRE to use Chimera
|
||||
# and hscollider
|
||||
set(PCRE_REQUIRED_MAJOR_VERSION 8)
|
||||
@ -567,32 +190,6 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS)
|
||||
set(BUILD_CHIMERA TRUE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(unit)
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt)
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA)
|
||||
add_subdirectory(chimera)
|
||||
endif()
|
||||
|
||||
# do substitutions
|
||||
configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
||||
configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h)
|
||||
|
||||
|
||||
configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars
|
||||
install(FILES ${CMAKE_BINARY_DIR}/libhs.pc
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
# only set these after all tests are done
|
||||
if (NOT FAT_RUNTIME)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${HS_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS} ${HS_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(RAGEL_C_FLAGS "-Wno-unused -funsigned-char")
|
||||
|
||||
set_source_files_properties(
|
||||
@ -609,7 +206,22 @@ set_source_files_properties(
|
||||
|
||||
ragelmaker(src/parser/control_verbs.rl)
|
||||
|
||||
add_subdirectory(util)
|
||||
# do substitutions
|
||||
configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
||||
configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h)
|
||||
|
||||
configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars
|
||||
install(FILES ${CMAKE_BINARY_DIR}/libhs.pc
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
# only set these after all tests are done
|
||||
if (NOT FAT_RUNTIME)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${HS_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS} ${HS_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
SET(hs_HEADERS
|
||||
src/hs.h
|
||||
@ -631,11 +243,15 @@ set (hs_exec_common_SRCS
|
||||
${hs_exec_common_SRCS}
|
||||
src/util/arch/x86/cpuid_flags.c
|
||||
)
|
||||
elseif (ARCH_ARM32 OR ARCH_AARCH64 OR ARCH_PPC64EL)
|
||||
elseif (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
set (hs_exec_common_SRCS
|
||||
${hs_exec_common_SRCS}
|
||||
src/util/arch/arm/cpuid_flags.c
|
||||
)
|
||||
elseif (ARCH_PPC64EL)
|
||||
set (hs_exec_common_SRCS
|
||||
${hs_exec_common_SRCS}
|
||||
src/util/arch/ppc64el/cpuid_flags.c)
|
||||
endif ()
|
||||
|
||||
set (hs_exec_SRCS
|
||||
@ -780,10 +396,10 @@ set (hs_exec_SRCS
|
||||
src/database.h
|
||||
)
|
||||
|
||||
if (NOT RELEASE_BUILD OR FAT_RUNTIME)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set (hs_exec_SRCS
|
||||
${hs_exec_SRCS}
|
||||
src/nfa/vermicelli_simd.cpp
|
||||
src/util/supervector/arch/x86/impl.cpp)
|
||||
elseif (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
set (hs_exec_SRCS
|
||||
@ -792,21 +408,24 @@ set (hs_exec_SRCS
|
||||
elseif (ARCH_PPC64EL)
|
||||
set (hs_exec_SRCS
|
||||
${hs_exec_SRCS}
|
||||
src/nfa/vermicelli_simd.cpp
|
||||
src/util/supervector/arch/ppc64el/impl.cpp)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (FAT_RUNTIME OR (NOT FAT_RUNTIME AND NOT BUILD_SVE2))
|
||||
set (hs_exec_SRCS
|
||||
${hs_exec_SRCS}
|
||||
src/nfa/vermicelli_simd.cpp)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set (hs_exec_avx2_SRCS
|
||||
src/fdr/teddy_avx2.c
|
||||
src/util/arch/x86/masked_move.c
|
||||
src/util/arch/x86/masked_move.h
|
||||
)
|
||||
endif()
|
||||
|
||||
set (hs_exec_avx2_SRCS
|
||||
src/fdr/teddy_avx2.c
|
||||
src/util/arch/x86/masked_move.c
|
||||
src/util/arch/x86/masked_move.h
|
||||
)
|
||||
if (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
set (hs_exec_neon_SRCS
|
||||
src/nfa/vermicelli_simd.cpp)
|
||||
set (hs_exec_sve_SRCS
|
||||
src/nfa/vermicelli_simd.cpp)
|
||||
endif()
|
||||
|
||||
SET (hs_compile_SRCS
|
||||
${hs_HEADERS}
|
||||
@ -1252,11 +871,20 @@ set (LIB_VERSION ${HS_VERSION})
|
||||
set (LIB_SOVERSION ${HS_MAJOR_VERSION})
|
||||
|
||||
if (NOT FAT_RUNTIME)
|
||||
|
||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_common_SRCS})
|
||||
|
||||
if (BUILD_AVX2)
|
||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
if (BUILD_AVX2)
|
||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
|
||||
endif()
|
||||
elseif (ARCH_AARCH64)
|
||||
if (BUILD_SVE2)
|
||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||
elseif (BUILD_SVE)
|
||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||
else()
|
||||
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_neon_SRCS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_STATIC_LIBS)
|
||||
@ -1273,7 +901,7 @@ if (NOT FAT_RUNTIME)
|
||||
$<TARGET_OBJECTS:hs_compile>)
|
||||
endif (BUILD_STATIC_LIBS)
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_library(hs_exec_shared OBJECT ${hs_exec_SRCS})
|
||||
set_target_properties(hs_exec_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||
@ -1352,7 +980,7 @@ else ()
|
||||
${RUNTIME_LIBS})
|
||||
endif (BUILD_STATIC_LIBS)
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# build shared libs
|
||||
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||
@ -1411,29 +1039,25 @@ else ()
|
||||
if (ARCH_AARCH64)
|
||||
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
|
||||
if (BUILD_STATIC_LIBS)
|
||||
add_library(hs_exec_neon OBJECT ${hs_exec_SRCS})
|
||||
add_library(hs_exec_neon OBJECT ${hs_exec_SRCS} ${hs_exec_neon_SRCS})
|
||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_neon>)
|
||||
set_target_properties(hs_exec_neon PROPERTIES
|
||||
COMPILE_FLAGS "-march=armv8-a"
|
||||
COMPILE_FLAGS "-march=${ARMV8_ARCH}"
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
|
||||
if (BUILD_SVE)
|
||||
add_library(hs_exec_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve>)
|
||||
set_target_properties(hs_exec_sve PROPERTIES
|
||||
COMPILE_FLAGS "-march=armv8-a+sve"
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
endif (BUILD_SVE)
|
||||
if (BUILD_SVE2)
|
||||
add_library(hs_exec_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve2>)
|
||||
set_target_properties(hs_exec_sve2 PROPERTIES
|
||||
COMPILE_FLAGS "-march=armv8-a+sve2"
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
endif (BUILD_SVE2)
|
||||
add_library(hs_exec_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve>)
|
||||
set_target_properties(hs_exec_sve PROPERTIES
|
||||
COMPILE_FLAGS "-march=${SVE_ARCH}"
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
add_library(hs_exec_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve2>)
|
||||
set_target_properties(hs_exec_sve2 PROPERTIES
|
||||
COMPILE_FLAGS "-march=${SVE2_BITPERM_ARCH}"
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
|
||||
add_library(hs_exec_common OBJECT
|
||||
${hs_exec_common_SRCS}
|
||||
@ -1456,36 +1080,32 @@ else ()
|
||||
${RUNTIME_LIBS})
|
||||
endif (BUILD_STATIC_LIBS)
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# build shared libs
|
||||
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
|
||||
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
||||
add_library(hs_exec_shared_neon OBJECT ${hs_exec_SRCS})
|
||||
add_library(hs_exec_shared_neon OBJECT ${hs_exec_SRCS} ${hs_exec_neon_SRCS})
|
||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_neon>)
|
||||
set_target_properties(hs_exec_shared_neon PROPERTIES
|
||||
COMPILE_FLAGS "-march=armv8-a"
|
||||
COMPILE_FLAGS "-march=${ARMV8_ARCH}"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
|
||||
if (BUILD_SVE)
|
||||
add_library(hs_exec_shared_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve>)
|
||||
set_target_properties(hs_exec_shared_sve PROPERTIES
|
||||
COMPILE_FLAGS "-march=armv8-a+sve"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
endif (BUILD_SVE)
|
||||
if (BUILD_SVE2)
|
||||
add_library(hs_exec_shared_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve2>)
|
||||
set_target_properties(hs_exec_shared_sve2 PROPERTIES
|
||||
COMPILE_FLAGS "-march=armv8-a+sve2"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
endif (BUILD_SVE2)
|
||||
add_library(hs_exec_shared_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
|
||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve>)
|
||||
set_target_properties(hs_exec_shared_sve PROPERTIES
|
||||
COMPILE_FLAGS "-march=${SVE_ARCH}"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
add_library(hs_exec_shared_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
|
||||
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve2>)
|
||||
set_target_properties(hs_exec_shared_sve2 PROPERTIES
|
||||
COMPILE_FLAGS "-march=${SVE2_BITPERM_ARCH}"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
|
||||
)
|
||||
add_library(hs_exec_common_shared OBJECT
|
||||
${hs_exec_common_SRCS}
|
||||
src/dispatcher.c
|
||||
@ -1501,7 +1121,7 @@ if (NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS hs_runtime DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT FAT_RUNTIME)
|
||||
add_library(hs_runtime_shared SHARED src/hs_version.c
|
||||
src/hs_valid_platform.c $<TARGET_OBJECTS:hs_exec_shared>
|
||||
@ -1533,19 +1153,12 @@ if (NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS hs DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(hs_shared_SRCS
|
||||
src/hs_version.c
|
||||
src/hs_valid_platform.c
|
||||
$<TARGET_OBJECTS:hs_compile_shared>)
|
||||
|
||||
if (XCODE)
|
||||
# force this lib to use C++ linkage
|
||||
add_custom_command(OUTPUT empty.cxx
|
||||
COMMAND ${CMAKE_COMMAND} -E touch empty.cxx)
|
||||
set (hs_shared_SRCS ${hs_shared_SRCS} empty.cxx)
|
||||
endif (XCODE)
|
||||
|
||||
if (NOT FAT_RUNTIME)
|
||||
set(hs_shared_SRCS
|
||||
${hs_shared_SRCS}
|
||||
@ -1578,6 +1191,16 @@ if (NOT BUILD_STATIC_LIBS)
|
||||
add_library(hs ALIAS hs_shared)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(util)
|
||||
add_subdirectory(unit)
|
||||
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt)
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA)
|
||||
add_subdirectory(chimera)
|
||||
endif()
|
||||
|
||||
option(BUILD_EXAMPLES "Build Hyperscan example code (default TRUE)" TRUE)
|
||||
if(BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
@ -1587,3 +1210,5 @@ option(BUILD_BENCHMARKS "Build benchmarks (default TRUE)" TRUE)
|
||||
if(BUILD_BENCHMARKS)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
|
||||
add_subdirectory(doc/dev-reference)
|
||||
|
16
README.md
16
README.md
@ -29,22 +29,6 @@ matching of regular expressions across streams of data.
|
||||
|
||||
Vectorscan is typically used in a DPI library stack, just like Hyperscan.
|
||||
|
||||
# Cross Compiling for AArch64
|
||||
|
||||
- To cross compile for AArch64, first adjust the variables set in cmake/setenv-arm64-cross.sh.
|
||||
- `export CROSS=<arm-cross-compiler-dir>/bin/aarch64-linux-gnu-`
|
||||
- `export CROSS_SYS=<arm-cross-compiler-system-dir>`
|
||||
- `export BOOST_PATH=<boost-source-dir>`
|
||||
- Set the environment variables:
|
||||
- `source cmake/setenv-arm64-cross.sh`
|
||||
- Configure Vectorscan:
|
||||
- `mkdir <build-dir-name>`
|
||||
- `cd <build-dir>`
|
||||
- `cmake -DCROSS_COMPILE_AARCH64=1 <hyperscan-source-dir> -DCMAKE_TOOLCHAIN_FILE=<hyperscan-source-dir>/cmake/arm64-cross.cmake`
|
||||
- Build Vectorscan:
|
||||
- `make -jT` where T is the number of threads used to compile.
|
||||
- `cmake --build . -- -j T` can also be used instead of make.
|
||||
|
||||
# Compiling for SVE
|
||||
|
||||
The following cmake variables can be set in order to target Arm's Scalable
|
||||
|
207
cmake/arch.cmake
207
cmake/arch.cmake
@ -1,207 +0,0 @@
|
||||
# detect architecture features
|
||||
#
|
||||
# must be called after determining where compiler intrinsics are defined
|
||||
|
||||
if (HAVE_C_X86INTRIN_H)
|
||||
set (INTRIN_INC_H "x86intrin.h")
|
||||
elseif (HAVE_C_INTRIN_H)
|
||||
set (INTRIN_INC_H "intrin.h")
|
||||
elseif (HAVE_C_ARM_NEON_H)
|
||||
set (INTRIN_INC_H "arm_neon.h")
|
||||
elseif (HAVE_C_PPC64EL_ALTIVEC_H)
|
||||
set (INTRIN_INC_H "altivec.h")
|
||||
set (FAT_RUNTIME OFF)
|
||||
else()
|
||||
message (FATAL_ERROR "No intrinsics header found")
|
||||
endif ()
|
||||
|
||||
if (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
int32x4_t a = vdupq_n_s32(1);
|
||||
(void)a;
|
||||
}" HAVE_NEON)
|
||||
endif ()
|
||||
|
||||
if (ARCH_AARCH64)
|
||||
if (APPLE)
|
||||
set (FAT_RUNTIME OFF)
|
||||
endif()
|
||||
set(PREV_FLAGS "${CMAKE_C_FLAGS}")
|
||||
if (BUILD_SVE2_BITPERM)
|
||||
set(CMAKE_C_FLAGS "-march=${GNUCC_ARCH} ${CMAKE_C_FLAGS}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
|
||||
int main() {
|
||||
svuint8_t a = svbext(svdup_u8(1), svdup_u8(2));
|
||||
(void)a;
|
||||
}" HAVE_SVE2_BITPERM)
|
||||
if (HAVE_SVE2_BITPERM)
|
||||
add_definitions(-DHAVE_SVE2_BITPERM)
|
||||
endif ()
|
||||
endif()
|
||||
if (BUILD_SVE2)
|
||||
set(CMAKE_C_FLAGS "-march=${GNUCC_ARCH} ${CMAKE_C_FLAGS}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
|
||||
int main() {
|
||||
svuint8_t a = svbsl(svdup_u8(1), svdup_u8(2), svdup_u8(3));
|
||||
(void)a;
|
||||
}" HAVE_SVE2)
|
||||
endif()
|
||||
if (HAVE_SVE2 OR HAVE_SVE2_BITPERM)
|
||||
add_definitions(-DHAVE_SVE2)
|
||||
endif ()
|
||||
if (BUILD_SVE)
|
||||
set(CMAKE_C_FLAGS "-march=${GNUCC_ARCH} ${CMAKE_C_FLAGS}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
|
||||
int main() {
|
||||
svuint8_t a = svdup_u8(1);
|
||||
(void)a;
|
||||
}" HAVE_SVE)
|
||||
endif ()
|
||||
if (HAVE_SVE OR HAVE_SVE2 OR HAVE_SVE2_BITPERM)
|
||||
add_definitions(-DHAVE_SVE)
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${PREV_FLAGS}")
|
||||
endif()
|
||||
|
||||
if (BUILD_AVX512)
|
||||
CHECK_C_COMPILER_FLAG(${SKYLAKE_FLAG} HAS_ARCH_SKYLAKE)
|
||||
if (NOT HAS_ARCH_SKYLAKE)
|
||||
message (FATAL_ERROR "AVX512 not supported by compiler")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BUILD_AVX512VBMI)
|
||||
CHECK_C_COMPILER_FLAG(${ICELAKE_FLAG} HAS_ARCH_ICELAKE)
|
||||
if (NOT HAS_ARCH_ICELAKE)
|
||||
message (FATAL_ERROR "AVX512VBMI not supported by compiler")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (FAT_RUNTIME)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
if (NOT DEFINED(BUILD_AVX2))
|
||||
set(BUILD_AVX2 TRUE)
|
||||
endif ()
|
||||
# test the highest level microarch to make sure everything works
|
||||
if (BUILD_AVX512)
|
||||
if (BUILD_AVX512VBMI)
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ICELAKE_FLAG}")
|
||||
else ()
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
|
||||
endif (BUILD_AVX512VBMI)
|
||||
elseif (BUILD_AVX2)
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2 -mavx2")
|
||||
elseif ()
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7 -mssse3")
|
||||
endif ()
|
||||
elseif(ARCH_AARCH64)
|
||||
if (NOT DEFINED(BUILD_SVE))
|
||||
set(BUILD_SVE TRUE)
|
||||
endif ()
|
||||
if (NOT DEFINED(BUILD_SVE2))
|
||||
set(BUILD_SVE2 TRUE)
|
||||
endif ()
|
||||
endif()
|
||||
else (NOT FAT_RUNTIME)
|
||||
# if not fat runtime, then test given cflags
|
||||
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
|
||||
endif ()
|
||||
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
# ensure we have the minimum of SSE4.2 - call a SSE4.2 intrinsic
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
__m128i a = _mm_set1_epi8(1);
|
||||
(void)_mm_shuffle_epi8(a, a);
|
||||
}" HAVE_SSE42)
|
||||
|
||||
# now look for AVX2
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX2__)
|
||||
#error no avx2
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
__m256i z = _mm256_setzero_si256();
|
||||
(void)_mm256_xor_si256(z, z);
|
||||
}" HAVE_AVX2)
|
||||
|
||||
# and now for AVX512
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX512BW__)
|
||||
#error no avx512bw
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
__m512i z = _mm512_setzero_si512();
|
||||
(void)_mm512_abs_epi8(z);
|
||||
}" HAVE_AVX512)
|
||||
|
||||
# and now for AVX512VBMI
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX512VBMI__)
|
||||
#error no avx512vbmi
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
__m512i a = _mm512_set1_epi8(0xFF);
|
||||
__m512i idx = _mm512_set_epi64(3ULL, 2ULL, 1ULL, 0ULL, 7ULL, 6ULL, 5ULL, 4ULL);
|
||||
(void)_mm512_permutexvar_epi8(idx, a);
|
||||
}" HAVE_AVX512VBMI)
|
||||
|
||||
|
||||
elseif (ARCH_ARM32 OR ARCH_AARCH64)
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
int32x4_t a = vdupq_n_s32(1);
|
||||
(void)a;
|
||||
}" HAVE_NEON)
|
||||
elseif (ARCH_PPC64EL)
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
vector int a = vec_splat_s32(1);
|
||||
(void)a;
|
||||
}" HAVE_VSX)
|
||||
else ()
|
||||
message (FATAL_ERROR "Unsupported architecture")
|
||||
endif ()
|
||||
|
||||
if (FAT_RUNTIME)
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSE42)
|
||||
message(FATAL_ERROR "SSE4.2 support required to build fat runtime")
|
||||
endif ()
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX2 AND NOT HAVE_AVX2)
|
||||
message(FATAL_ERROR "AVX2 support required to build fat runtime")
|
||||
endif ()
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512 AND NOT HAVE_AVX512)
|
||||
message(FATAL_ERROR "AVX512 support requested but not supported")
|
||||
endif ()
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
|
||||
message(FATAL_ERROR "AVX512VBMI support requested but not supported")
|
||||
endif ()
|
||||
else (NOT FAT_RUNTIME)
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT BUILD_AVX2)
|
||||
message(STATUS "Building without AVX2 support")
|
||||
endif ()
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512)
|
||||
message(STATUS "Building without AVX512 support")
|
||||
endif ()
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512VBMI)
|
||||
message(STATUS "Building without AVX512VBMI support")
|
||||
endif ()
|
||||
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSE42)
|
||||
message(FATAL_ERROR "A minimum of SSE4.2 compiler support is required")
|
||||
endif ()
|
||||
if ((ARCH_ARM32 OR ARCH_AARCH64) AND NOT HAVE_NEON)
|
||||
message(FATAL_ERROR "NEON support required for ARM support")
|
||||
endif ()
|
||||
if (ARCH_PPPC64EL AND NOT HAVE_VSX)
|
||||
message(FATAL_ERROR "VSX support required for Power support")
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
unset (PREV_FLAGS)
|
||||
unset (CMAKE_REQUIRED_FLAGS)
|
||||
unset (INTRIN_INC_H)
|
91
cmake/archdetect.cmake
Normal file
91
cmake/archdetect.cmake
Normal file
@ -0,0 +1,91 @@
|
||||
if (USE_CPU_NATIVE)
|
||||
# Detect best GNUCC_ARCH to tune for
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
message(STATUS "gcc version ${CMAKE_C_COMPILER_VERSION}")
|
||||
|
||||
# If gcc doesn't recognise the host cpu, then mtune=native becomes
|
||||
# generic, which isn't very good in some cases. march=native looks at
|
||||
# cpuid info and then chooses the best microarch it can (and replaces
|
||||
# the flag), so use that for tune.
|
||||
|
||||
set(TUNE_FLAG "mtune")
|
||||
set(GNUCC_TUNE "")
|
||||
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
|
||||
|
||||
# arg1 might exist if using ccache
|
||||
string (STRIP "${CMAKE_C_COMPILER_ARG1}" CC_ARG1)
|
||||
set (EXEC_ARGS ${CC_ARG1} -c -Q --help=target -${ARCH_FLAG}=native -${TUNE_FLAG}=native)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
|
||||
OUTPUT_VARIABLE _GCC_OUTPUT)
|
||||
set(_GCC_OUTPUT_TUNE ${_GCC_OUTPUT})
|
||||
string(FIND "${_GCC_OUTPUT}" "${ARCH_FLAG}=" POS)
|
||||
string(SUBSTRING "${_GCC_OUTPUT}" ${POS} -1 _GCC_OUTPUT)
|
||||
string(REGEX REPLACE "${ARCH_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_ARCH "${_GCC_OUTPUT}")
|
||||
|
||||
string(FIND "${_GCC_OUTPUT_TUNE}" "${TUNE_FLAG}=" POS_TUNE)
|
||||
string(SUBSTRING "${_GCC_OUTPUT_TUNE}" ${POS_TUNE} -1 _GCC_OUTPUT_TUNE)
|
||||
string(REGEX REPLACE "${TUNE_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_TUNE "${_GCC_OUTPUT_TUNE}")
|
||||
|
||||
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
|
||||
|
||||
# test the parsed flag
|
||||
set (EXEC_ARGS ${CC_ARG1} -E - -${ARCH_FLAG}=${GNUCC_ARCH} -${TUNE_FLAG}=${GNUCC_TUNE})
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
|
||||
OUTPUT_QUIET ERROR_QUIET
|
||||
INPUT_FILE /dev/null
|
||||
RESULT_VARIABLE GNUCC_TUNE_TEST)
|
||||
|
||||
if (NOT GNUCC_TUNE_TEST EQUAL 0)
|
||||
message(WARNING "Something went wrong determining gcc tune: -mtune=${GNUCC_TUNE} not valid, falling back to -mtune=native")
|
||||
set(GNUCC_TUNE native)
|
||||
else()
|
||||
set(GNUCC_TUNE ${GNUCC_TUNE})
|
||||
message(STATUS "gcc will tune for ${GNUCC_ARCH}, ${GNUCC_TUNE}")
|
||||
endif()
|
||||
elseif (CMAKE_COMPILER_IS_CLANG)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set(GNUCC_ARCH x86_64_v2)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_AARCH64)
|
||||
if (BUILD_SVE2_BITPERM)
|
||||
set(GNUCC_ARCH ${SVE2_BITPERM_ARCH})
|
||||
elseif (BUILD_SVE2)
|
||||
set(GNUCC_ARCH ${SVE2_ARCH})
|
||||
elseif (BUILD_SVE)
|
||||
set(GNUCC_ARCH ${SVE_ARCH})
|
||||
else ()
|
||||
set(GNUCC_ARCH ${ARMV8_ARCH})
|
||||
endif()
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_ARM32)
|
||||
set(GNUCC_ARCH armv7a)
|
||||
set(TUNE_FLAG generic)
|
||||
else()
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG generic)
|
||||
endif()
|
||||
message(STATUS "clang will tune for ${GNUCC_ARCH}, ${TUNE_FLAG}")
|
||||
endif()
|
||||
else()
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_AARCH64)
|
||||
if (BUILD_SVE2_BITPERM)
|
||||
set(GNUCC_ARCH ${SVE2_BITPERM_ARCH})
|
||||
elseif (BUILD_SVE2)
|
||||
set(GNUCC_ARCH ${SVE2_ARCH})
|
||||
elseif (BUILD_SVE)
|
||||
set(GNUCC_ARCH ${SVE_ARCH})
|
||||
else ()
|
||||
set(GNUCC_ARCH ${ARMV8_ARCH})
|
||||
endif()
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_ARM32)
|
||||
set(GNUCC_ARCH armv7a)
|
||||
set(TUNE_FLAG generic)
|
||||
else()
|
||||
set(GNUCC_ARCH power9)
|
||||
set(TUNE_FLAG power9)
|
||||
endif()
|
||||
endif()
|
93
cmake/cflags-arm.cmake
Normal file
93
cmake/cflags-arm.cmake
Normal file
@ -0,0 +1,93 @@
|
||||
if (NOT FAT_RUNTIME)
|
||||
if (BUILD_SVE2_BITPERM)
|
||||
message (STATUS "SVE2_BITPERM implies SVE2, enabling BUILD_SVE2")
|
||||
set(BUILD_SVE2 ON)
|
||||
endif ()
|
||||
if (BUILD_SVE2)
|
||||
message (STATUS "SVE2 implies SVE, enabling BUILD_SVE")
|
||||
set(BUILD_SVE ON)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(ARMV9BASE_MINVER "12")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ARMV9BASE_MINVER)
|
||||
set(SVE2_ARCH "armv8-a+sve2")
|
||||
else()
|
||||
set(SVE2_ARCH "armv9-a")
|
||||
endif()
|
||||
else()
|
||||
set(SVE2_ARCH "armv9-a")
|
||||
endif()
|
||||
|
||||
set(ARMV8_ARCH "armv8-a")
|
||||
set(SVE_ARCH "${ARMV8_ARCH}+sve")
|
||||
set(SVE2_BITPERM_ARCH "${SVE2_ARCH}+sve2-bitperm")
|
||||
|
||||
CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_C_ARM_NEON_H)
|
||||
if (BUILD_SVE OR BUILD_SVE2 OR BUILD_SVE2_BITPERM OR FAT_RUNTIME)
|
||||
set(CMAKE_REQUIRED_FLAGS "-march=${SVE_ARCH}")
|
||||
CHECK_INCLUDE_FILE_CXX(arm_sve.h HAVE_C_ARM_SVE_H)
|
||||
if (NOT HAVE_C_ARM_SVE_H)
|
||||
message(FATAL_ERROR "arm_sve.h is required to build for SVE.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_neon.h>
|
||||
int main() {
|
||||
int32x4_t a = vdupq_n_s32(1);
|
||||
(void)a;
|
||||
}" HAVE_NEON)
|
||||
|
||||
if (BUILD_SVE2_BITPERM)
|
||||
set(CMAKE_REQUIRED_FLAGS "-march=${SVE2_BITPERM_ARCH}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
|
||||
int main() {
|
||||
svuint8_t a = svbext(svdup_u8(1), svdup_u8(2));
|
||||
(void)a;
|
||||
}" HAVE_SVE2_BITPERM)
|
||||
endif()
|
||||
if (BUILD_SVE2)
|
||||
set(CMAKE_REQUIRED_FLAGS "-march=${SVE2_ARCH}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
|
||||
int main() {
|
||||
svuint8_t a = svbsl(svdup_u8(1), svdup_u8(2), svdup_u8(3));
|
||||
(void)a;
|
||||
}" HAVE_SVE2)
|
||||
endif()
|
||||
if (BUILD_SVE)
|
||||
set(CMAKE_REQUIRED_FLAGS "-march=${SVE_ARCH}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
|
||||
int main() {
|
||||
svuint8_t a = svdup_u8(1);
|
||||
(void)a;
|
||||
}" HAVE_SVE)
|
||||
endif ()
|
||||
|
||||
if (FAT_RUNTIME)
|
||||
if (NOT HAVE_NEON)
|
||||
message(FATAL_ERROR "NEON support required to build fat runtime")
|
||||
endif ()
|
||||
if (BUILD_SVE AND NOT HAVE_SVE)
|
||||
message(FATAL_ERROR "SVE support required to build fat runtime")
|
||||
endif ()
|
||||
if (BUILD_SVE2 AND NOT HAVE_SVE2)
|
||||
message(FATAL_ERROR "SVE2 support required to build fat runtime")
|
||||
endif ()
|
||||
if (BUILD_SVE2_BITPERM AND NOT HAVE_SVE2_BITPERM)
|
||||
message(FATAL_ERROR "SVE2 support required to build fat runtime")
|
||||
endif ()
|
||||
else (NOT FAT_RUNTIME)
|
||||
if (NOT BUILD_SVE)
|
||||
message(STATUS "Building without SVE support")
|
||||
endif ()
|
||||
if (NOT BUILD_SVE2)
|
||||
message(STATUS "Building without SVE2 support")
|
||||
endif ()
|
||||
if (NOT HAVE_NEON)
|
||||
message(FATAL_ERROR "Neon/ASIMD support required for Arm support")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
164
cmake/cflags-generic.cmake
Normal file
164
cmake/cflags-generic.cmake
Normal file
@ -0,0 +1,164 @@
|
||||
# set compiler flags - more are tested and added later
|
||||
set(EXTRA_C_FLAGS "${OPT_C_FLAG} -std=c17 -Wall -Wextra -Wshadow -Wcast-qual -fno-strict-aliasing")
|
||||
set(EXTRA_CXX_FLAGS "${OPT_CXX_FLAG} -std=c++17 -Wall -Wextra -Wshadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing")
|
||||
if (NOT CMAKE_COMPILER_IS_CLANG)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-new-ttp-matching")
|
||||
endif()
|
||||
|
||||
if (NOT RELEASE_BUILD)
|
||||
# -Werror is most useful during development, don't potentially break
|
||||
# release builds
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror")
|
||||
if (CMAKE_COMPILER_IS_CLANG)
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER "13.0")
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-unused-but-set-variable")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (DISABLE_ASSERTS)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -DNDEBUG")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -DNDEBUG")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# spurious warnings?
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-array-bounds -Wno-maybe-uninitialized")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-maybe-uninitialized")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fabi-version=0")
|
||||
endif ()
|
||||
# don't complain about abi
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-abi")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-abi")
|
||||
endif()
|
||||
|
||||
if (NOT(ARCH_IA32 AND RELEASE_BUILD))
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fno-omit-frame-pointer")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-omit-frame-pointer")
|
||||
endif()
|
||||
|
||||
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
||||
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
|
||||
CHECK_FUNCTION_EXISTS(_aligned_malloc HAVE__ALIGNED_MALLOC)
|
||||
|
||||
# these end up in the config file
|
||||
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
|
||||
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
|
||||
|
||||
# are we using libc++
|
||||
CHECK_CXX_SYMBOL_EXISTS(_LIBCPP_VERSION ciso646 HAVE_LIBCPP)
|
||||
|
||||
if (RELEASE_BUILD)
|
||||
if (HAS_C_HIDDEN)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fvisibility=hidden")
|
||||
endif()
|
||||
if (HAS_CXX_HIDDEN)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fvisibility=hidden")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# testing a builtin takes a little more work
|
||||
CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED)
|
||||
CHECK_CXX_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CXX_BUILTIN_ASSUME_ALIGNED)
|
||||
# Clang does not use __builtin_constant_p() the same way as gcc
|
||||
if (NOT CMAKE_COMPILER_IS_CLANG)
|
||||
CHECK_C_SOURCE_COMPILES("int main(void) { __builtin_constant_p(0); }" HAVE__BUILTIN_CONSTANT_P)
|
||||
endif()
|
||||
|
||||
set(C_FLAGS_TO_CHECK
|
||||
# Variable length arrays are way bad, most especially at run time
|
||||
"-Wvla"
|
||||
# Pointer arith on void pointers is doing it wrong.
|
||||
"-Wpointer-arith"
|
||||
# Build our C code with -Wstrict-prototypes -Wmissing-prototypes
|
||||
"-Wstrict-prototypes"
|
||||
"-Wmissing-prototypes"
|
||||
)
|
||||
foreach (FLAG ${C_FLAGS_TO_CHECK})
|
||||
# munge the name so it doesn't break things
|
||||
string(REPLACE "-" "_" FNAME C_FLAG${FLAG})
|
||||
CHECK_C_COMPILER_FLAG("${FLAG}" ${FNAME})
|
||||
if (${FNAME})
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} ${FLAG}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# self-assign should be thrown away, but clang whinges
|
||||
CHECK_C_COMPILER_FLAG("-Wself-assign" CC_SELF_ASSIGN)
|
||||
if (CC_SELF_ASSIGN)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-self-assign")
|
||||
endif()
|
||||
CHECK_CXX_COMPILER_FLAG("-Wself-assign" CXX_SELF_ASSIGN)
|
||||
if (CXX_SELF_ASSIGN)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-self-assign")
|
||||
endif()
|
||||
|
||||
# clang gets up in our face for going paren crazy with macros
|
||||
CHECK_C_COMPILER_FLAG("-Wparentheses-equality" CC_PAREN_EQUALITY)
|
||||
if (CC_PAREN_EQUALITY)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-parentheses-equality")
|
||||
endif()
|
||||
|
||||
# clang complains about unused const vars in our Ragel-generated code.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-const-variable" CXX_UNUSED_CONST_VAR)
|
||||
if (CXX_UNUSED_CONST_VAR)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-const-variable")
|
||||
endif()
|
||||
|
||||
# clang-14 complains about unused-but-set variable.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-but-set-variable" CXX_UNUSED_BUT_SET_VAR)
|
||||
if (CXX_UNUSED_BUT_SET_VAR)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif()
|
||||
|
||||
# clang-14 complains about using bitwise operator instead of logical ones.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
|
||||
endif()
|
||||
|
||||
# clang-14 complains about using bitwise operator instead of logical ones.
|
||||
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wignored-attributes" CXX_IGNORED_ATTR)
|
||||
if (CXX_IGNORED_ATTR)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-ignored-attributes")
|
||||
endif()
|
||||
|
||||
# gcc 9 complains about redundant move for returned variable
|
||||
CHECK_CXX_COMPILER_FLAG("-Wredundant-move" CXX_REDUNDANT_MOVE)
|
||||
if (CXX_REDUNDANT_MOVE)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-redundant-move")
|
||||
endif()
|
||||
|
||||
# note this for later, g++ doesn't have this flag but clang does
|
||||
CHECK_CXX_COMPILER_FLAG("-Wweak-vtables" CXX_WEAK_VTABLES)
|
||||
if (CXX_WEAK_VTABLES)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wweak-vtables")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wmissing-declarations" CXX_MISSING_DECLARATIONS)
|
||||
if (CXX_MISSING_DECLARATIONS)
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wmissing-declarations")
|
||||
endif()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-local-typedefs" CXX_UNUSED_LOCAL_TYPEDEFS)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wunused-variable" CXX_WUNUSED_VARIABLE)
|
||||
|
||||
# gcc 10 complains about this
|
||||
CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW)
|
||||
CHECK_CXX_COMPILER_FLAG("-Wstringop-overflow" CXX_STRINGOP_OVERFLOW)
|
||||
if(CC_STRINGOP_OVERFLOW OR CXX_STRINGOP_OVERFLOW)
|
||||
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow")
|
||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-stringop-overflow")
|
||||
endif()
|
18
cmake/cflags-ppc64le.cmake
Normal file
18
cmake/cflags-ppc64le.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
CHECK_INCLUDE_FILE_CXX(altivec.h HAVE_C_PPC64EL_ALTIVEC_H)
|
||||
|
||||
if (HAVE_C_PPC64EL_ALTIVEC_H)
|
||||
set (INTRIN_INC_H "altivec.h")
|
||||
else()
|
||||
message (FATAL_ERROR "No intrinsics header found for VSX")
|
||||
endif ()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
vector int a = vec_splat_s32(1);
|
||||
(void)a;
|
||||
}" HAVE_VSX)
|
||||
|
||||
if (NOT HAVE_VSX)
|
||||
message(FATAL_ERROR "VSX support required for Power support")
|
||||
endif ()
|
133
cmake/cflags-x86.cmake
Normal file
133
cmake/cflags-x86.cmake
Normal file
@ -0,0 +1,133 @@
|
||||
option(BUILD_AVX512 "Enabling support for AVX512" OFF)
|
||||
option(BUILD_AVX512VBMI "Enabling support for AVX512VBMI" OFF)
|
||||
|
||||
set(SKYLAKE_FLAG "-march=skylake-avx512")
|
||||
set(ICELAKE_FLAG "-march=icelake-server")
|
||||
|
||||
if (NOT FAT_RUNTIME)
|
||||
if (BUILD_AVX512VBMI)
|
||||
message (STATUS "AVX512VBMI implies AVX512, enabling BUILD_AVX512")
|
||||
set(BUILD_AVX512 ON)
|
||||
set(ARCH_C_FLAGS "${ICELAKE_FLAG}")
|
||||
set(ARCH_CXX_FLAGS "${ICELAKE_FLAG}")
|
||||
endif ()
|
||||
if (BUILD_AVX512)
|
||||
message (STATUS "AVX512 implies AVX2, enabling BUILD_AVX2")
|
||||
set(BUILD_AVX2 ON)
|
||||
set(ARCH_C_FLAGS "${SKYLAKE_FLAG}")
|
||||
set(ARCH_CXX_FLAGS "${SKYLAKE_FLAG}")
|
||||
endif ()
|
||||
if (BUILD_AVX2)
|
||||
message (STATUS "Enabling BUILD_AVX2")
|
||||
set(ARCH_C_FLAGS "-mavx2")
|
||||
set(ARCH_CXX_FLAGS "-mavx2")
|
||||
else()
|
||||
set(ARCH_C_FLAGS "-msse4.2")
|
||||
set(ARCH_CXX_FLAGS "-msse4.2")
|
||||
endif()
|
||||
else()
|
||||
set(ARCH_C_FLAGS "-msse4.2")
|
||||
set(ARCH_CXX_FLAGS "-msse4.2")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${ARCH_C_FLAGS}")
|
||||
CHECK_INCLUDE_FILES(intrin.h HAVE_C_INTRIN_H)
|
||||
CHECK_INCLUDE_FILE_CXX(intrin.h HAVE_CXX_INTRIN_H)
|
||||
CHECK_INCLUDE_FILES(x86intrin.h HAVE_C_X86INTRIN_H)
|
||||
CHECK_INCLUDE_FILE_CXX(x86intrin.h HAVE_CXX_X86INTRIN_H)
|
||||
|
||||
if (HAVE_C_X86INTRIN_H)
|
||||
set (INTRIN_INC_H "x86intrin.h")
|
||||
elseif (HAVE_C_INTRIN_H)
|
||||
set (INTRIN_INC_H "intrin.h")
|
||||
else()
|
||||
message (FATAL_ERROR "No intrinsics header found for SSE/AVX2/AVX512")
|
||||
endif ()
|
||||
|
||||
if (BUILD_AVX512)
|
||||
CHECK_C_COMPILER_FLAG(${SKYLAKE_FLAG} HAS_ARCH_SKYLAKE)
|
||||
if (NOT HAS_ARCH_SKYLAKE)
|
||||
message (FATAL_ERROR "AVX512 not supported by compiler")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BUILD_AVX512VBMI)
|
||||
CHECK_C_COMPILER_FLAG(${ICELAKE_FLAG} HAS_ARCH_ICELAKE)
|
||||
if (NOT HAS_ARCH_ICELAKE)
|
||||
message (FATAL_ERROR "AVX512VBMI not supported by compiler")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# ensure we have the minimum of SSE4.2 - call a SSE4.2 intrinsic
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
int main() {
|
||||
__m128i a = _mm_set1_epi8(1);
|
||||
(void)_mm_shuffle_epi8(a, a);
|
||||
}" HAVE_SSE42)
|
||||
|
||||
# now look for AVX2
|
||||
set(CMAKE_REQUIRED_FLAGS "-mavx2")
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX2__)
|
||||
#error no avx2
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
__m256i z = _mm256_setzero_si256();
|
||||
(void)_mm256_xor_si256(z, z);
|
||||
}" HAVE_AVX2)
|
||||
|
||||
# and now for AVX512
|
||||
set(CMAKE_REQUIRED_FLAGS "${SKYLAKE_FLAG}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX512BW__)
|
||||
#error no avx512bw
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
__m512i z = _mm512_setzero_si512();
|
||||
(void)_mm512_abs_epi8(z);
|
||||
}" HAVE_AVX512)
|
||||
|
||||
# and now for AVX512VBMI
|
||||
set(CMAKE_REQUIRED_FLAGS "${ICELAKE_FLAG}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
|
||||
#if !defined(__AVX512VBMI__)
|
||||
#error no avx512vbmi
|
||||
#endif
|
||||
|
||||
int main(){
|
||||
__m512i a = _mm512_set1_epi8(0xFF);
|
||||
__m512i idx = _mm512_set_epi64(3ULL, 2ULL, 1ULL, 0ULL, 7ULL, 6ULL, 5ULL, 4ULL);
|
||||
(void)_mm512_permutexvar_epi8(idx, a);
|
||||
}" HAVE_AVX512VBMI)
|
||||
|
||||
if (FAT_RUNTIME)
|
||||
if (NOT HAVE_SSE42)
|
||||
message(FATAL_ERROR "SSE4.2 support required to build fat runtime")
|
||||
endif ()
|
||||
if (BUILD_AVX2 AND NOT HAVE_AVX2)
|
||||
message(FATAL_ERROR "AVX2 support required to build fat runtime")
|
||||
endif ()
|
||||
if (BUILD_AVX512 AND NOT HAVE_AVX512)
|
||||
message(FATAL_ERROR "AVX512 support requested but not supported")
|
||||
endif ()
|
||||
if (BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
|
||||
message(FATAL_ERROR "AVX512VBMI support requested but not supported")
|
||||
endif ()
|
||||
else (NOT FAT_RUNTIME)
|
||||
if (NOT BUILD_AVX2)
|
||||
message(STATUS "Building without AVX2 support")
|
||||
endif ()
|
||||
if (NOT HAVE_AVX512)
|
||||
message(STATUS "Building without AVX512 support")
|
||||
endif ()
|
||||
if (NOT HAVE_AVX512VBMI)
|
||||
message(STATUS "Building without AVX512VBMI support")
|
||||
endif ()
|
||||
if (NOT HAVE_SSE42)
|
||||
message(FATAL_ERROR "A minimum of SSE4.2 compiler support is required")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
19
cmake/compiler.cmake
Normal file
19
cmake/compiler.cmake
Normal file
@ -0,0 +1,19 @@
|
||||
# determine compiler
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANG TRUE)
|
||||
set(CLANGCXX_MINVER "5")
|
||||
message(STATUS "clang++ version ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANGCXX_MINVER)
|
||||
message(FATAL_ERROR "A minimum of clang++ ${CLANGCXX_MINVER} is required for C++17 support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# compiler version checks TODO: test more compilers
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(GNUCXX_MINVER "9")
|
||||
message(STATUS "g++ version ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNUCXX_MINVER)
|
||||
message(FATAL_ERROR "A minimum of g++ ${GNUCXX_MINVER} is required for C++17 support")
|
||||
endif()
|
||||
endif()
|
||||
|
36
cmake/osdetection.cmake
Normal file
36
cmake/osdetection.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
set(LINUX TRUE)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(FREEBSD true)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
|
||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF)
|
||||
message("Checking Fat Runtime Requirements...")
|
||||
if (FAT_RUNTIME AND NOT LINUX)
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
|
||||
endif()
|
||||
|
||||
if (FAT_RUNTIME AND LINUX)
|
||||
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||
else()
|
||||
message(STATUS "Building Fat runtime for multiple microarchitectures")
|
||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||
if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
|
||||
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
|
||||
message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
|
||||
else()
|
||||
include (${CMAKE_MODULE_PATH}/attrib.cmake)
|
||||
if (NOT HAS_C_ATTR_IFUNC)
|
||||
message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if (NOT RELEASE_BUILD)
|
||||
message(FATAL_ERROR "Fat runtime is only built on Release builds")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
|
@ -1,24 +1,12 @@
|
||||
# determine compiler
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANG TRUE)
|
||||
endif()
|
||||
|
||||
# determine the target arch
|
||||
|
||||
if (CROSS_COMPILE_AARCH64)
|
||||
set(ARCH_AARCH64 TRUE)
|
||||
# really only interested in the preprocessor here
|
||||
CHECK_C_SOURCE_COMPILES("#if !(defined(__x86_64__) || defined(_M_X64))\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_X86_64)
|
||||
CHECK_C_SOURCE_COMPILES("#if !(defined(__i386__) || defined(_M_IX86))\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_IA32)
|
||||
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_A64)\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_AARCH64)
|
||||
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_ARM)\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_ARM32)
|
||||
CHECK_C_SOURCE_COMPILES("#if !defined(__PPC64__) && !(defined(__LITTLE_ENDIAN__) && defined(__VSX__))\n#error not ppc64el\n#endif\nint main(void) { return 0; }" ARCH_PPC64EL)
|
||||
if (ARCH_X86_64 OR ARCH_AARCH64 OR ARCH_PPC64EL)
|
||||
set(ARCH_64_BIT TRUE)
|
||||
message(STATUS "Cross compiling for aarch64")
|
||||
else()
|
||||
# really only interested in the preprocessor here
|
||||
CHECK_C_SOURCE_COMPILES("#if !(defined(__x86_64__) || defined(_M_X64))\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_X86_64)
|
||||
CHECK_C_SOURCE_COMPILES("#if !(defined(__i386__) || defined(_M_IX86))\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_IA32)
|
||||
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_A64)\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_AARCH64)
|
||||
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_ARM)\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_ARM32)
|
||||
CHECK_C_SOURCE_COMPILES("#if !defined(__PPC64__) && !(defined(__LITTLE_ENDIAN__) && defined(__VSX__))\n#error not ppc64el\n#endif\nint main(void) { return 0; }" ARCH_PPC64EL)
|
||||
if (ARCH_X86_64 OR ARCH_AARCH64 OR ARCH_PPC64EL)
|
||||
set(ARCH_64_BIT TRUE)
|
||||
else()
|
||||
set(ARCH_32_BIT TRUE)
|
||||
endif()
|
||||
set(ARCH_32_BIT TRUE)
|
||||
endif()
|
||||
|
@ -11,28 +11,14 @@ find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(SQLITE3 sqlite3)
|
||||
endif()
|
||||
|
||||
if (NOT SQLITE3_FOUND)
|
||||
message(STATUS "looking for sqlite3 in source tree")
|
||||
# look in the source tree
|
||||
if (EXISTS "${PROJECT_SOURCE_DIR}/sqlite3/sqlite3.h" AND
|
||||
EXISTS "${PROJECT_SOURCE_DIR}/sqlite3/sqlite3.c")
|
||||
message(STATUS " found sqlite3 in source tree")
|
||||
set(SQLITE3_FOUND TRUE)
|
||||
set(SQLITE3_BUILD_SOURCE TRUE)
|
||||
set(SQLITE3_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/sqlite3")
|
||||
set(SQLITE3_LDFLAGS sqlite3_static)
|
||||
else()
|
||||
message(STATUS " no sqlite3 in source tree")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# now do version checks
|
||||
if (SQLITE3_FOUND)
|
||||
list(INSERT CMAKE_REQUIRED_INCLUDES 0 "${SQLITE3_INCLUDE_DIRS}")
|
||||
CHECK_C_SOURCE_COMPILES("#include <sqlite3.h>\n#if SQLITE_VERSION_NUMBER >= 3008007 && SQLITE_VERSION_NUMBER < 3008010\n#error broken sqlite\n#endif\nint main() {return 0;}" SQLITE_VERSION_OK)
|
||||
if (NOT SQLITE_VERSION_OK)
|
||||
if (SQLITE_VERSION LESS "3.8.10")
|
||||
message(FATAL_ERROR "sqlite3 is broken from 3.8.7 to 3.8.10 - please find a working version")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT SQLITE3_BUILD_SOURCE)
|
||||
set(_SAVED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
list(INSERT CMAKE_REQUIRED_LIBRARIES 0 ${SQLITE3_LDFLAGS})
|
||||
@ -46,6 +32,5 @@ else()
|
||||
set_target_properties(sqlite3_static PROPERTIES COMPILE_FLAGS "-Wno-error -Wno-extra -Wno-unused -Wno-cast-qual -DSQLITE_OMIT_LOAD_EXTENSION")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# that's enough about sqlite
|
||||
|
@ -117,6 +117,11 @@
|
||||
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
|
||||
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data,
|
||||
unsigned length, unsigned flags, hs_scratch_t *scratch,
|
||||
match_event_handler onEvent, void *userCtx);
|
||||
@ -185,3 +190,6 @@ CREATE_DISPATCH(hs_error_t, hs_reset_and_expand_stream, hs_stream_t *to_stream,
|
||||
/** INTERNALS **/
|
||||
|
||||
CREATE_DISPATCH(u32, Crc32c_ComputeBuf, u32 inCrc32, const void *buf, size_t bufLen);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
const FDREngineDescription &eng_in,
|
||||
bool make_small_in, const Grey &grey_in)
|
||||
: eng(eng_in), grey(grey_in), tab(eng_in.getTabSizeBytes()),
|
||||
lits(move(lits_in)), bucketToLits(move(bucketToLits_in)),
|
||||
lits(std::move(lits_in)), bucketToLits(std::move(bucketToLits_in)),
|
||||
make_small(make_small_in) {}
|
||||
|
||||
bytecode_ptr<FDR> build();
|
||||
@ -504,7 +504,7 @@ map<BucketIndex, vector<LiteralIndex>> assignStringsToBuckets(
|
||||
map<BucketIndex, vector<LiteralIndex>> bucketToLits;
|
||||
size_t bucketCnt = buckets.size();
|
||||
for (size_t i = 0; i < bucketCnt; i++) {
|
||||
bucketToLits.emplace(bucketCnt - i - 1, move(buckets[i]));
|
||||
bucketToLits.emplace(bucketCnt - i - 1, std::move(buckets[i]));
|
||||
}
|
||||
|
||||
return bucketToLits;
|
||||
@ -867,7 +867,7 @@ unique_ptr<HWLMProto> fdrBuildProtoInternal(u8 engType,
|
||||
auto bucketToLits = assignStringsToBuckets(lits, *des);
|
||||
addIncludedInfo(lits, des->getNumBuckets(), bucketToLits);
|
||||
auto proto =
|
||||
std::make_unique<HWLMProto>(engType, move(des), lits, bucketToLits,
|
||||
std::make_unique<HWLMProto>(engType, std::move(des), lits, bucketToLits,
|
||||
make_small);
|
||||
return proto;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ setupFullConfs(const vector<hwlmLiteral> &lits,
|
||||
DEBUG_PRINTF("b %d sz %zu\n", b, vl.size());
|
||||
auto fc = getFDRConfirm(vl, make_small);
|
||||
totalConfirmSize += fc.size();
|
||||
bc2Conf.emplace(b, move(fc));
|
||||
bc2Conf.emplace(b, std::move(fc));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
const TeddyEngineDescription &eng_in, bool make_small_in,
|
||||
const Grey &grey_in)
|
||||
: eng(eng_in), grey(grey_in), lits(lits_in),
|
||||
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {}
|
||||
bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}
|
||||
|
||||
bytecode_ptr<FDR> build();
|
||||
};
|
||||
@ -676,7 +676,7 @@ unique_ptr<HWLMProto> teddyBuildProtoHinted(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::make_unique<HWLMProto>(engType, move(des), lits,
|
||||
return std::make_unique<HWLMProto>(engType, std::move(des), lits,
|
||||
bucketToLits, make_small);
|
||||
}
|
||||
|
||||
|
@ -57,24 +57,24 @@ using namespace std;
|
||||
namespace ue2 {
|
||||
|
||||
HWLMProto::HWLMProto(u8 engType_in, vector<hwlmLiteral> lits_in)
|
||||
: engType(engType_in), lits(move(lits_in)) {}
|
||||
: engType(engType_in), lits(std::move(lits_in)) {}
|
||||
|
||||
HWLMProto::HWLMProto(u8 engType_in,
|
||||
unique_ptr<FDREngineDescription> eng_in,
|
||||
vector<hwlmLiteral> lits_in,
|
||||
map<u32, vector<u32>> bucketToLits_in,
|
||||
bool make_small_in)
|
||||
: engType(engType_in), fdrEng(move(eng_in)), lits(move(lits_in)),
|
||||
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {}
|
||||
: engType(engType_in), fdrEng(std::move(eng_in)), lits(std::move(lits_in)),
|
||||
bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}
|
||||
|
||||
HWLMProto::HWLMProto(u8 engType_in,
|
||||
unique_ptr<TeddyEngineDescription> eng_in,
|
||||
vector<hwlmLiteral> lits_in,
|
||||
map<u32, vector<u32>> bucketToLits_in,
|
||||
bool make_small_in)
|
||||
: engType(engType_in), teddyEng(move(eng_in)),
|
||||
lits(move(lits_in)),
|
||||
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {}
|
||||
: engType(engType_in), teddyEng(std::move(eng_in)),
|
||||
lits(std::move(lits_in)),
|
||||
bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}
|
||||
|
||||
HWLMProto::~HWLMProto() {}
|
||||
|
||||
@ -132,14 +132,14 @@ bytecode_ptr<HWLM> hwlmBuild(const HWLMProto &proto, const CompileContext &cc,
|
||||
if (noodle) {
|
||||
engSize = noodle.size();
|
||||
}
|
||||
eng = move(noodle);
|
||||
eng = std::move(noodle);
|
||||
} else {
|
||||
DEBUG_PRINTF("building a new deal\n");
|
||||
auto fdr = fdrBuildTable(proto, cc.grey);
|
||||
if (fdr) {
|
||||
engSize = fdr.size();
|
||||
}
|
||||
eng = move(fdr);
|
||||
eng = std::move(fdr);
|
||||
}
|
||||
|
||||
if (!eng) {
|
||||
|
@ -130,14 +130,14 @@ void extend(const raw_dfa &rdfa, const vector<CharReach> &rev_map,
|
||||
} else {
|
||||
path pp = append(p, CharReach(), p.dest);
|
||||
all[p.dest].emplace_back(pp);
|
||||
out.emplace_back(move(pp));
|
||||
out.emplace_back(std::move(pp));
|
||||
}
|
||||
}
|
||||
|
||||
if (!s.reports_eod.empty()) {
|
||||
path pp = append(p, CharReach(), p.dest);
|
||||
all[p.dest].emplace_back(pp);
|
||||
out.emplace_back(move(pp));
|
||||
out.emplace_back(std::move(pp));
|
||||
}
|
||||
|
||||
flat_map<u32, CharReach> dest;
|
||||
@ -157,7 +157,7 @@ void extend(const raw_dfa &rdfa, const vector<CharReach> &rev_map,
|
||||
DEBUG_PRINTF("----good: [%s] -> %u\n",
|
||||
describeClasses(pp.reach).c_str(), pp.dest);
|
||||
all[e.first].emplace_back(pp);
|
||||
out.emplace_back(move(pp));
|
||||
out.emplace_back(std::move(pp));
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ vector<vector<CharReach>> generate_paths(const raw_dfa &rdfa,
|
||||
extend(rdfa, rev_map, p, all, next_gen);
|
||||
}
|
||||
|
||||
paths = move(next_gen);
|
||||
paths = std::move(next_gen);
|
||||
}
|
||||
|
||||
dump_paths(paths);
|
||||
|
@ -1299,7 +1299,7 @@ unique_ptr<raw_report_info> gough_build_strat::gatherReports(
|
||||
*arbReport = MO_INVALID_IDX;
|
||||
assert(!ri->rl.empty()); /* all components should be able to generate
|
||||
reports */
|
||||
return move(ri);
|
||||
return std::move(ri);
|
||||
}
|
||||
|
||||
u32 raw_gough_report_info_impl::getReportListSize() const {
|
||||
|
@ -1026,7 +1026,7 @@ u32 addReports(const flat_set<ReportID> &r, vector<ReportID> &reports,
|
||||
|
||||
u32 offset = verify_u32(reports.size());
|
||||
insert(&reports, reports.end(), my_reports);
|
||||
reports_cache.emplace(move(my_reports), offset);
|
||||
reports_cache.emplace(std::move(my_reports), offset);
|
||||
return offset;
|
||||
}
|
||||
|
||||
@ -1064,7 +1064,7 @@ void buildAcceptsList(const build_info &args, ReportListCache &reports_cache,
|
||||
a.reports = addReports(h[v].reports, reports, reports_cache);
|
||||
}
|
||||
a.squash = addSquashMask(args, v, squash);
|
||||
accepts.emplace_back(move(a));
|
||||
accepts.emplace_back(std::move(a));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1819,7 +1819,7 @@ struct Factory {
|
||||
*streamState += streamStateLen;
|
||||
*scratchStateSize += sizeof(RepeatControl);
|
||||
|
||||
out.emplace_back(move(info));
|
||||
out.emplace_back(std::move(info));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ unique_ptr<raw_report_info> mcclellan_build_strat::gatherReports(
|
||||
*isSingleReport = 0;
|
||||
}
|
||||
|
||||
return move(ri);
|
||||
return std::move(ri);
|
||||
}
|
||||
|
||||
u32 raw_report_info_impl::getReportListSize() const {
|
||||
|
@ -319,7 +319,7 @@ void mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, size_t max_states,
|
||||
|
||||
queue<unique_ptr<raw_dfa>> q;
|
||||
for (auto &dfa : dfas) {
|
||||
q.push(move(dfa));
|
||||
q.push(std::move(dfa));
|
||||
}
|
||||
|
||||
// All DFAs are now on the queue, so we'll clear the vector and use it for
|
||||
@ -328,30 +328,30 @@ void mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, size_t max_states,
|
||||
|
||||
while (q.size() > 1) {
|
||||
// Attempt to merge the two front elements of the queue.
|
||||
unique_ptr<raw_dfa> d1 = move(q.front());
|
||||
unique_ptr<raw_dfa> d1 = std::move(q.front());
|
||||
q.pop();
|
||||
unique_ptr<raw_dfa> d2 = move(q.front());
|
||||
unique_ptr<raw_dfa> d2 = std::move(q.front());
|
||||
q.pop();
|
||||
|
||||
auto rdfa = mergeTwoDfas(d1.get(), d2.get(), max_states, rm, grey);
|
||||
if (rdfa) {
|
||||
q.push(move(rdfa));
|
||||
q.push(std::move(rdfa));
|
||||
} else {
|
||||
DEBUG_PRINTF("failed to merge\n");
|
||||
// Put the larger of the two DFAs on the output list, retain the
|
||||
// smaller one on the queue for further merge attempts.
|
||||
if (d2->states.size() > d1->states.size()) {
|
||||
dfas.emplace_back(move(d2));
|
||||
q.push(move(d1));
|
||||
dfas.emplace_back(std::move(d2));
|
||||
q.push(std::move(d1));
|
||||
} else {
|
||||
dfas.emplace_back(move(d1));
|
||||
q.push(move(d2));
|
||||
dfas.emplace_back(std::move(d1));
|
||||
q.push(std::move(d2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (!q.empty()) {
|
||||
dfas.emplace_back(move(q.front()));
|
||||
dfas.emplace_back(std::move(q.front()));
|
||||
q.pop();
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ unique_ptr<raw_report_info> sheng_build_strat::gatherReports(
|
||||
*isSingleReport = 0;
|
||||
}
|
||||
|
||||
return move(ri);
|
||||
return std::move(ri);
|
||||
}
|
||||
|
||||
u32 sheng_build_strat::max_allowed_offset_accel() const {
|
||||
|
@ -162,7 +162,7 @@ BuiltExpression NFABuilderImpl::getGraph() {
|
||||
throw CompileError("Pattern too large.");
|
||||
}
|
||||
|
||||
return { expr, move(graph) };
|
||||
return { expr, std::move(graph) };
|
||||
}
|
||||
|
||||
void NFABuilderImpl::setNodeReportID(Position pos, int offsetAdjust) {
|
||||
|
@ -369,7 +369,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
pruneUseless(*gc);
|
||||
DEBUG_PRINTF("component %zu has %zu vertices\n", comps.size(),
|
||||
num_vertices(*gc));
|
||||
comps.emplace_back(move(gc));
|
||||
comps.emplace_back(std::move(gc));
|
||||
}
|
||||
|
||||
// Another component to handle the direct shell-to-shell edges.
|
||||
@ -385,7 +385,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
pruneUseless(*gc);
|
||||
DEBUG_PRINTF("shell edge component %zu has %zu vertices\n",
|
||||
comps.size(), num_vertices(*gc));
|
||||
comps.emplace_back(move(gc));
|
||||
comps.emplace_back(std::move(gc));
|
||||
*shell_comp = true;
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ vector<VertexInfoSet> partitionGraph(vector<unique_ptr<VertexInfo>> &infos,
|
||||
unsigned eq_class = classes.size();
|
||||
vi->equivalence_class = eq_class;
|
||||
classes.push_back({vi.get()});
|
||||
classinfomap.emplace(move(ci), eq_class);
|
||||
classinfomap.emplace(std::move(ci), eq_class);
|
||||
} else {
|
||||
// vertex is added to an existing class.
|
||||
unsigned eq_class = ii->second;
|
||||
@ -441,7 +441,7 @@ void equivalence(vector<VertexInfoSet> &classes, WorkQueue &work_queue,
|
||||
classes[cur_class].erase(vi);
|
||||
new_class_vertices.insert(vi);
|
||||
}
|
||||
classes.emplace_back(move(new_class_vertices));
|
||||
classes.emplace_back(std::move(new_class_vertices));
|
||||
|
||||
if (contains(tmi->first, cur_class)) {
|
||||
reval_queue.push(new_class);
|
||||
|
@ -254,7 +254,7 @@ void findBestInternal(vector<vector<CharReach>>::const_iterator pb,
|
||||
DEBUG_PRINTF("worse\n");
|
||||
continue;
|
||||
}
|
||||
priority_path.emplace_back(move(as));
|
||||
priority_path.emplace_back(std::move(as));
|
||||
}
|
||||
|
||||
sort(priority_path.begin(), priority_path.end());
|
||||
@ -422,7 +422,7 @@ void findDoubleBest(vector<vector<CharReach> >::const_iterator pb,
|
||||
DEBUG_PRINTF("worse\n");
|
||||
continue;
|
||||
}
|
||||
priority_path.emplace_back(move(as));
|
||||
priority_path.emplace_back(std::move(as));
|
||||
}
|
||||
|
||||
sort(priority_path.begin(), priority_path.end());
|
||||
@ -569,7 +569,7 @@ AccelScheme findBestAccelScheme(vector<vector<CharReach>> paths,
|
||||
DAccelScheme da = findBestDoubleAccelScheme(paths, terminating);
|
||||
if (da.double_byte.size() <= DOUBLE_SHUFTI_LIMIT) {
|
||||
rv.double_byte = std::move(da.double_byte);
|
||||
rv.double_cr = move(da.double_cr);
|
||||
rv.double_cr = std::move(da.double_cr);
|
||||
rv.double_offset = da.double_offset;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace {
|
||||
|
||||
struct LitGraphVertexProps {
|
||||
LitGraphVertexProps() = default;
|
||||
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(move(c_in)) {}
|
||||
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(std::move(c_in)) {}
|
||||
ue2_literal::elem c; // string element (char + bool)
|
||||
size_t index = 0; // managed by ue2_graph
|
||||
};
|
||||
|
@ -237,7 +237,7 @@ bool handleDecoratedLiterals(RoseBuild &rose, const NGHolder &g,
|
||||
DEBUG_PRINTF("failed validation\n");
|
||||
return false;
|
||||
}
|
||||
masks.emplace_back(move(pm));
|
||||
masks.emplace_back(std::move(pm));
|
||||
}
|
||||
|
||||
for (const auto &pm : masks) {
|
||||
|
@ -100,7 +100,7 @@ void checkAndAddExitCandidate(const AcyclicGraph &g,
|
||||
|
||||
if (!open.empty()) {
|
||||
DEBUG_PRINTF("exit %zu\n", g[v].index);
|
||||
exits.emplace_back(move(v_exit));
|
||||
exits.emplace_back(std::move(v_exit));
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ void buildInitialCandidate(const AcyclicGraph &g,
|
||||
|
||||
if (it != ite) {
|
||||
enters.erase(*it);
|
||||
open_jumps = move(enters);
|
||||
open_jumps = std::move(enters);
|
||||
DEBUG_PRINTF("oj size = %zu\n", open_jumps.size());
|
||||
++it;
|
||||
} else {
|
||||
|
@ -1733,7 +1733,7 @@ void clearProperInEdges(NGHolder &g, const NFAVertex sink) {
|
||||
namespace {
|
||||
struct SomRevNfa {
|
||||
SomRevNfa(NFAVertex s, ReportID r, bytecode_ptr<NFA> n)
|
||||
: sink(s), report(r), nfa(move(n)) {}
|
||||
: sink(s), report(r), nfa(std::move(n)) {}
|
||||
NFAVertex sink;
|
||||
ReportID report;
|
||||
bytecode_ptr<NFA> nfa;
|
||||
@ -1799,7 +1799,7 @@ bool makeSomRevNfa(vector<SomRevNfa> &som_nfas, const NGHolder &g,
|
||||
return false;
|
||||
}
|
||||
|
||||
som_nfas.emplace_back(sink, report, move(nfa));
|
||||
som_nfas.emplace_back(sink, report, std::move(nfa));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1839,7 +1839,7 @@ bool doSomRevNfa(NG &ng, NGHolder &g, const CompileContext &cc) {
|
||||
assert(som_nfa.nfa);
|
||||
|
||||
// Transfer ownership of the NFA to the SOM slot manager.
|
||||
u32 comp_id = ng.ssm.addRevNfa(move(som_nfa.nfa), maxWidth);
|
||||
u32 comp_id = ng.ssm.addRevNfa(std::move(som_nfa.nfa), maxWidth);
|
||||
|
||||
// Replace this report on 'g' with a SOM_REV_NFA report pointing at our
|
||||
// new component.
|
||||
@ -1872,7 +1872,7 @@ u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, NGHolder &g,
|
||||
max(cc.grey.maxHistoryAvailable, ng.maxSomRevHistoryAvailable));
|
||||
}
|
||||
|
||||
return ng.ssm.addRevNfa(move(nfa), maxWidth);
|
||||
return ng.ssm.addRevNfa(std::move(nfa), maxWidth);
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -394,7 +394,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored,
|
||||
|
||||
lits->reserve(lit_info.size());
|
||||
for (auto &m : lit_info) {
|
||||
lits->emplace_back(move(m.second));
|
||||
lits->emplace_back(std::move(m.second));
|
||||
}
|
||||
DEBUG_PRINTF("%zu candidate literal sets\n", lits->size());
|
||||
}
|
||||
@ -707,11 +707,11 @@ unique_ptr<VertLitInfo> findBestSplit(const NGHolder &g,
|
||||
auto cmp = LitComparator(g, seeking_anchored, seeking_transient,
|
||||
last_chance);
|
||||
|
||||
unique_ptr<VertLitInfo> best = move(lits.back());
|
||||
unique_ptr<VertLitInfo> best = std::move(lits.back());
|
||||
lits.pop_back();
|
||||
while (!lits.empty()) {
|
||||
if (cmp(best, lits.back())) {
|
||||
best = move(lits.back());
|
||||
best = std::move(lits.back());
|
||||
}
|
||||
lits.pop_back();
|
||||
}
|
||||
@ -1621,7 +1621,7 @@ void removeRedundantLiteralsFromPrefixes(RoseInGraph &g,
|
||||
if (delay && delay != MO_INVALID_IDX) {
|
||||
DEBUG_PRINTF("setting delay %u on lhs %p\n", delay, h.get());
|
||||
|
||||
g[e].graph = move(h);
|
||||
g[e].graph = std::move(h);
|
||||
g[e].graph_lag = delay;
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void ComponentAlternation::accept(ConstComponentVisitor &v) const {
|
||||
}
|
||||
|
||||
void ComponentAlternation::append(unique_ptr<Component> component) {
|
||||
children.emplace_back(move(component));
|
||||
children.emplace_back(std::move(component));
|
||||
}
|
||||
|
||||
vector<PositionInfo> ComponentAlternation::first() const {
|
||||
|
@ -50,7 +50,7 @@ ComponentCondReference::ComponentCondReference(const string &name)
|
||||
: kind(CONDITION_NAME), ref_id(0), ref_name(name), hasBothBranches(false) {}
|
||||
|
||||
ComponentCondReference::ComponentCondReference(unique_ptr<Component> c)
|
||||
: kind(CONDITION_ASSERTION), ref_id(0), assertion(move(c)),
|
||||
: kind(CONDITION_ASSERTION), ref_id(0), assertion(std::move(c)),
|
||||
hasBothBranches(false) {}
|
||||
|
||||
ComponentCondReference::~ComponentCondReference() {}
|
||||
|
@ -60,7 +60,7 @@ static constexpr u32 MAX_POSITIONS_EXPANDED = 500000; // arbitrarily huge
|
||||
* extent is effectively zero. */
|
||||
ComponentRepeat::ComponentRepeat(unique_ptr<Component> sub_comp_in, u32 min,
|
||||
u32 max, enum RepeatType t)
|
||||
: type(t), sub_comp(move(sub_comp_in)), m_min(min), m_max(max),
|
||||
: type(t), sub_comp(std::move(sub_comp_in)), m_min(min), m_max(max),
|
||||
posFirst(GlushkovBuildState::POS_UNINITIALIZED),
|
||||
posLast(GlushkovBuildState::POS_UNINITIALIZED) {
|
||||
assert(sub_comp);
|
||||
@ -361,7 +361,7 @@ void ComponentRepeat::postSubNotePositionHook() {
|
||||
unique_ptr<ComponentRepeat> makeComponentRepeat(unique_ptr<Component> sub_comp,
|
||||
u32 min, u32 max,
|
||||
ComponentRepeat::RepeatType t) {
|
||||
return std::make_unique<ComponentRepeat>(move(sub_comp), min, max, t);
|
||||
return std::make_unique<ComponentRepeat>(std::move(sub_comp), min, max, t);
|
||||
}
|
||||
|
||||
} // namespace ue2
|
||||
|
@ -116,7 +116,7 @@ void ComponentSequence::accept(ConstComponentVisitor &v) const {
|
||||
}
|
||||
|
||||
void ComponentSequence::addComponent(unique_ptr<Component> comp) {
|
||||
children.emplace_back(move(comp));
|
||||
children.emplace_back(std::move(comp));
|
||||
}
|
||||
|
||||
bool ComponentSequence::addRepeat(u32 min, u32 max,
|
||||
@ -131,7 +131,7 @@ bool ComponentSequence::addRepeat(u32 min, u32 max,
|
||||
return false;
|
||||
}
|
||||
|
||||
children.back() = makeComponentRepeat(move(children.back()), min, max,
|
||||
children.back() = makeComponentRepeat(std::move(children.back()), min, max,
|
||||
type);
|
||||
assert(children.back());
|
||||
return true;
|
||||
@ -144,14 +144,14 @@ void ComponentSequence::addAlternation() {
|
||||
|
||||
auto seq = std::make_unique<ComponentSequence>();
|
||||
seq->children.swap(children);
|
||||
alternation->append(move(seq));
|
||||
alternation->append(std::move(seq));
|
||||
}
|
||||
|
||||
void ComponentSequence::finalize() {
|
||||
if (alternation) {
|
||||
addAlternation();
|
||||
assert(children.empty());
|
||||
children.emplace_back(move(alternation));
|
||||
children.emplace_back(std::move(alternation));
|
||||
alternation = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ ComponentSequence *enterSequence(ComponentSequence *parent,
|
||||
assert(child);
|
||||
|
||||
ComponentSequence *seq = child.get();
|
||||
parent->addComponent(move(child));
|
||||
parent->addComponent(std::move(child));
|
||||
return seq;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ void addLiteral(ComponentSequence *currentSeq, char c, const ParseMode &mode) {
|
||||
assert(cc);
|
||||
cc->add(c);
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
} else {
|
||||
currentSeq->addComponent(getLiteralComponentClass(c, mode.caseless));
|
||||
}
|
||||
@ -190,7 +190,7 @@ void addEscaped(ComponentSequence *currentSeq, unichar accum,
|
||||
assert(cc);
|
||||
cc->add(accum);
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
} else {
|
||||
if (accum > 255) {
|
||||
throw LocatedParseError(err_msg);
|
||||
@ -330,7 +330,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
PUSH_SEQUENCE;
|
||||
auto seq = std::make_unique<ComponentSequence>();
|
||||
seq->setCaptureIndex(groupIndex++);
|
||||
currentSeq = enterSequence(currentSeq, move(seq));
|
||||
currentSeq = enterSequence(currentSeq, std::move(seq));
|
||||
}
|
||||
|
||||
# enter a NAMED CAPTURING group ( e.g. (?'<hatstand>blah) )
|
||||
@ -347,7 +347,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto seq = std::make_unique<ComponentSequence>();
|
||||
seq->setCaptureIndex(groupIndex++);
|
||||
seq->setCaptureName(label);
|
||||
currentSeq = enterSequence(currentSeq, move(seq));
|
||||
currentSeq = enterSequence(currentSeq, std::move(seq));
|
||||
}
|
||||
|
||||
# enter a NON-CAPTURING group where we're modifying flags
|
||||
@ -724,7 +724,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
([^^] ${ fhold; fcall readUCP; })
|
||||
'}' ${ if (!inCharClass) { // not inside [..]
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
})
|
||||
@ -735,7 +735,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_C, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -743,7 +743,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_L, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -751,7 +751,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_M, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -759,7 +759,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_N, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -767,7 +767,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_P, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -775,7 +775,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_S, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -783,7 +783,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
currentCls->add(CLASS_UCP_Z, negated);
|
||||
if (!inCharClass) {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
}
|
||||
fret;
|
||||
};
|
||||
@ -1106,7 +1106,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
|
||||
']' => {
|
||||
currentCls->finalize();
|
||||
currentSeq->addComponent(move(currentCls));
|
||||
currentSeq->addComponent(std::move(currentCls));
|
||||
inCharClass = false;
|
||||
fgoto main;
|
||||
};
|
||||
@ -1163,7 +1163,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto cc = getComponentClass(mode);
|
||||
cc->add(readUtf8CodePoint2c(ts));
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
utf8_3c when is_utf8 => {
|
||||
@ -1172,7 +1172,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto cc = getComponentClass(mode);
|
||||
cc->add(readUtf8CodePoint3c(ts));
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
utf8_4c when is_utf8 => {
|
||||
@ -1181,7 +1181,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto cc = getComponentClass(mode);
|
||||
cc->add(readUtf8CodePoint4c(ts));
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
hi_byte when is_utf8 => {
|
||||
@ -1618,52 +1618,52 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
# Word character
|
||||
'\\w' => {
|
||||
auto cc = generateComponent(CLASS_WORD, false, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Non word character
|
||||
'\\W' => {
|
||||
auto cc = generateComponent(CLASS_WORD, true, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Whitespace character
|
||||
'\\s' => {
|
||||
auto cc = generateComponent(CLASS_SPACE, false, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Non whitespace character
|
||||
'\\S' => {
|
||||
auto cc = generateComponent(CLASS_SPACE, true, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Digit character
|
||||
'\\d' => {
|
||||
auto cc = generateComponent(CLASS_DIGIT, false, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Non digit character
|
||||
'\\D' => {
|
||||
auto cc = generateComponent(CLASS_DIGIT, true, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Horizontal whitespace
|
||||
'\\h' => {
|
||||
auto cc = generateComponent(CLASS_HORZ, false, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Not horizontal whitespace
|
||||
'\\H' => {
|
||||
auto cc = generateComponent(CLASS_HORZ, true, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Vertical whitespace
|
||||
'\\v' => {
|
||||
auto cc = generateComponent(CLASS_VERT, false, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
# Not vertical whitespace
|
||||
'\\V' => {
|
||||
auto cc = generateComponent(CLASS_VERT, true, mode);
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
'\\p{' => {
|
||||
@ -1787,7 +1787,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
ComponentAssertion *a_seq = a.get();
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = enterSequence(currentSeq,
|
||||
std::make_unique<ComponentCondReference>(move(a)));
|
||||
std::make_unique<ComponentCondReference>(std::move(a)));
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = a_seq;
|
||||
};
|
||||
@ -1798,7 +1798,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
ComponentAssertion *a_seq = a.get();
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = enterSequence(currentSeq,
|
||||
std::make_unique<ComponentCondReference>(move(a)));
|
||||
std::make_unique<ComponentCondReference>(std::move(a)));
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = a_seq;
|
||||
};
|
||||
@ -1809,7 +1809,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
ComponentAssertion *a_seq = a.get();
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = enterSequence(currentSeq,
|
||||
std::make_unique<ComponentCondReference>(move(a)));
|
||||
std::make_unique<ComponentCondReference>(std::move(a)));
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = a_seq;
|
||||
};
|
||||
@ -1820,7 +1820,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
ComponentAssertion *a_seq = a.get();
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = enterSequence(currentSeq,
|
||||
std::make_unique<ComponentCondReference>(move(a)));
|
||||
std::make_unique<ComponentCondReference>(std::move(a)));
|
||||
PUSH_SEQUENCE;
|
||||
currentSeq = a_seq;
|
||||
};
|
||||
@ -1861,7 +1861,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto cc = getComponentClass(mode);
|
||||
cc->add(readUtf8CodePoint2c(ts));
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
utf8_3c when is_utf8 => {
|
||||
@ -1870,7 +1870,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto cc = getComponentClass(mode);
|
||||
cc->add(readUtf8CodePoint3c(ts));
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
utf8_4c when is_utf8 => {
|
||||
@ -1879,7 +1879,7 @@ unichar readUtf8CodePoint4c(const char *s) {
|
||||
auto cc = getComponentClass(mode);
|
||||
cc->add(readUtf8CodePoint4c(ts));
|
||||
cc->finalize();
|
||||
currentSeq->addComponent(move(cc));
|
||||
currentSeq->addComponent(std::move(cc));
|
||||
};
|
||||
|
||||
hi_byte when is_utf8 => {
|
||||
@ -2024,7 +2024,7 @@ unique_ptr<Component> parse(const char *ptr, ParseMode &globalMode) {
|
||||
// Ensure that all references are valid.
|
||||
checkReferences(*rootSeq, groupIndex, groupNames);
|
||||
|
||||
return move(rootSeq);
|
||||
return std::move(rootSeq);
|
||||
} catch (LocatedParseError &error) {
|
||||
if (ts >= ptr && ts <= pe) {
|
||||
error.locate(ts - ptr);
|
||||
|
@ -1780,7 +1780,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h) {
|
||||
}
|
||||
|
||||
if (rdfa) {
|
||||
outfixes.emplace_back(OutfixInfo(move(rdfa)));
|
||||
outfixes.emplace_back(OutfixInfo(std::move(rdfa)));
|
||||
} else {
|
||||
outfixes.emplace_back(OutfixInfo(cloneHolder(h)));
|
||||
}
|
||||
|
@ -144,9 +144,9 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
|
||||
for (auto &rdfa : dfas) {
|
||||
u32 start_size = mcclellanStartReachSize(rdfa.get());
|
||||
if (start_size <= MAX_SMALL_START_REACH) {
|
||||
small_starts.emplace_back(move(rdfa));
|
||||
small_starts.emplace_back(std::move(rdfa));
|
||||
} else {
|
||||
big_starts.emplace_back(move(rdfa));
|
||||
big_starts.emplace_back(std::move(rdfa));
|
||||
}
|
||||
}
|
||||
dfas.clear();
|
||||
@ -158,10 +158,10 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
|
||||
|
||||
// Rehome our groups into one vector.
|
||||
for (auto &rdfa : small_starts) {
|
||||
dfas.emplace_back(move(rdfa));
|
||||
dfas.emplace_back(std::move(rdfa));
|
||||
}
|
||||
for (auto &rdfa : big_starts) {
|
||||
dfas.emplace_back(move(rdfa));
|
||||
dfas.emplace_back(std::move(rdfa));
|
||||
}
|
||||
|
||||
// Final test: if we've built two DFAs here that are small enough, we can
|
||||
@ -685,7 +685,7 @@ int finalise_out(RoseBuildImpl &build, const NGHolder &h,
|
||||
if (check_dupe(*out_dfa, build.anchored_nfas[hash], remap)) {
|
||||
return ANCHORED_REMAP;
|
||||
}
|
||||
build.anchored_nfas[hash].emplace_back(move(out_dfa));
|
||||
build.anchored_nfas[hash].emplace_back(std::move(out_dfa));
|
||||
return ANCHORED_SUCCESS;
|
||||
}
|
||||
|
||||
@ -700,7 +700,7 @@ int addAutomaton(RoseBuildImpl &build, const NGHolder &h, ReportID *remap) {
|
||||
|
||||
auto out_dfa = std::make_unique<raw_dfa>(NFA_OUTFIX_RAW);
|
||||
if (determinise(autom, out_dfa->states, MAX_DFA_STATES)) {
|
||||
return finalise_out(build, h, autom, move(out_dfa), remap);
|
||||
return finalise_out(build, h, autom, std::move(out_dfa), remap);
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("determinise failed\n");
|
||||
@ -767,7 +767,7 @@ void buildSimpleDfas(const RoseBuildImpl &build, const vector<u32> &frag_map,
|
||||
rdfa->start_floating = DEAD_STATE;
|
||||
rdfa->alpha_size = autom.alphasize;
|
||||
rdfa->alpha_remap = autom.alpha;
|
||||
anchored_dfas->emplace_back(move(rdfa));
|
||||
anchored_dfas->emplace_back(std::move(rdfa));
|
||||
}
|
||||
}
|
||||
|
||||
@ -784,7 +784,7 @@ vector<unique_ptr<raw_dfa>> getAnchoredDfas(RoseBuildImpl &build,
|
||||
// DFAs that already exist as raw_dfas.
|
||||
for (auto &anch_dfas : build.anchored_nfas) {
|
||||
for (auto &rdfa : anch_dfas.second) {
|
||||
dfas.emplace_back(move(rdfa));
|
||||
dfas.emplace_back(std::move(rdfa));
|
||||
}
|
||||
}
|
||||
build.anchored_nfas.clear();
|
||||
@ -834,7 +834,7 @@ size_t buildNfas(vector<raw_dfa> &anchored_dfas,
|
||||
|
||||
assert(nfa->length);
|
||||
total_size += ROUNDUP_CL(sizeof(anchored_matcher_info) + nfa->length);
|
||||
nfas->emplace_back(move(nfa));
|
||||
nfas->emplace_back(std::move(nfa));
|
||||
}
|
||||
|
||||
// We no longer need to keep the raw_dfa structures around.
|
||||
@ -861,7 +861,7 @@ vector<raw_dfa> buildAnchoredDfas(RoseBuildImpl &build,
|
||||
dfas.reserve(anch_dfas.size());
|
||||
for (auto &rdfa : anch_dfas) {
|
||||
assert(rdfa);
|
||||
dfas.emplace_back(move(*rdfa));
|
||||
dfas.emplace_back(std::move(*rdfa));
|
||||
}
|
||||
return dfas;
|
||||
}
|
||||
|
@ -701,9 +701,9 @@ buildSuffix(const ReportManager &rm, const SomSlotManager &ssm,
|
||||
auto d = getDfa(*rdfa, false, cc, rm);
|
||||
assert(d);
|
||||
if (cc.grey.roseMcClellanSuffix != 2) {
|
||||
n = pickImpl(move(d), move(n), fast_nfa);
|
||||
n = pickImpl(std::move(d), std::move(n), fast_nfa);
|
||||
} else {
|
||||
n = move(d);
|
||||
n = std::move(d);
|
||||
}
|
||||
|
||||
assert(n);
|
||||
@ -853,7 +853,7 @@ bytecode_ptr<NFA> makeLeftNfa(const RoseBuildImpl &tbi, left_id &left,
|
||||
if (rdfa) {
|
||||
auto d = getDfa(*rdfa, is_transient, cc, rm);
|
||||
assert(d);
|
||||
n = pickImpl(move(d), move(n), fast_nfa);
|
||||
n = pickImpl(std::move(d), std::move(n), fast_nfa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1422,12 +1422,12 @@ void buildExclusiveInfixes(RoseBuildImpl &build, build_context &bc,
|
||||
setLeftNfaProperties(*n, leftfix);
|
||||
|
||||
ExclusiveSubengine engine;
|
||||
engine.nfa = move(n);
|
||||
engine.nfa = std::move(n);
|
||||
engine.vertices = verts;
|
||||
info.subengines.emplace_back(move(engine));
|
||||
info.subengines.emplace_back(std::move(engine));
|
||||
}
|
||||
info.queue = qif.get_queue();
|
||||
exclusive_info.emplace_back(move(info));
|
||||
exclusive_info.emplace_back(std::move(info));
|
||||
}
|
||||
updateExclusiveInfixProperties(build, exclusive_info, bc.leftfix_info,
|
||||
no_retrigger_queues);
|
||||
@ -1649,7 +1649,7 @@ public:
|
||||
if (rdfa) {
|
||||
auto d = getDfa(*rdfa, false, cc, rm);
|
||||
if (d) {
|
||||
n = pickImpl(move(d), move(n), fast_nfa);
|
||||
n = pickImpl(std::move(d), std::move(n), fast_nfa);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1864,15 +1864,15 @@ void buildExclusiveSuffixes(RoseBuildImpl &build, build_context &bc,
|
||||
setSuffixProperties(*n, s, build.rm);
|
||||
|
||||
ExclusiveSubengine engine;
|
||||
engine.nfa = move(n);
|
||||
engine.nfa = std::move(n);
|
||||
engine.vertices = verts;
|
||||
info.subengines.emplace_back(move(engine));
|
||||
info.subengines.emplace_back(std::move(engine));
|
||||
|
||||
const auto &reports = all_reports(s);
|
||||
info.reports.insert(reports.begin(), reports.end());
|
||||
}
|
||||
info.queue = qif.get_queue();
|
||||
exclusive_info.emplace_back(move(info));
|
||||
exclusive_info.emplace_back(std::move(info));
|
||||
}
|
||||
updateExclusiveSuffixProperties(build, exclusive_info,
|
||||
no_retrigger_queues);
|
||||
@ -2416,7 +2416,7 @@ u32 writeProgram(build_context &bc, RoseProgram &&program) {
|
||||
u32 offset = bc.engine_blob.add(prog_bytecode);
|
||||
DEBUG_PRINTF("prog len %zu written at offset %u\n", prog_bytecode.size(),
|
||||
offset);
|
||||
bc.program_cache.emplace(move(program), offset);
|
||||
bc.program_cache.emplace(std::move(program), offset);
|
||||
return offset;
|
||||
}
|
||||
|
||||
@ -2581,13 +2581,13 @@ void makeBoundaryPrograms(const RoseBuildImpl &build, build_context &bc,
|
||||
DEBUG_PRINTF("report ^$: %zu\n", dboundary.report_at_0_eod_full.size());
|
||||
|
||||
auto eod_prog = makeBoundaryProgram(build, boundary.report_at_eod);
|
||||
out.reportEodOffset = writeProgram(bc, move(eod_prog));
|
||||
out.reportEodOffset = writeProgram(bc, std::move(eod_prog));
|
||||
|
||||
auto zero_prog = makeBoundaryProgram(build, boundary.report_at_0);
|
||||
out.reportZeroOffset = writeProgram(bc, move(zero_prog));
|
||||
out.reportZeroOffset = writeProgram(bc, std::move(zero_prog));
|
||||
|
||||
auto zeod_prog = makeBoundaryProgram(build, dboundary.report_at_0_eod_full);
|
||||
out.reportZeroEodOffset = writeProgram(bc, move(zeod_prog));
|
||||
out.reportZeroEodOffset = writeProgram(bc, std::move(zeod_prog));
|
||||
}
|
||||
|
||||
static
|
||||
@ -2752,10 +2752,10 @@ RoseProgram makeFragmentProgram(const RoseBuildImpl &build, build_context &bc,
|
||||
for (const auto &lit_id : lit_ids) {
|
||||
auto prog = makeLiteralProgram(build, bc, prog_build, lit_id,
|
||||
lit_edge_map, false);
|
||||
blocks.emplace_back(move(prog));
|
||||
blocks.emplace_back(std::move(prog));
|
||||
}
|
||||
|
||||
return assembleProgramBlocks(move(blocks));
|
||||
return assembleProgramBlocks(std::move(blocks));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2865,7 +2865,7 @@ vector<LitFragment> groupByFragment(const RoseBuildImpl &build) {
|
||||
auto &fi = m.second;
|
||||
DEBUG_PRINTF("frag %s -> ids: %s\n", dumpString(m.first.s).c_str(),
|
||||
as_string_list(fi.lit_ids).c_str());
|
||||
fragments.emplace_back(frag_id, lit.s, fi.groups, move(fi.lit_ids));
|
||||
fragments.emplace_back(frag_id, lit.s, fi.groups, std::move(fi.lit_ids));
|
||||
frag_id++;
|
||||
assert(frag_id == fragments.size());
|
||||
}
|
||||
@ -2981,7 +2981,7 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
|
||||
child_offset);
|
||||
addIncludedJumpProgram(lit_prog, child_offset, pfrag.squash);
|
||||
}
|
||||
pfrag.lit_program_offset = writeProgram(bc, move(lit_prog));
|
||||
pfrag.lit_program_offset = writeProgram(bc, std::move(lit_prog));
|
||||
|
||||
// We only do delayed rebuild in streaming mode.
|
||||
if (!build.cc.streaming) {
|
||||
@ -3001,7 +3001,7 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
|
||||
addIncludedJumpProgram(rebuild_prog, child_offset,
|
||||
pfrag.delay_squash);
|
||||
}
|
||||
pfrag.delay_program_offset = writeProgram(bc, move(rebuild_prog));
|
||||
pfrag.delay_program_offset = writeProgram(bc, std::move(rebuild_prog));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3090,7 +3090,7 @@ pair<u32, u32> writeDelayPrograms(const RoseBuildImpl &build,
|
||||
auto prog = makeLiteralProgram(build, bc, prog_build,
|
||||
delayed_lit_id, lit_edge_map,
|
||||
false);
|
||||
u32 offset = writeProgram(bc, move(prog));
|
||||
u32 offset = writeProgram(bc, std::move(prog));
|
||||
|
||||
u32 delay_id;
|
||||
auto it = cache.find(offset);
|
||||
@ -3150,7 +3150,7 @@ pair<u32, u32> writeAnchoredPrograms(const RoseBuildImpl &build,
|
||||
|
||||
auto prog = makeLiteralProgram(build, bc, prog_build, lit_id,
|
||||
lit_edge_map, true);
|
||||
u32 offset = writeProgram(bc, move(prog));
|
||||
u32 offset = writeProgram(bc, std::move(prog));
|
||||
DEBUG_PRINTF("lit_id=%u -> anch prog at %u\n", lit_id, offset);
|
||||
|
||||
u32 anch_id;
|
||||
@ -3210,7 +3210,7 @@ pair<u32, u32> buildReportPrograms(const RoseBuildImpl &build,
|
||||
|
||||
for (ReportID id : reports) {
|
||||
auto program = makeReportProgram(build, bc.needs_mpv_catchup, id);
|
||||
u32 offset = writeProgram(bc, move(program));
|
||||
u32 offset = writeProgram(bc, std::move(program));
|
||||
programs.emplace_back(offset);
|
||||
build.rm.setProgramOffset(id, offset);
|
||||
DEBUG_PRINTF("program for report %u @ %u (%zu instructions)\n", id,
|
||||
@ -3326,7 +3326,7 @@ void addEodEventProgram(const RoseBuildImpl &build, build_context &bc,
|
||||
bc.roleStateIndices, prog_build,
|
||||
build.eod_event_literal_id, edge_list,
|
||||
false);
|
||||
program.add_block(move(block));
|
||||
program.add_block(std::move(block));
|
||||
}
|
||||
|
||||
static
|
||||
@ -3715,7 +3715,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
drproto.get(), eproto.get(), sbproto.get());
|
||||
|
||||
auto eod_prog = makeEodProgram(*this, bc, prog_build, eodNfaIterOffset);
|
||||
proto.eodProgramOffset = writeProgram(bc, move(eod_prog));
|
||||
proto.eodProgramOffset = writeProgram(bc, std::move(eod_prog));
|
||||
|
||||
size_t longLitStreamStateRequired = 0;
|
||||
proto.longLitTableOffset
|
||||
@ -3734,11 +3734,11 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
writeLogicalInfo(rm, bc.engine_blob, proto);
|
||||
|
||||
auto flushComb_prog = makeFlushCombProgram(proto);
|
||||
proto.flushCombProgramOffset = writeProgram(bc, move(flushComb_prog));
|
||||
proto.flushCombProgramOffset = writeProgram(bc, std::move(flushComb_prog));
|
||||
|
||||
auto lastFlushComb_prog = makeLastFlushCombProgram(proto);
|
||||
proto.lastFlushCombProgramOffset =
|
||||
writeProgram(bc, move(lastFlushComb_prog));
|
||||
writeProgram(bc, std::move(lastFlushComb_prog));
|
||||
|
||||
// Build anchored matcher.
|
||||
auto atable = buildAnchoredMatcher(*this, fragments, anchored_dfas);
|
||||
@ -3882,7 +3882,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
bc.engine_blob.write_bytes(engine.get());
|
||||
|
||||
// Add a small write engine if appropriate.
|
||||
engine = addSmallWriteEngine(*this, bc.resources, move(engine));
|
||||
engine = addSmallWriteEngine(*this, bc.resources, std::move(engine));
|
||||
|
||||
DEBUG_PRINTF("rose done %p\n", engine.get());
|
||||
|
||||
|
@ -1782,7 +1782,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
|
||||
|
||||
/* transfer mpv outfix to main queue */
|
||||
if (mpv_outfix) {
|
||||
outfixes.emplace_back(move(*mpv_outfix));
|
||||
outfixes.emplace_back(std::move(*mpv_outfix));
|
||||
mpv_outfix = nullptr;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ void convertFloodProneSuffix(RoseBuildImpl &tbi, RoseVertex v, u32 lit_id,
|
||||
|
||||
// Apply the NFA.
|
||||
assert(!g[v].suffix);
|
||||
g[v].suffix.graph = move(h);
|
||||
g[v].suffix.graph = std::move(h);
|
||||
g[v].reports.clear();
|
||||
|
||||
// Swap v's literal for a shorter one.
|
||||
|
@ -464,7 +464,7 @@ void findFloodReach(const RoseBuildImpl &tbi, const RoseVertex v,
|
||||
namespace {
|
||||
struct LookProto {
|
||||
LookProto(s32 offset_in, CharReach reach_in)
|
||||
: offset(offset_in), reach(move(reach_in)) {}
|
||||
: offset(offset_in), reach(std::move(reach_in)) {}
|
||||
s32 offset;
|
||||
CharReach reach;
|
||||
};
|
||||
|
@ -738,7 +738,7 @@ void addFragmentLiteral(const RoseBuildImpl &build, MatcherProto &mp,
|
||||
|
||||
const auto &groups = f.groups;
|
||||
|
||||
mp.lits.emplace_back(move(s_final), nocase, noruns, f.fragment_id,
|
||||
mp.lits.emplace_back(std::move(s_final), nocase, noruns, f.fragment_id,
|
||||
groups, msk, cmp);
|
||||
}
|
||||
|
||||
@ -936,7 +936,7 @@ buildFloatingMatcherProto(const RoseBuildImpl &build,
|
||||
throw CompileError("Unable to generate literal matcher proto.");
|
||||
}
|
||||
|
||||
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
|
||||
return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
|
||||
}
|
||||
|
||||
unique_ptr<LitProto>
|
||||
@ -964,7 +964,7 @@ buildDelayRebuildMatcherProto(const RoseBuildImpl &build,
|
||||
throw CompileError("Unable to generate literal matcher proto.");
|
||||
}
|
||||
|
||||
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
|
||||
return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
|
||||
}
|
||||
|
||||
unique_ptr<LitProto>
|
||||
@ -1021,7 +1021,7 @@ buildSmallBlockMatcherProto(const RoseBuildImpl &build,
|
||||
throw CompileError("Unable to generate literal matcher proto.");
|
||||
}
|
||||
|
||||
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
|
||||
return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
|
||||
}
|
||||
|
||||
unique_ptr<LitProto>
|
||||
@ -1046,7 +1046,7 @@ buildEodAnchoredMatcherProto(const RoseBuildImpl &build,
|
||||
throw CompileError("Unable to generate literal matcher proto.");
|
||||
}
|
||||
|
||||
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
|
||||
return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
|
||||
}
|
||||
|
||||
} // namespace ue2
|
||||
|
@ -1442,7 +1442,7 @@ void mergeLeftfixesVariableLag(RoseBuildImpl &build) {
|
||||
|
||||
vector<vector<left_id>> chunks;
|
||||
for (auto &raw_group : engine_groups | map_values) {
|
||||
chunk(move(raw_group), &chunks, MERGE_GROUP_SIZE_MAX);
|
||||
chunk(std::move(raw_group), &chunks, MERGE_GROUP_SIZE_MAX);
|
||||
}
|
||||
engine_groups.clear();
|
||||
|
||||
@ -1511,7 +1511,7 @@ namespace {
|
||||
struct DedupeLeftKey {
|
||||
DedupeLeftKey(const RoseBuildImpl &build,
|
||||
flat_set<pair<size_t, u32>> preds_in, const left_id &left)
|
||||
: left_hash(hashLeftfix(left)), preds(move(preds_in)),
|
||||
: left_hash(hashLeftfix(left)), preds(std::move(preds_in)),
|
||||
transient(contains(build.transient, left)) {
|
||||
}
|
||||
|
||||
@ -1599,7 +1599,7 @@ void dedupeLeftfixesVariableLag(RoseBuildImpl &build) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
engine_groups[DedupeLeftKey(build, move(preds), left)].emplace_back(left);
|
||||
engine_groups[DedupeLeftKey(build, std::move(preds), left)].emplace_back(left);
|
||||
}
|
||||
|
||||
/* We don't bother chunking as we expect deduping to be successful if the
|
||||
@ -2048,7 +2048,7 @@ void mergeCastleLeftfixes(RoseBuildImpl &build) {
|
||||
|
||||
vector<vector<left_id>> chunks;
|
||||
for (auto &raw_group : by_reach | map_values) {
|
||||
chunk(move(raw_group), &chunks, MERGE_CASTLE_GROUP_SIZE_MAX);
|
||||
chunk(std::move(raw_group), &chunks, MERGE_CASTLE_GROUP_SIZE_MAX);
|
||||
}
|
||||
by_reach.clear();
|
||||
|
||||
@ -2429,7 +2429,7 @@ void pairwiseDfaMerge(vector<RawDfa *> &dfas,
|
||||
RawDfa *dfa_ptr = rdfa.get();
|
||||
dfa_mapping[dfa_ptr] = dfa_mapping[*it];
|
||||
dfa_mapping.erase(*it);
|
||||
winner.proto = move(rdfa);
|
||||
winner.proto = std::move(rdfa);
|
||||
|
||||
mergeOutfixInfo(winner, victim);
|
||||
|
||||
@ -2546,7 +2546,7 @@ void mergeOutfixCombo(RoseBuildImpl &tbi, const ReportManager &rm,
|
||||
// Transform this outfix into a DFA and add it to the merge set.
|
||||
dfa_mapping[rdfa.get()] = it - tbi.outfixes.begin();
|
||||
dfas.emplace_back(rdfa.get());
|
||||
outfix.proto = move(rdfa);
|
||||
outfix.proto = std::move(rdfa);
|
||||
new_dfas++;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ RoseProgram::iterator RoseProgram::insert(RoseProgram::iterator it,
|
||||
assert(it != end());
|
||||
assert(prog.back()->code() == ROSE_INSTR_END);
|
||||
|
||||
return prog.insert(it, move(ri));
|
||||
return prog.insert(it, std::move(ri));
|
||||
}
|
||||
|
||||
RoseProgram::iterator RoseProgram::insert(RoseProgram::iterator it,
|
||||
@ -183,7 +183,7 @@ void RoseProgram::add_before_end(RoseProgram &&block) {
|
||||
return;
|
||||
}
|
||||
|
||||
insert(prev(prog.end()), move(block));
|
||||
insert(prev(prog.end()), std::move(block));
|
||||
}
|
||||
|
||||
void RoseProgram::add_block(RoseProgram &&block) {
|
||||
@ -209,7 +209,7 @@ void RoseProgram::replace(Iter it, std::unique_ptr<RoseInstruction> ri) {
|
||||
assert(!prog.empty());
|
||||
|
||||
const RoseInstruction *old_ptr = it->get();
|
||||
*it = move(ri);
|
||||
*it = std::move(ri);
|
||||
update_targets(prog.begin(), prog.end(), old_ptr, it->get());
|
||||
}
|
||||
|
||||
@ -307,19 +307,19 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) {
|
||||
|
||||
RoseProgram block;
|
||||
block.add_before_end(std::make_unique<RoseInstrEnginesEod>(eodNfaIterOffset));
|
||||
program.add_block(move(block));
|
||||
program.add_block(std::move(block));
|
||||
}
|
||||
|
||||
void addSuffixesEodProgram(RoseProgram &program) {
|
||||
RoseProgram block;
|
||||
block.add_before_end(std::make_unique<RoseInstrSuffixesEod>());
|
||||
program.add_block(move(block));
|
||||
program.add_block(std::move(block));
|
||||
}
|
||||
|
||||
void addMatcherEodProgram(RoseProgram &program) {
|
||||
RoseProgram block;
|
||||
block.add_before_end(std::make_unique<RoseInstrMatcherEod>());
|
||||
program.add_block(move(block));
|
||||
program.add_block(std::move(block));
|
||||
}
|
||||
|
||||
void addFlushCombinationProgram(RoseProgram &program) {
|
||||
@ -359,7 +359,7 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build,
|
||||
build.g[v].left.leftfix_report,
|
||||
end_inst);
|
||||
}
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -394,7 +394,7 @@ void makeAnchoredLiteralDelay(const RoseBuildImpl &build,
|
||||
|
||||
const auto *end_inst = program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrAnchoredDelay>(groups, anch_id, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -404,7 +404,7 @@ void makeDedupe(const ReportManager &rm, const Report &report,
|
||||
auto ri =
|
||||
std::make_unique<RoseInstrDedupe>(report.quashSom, rm.getDkey(report),
|
||||
report.offsetAdjust, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -414,7 +414,7 @@ void makeDedupeSom(const ReportManager &rm, const Report &report,
|
||||
auto ri = std::make_unique<RoseInstrDedupeSom>(report.quashSom,
|
||||
rm.getDkey(report),
|
||||
report.offsetAdjust, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -522,11 +522,11 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm,
|
||||
// set matching status of current lkey
|
||||
auto risl = std::make_unique<RoseInstrSetLogical>(report.lkey,
|
||||
report.offsetAdjust);
|
||||
program.add_before_end(move(risl));
|
||||
program.add_before_end(std::move(risl));
|
||||
// set current lkey's corresponding ckeys active, pending to check
|
||||
for (auto ckey : rm.getRelateCKeys(report.lkey)) {
|
||||
auto risc = std::make_unique<RoseInstrSetCombination>(ckey);
|
||||
program.add_before_end(move(risc));
|
||||
program.add_before_end(std::move(risc));
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,14 +543,14 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
|
||||
if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) {
|
||||
auto ri = std::make_unique<RoseInstrCheckBounds>(report.minOffset,
|
||||
report.maxOffset, end_inst);
|
||||
report_block.add_before_end(move(ri));
|
||||
report_block.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
// If this report has an exhaustion key, we can check it in the program
|
||||
// rather than waiting until we're in the callback adaptor.
|
||||
if (report.ekey != INVALID_EKEY) {
|
||||
auto ri = std::make_unique<RoseInstrCheckExhausted>(report.ekey, end_inst);
|
||||
report_block.add_before_end(move(ri));
|
||||
report_block.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
// External SOM reports that aren't passthrough need their SOM value
|
||||
@ -559,7 +559,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
|
||||
report.type != EXTERNAL_CALLBACK_SOM_PASS) {
|
||||
auto ri = std::make_unique<RoseInstrSomFromReport>();
|
||||
writeSomOperation(report, &ri->som);
|
||||
report_block.add_before_end(move(ri));
|
||||
report_block.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
// Min length constraint.
|
||||
@ -567,7 +567,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
|
||||
assert(build.hasSom);
|
||||
auto ri = std::make_unique<RoseInstrCheckMinLength>(
|
||||
report.offsetAdjust, report.minLength, end_inst);
|
||||
report_block.add_before_end(move(ri));
|
||||
report_block.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
if (report.quashSom) {
|
||||
@ -650,11 +650,11 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
|
||||
if (has_som) {
|
||||
auto ri = std::make_unique<RoseInstrReportSomAware>();
|
||||
writeSomOperation(report, &ri->som);
|
||||
report_block.add_before_end(move(ri));
|
||||
report_block.add_before_end(std::move(ri));
|
||||
} else {
|
||||
auto ri = std::make_unique<RoseInstrReportSomInt>();
|
||||
writeSomOperation(report, &ri->som);
|
||||
report_block.add_before_end(move(ri));
|
||||
report_block.add_before_end(std::move(ri));
|
||||
}
|
||||
break;
|
||||
case INTERNAL_ROSE_CHAIN: {
|
||||
@ -715,7 +715,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
|
||||
throw CompileError("Unable to generate bytecode.");
|
||||
}
|
||||
|
||||
program.add_block(move(report_block));
|
||||
program.add_block(std::move(report_block));
|
||||
}
|
||||
|
||||
static
|
||||
@ -745,7 +745,7 @@ void makeRoleReports(const RoseBuildImpl &build,
|
||||
for (ReportID id : g[v].reports) {
|
||||
makeReport(build, id, report_som, report_block);
|
||||
}
|
||||
program.add_before_end(move(report_block));
|
||||
program.add_before_end(std::move(report_block));
|
||||
}
|
||||
|
||||
static
|
||||
@ -816,7 +816,7 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit,
|
||||
ri = std::make_unique<RoseInstrCheckMedLit>(lit.s.get_string(),
|
||||
end_inst);
|
||||
}
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -834,7 +834,7 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit,
|
||||
} else {
|
||||
ri = std::make_unique<RoseInstrCheckLongLit>(lit.s.get_string(), end_inst);
|
||||
}
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -850,7 +850,7 @@ void makeRoleCheckNotHandled(ProgramBuild &prog_build, RoseVertex v,
|
||||
|
||||
const auto *end_inst = program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrCheckNotHandled>(handled_key, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -979,7 +979,7 @@ bool makeRoleByte(const vector<LookEntry> &look, RoseProgram &program) {
|
||||
const auto *end_inst = program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrCheckByte>(andmask_u8, cmpmask_u8, flip,
|
||||
checkbyte_offset, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1011,7 +1011,7 @@ bool makeRoleMask(const vector<LookEntry> &look, RoseProgram &program) {
|
||||
const auto *end_inst = program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrCheckMask>(and_mask, cmp_mask, neg_mask,
|
||||
base_offset, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1066,7 +1066,7 @@ bool makeRoleMask32(const vector<LookEntry> &look,
|
||||
const auto *end_inst = program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrCheckMask32>(and_mask, cmp_mask, neg_mask,
|
||||
base_offset, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1109,7 +1109,7 @@ bool makeRoleMask64(const vector<LookEntry> &look,
|
||||
const auto *end_inst = program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrCheckMask64>(and_mask, cmp_mask, neg_mask,
|
||||
base_offset, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1474,7 +1474,7 @@ bool makeRoleShufti(const vector<LookEntry> &look, RoseProgram &program,
|
||||
}
|
||||
}
|
||||
assert(ri);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1497,7 +1497,7 @@ void makeLookaroundInstruction(const vector<LookEntry> &look,
|
||||
const CharReach &reach = look.begin()->reach;
|
||||
auto ri = std::make_unique<RoseInstrCheckSingleLookaround>(offset, reach,
|
||||
program.end_instruction());
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1519,7 +1519,7 @@ void makeLookaroundInstruction(const vector<LookEntry> &look,
|
||||
|
||||
auto ri = std::make_unique<RoseInstrCheckLookaround>(look,
|
||||
program.end_instruction());
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -1774,7 +1774,7 @@ bool makeRoleMultipathShufti(const vector<vector<LookEntry>> &multi_look,
|
||||
auto ri = std::make_unique<RoseInstrCheckMultipathShufti16x8>
|
||||
(nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask,
|
||||
lo_bits_mask, neg_mask, base_offset, last_start, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
} else if (multi_len == 32) {
|
||||
neg_mask &= 0xffffffff;
|
||||
assert(!(hi_bits_mask & ~0xffffffffULL));
|
||||
@ -1784,20 +1784,20 @@ bool makeRoleMultipathShufti(const vector<vector<LookEntry>> &multi_look,
|
||||
(hi_mask, lo_mask, bucket_select_lo, data_select_mask,
|
||||
hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
|
||||
last_start, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
} else {
|
||||
auto ri = std::make_unique<RoseInstrCheckMultipathShufti32x16>
|
||||
(hi_mask, lo_mask, bucket_select_hi, bucket_select_lo,
|
||||
data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask,
|
||||
base_offset, last_start, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
} else {
|
||||
auto ri = std::make_unique<RoseInstrCheckMultipathShufti64>
|
||||
(hi_mask, lo_mask, bucket_select_lo, data_select_mask,
|
||||
hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
|
||||
last_start, end_inst);
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1865,10 +1865,10 @@ void makeRoleMultipathLookaround(const vector<vector<LookEntry>> &multi_look,
|
||||
ordered_look.emplace_back(multi_entry);
|
||||
}
|
||||
|
||||
auto ri = std::make_unique<RoseInstrMultipathLookaround>(move(ordered_look),
|
||||
auto ri = std::make_unique<RoseInstrMultipathLookaround>(std::move(ordered_look),
|
||||
last_start, start_mask,
|
||||
program.end_instruction());
|
||||
program.add_before_end(move(ri));
|
||||
program.add_before_end(std::move(ri));
|
||||
}
|
||||
|
||||
static
|
||||
@ -1893,7 +1893,7 @@ void makeRoleLookaround(const RoseBuildImpl &build,
|
||||
vector<LookEntry> look;
|
||||
vector<LookEntry> look_more;
|
||||
if (!looks.empty()) {
|
||||
look = move(looks.front());
|
||||
look = std::move(looks.front());
|
||||
}
|
||||
findLookaroundMasks(build, v, look_more);
|
||||
mergeLookaround(look, look_more);
|
||||
@ -2001,7 +2001,7 @@ void makeRoleInfixTriggers(const RoseBuildImpl &build,
|
||||
triggers.emplace_back(g[e].rose_cancel_prev_top, lbi.queue, top);
|
||||
}
|
||||
|
||||
addInfixTriggerInstructions(move(triggers), program);
|
||||
addInfixTriggerInstructions(std::move(triggers), program);
|
||||
}
|
||||
|
||||
|
||||
@ -2063,7 +2063,7 @@ void makeRoleEagerEodReports(const RoseBuildImpl &build,
|
||||
RoseProgram block;
|
||||
makeRoleReports(build, leftfix_info, needs_catchup,
|
||||
target(e, build.g), block);
|
||||
eod_program.add_block(move(block));
|
||||
eod_program.add_block(std::move(block));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2077,7 +2077,7 @@ void makeRoleEagerEodReports(const RoseBuildImpl &build,
|
||||
addCheckOnlyEodInstruction(program);
|
||||
}
|
||||
|
||||
program.add_before_end(move(eod_program));
|
||||
program.add_before_end(std::move(eod_program));
|
||||
}
|
||||
|
||||
/** Makes a program for a role/vertex given a specific pred/in_edge. */
|
||||
@ -2124,33 +2124,33 @@ RoseProgram makeRoleProgram(const RoseBuildImpl &build,
|
||||
RoseProgram reports_block;
|
||||
makeRoleReports(build, leftfix_info, prog_build.needs_catchup, v,
|
||||
reports_block);
|
||||
effects_block.add_block(move(reports_block));
|
||||
effects_block.add_block(std::move(reports_block));
|
||||
|
||||
RoseProgram infix_block;
|
||||
makeRoleInfixTriggers(build, leftfix_info, engine_info_by_queue, v,
|
||||
infix_block);
|
||||
effects_block.add_block(move(infix_block));
|
||||
effects_block.add_block(std::move(infix_block));
|
||||
|
||||
// Note: SET_GROUPS instruction must be after infix triggers, as an infix
|
||||
// going dead may switch off groups.
|
||||
RoseProgram groups_block;
|
||||
makeRoleGroups(build.g, prog_build, v, groups_block);
|
||||
effects_block.add_block(move(groups_block));
|
||||
effects_block.add_block(std::move(groups_block));
|
||||
|
||||
RoseProgram suffix_block;
|
||||
makeRoleSuffix(build, suffixes, engine_info_by_queue, v, suffix_block);
|
||||
effects_block.add_block(move(suffix_block));
|
||||
effects_block.add_block(std::move(suffix_block));
|
||||
|
||||
RoseProgram state_block;
|
||||
makeRoleSetState(roleStateIndices, v, state_block);
|
||||
effects_block.add_block(move(state_block));
|
||||
effects_block.add_block(std::move(state_block));
|
||||
|
||||
// Note: EOD eager reports may generate a CHECK_ONLY_EOD instruction (if
|
||||
// the program doesn't have one already).
|
||||
RoseProgram eod_block;
|
||||
makeRoleEagerEodReports(build, leftfix_info, prog_build.needs_catchup, v,
|
||||
eod_block);
|
||||
effects_block.add_block(move(eod_block));
|
||||
effects_block.add_block(std::move(eod_block));
|
||||
|
||||
/* a 'ghost role' may do nothing if we know that its groups are already set
|
||||
* - in this case we can avoid producing a program at all. */
|
||||
@ -2158,7 +2158,7 @@ RoseProgram makeRoleProgram(const RoseBuildImpl &build,
|
||||
return {};
|
||||
}
|
||||
|
||||
program.add_before_end(move(effects_block));
|
||||
program.add_before_end(std::move(effects_block));
|
||||
return program;
|
||||
}
|
||||
|
||||
@ -2204,7 +2204,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
|
||||
continue;
|
||||
}
|
||||
|
||||
blocks.emplace_back(move(block));
|
||||
blocks.emplace_back(std::move(block));
|
||||
seen.emplace(blocks.back());
|
||||
}
|
||||
|
||||
@ -2219,10 +2219,10 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
|
||||
if (!prog.empty() && reads_work_done_flag(block)) {
|
||||
RoseProgram clear_block;
|
||||
clear_block.add_before_end(std::make_unique<RoseInstrClearWorkDone>());
|
||||
prog.add_block(move(clear_block));
|
||||
prog.add_block(std::move(clear_block));
|
||||
}
|
||||
|
||||
prog.add_block(move(block));
|
||||
prog.add_block(std::move(block));
|
||||
}
|
||||
|
||||
return prog;
|
||||
@ -2265,7 +2265,7 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
|
||||
engine_info_by_queue, roleStateIndices,
|
||||
prog_build, e);
|
||||
if (!role_prog.empty()) {
|
||||
pred_blocks[pred_state].add_block(move(role_prog));
|
||||
pred_blocks[pred_state].add_block(std::move(role_prog));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2284,7 +2284,7 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
|
||||
auto role_prog = makeRoleProgram(build, leftfix_info, suffixes,
|
||||
engine_info_by_queue, roleStateIndices,
|
||||
prog_build, e);
|
||||
role_programs.add_block(move(role_prog));
|
||||
role_programs.add_block(std::move(role_prog));
|
||||
}
|
||||
|
||||
if (lit_id == build.eod_event_literal_id) {
|
||||
@ -2299,8 +2299,8 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
|
||||
// Literal may squash groups.
|
||||
makeGroupSquashInstruction(build, lit_id, unconditional_block);
|
||||
|
||||
role_programs.add_block(move(unconditional_block));
|
||||
lit_program.add_before_end(move(role_programs));
|
||||
role_programs.add_block(std::move(unconditional_block));
|
||||
lit_program.add_before_end(std::move(role_programs));
|
||||
|
||||
return lit_program;
|
||||
}
|
||||
@ -2331,10 +2331,10 @@ RoseProgram makeDelayRebuildProgram(const RoseBuildImpl &build,
|
||||
makePushDelayedInstructions(build.literals, prog_build,
|
||||
build.literal_info.at(lit_id).delayed_ids,
|
||||
prog);
|
||||
blocks.emplace_back(move(prog));
|
||||
blocks.emplace_back(std::move(prog));
|
||||
}
|
||||
|
||||
return assembleProgramBlocks(move(blocks));
|
||||
return assembleProgramBlocks(std::move(blocks));
|
||||
}
|
||||
|
||||
RoseProgram makeEodAnchorProgram(const RoseBuildImpl &build,
|
||||
@ -2361,7 +2361,7 @@ RoseProgram makeEodAnchorProgram(const RoseBuildImpl &build,
|
||||
for (const auto &id : g[v].reports) {
|
||||
makeReport(build, id, has_som, report_block);
|
||||
}
|
||||
program.add_before_end(move(report_block));
|
||||
program.add_before_end(std::move(report_block));
|
||||
|
||||
return program;
|
||||
}
|
||||
@ -2413,7 +2413,7 @@ void addIncludedJumpProgram(RoseProgram &program, u32 child_offset,
|
||||
RoseProgram block;
|
||||
block.add_before_end(std::make_unique<RoseInstrIncludedJump>(child_offset,
|
||||
squash));
|
||||
program.add_block(move(block));
|
||||
program.add_block(std::move(block));
|
||||
}
|
||||
|
||||
static
|
||||
@ -2423,7 +2423,7 @@ void addPredBlockSingle(u32 pred_state, RoseProgram &pred_block,
|
||||
const auto *end_inst = pred_block.end_instruction();
|
||||
pred_block.insert(begin(pred_block),
|
||||
std::make_unique<RoseInstrCheckState>(pred_state, end_inst));
|
||||
program.add_block(move(pred_block));
|
||||
program.add_block(std::move(pred_block));
|
||||
}
|
||||
|
||||
static
|
||||
@ -2438,7 +2438,7 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
|
||||
|
||||
const RoseInstruction *end_inst = sparse_program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrSparseIterAny>(num_states, keys, end_inst);
|
||||
sparse_program.add_before_end(move(ri));
|
||||
sparse_program.add_before_end(std::move(ri));
|
||||
|
||||
RoseProgram &block = pred_blocks.begin()->second;
|
||||
|
||||
@ -2446,8 +2446,8 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
|
||||
* blocks are being collapsed together */
|
||||
stripCheckHandledInstruction(block);
|
||||
|
||||
sparse_program.add_before_end(move(block));
|
||||
program.add_block(move(sparse_program));
|
||||
sparse_program.add_before_end(std::move(block));
|
||||
program.add_block(std::move(sparse_program));
|
||||
}
|
||||
|
||||
static
|
||||
@ -2462,14 +2462,14 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
|
||||
// BEGIN instruction.
|
||||
auto ri_begin = std::make_unique<RoseInstrSparseIterBegin>(num_states, end_inst);
|
||||
RoseInstrSparseIterBegin *begin_inst = ri_begin.get();
|
||||
sparse_program.add_before_end(move(ri_begin));
|
||||
sparse_program.add_before_end(std::move(ri_begin));
|
||||
|
||||
// NEXT instructions, one per pred program.
|
||||
u32 prev_key = pred_blocks.begin()->first;
|
||||
for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) {
|
||||
auto ri = std::make_unique<RoseInstrSparseIterNext>(prev_key, begin_inst,
|
||||
end_inst);
|
||||
sparse_program.add_before_end(move(ri));
|
||||
sparse_program.add_before_end(std::move(ri));
|
||||
prev_key = it->first;
|
||||
}
|
||||
|
||||
@ -2483,7 +2483,7 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
|
||||
|
||||
assert(dynamic_cast<const RoseInstrSparseIterBegin *>(out_it->get()) ||
|
||||
dynamic_cast<const RoseInstrSparseIterNext *>(out_it->get()));
|
||||
out_it = sparse_program.insert(++out_it, move(flat_prog));
|
||||
out_it = sparse_program.insert(++out_it, std::move(flat_prog));
|
||||
|
||||
// Jump table target for this key is the beginning of the block we just
|
||||
// spliced in.
|
||||
@ -2495,9 +2495,9 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
|
||||
}
|
||||
|
||||
// Write the jump table back into the SPARSE_ITER_BEGIN instruction.
|
||||
begin_inst->jump_table = move(jump_table);
|
||||
begin_inst->jump_table = std::move(jump_table);
|
||||
|
||||
program.add_block(move(sparse_program));
|
||||
program.add_block(std::move(sparse_program));
|
||||
}
|
||||
|
||||
void addPredBlocks(map<u32, RoseProgram> &pred_blocks, u32 num_states,
|
||||
|
@ -242,7 +242,7 @@ u32 SomSlotManager::numSomSlots() const {
|
||||
|
||||
u32 SomSlotManager::addRevNfa(bytecode_ptr<NFA> nfa, u32 maxWidth) {
|
||||
u32 rv = verify_u32(rev_nfas.size());
|
||||
rev_nfas.emplace_back(move(nfa));
|
||||
rev_nfas.emplace_back(std::move(nfa));
|
||||
|
||||
// A rev nfa commits us to having enough history around to handle its
|
||||
// max width.
|
||||
|
@ -41,5 +41,17 @@
|
||||
#define VECTORSIZE 16
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_FEATURE_SVE)
|
||||
#define HAVE_SVE
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_FEATURE_SVE2)
|
||||
#define HAVE_SVE2
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_FEATURE_SVE2_BITPERM)
|
||||
#define HAVE_SVE2_BITPERM
|
||||
#endif
|
||||
|
||||
#endif // UTIL_ARCH_ARM_H_
|
||||
|
||||
|
41
src/util/arch/ppc64el/cpuid_flags.c
Normal file
41
src/util/arch/ppc64el/cpuid_flags.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
* Copyright (c) 2020-2023, VectorCamp PC
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Intel Corporation nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "util/arch/common/cpuid_flags.h"
|
||||
#include "ue2common.h"
|
||||
#include "hs_compile.h" // for HS_MODE_ flags
|
||||
#include "util/arch.h"
|
||||
|
||||
u64a cpuid_flags(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 cpuid_tune(void) {
|
||||
return HS_TUNE_FAMILY_GENERIC;
|
||||
}
|
@ -43,6 +43,11 @@
|
||||
|
||||
#include <string.h> // for memcpy
|
||||
|
||||
#if defined(__clang__) && (__clang_major__ == 15)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
|
||||
typedef __vector unsigned long long int uint64x2_t;
|
||||
typedef __vector signed long long int int64x2_t;
|
||||
typedef __vector unsigned int uint32x4_t;
|
||||
@ -124,8 +129,8 @@ static really_really_inline
|
||||
m128 rshift_m128(m128 a, unsigned b) {
|
||||
if (b == 0) return a;
|
||||
m128 sl = (m128) vec_splats((uint8_t) b << 3);
|
||||
m128 result = (m128) vec_sro((uint8x16_t) a, (uint8x16_t) sl);
|
||||
return result;
|
||||
uint8x16_t result = vec_sro((uint8x16_t) a, (uint8x16_t) sl);
|
||||
return (m128) result;
|
||||
}
|
||||
|
||||
static really_really_inline
|
||||
@ -420,4 +425,8 @@ m128 set2x64(u64a hi, u64a lo) {
|
||||
return (m128) v;
|
||||
}
|
||||
|
||||
#if defined(__clang__) && (__clang_major__ == 15)
|
||||
#pragma clang diagnostic pop
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
|
||||
#endif // ARCH_PPC64EL_SIMD_UTILS_H
|
||||
|
@ -74,7 +74,7 @@ vector<u32> findCliqueGroup(CliqueGraph &cg) {
|
||||
// Get the vertex to start from
|
||||
vector<u32> clique;
|
||||
while (!gStack.empty()) {
|
||||
vector<u32> g = move(gStack.top());
|
||||
vector<u32> g = std::move(gStack.top());
|
||||
gStack.pop();
|
||||
|
||||
// Choose a vertex from the graph
|
||||
|
@ -158,18 +158,25 @@ really_inline SuperVector<16>::SuperVector(uint32_t const other)
|
||||
u.u32x4[0] = vec_splats(static_cast<uint32_t>(other));
|
||||
}
|
||||
|
||||
#if defined(__clang__) && (__clang_major__ >= 15)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
template<>
|
||||
template<>
|
||||
really_inline SuperVector<16>::SuperVector(int64_t const other)
|
||||
{
|
||||
u.s64x2[0] = (int64x2_t) vec_splats(static_cast<ulong64_t>(other));
|
||||
u.s64x2[0] = reinterpret_cast<int64x2_t>(vec_splats(static_cast<ulong64_t>(other)));
|
||||
}
|
||||
#if defined(__clang__) && (__clang_major__ >= 15)
|
||||
#pragma clang diagnostic pop
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
|
||||
template<>
|
||||
template<>
|
||||
really_inline SuperVector<16>::SuperVector(uint64_t const other)
|
||||
{
|
||||
u.u64x2[0] = (uint64x2_t) vec_splats(static_cast<ulong64_t>(other));
|
||||
u.u64x2[0] = reinterpret_cast<uint64x2_t>(vec_splats(static_cast<ulong64_t>(other)));
|
||||
}
|
||||
|
||||
// Constants
|
||||
@ -266,6 +273,10 @@ really_inline SuperVector<16> SuperVector<16>::eq(SuperVector<16> const &b) cons
|
||||
return (*this == b);
|
||||
}
|
||||
|
||||
#if defined(__clang__) && (__clang_major__ >= 15)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
template <>
|
||||
really_inline typename SuperVector<16>::comparemask_type
|
||||
SuperVector<16>::comparemask(void) const {
|
||||
@ -273,9 +284,12 @@ SuperVector<16>::comparemask(void) const {
|
||||
uint8x16_t bitmask = vec_gb(u.u8x16[0]);
|
||||
bitmask = (uint8x16_t) vec_perm(vec_splat_u8(0), bitmask, perm);
|
||||
u32 ALIGN_ATTR(16) movemask;
|
||||
vec_ste((uint32x4_t) bitmask, 0, &movemask);
|
||||
vec_ste(reinterpret_cast<uint32x4_t>(bitmask), 0, &movemask);
|
||||
return movemask;
|
||||
}
|
||||
#if defined(__clang__) && (__clang_major__ >= 15)
|
||||
#pragma clang diagnostic pop
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
|
||||
template <>
|
||||
really_inline typename SuperVector<16>::comparemask_type
|
||||
|
@ -1145,7 +1145,7 @@ really_inline SuperVector<32> SuperVector<32>::loadu_maskz(void const *ptr, uint
|
||||
template<>
|
||||
really_inline SuperVector<32> SuperVector<32>::alignr(SuperVector<32> &other, int8_t offset)
|
||||
{
|
||||
#if defined(HAVE__BUILTIN_CONSTANT_P)
|
||||
#if defined(HAVE__BUILTIN_CONSTANT_P) && !(defined(__GNUC__) && (__GNUC__ == 13))
|
||||
if (__builtin_constant_p(offset)) {
|
||||
if (offset == 16) {
|
||||
return *this;
|
||||
|
@ -174,7 +174,7 @@ unique_ptr<EngineStream> EngineHyperscan::streamOpen(EngineContext &ectx,
|
||||
return nullptr;
|
||||
}
|
||||
stream->sn = streamId;
|
||||
return move(stream);
|
||||
return std::move(stream);
|
||||
}
|
||||
|
||||
void EngineHyperscan::streamClose(unique_ptr<EngineStream> stream,
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
thread_barrier &tb_in, thread_func_t function_in,
|
||||
vector<DataBlock> corpus_data_in)
|
||||
: num(num_in), results(repeats), engine(db_in),
|
||||
enginectx(db_in.makeContext()), corpus_data(move(corpus_data_in)),
|
||||
enginectx(db_in.makeContext()), corpus_data(std::move(corpus_data_in)),
|
||||
tb(tb_in), function(function_in) {}
|
||||
|
||||
// Start the thread.
|
||||
@ -219,7 +219,7 @@ void usage(const char *error) {
|
||||
/** Wraps up a name and the set of signature IDs it refers to. */
|
||||
struct BenchmarkSigs {
|
||||
BenchmarkSigs(string name_in, SignatureSet sigs_in)
|
||||
: name(move(name_in)), sigs(move(sigs_in)) {}
|
||||
: name(std::move(name_in)), sigs(std::move(sigs_in)) {}
|
||||
string name;
|
||||
SignatureSet sigs;
|
||||
};
|
||||
@ -457,7 +457,7 @@ void processArgs(int argc, char *argv[], vector<BenchmarkSigs> &sigSets,
|
||||
for (const auto &file : sigFiles) {
|
||||
SignatureSet sigs;
|
||||
loadSignatureList(file, sigs);
|
||||
sigSets.emplace_back(file, move(sigs));
|
||||
sigSets.emplace_back(file, std::move(sigs));
|
||||
}
|
||||
|
||||
useLiteralApi = (bool)literalFlag;
|
||||
@ -590,7 +590,7 @@ void benchStreamingInternal(ThreadContext *ctx, vector<StreamInfo> &streams,
|
||||
|
||||
// if this was the last block in the stream, close the stream handle
|
||||
if (b.id == stream.last_block_id) {
|
||||
e.streamClose(move(stream.eng_handle), r);
|
||||
e.streamClose(std::move(stream.eng_handle), r);
|
||||
stream.eng_handle = nullptr;
|
||||
}
|
||||
}
|
||||
@ -963,7 +963,7 @@ void runBenchmark(const Engine &db,
|
||||
printf("Unable to start processing thread %u\n", i);
|
||||
exit(1);
|
||||
}
|
||||
threads.push_back(move(t));
|
||||
threads.push_back(std::move(t));
|
||||
}
|
||||
|
||||
// Reap threads.
|
||||
@ -1011,7 +1011,7 @@ int HS_CDECL main(int argc, char *argv[]) {
|
||||
for (auto i : exprMapTemplate | map_keys) {
|
||||
sigs.push_back(i);
|
||||
}
|
||||
sigSets.emplace_back(exprPath, move(sigs));
|
||||
sigSets.emplace_back(exprPath, std::move(sigs));
|
||||
}
|
||||
|
||||
// read in and process our corpus
|
||||
|
@ -133,7 +133,7 @@ void CNGInfo::compile() {
|
||||
auto pl = std::make_unique<ParsedLogical>();
|
||||
pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL);
|
||||
pl->logicalKeyRenumber();
|
||||
cng = make_unique<CompiledNG>(move(pl));
|
||||
cng = make_unique<CompiledNG>(std::move(pl));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ void CNGInfo::compile() {
|
||||
}
|
||||
}
|
||||
|
||||
cng = make_unique<CompiledNG>(move(g), move(rm));
|
||||
cng = make_unique<CompiledNG>(std::move(g), std::move(rm));
|
||||
} catch (CompileError &e) {
|
||||
throw NGCompileFailure(e.reason);
|
||||
} catch (NGUnsupportedFailure &e) {
|
||||
|
@ -107,7 +107,7 @@ void NfaGeneratedCorpora::generate(unsigned id, vector<Corpus> &data) {
|
||||
a_subid = it.first;
|
||||
vector<Corpus> sub_data;
|
||||
generate(a_subid, sub_data);
|
||||
m_data.emplace(a_subid, move(sub_data));
|
||||
m_data.emplace(a_subid, std::move(sub_data));
|
||||
}
|
||||
assert(!m_data.empty());
|
||||
size_t num_corpus = m_data[a_subid].size();
|
||||
|
@ -1079,7 +1079,7 @@ shared_ptr<BaseDB> UltimateTruth::compile(const set<unsigned> &ids,
|
||||
}
|
||||
}
|
||||
|
||||
return move(db);
|
||||
return std::move(db);
|
||||
}
|
||||
|
||||
bool UltimateTruth::allocScratch(shared_ptr<const BaseDB> db) {
|
||||
|
@ -1188,7 +1188,7 @@ struct CorpusGenUnit {
|
||||
CorpusGenUnit(unique_ptr<CNGInfo> cngi_in, unique_ptr<CompiledPcre> pcre_in,
|
||||
shared_ptr<DatabaseProxy> ue2_in, unsigned expr_id,
|
||||
bool multi_in, bool utf8_in)
|
||||
: cngi(move(cngi_in)), pcre(move(pcre_in)), ue2(ue2_in), id(expr_id),
|
||||
: cngi(std::move(cngi_in)), pcre(std::move(pcre_in)), ue2(ue2_in), id(expr_id),
|
||||
multi(multi_in), utf8(utf8_in) {}
|
||||
|
||||
unique_ptr<CNGInfo> cngi;
|
||||
@ -1220,7 +1220,7 @@ public:
|
||||
}
|
||||
|
||||
addCorporaToQueue(out, testq, c->id, *corpora, summary,
|
||||
move(c->pcre), move(c->cngi), c->ue2, c->multi,
|
||||
std::move(c->pcre), std::move(c->cngi), c->ue2, c->multi,
|
||||
c->utf8);
|
||||
|
||||
count++;
|
||||
@ -1434,7 +1434,7 @@ unique_ptr<CorpusGenUnit> makeCorpusGenUnit(unsigned id, TestSummary &summary,
|
||||
// Caller may already have set the UTF-8 property (in multi cases)
|
||||
utf8 |= cpcre ? cpcre->utf8 : cngi->utf8;
|
||||
|
||||
return std::make_unique<CorpusGenUnit>(move(cngi), move(cpcre), ue2, id,
|
||||
return std::make_unique<CorpusGenUnit>(std::move(cngi), std::move(cpcre), ue2, id,
|
||||
multi, utf8);
|
||||
}
|
||||
|
||||
@ -1489,7 +1489,7 @@ void buildSingle(BoundedQueue<CorpusGenUnit> &corpq, TestSummary &summary,
|
||||
auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, ue2,
|
||||
multi, utf8);
|
||||
if (u) {
|
||||
corpq.push(move(u));
|
||||
corpq.push(std::move(u));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1547,7 +1547,7 @@ void buildBanded(BoundedQueue<CorpusGenUnit> &corpq, TestSummary &summary,
|
||||
auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate,
|
||||
ue2, multi, utf8);
|
||||
if (u) {
|
||||
corpq.push(move(u));
|
||||
corpq.push(std::move(u));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1587,7 +1587,7 @@ void buildMulti(BoundedQueue<CorpusGenUnit> &corpq, TestSummary &summary,
|
||||
auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, ue2,
|
||||
multi, utf8);
|
||||
if (u) {
|
||||
corpq.push(move(u));
|
||||
corpq.push(std::move(u));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1607,7 +1607,7 @@ void generateTests(CorporaSource &corpora_src, const ExpressionMap &exprMap,
|
||||
for (size_t i = 0; i < numGeneratorThreads; i++) {
|
||||
auto c = make_unique<CorpusGenThread>(i, testq, corpq, corpora_src);
|
||||
c->start();
|
||||
generators.push_back(move(c));
|
||||
generators.push_back(std::move(c));
|
||||
}
|
||||
|
||||
if (g_ue2CompileAll && multicompile_bands) {
|
||||
@ -1830,11 +1830,11 @@ unique_ptr<CorporaSource> buildCorpora(const vector<string> &corporaFiles,
|
||||
exit_with_fail();
|
||||
}
|
||||
}
|
||||
return move(c); /* move allows unique_ptr<CorporaSource> conversion */
|
||||
return std::move(c); /* move allows unique_ptr<CorporaSource> conversion */
|
||||
} else {
|
||||
auto c = std::make_unique<NfaGeneratedCorpora>(
|
||||
exprMap, corpus_gen_prop, force_utf8, force_prefilter);
|
||||
return move(c);
|
||||
return std::move(c);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1883,7 +1883,7 @@ bool runTests(CorporaSource &corpora_source, const ExpressionMap &exprMap,
|
||||
for (size_t i = 0; i < numScannerThreads; i++) {
|
||||
auto s = std::make_unique<ScanThread>(i, testq, exprMap, plat, grey);
|
||||
s->start();
|
||||
scanners.push_back(move(s));
|
||||
scanners.push_back(std::move(s));
|
||||
}
|
||||
|
||||
generateTests(corpora_source, exprMap, summary, plat, grey, testq);
|
||||
|
@ -56,14 +56,9 @@ set(unit_hyperscan_SOURCES
|
||||
hyperscan/test_util.h
|
||||
)
|
||||
add_executable(unit-hyperscan ${unit_hyperscan_SOURCES})
|
||||
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
|
||||
target_link_libraries(unit-hyperscan hs_shared expressionutil)
|
||||
else()
|
||||
target_link_libraries(unit-hyperscan hs expressionutil)
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT FAT_RUNTIME )
|
||||
if (NOT FAT_RUNTIME AND BUILD_STATIC_LIBS)
|
||||
set(unit_internal_SOURCES
|
||||
${gtest_SOURCES}
|
||||
internal/bitfield.cpp
|
||||
@ -133,7 +128,7 @@ endif(NOT RELEASE_BUILD)
|
||||
add_executable(unit-internal ${unit_internal_SOURCES})
|
||||
set_target_properties(unit-internal PROPERTIES COMPILE_FLAGS "${HS_CXX_FLAGS}")
|
||||
target_link_libraries(unit-internal hs corpusomatic)
|
||||
endif(NOT FAT_RUNTIME)
|
||||
endif (NOT FAT_RUNTIME AND BUILD_STATIC_LIBS)
|
||||
|
||||
if (BUILD_CHIMERA)
|
||||
# enable Chimera unit tests
|
||||
|
@ -280,7 +280,11 @@ TEST_P(BadPattern, Stream) {
|
||||
|
||||
static
|
||||
vector<BadPatternParam> getBadPatterns() {
|
||||
#ifdef NDEBUG
|
||||
string filename = "unit/hyperscan/bad_patterns.txt";
|
||||
#else
|
||||
string filename = "unit/hyperscan/bad_patterns_fast.txt";
|
||||
#endif
|
||||
|
||||
ifstream f;
|
||||
f.open(filename.c_str(), ifstream::in);
|
||||
|
159
unit/hyperscan/bad_patterns_fast.txt
Normal file
159
unit/hyperscan/bad_patterns_fast.txt
Normal file
@ -0,0 +1,159 @@
|
||||
1:/\c空/ #\c must be followed by an ASCII character at index 0.
|
||||
2:/\c/ #\c must be followed by an ASCII character at index 0.
|
||||
3:/[\c空]/ #\c must be followed by an ASCII character at index 1.
|
||||
4:/[\c]/ #Unterminated character class starting at index 0.
|
||||
5:/\c空/8 #\c must be followed by an ASCII character at index 0.
|
||||
6:/<([^>+i)>.*?</\1>/sP #Unterminated character class starting at index 2.
|
||||
6:/[foo/ #Unterminated character class starting at index 0.
|
||||
7:/[\p{X}]/8 #Unknown property at index 4.
|
||||
8:/[\p{^X}]/8 #Unknown property at index 5.
|
||||
9:/[\p{L]/8 #Malformed property at index 0.
|
||||
10:/[\p{^L]/8 #Malformed property at index 0.
|
||||
11:/[\P{L]/8 #Malformed property at index 0.
|
||||
12:/[\P{^L]/8 #Malformed property at index 0.
|
||||
13:/\p/8 #Malformed property at index 0.
|
||||
14:/\P/8 #Malformed property at index 0.
|
||||
15:/\p{/8 #Malformed property at index 0.
|
||||
16:/\P{/8 #Malformed property at index 0.
|
||||
17:/\p{^/8 #Malformed property at index 0.
|
||||
18:/\P{^/8 #Malformed property at index 0.
|
||||
19:/[\p/8 #Malformed property at index 1.
|
||||
20:/[\P/8 #Malformed property at index 1.
|
||||
21:/[\p{/8 #Malformed property at index 0.
|
||||
22:/[\P{/8 #Malformed property at index 0.
|
||||
23:/[\p{^/8 #Malformed property at index 0.
|
||||
24:/[\P{^/8 #Malformed property at index 0.
|
||||
25:/\pl/8 #Unknown property at index 2.
|
||||
26:/\p{any}/8 #Unknown property at index 3.
|
||||
27:/\p{greek}/8 #Unknown property at index 3.
|
||||
28:/\b/8W #\b unsupported in UCP mode at index 0.
|
||||
29:/(*UCP)\b/8 #\b unsupported in UCP mode at index 6.
|
||||
30:/\B/8W #\B unsupported in UCP mode at index 0.
|
||||
31:/\B/W #\B unsupported in UCP mode at index 0.
|
||||
32:/foo(?{print "Hello world\n";})bar/ #Embedded code is not supported at index 3.
|
||||
33:/the (\S+)(?{ $color = $^N }) (\S+)(?{ $animal = $^N })/i #Embedded code is not supported at index 9.
|
||||
35:/\X/8 #\X unsupported at index 0.
|
||||
36:/\B+/ #Invalid repeat at index 2.
|
||||
37:/\B?/ #Invalid repeat at index 2.
|
||||
38:/\B*/ #Invalid repeat at index 2.
|
||||
39:/\B{0,6}/ #Invalid repeat at index 2.
|
||||
40:/\b+/ #Invalid repeat at index 2.
|
||||
41:/\b?/ #Invalid repeat at index 2.
|
||||
42:/\b*/ #Invalid repeat at index 2.
|
||||
43:/\b{0,6}/ #Invalid repeat at index 2.
|
||||
44:/[.ch.]/ #Unsupported POSIX collating element at index 0.
|
||||
45:/[=ch=]/ #Unsupported POSIX collating element at index 0.
|
||||
46:/[:digit:]/ #POSIX named classes are only supported inside a class at index 0.
|
||||
47:/[[.ch.]]/ #Unsupported POSIX collating element at index 1.
|
||||
48:/[[=ch=]]/ #Unsupported POSIX collating element at index 1.
|
||||
49:/foo(?m)?bar/ #Invalid repeat at index 7.
|
||||
50:/.(?)+/ #Invalid repeat at index 4.
|
||||
51:/(abc)\2/P #Invalid back reference to expression 2.
|
||||
52:/\x{100000000}/ #Value in \x{...} sequence is too large at index 0.
|
||||
53:/^foo/{min_offset=5} #Expression is anchored and cannot satisfy min_offset=5 as it can only produce matches of length 3 bytes at most.
|
||||
54:/foobar/{min_length=20} #Expression has min_length=20 but can only produce matches of length 6 bytes at most.
|
||||
55:/foobar/{max_offset=3} #Expression has max_offset=3 but requires 6 bytes to match.
|
||||
56:/mkdzo(x|u)(\b)kd/{max_offset=29} #Pattern can never match.
|
||||
57:/[^\x00-\xff]/ #Pattern can never match.
|
||||
58:/[^\x00-\xff]foo/ #Pattern can never match.
|
||||
59:/^\Bfoo/ #Pattern can never match.
|
||||
60:/^\B\Bfoo/ #Pattern can never match.
|
||||
61:/can't_match\b\B/ #Pattern can never match.
|
||||
62:/\b\Bcan't_match/ #Pattern can never match.
|
||||
63:/^\b$/m #Pattern can never match.
|
||||
64:/^\b\Z/m #Pattern can never match.
|
||||
65:/^\b\z/m #Pattern can never match.
|
||||
66:/\A\b$/m #Pattern can never match.
|
||||
67:/\A\b\Z/m #Pattern can never match.
|
||||
68:/\A\b\z/m #Pattern can never match.
|
||||
69:/^[^\x00-\xff]foo/ #Pattern can never match.
|
||||
70:/foo[^\x00-\xff]/ #Pattern can never match.
|
||||
71:/foo[^\x00-\xff]$/ #Pattern can never match.
|
||||
72:/\Bd\B/i{min_length=2,min_offset=4,max_offset=54} #Expression has min_length=2 but can only produce matches of length 1 bytes at most.
|
||||
74:/(((.|aaa)aaaaaa.aaa){14,19}a((a|a{5,6}|aa){3,11}|aa.|a){2}){40}\Z/smL #Pattern is too large.
|
||||
75:/\B/s8{min_length=1} #Expression has min_length=1 but can only produce matches of length 0 bytes at most.
|
||||
76:/(f|d|(\b)|i|a\Z)/mHV8{min_length=2,min_offset=9,max_offset=14} #Expression has min_length=2 but can only produce matches of length 1 bytes at most.
|
||||
77:/(f|e|d{19,}|h\Z|^j|\Aa)/smi{min_length=7,min_offset=8,max_offset=18} #Extended parameter constraints can not be satisfied for any match from this expression.
|
||||
78:/(i{13,}|i\Z)/s{min_length=3,max_offset=5} #Extended parameter constraints can not be satisfied for any match from this expression.
|
||||
79:/(?P<dupename>foo).*(?P<dupename>bar)/ #Two named subpatterns use the name 'dupename' at index 19.
|
||||
80:/_W{0,3}bazr_W{0,3}(ac[_a-z]{22}a)?e_W{0,3}bazr[_a-z](ac[a-z]{4}c{14}[a-z]{5})?e_W{0,3}bazr[_a-z](e|ac[_a-z]{4}c{16}([_a-z]|[a-p]W|[o-z]WW){3}([_a-z]|WWW))_W{0,3}bazr([_a-z]|[a-p]WW?|[o-z]WWW)a(foobar|c([a-z]W{0,3})bc([a-z]W{0,3})c{14}([_a-z]W{0,3}){6})((fooaa|[_a-z]W{0,3})bazr[_a-z]W{0,5}a(foobar|c([_a-z]|[a-z]W{1,3})bc([_a-z]|[o-z]W{1,5})c{14}([_a-f]|[A-Z0]W|~WW|;WWW){6})){40}(fooaa|_)bazr[_a-z]/sL #Pattern is too large.
|
||||
81:/[..]/ #Unsupported POSIX collating element at index 0.
|
||||
82:/[==]/ #Unsupported POSIX collating element at index 0.
|
||||
83:/[.\].]/ #Unsupported POSIX collating element at index 0.
|
||||
84:/[=\]=]/ #Unsupported POSIX collating element at index 0.
|
||||
85:/A(?!)+Z/ #Invalid repeat at index 5.
|
||||
86:/\X/ #\X unsupported at index 0.
|
||||
88:/[A-\d]/ #Invalid range in character class at index 3.
|
||||
89:/[A-[:digit:]]/ #Invalid range in character class at index 3.
|
||||
90:/B[--[:digit:]--]+/ #Invalid range in character class at index 4.
|
||||
91:/a\owibble/ #Value in \o{...} sequence is non-octal or missing braces at index 1.
|
||||
92:/a\o{wibble/ #Value in \o{...} sequence is non-octal or missing braces at index 1.
|
||||
93:/a\o{777}/ #Value in \o{...} sequence is too large at index 1.
|
||||
94:/(*UTF16)foo/ #Unsupported control verb (*UTF16) at index 0.
|
||||
95:/(*BSR_UNICODE)abc/ #Unsupported control verb (*BSR_UNICODE) at index 0.
|
||||
96:/a+(*SKIP)b/ #Unknown control verb (*SKIP) at index 2.
|
||||
97:/foo(*/ #Invalid repeat at index 4.
|
||||
98:/[:\]:]/ #POSIX named classes are only supported inside a class at index 0.
|
||||
99:/[[:[:]/ #Invalid POSIX named class at index 1.
|
||||
100:/abc(?(1)def|ghi)/P #Invalid conditional reference to expression 1.
|
||||
101:/abc(?(<blah>)def|ghi)/P #Invalid conditional reference to label 'blah'.
|
||||
102:/(?(DEFINE)foo|bar)/P #DEFINE conditional group with more than one branch at index 17.
|
||||
103:/(?<1name>group)/ #Group name cannot begin with a digit at index 0.
|
||||
104:/abc((def)?(?(R)bar))+/P #Pattern recursion not supported at index 10.
|
||||
105:/abc((def)?(?(R2)bar))+/P #Pattern recursion not supported at index 10.
|
||||
106:/abc((def)(?(R&label)bar))+/P #Pattern recursion not supported at index 9.
|
||||
107:/\o{4200000}/8 #Value in \o{...} sequence is too large at index 0.
|
||||
108:/\o{19}/ #Value in \o{...} sequence is non-octal or missing braces at index 0.
|
||||
109:/\o{/ #Value in \o{...} sequence is non-octal or missing braces at index 0.
|
||||
110:/\o{1/ #Value in \o{...} sequence is non-octal or missing braces at index 0.
|
||||
111:/\x{0x110000}/8 #Value in \x{...} sequence is non-hex or missing } at index 0.
|
||||
112:/\cÀ/ #\c must be followed by an ASCII character at index 0.
|
||||
113:/[\cÀ]/ #\c must be followed by an ASCII character at index 1.
|
||||
114:/[\o{4200000}]/8 #Value in \o{...} sequence is too large at index 1.
|
||||
115:/[\x{0x110000}]/8 #Value in \x{...} sequence is non-hex or missing } at index 1.
|
||||
116:/[\o{70]/ #Value in \o{...} sequence is non-octal or missing braces at index 1.
|
||||
117:/[\x{ff]/ #Value in \x{...} sequence is non-hex or missing } at index 1.
|
||||
118:/foo/{min_offset=10,max_offset=9} #In hs_expr_ext, min_offset must be less than or equal to max_offset.
|
||||
120:/foo/{min_length=10,max_offset=9} #In hs_expr_ext, min_length must be less than or equal to max_offset.
|
||||
122:/ÀÀ/8 #Expression is not valid UTF-8.
|
||||
123:/hello \6 world/P #Invalid back reference to expression 6.
|
||||
124:/hello \6 world|dog/P #Invalid back reference to expression 6.
|
||||
125:/[~-\V]/8 #Invalid range in character class at index 3.
|
||||
126:/(*UTF8)ÀÀ/ #Expression is not valid UTF-8.
|
||||
127:/^fo?ob{ro|nax_off\Qt=10omnax+8Wnah/ñññññññññññññññññññññññññññ0}l.{1,60}Car*k|npanomnax+8Wnah/8 #Expression is not valid UTF-8.
|
||||
128:/(*UTF8)^fo?ob{ro|nax_off\Qt=10omnax+8Wnah/ñññññññññññññññññññññññññññ0}l.{1,60}Car*k|npanomnax+8Wnah/ #Expression is not valid UTF-8.
|
||||
129:/bignum \1111111111111111111/ #Number is too big at index 7.
|
||||
130:/foo|&{5555555,}/ #Bounded repeat is too large.
|
||||
131:/[a[..]]/ #Unsupported POSIX collating element at index 2.
|
||||
132:/[a[==]]/ #Unsupported POSIX collating element at index 2.
|
||||
133:/[a[.\].]]/ #Unsupported POSIX collating element at index 2.
|
||||
134:/[a[=\]=]]/ #Unsupported POSIX collating element at index 2.
|
||||
135:/[^\D\d]/8W #Pattern can never match.
|
||||
136:/(*LIMIT_MATCH=1000)foobar/ #Unsupported control verb (*LIMIT_MATCH=1000) at index 0.
|
||||
137:/(*UTF32)foobar/ #Unsupported control verb (*UTF32) at index 0.
|
||||
138:/(*UNKNOWNVERB)foobar/ #Unknown control verb (*UNKNOWNVERB) at index 0.
|
||||
139:/foo(*UTF8)bar/ #(*UTF8) must be at start of expression, encountered at index 5.
|
||||
140:/(?i)(*UTF8)foobar/ #(*UTF8) must be at start of expression, encountered at index 6.
|
||||
141:/(*@&/ #Unknown control verb at index 2.
|
||||
142:/abcd/si{edit_distance=4} #Approximate matching patterns that reduce to vacuous patterns are disallowed.
|
||||
143:/foobar|hatstand/sL{edit_distance=6} #Approximate matching patterns that reduce to vacuous patterns are disallowed.
|
||||
144:/abc\b/{edit_distance=1} #Zero-width assertions are disallowed for approximate matching.
|
||||
145:/abc/8{edit_distance=1} #UTF-8 is disallowed for approximate matching.
|
||||
146:/(*UTF8)abc/{edit_distance=1} #UTF-8 is disallowed for approximate matching.
|
||||
147:/\b\BMYBt/s{edit_distance=1} #Pattern can never match.
|
||||
148:/\QÀ\Eaaaa/8 #Expression is not valid UTF-8.
|
||||
149:/[\QÀ\Eaaaa]/8 #Expression is not valid UTF-8.
|
||||
150:/abcd/{edit_distance=1,hamming_distance=1} #In hs_expr_ext, cannot have both edit distance and Hamming distance.
|
||||
151:/141 | abc/C #Unknown character at index 6.
|
||||
152:/141 & | 142/C #Not enough operand at index 6.
|
||||
153:/141 142 & 143/C #Not enough operator at index 13.
|
||||
154:/141 !142/C #Not enough operator at index 8.
|
||||
155:/141 & 142 |/C #Not enough operand at index 11.
|
||||
156:/)141 & 142 /C #Not enough left parentheses at index 0.
|
||||
157:/(141 & (142|!143) |144/C #Not enough right parentheses at index 22.
|
||||
158:/141 & (142|!143) )| 144/C #Not enough left parentheses at index 17.
|
||||
159:/1234567890 & (142|!143 )/C #Expression id too large at index 10.
|
||||
160:/141 & (142|!143 )|/C #Not enough operand at index 18.
|
||||
161:/141/C #No logical operation.
|
||||
162:/119 & 121/C #Unknown sub-expression id.
|
||||
163:/166 & 167/C #Unknown sub-expression id.
|
@ -157,7 +157,11 @@ TEST_P(HyperscanScanGigabytesMatch, StreamingMatch) {
|
||||
|
||||
// gb is the number of gigabytes to scan between pre-block and post-block
|
||||
// run over 1,2,4,8 gb
|
||||
#ifdef NDEBUG
|
||||
for (unsigned long long gb = 1; gb <= 8; gb *= 2) {
|
||||
#else
|
||||
for (unsigned long long gb = 1; gb <= 2; gb *= 2) {
|
||||
#endif
|
||||
SCOPED_TRACE(gb);
|
||||
|
||||
hs_stream_t *stream = nullptr;
|
||||
@ -261,12 +265,12 @@ TEST_P(HyperscanScanGigabytesMatch, BlockMatch) {
|
||||
1*1024,
|
||||
#ifdef BIG_BLOCKS
|
||||
4*1024, 32*1024, 128*1024, 512*1024,
|
||||
#ifdef NDEBUG
|
||||
// gigabytes
|
||||
1024*1024,
|
||||
#ifdef ARCH_X86_64
|
||||
// big cases for big beefy machines
|
||||
2048*1024, 3072*1024
|
||||
#endif // ARCH_X86_64
|
||||
#endif // NDEBUG
|
||||
#endif // BIG_BLOCKS
|
||||
};
|
||||
|
||||
@ -1333,6 +1337,7 @@ TEST(regression, UE_2425) {
|
||||
hs_free_database(db);
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
TEST(regression, UE_2485) {
|
||||
const char regex[] = "(?:(.EeEa|((a{2}BD[bc]Bd[eae]|[DCd]|c|ebCa|d)){7,21})(E{5,}A{4,}[Cc].cc{3,6}|eCec|e+CaBEd|[Bb])){10}DB(a|[AAda])..A?DE?E";
|
||||
unsigned flags = HS_FLAG_DOTALL | HS_FLAG_CASELESS | HS_FLAG_UTF8 |
|
||||
@ -1348,6 +1353,7 @@ TEST(regression, UE_2485) {
|
||||
ASSERT_NE(nullptr, db);
|
||||
hs_free_database(db);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(regression, UE_2452) {
|
||||
const char regex[] = "/ab.b[bca]{2,}ca((?:c|(abc(?sxmi-xm)){10,14}|c|b|[abcb])){4,23}acbcbb*ba((?:(a|.{4,}|.|[acba])){3,16}a)+";
|
||||
@ -1364,6 +1370,7 @@ TEST(regression, UE_2452) {
|
||||
hs_free_database(db);
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
TEST(regression, UE_2595) {
|
||||
const char regex[] = "(?:(?:acAa|c[EAA]aEb|((?:CC[bdd].cE((?x-msix)BE){32}(?:\\B)){16,19}CdD.E(E|E|B)){3,6}|E(a|d|.)(?:(?xs-isxm)|b|.|C))){17,}";
|
||||
unsigned flags = HS_FLAG_MULTILINE | HS_FLAG_CASELESS |
|
||||
@ -1378,6 +1385,7 @@ TEST(regression, UE_2595) {
|
||||
ASSERT_NE(nullptr, db);
|
||||
hs_free_database(db);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(regression, UE_2762) {
|
||||
const vector<pattern> patterns = {
|
||||
|
@ -235,7 +235,11 @@ static const unsigned test_modes[] = {HS_MODE_BLOCK, HS_MODE_STREAM,
|
||||
static const unsigned test_flags[] = {0, HS_FLAG_SINGLEMATCH,
|
||||
HS_FLAG_SOM_LEFTMOST};
|
||||
|
||||
#ifdef NDEBUG
|
||||
static const unsigned test_sizes[] = {1, 10, 100, 500, 10000};
|
||||
#else
|
||||
static const unsigned test_sizes[] = {1, 10, 100, 500};
|
||||
#endif
|
||||
|
||||
static const pair<unsigned, unsigned> test_bounds[] = {{3u, 10u}, {10u, 100u}};
|
||||
|
||||
|
@ -363,9 +363,11 @@ static const unsigned validModes[] = {
|
||||
// Mode bits for switching off various architecture features
|
||||
static const unsigned long long featureMask[] = {
|
||||
~0ULL, /* native */
|
||||
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
|
||||
~(HS_CPU_FEATURES_AVX2 | HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx2 */
|
||||
~(HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx512 */
|
||||
~HS_CPU_FEATURES_AVX512VBMI, /* no avx512vbmi */
|
||||
#endif
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Single,
|
||||
|
@ -1327,16 +1327,19 @@ static const MultiBitTestParam multibitTests[] = {
|
||||
{ 1024, 1 },
|
||||
{ 1025, 1 },
|
||||
{ 2099, 1 },
|
||||
#ifdef NDEBUG
|
||||
{ 10000, 1 },
|
||||
{ 32768, 1 },
|
||||
{ 32769, 1 },
|
||||
{ 200000, 1 },
|
||||
#endif
|
||||
|
||||
// Larger cases, bigger strides.
|
||||
{ 1U << 18, 3701 },
|
||||
{ 1U << 19, 3701 },
|
||||
{ 1U << 20, 3701 },
|
||||
{ 1U << 21, 3701 },
|
||||
#ifdef NDEBUG
|
||||
{ 1U << 22, 3701 },
|
||||
{ 1U << 23, 3701 },
|
||||
{ 1U << 24, 3701 },
|
||||
@ -1347,6 +1350,7 @@ static const MultiBitTestParam multibitTests[] = {
|
||||
{ 1U << 29, 24413 },
|
||||
{ 1U << 30, 50377 },
|
||||
{ 1U << 31, 104729 },
|
||||
#endif
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MultiBit, MultiBitTest, ValuesIn(multibitTests));
|
||||
|
@ -165,10 +165,12 @@ TEST(MultiBitComp, CompCompsizeSparse) {
|
||||
257,
|
||||
4097,
|
||||
(1U << 18) + 1,
|
||||
#ifdef NDEBUG
|
||||
(1U << 24) + 1,
|
||||
(1U << 30) + 1
|
||||
#endif
|
||||
};
|
||||
for (u32 i = 0; i < 5; i++) {
|
||||
for (u32 i = 0; i < sizeof(test_set)/sizeof(u32); i++) {
|
||||
u32 test_size = test_set[i];
|
||||
mmbit_holder ba(test_size);
|
||||
|
||||
@ -225,10 +227,12 @@ TEST(MultiBitComp, CompCompsizeDense) {
|
||||
257,
|
||||
4097,
|
||||
(1U << 18) + 1,
|
||||
#ifdef NDEBUG
|
||||
(1U << 24) + 1,
|
||||
(1U << 30) + 1
|
||||
#endif
|
||||
};
|
||||
for (u32 i = 0; i < 5; i++) {
|
||||
for (u32 i = 0; i < sizeof(test_set)/sizeof(u32); i++) {
|
||||
u32 test_size = test_set[i];
|
||||
mmbit_holder ba(test_size);
|
||||
|
||||
@ -760,16 +764,19 @@ static const MultiBitCompTestParam multibitCompTests[] = {
|
||||
{ 1025, 1 },
|
||||
{ 2099, 1 }, // 4097 = 64 ^ 2 + 1
|
||||
{ 4097, 1 },
|
||||
#ifdef NDEBUG
|
||||
{ 10000, 1 },
|
||||
{ 32768, 1 },
|
||||
{ 32769, 1 },
|
||||
{ 200000, 1 },
|
||||
{ 262145, 1 }, // 262145 = 64 * 3 + 1
|
||||
#endif
|
||||
|
||||
// Larger cases, bigger strides.
|
||||
{ 1U << 19, 3701 },
|
||||
{ 1U << 20, 3701 },
|
||||
{ 1U << 21, 3701 },
|
||||
#ifdef NDEBUG
|
||||
{ 1U << 22, 3701 },
|
||||
{ 1U << 23, 3701 },
|
||||
{ 1U << 24, 3701 },
|
||||
@ -780,6 +787,7 @@ static const MultiBitCompTestParam multibitCompTests[] = {
|
||||
{ 1U << 29, 24413 },
|
||||
{ 1U << 30, 50377 },
|
||||
{ 1U << 31, 104729 },
|
||||
#endif
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MultiBitComp, MultiBitCompTest,
|
||||
|
@ -673,8 +673,15 @@ TEST(SimdUtilsTest, movq) {
|
||||
int64x2_t a = { 0x123456789abcdefLL, ~0LL };
|
||||
simd = vreinterpretq_s32_s64(a);
|
||||
#elif defined(ARCH_PPC64EL)
|
||||
#if defined(__clang__) && (__clang_major__ >= 15)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
int64x2_t a = {0x123456789abcdefLL, ~0LL };
|
||||
simd = (m128) a;
|
||||
simd = reinterpret_cast<m128>(a);
|
||||
#if defined(__clang__) && (__clang_major__ >= 15)
|
||||
#pragma clang diagnostic pop
|
||||
#endif // defined(__clang__) && (__clang_major__ == 15)
|
||||
#endif
|
||||
#endif
|
||||
r = movq(simd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user