diff --git a/build.sh b/build.sh index dc28732e239d3205ee672899e526aa294f8bc366..c4c98c4a2a837735b514b71c19aebccc7fbc00ea 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,7 @@ C_COMPILER_PATH=gcc CXX_COMPILER_PATH=g++ # Initialize our own variables: +enable_autotuner="0" buildtype=RelWithDebInfo backends="ARM;AArch64;X86" build_for_openeuler="0" @@ -47,6 +48,7 @@ Usage: $0 [options] Build the compiler under $build_prefix, then install under $install_prefix. Options: + -a Enable BiSheng-Autotuner. -b type Specify CMake build type (default: $buildtype). -c Use ccache (default: $use_ccache). -e Build for embedded cross tool chain. @@ -67,8 +69,11 @@ EOF # Process command-line options. Remember the options for passing to the # containerized build script. -while getopts :b:ceEhiI:j:orstvfX: optchr; do +while getopts :ab:ceEhiI:j:orstvfX: optchr; do case "$optchr" in + a) + enable_autotuner="1" + ;; b) buildtype="$OPTARG" case "${buildtype,,}" in @@ -197,6 +202,11 @@ if [ $build_for_openeuler == "1" ]; then CMAKE_OPTIONS="$CMAKE_OPTIONS -DBUILD_FOR_OPENEULER=ON" fi +if [ $enable_autotuner == "1" ]; then + echo "enable BiSheng-Autotuner" + CMAKE_OPTIONS="$CMAKE_OPTIONS -DLLVM_ENABLE_AUTOTUNER=ON" +fi + # Build and install if [ $clean -eq 1 -a -e "$install_prefix" ]; then rm -rf "$install_prefix" diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 949f12d3ce8c813e9d46534af7bf29b70f297cd8..98fcb6ea1a078b26f6671354e3a35d8df3ebc0eb 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -322,6 +322,10 @@ if (BUILD_FOR_OPENEULER) add_definitions( -DBUILD_FOR_OPENEULER ) endif() +if (LLVM_ENABLE_AUTOTUNER) + add_definitions( -DENABLE_AUTOTUNER ) +endif() + # Determine HOST_LINK_VERSION on Darwin. set(HOST_LINK_VERSION) if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*")