From 6c97b40a624f9183fdba085b23b53ce2578ebe20 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Tue, 22 Aug 2023 22:35:22 -0700 Subject: [PATCH] Remove LLVM <= 10 (#634) --- .github/workflows/main.yml | 212 ++++++------------------------- CHANGES.md | 6 +- CMakeLists.txt | 10 +- appveyor.yml | 22 +--- release/share/terra/README.md | 18 +-- src/llvmheaders.h | 16 +-- src/llvmheaders_100.h | 34 ----- src/llvmheaders_60.h | 33 ----- src/llvmheaders_70.h | 33 ----- src/llvmheaders_80.h | 34 ----- src/llvmheaders_90.h | 34 ----- src/tcompiler.cpp | 227 ++++------------------------------ src/tcompilerstate.h | 3 - src/tcuda.cpp | 11 -- src/tcwrapper.cpp | 136 +------------------- src/tinline.cpp | 8 -- src/tllvmutil.cpp | 71 +---------- tests/amdgpu_kernel.t | 5 - tests/amdgpu_struct.t | 5 - tests/atomicrmw.t | 42 +++---- tests/dgemm3.t | 6 +- tests/dgemmpaper.t | 6 +- tests/diffuse.t | 6 +- tests/gemm.t | 6 +- tests/sgemm3.t | 6 +- travis.sh | 30 ----- 26 files changed, 108 insertions(+), 912 deletions(-) delete mode 100644 src/llvmheaders_100.h delete mode 100644 src/llvmheaders_60.h delete mode 100644 src/llvmheaders_70.h delete mode 100644 src/llvmheaders_80.h delete mode 100644 src/llvmheaders_90.h diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 921127101..a81a9612c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,23 +20,13 @@ jobs: strategy: matrix: os: ['ubuntu-22.04', 'macos-11', 'windows-2022'] - llvm: ['6.0', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16'] + llvm: ['11', '12', '13', '14', '15', '16'] cmake: ['0', '1'] cuda: ['0', '1'] lua: ['luajit', 'moonjit'] exclude: - # Linux: exclude LLVM 6.0-13, 15-16, cmake + # Linux: exclude LLVM 11-13, 15-16, cmake # Note: CMake configurations are tested in Docker - - os: 'ubuntu-22.04' - llvm: '6.0' - - os: 'ubuntu-22.04' - llvm: '7' - - os: 'ubuntu-22.04' - llvm: '8' - - os: 'ubuntu-22.04' - llvm: '9' - - os: 'ubuntu-22.04' - llvm: '10' - os: 'ubuntu-22.04' llvm: '11' - os: 'ubuntu-22.04' @@ -50,51 +40,13 @@ jobs: - os: 'ubuntu-22.04' cmake: '1' - # macOS: exclude LLVM 8-16 make, cuda - - os: 'macos-11' - llvm: '8' - cmake: '0' - - os: 'macos-11' - llvm: '9' - cmake: '0' - - os: 'macos-11' - llvm: '10' - cmake: '0' - - os: 'macos-11' - llvm: '11' - cmake: '0' + # macOS: exclude make, cuda - os: 'macos-11' - llvm: '12' - cmake: '0' - - os: 'macos-11' - llvm: '13' - cmake: '0' - - os: 'macos-11' - llvm: '14' - cmake: '0' - - os: 'macos-11' - llvm: '15' - cmake: '0' - - os: 'macos-11' - llvm: '16' cmake: '0' - os: 'macos-11' cuda: '1' - # LLVM 10 binaries are broken on recent macOS - - os: 'macos-11' - llvm: '10' - # Windows: exclude LLVM 6.0-10,12-16, make - - os: 'windows-2022' - llvm: '6.0' - - os: 'windows-2022' - llvm: '7' - - os: 'windows-2022' - llvm: '8' - - os: 'windows-2022' - llvm: '9' - - os: 'windows-2022' - llvm: '10' + # Windows: exclude LLVM 12-16, make - os: 'windows-2022' llvm: '12' - os: 'windows-2022' @@ -108,25 +60,11 @@ jobs: - os: 'windows-2022' cmake: '0' - # CMake - - llvm: '7' - cmake: '0' - # Moonjit requires CMake - cmake: '0' lua: 'moonjit' # CUDA: only LLVM 11 - - llvm: '6.0' - cuda: '1' - - llvm: '7' - cuda: '1' - - llvm: '8' - cuda: '1' - - llvm: '9' - cuda: '1' - - llvm: '10' - cuda: '1' - llvm: '12' cuda: '1' - llvm: '13' @@ -138,19 +76,9 @@ jobs: - llvm: '16' cuda: '1' - # Moonjit: only LLVM 9 - - llvm: '6.0' - lua: 'moonjit' - - llvm: '7' - lua: 'moonjit' - - llvm: '8' - lua: 'moonjit' - - llvm: '10' - lua: 'moonjit' + # Moonjit: only LLVM 12 - llvm: '11' lua: 'moonjit' - - llvm: '12' - lua: 'moonjit' - llvm: '13' lua: 'moonjit' - llvm: '14' @@ -185,28 +113,16 @@ jobs: strategy: matrix: distro: ['ubuntu-18.04'] - llvm: ['6.0', '7', '8', '9', '10', '11', '12.0.1', '13.0.1', '14.0.6', '15.0.2', '16.0.3'] + llvm: ['11', '12.0.1', '13.0.1', '14.0.6', '15.0.2', '16.0.3'] lua: ['luajit', 'moonjit'] - static: ['0', '1'] - slib: ['0', '1'] cuda: ['0', '1'] test: ['1'] exclude: - # CUDA with LLVM 9 only: - - llvm: '6.0' - cuda: '1' - - llvm: '7' - cuda: '1' - - llvm: '8' - cuda: '1' - - llvm: '10' - cuda: '1' + # CUDA with LLVM 13 only: - llvm: '11' cuda: '1' - llvm: '12.0.1' cuda: '1' - - llvm: '13.0.1' - cuda: '1' - llvm: '14.0.6' cuda: '1' - llvm: '15.0.2' @@ -214,127 +130,73 @@ jobs: - llvm: '16.0.3' cuda: '1' - # Moonjit with LLVM 10 only: - - llvm: '6.0' - lua: 'moonjit' - - llvm: '7' - lua: 'moonjit' - - llvm: '8' - lua: 'moonjit' - - llvm: '9' - lua: 'moonjit' + # Moonjit with LLVM 14 only: - llvm: '11' lua: 'moonjit' - llvm: '12.0.1' lua: 'moonjit' - llvm: '13.0.1' lua: 'moonjit' - - llvm: '14.0.6' - lua: 'moonjit' - llvm: '15.0.2' lua: 'moonjit' - llvm: '16.0.3' lua: 'moonjit' - # no-static with LLVM 10 only: - - llvm: '6.0' - static: '0' - - llvm: '7' - static: '0' - - llvm: '8' - static: '0' - - llvm: '9' - static: '0' - - llvm: '11' - static: '0' - - llvm: '12.0.1' - static: '0' - - llvm: '13.0.1' - static: '0' - - llvm: '14.0.6' - static: '0' - - llvm: '15.0.2' - static: '0' - - llvm: '16.0.3' - static: '0' - - # no-slib with LLVM 10 only: - - llvm: '6.0' - slib: '0' - - llvm: '7' - slib: '0' - - llvm: '8' - slib: '0' - - llvm: '9' - slib: '0' - - llvm: '11' - slib: '0' - - llvm: '12.0.1' - slib: '0' - - llvm: '13.0.1' - slib: '0' - - llvm: '14.0.6' - slib: '0' - - llvm: '15.0.2' - slib: '0' - - llvm: '16.0.3' - slib: '0' - - # slib requires static - - static: '0' - slib: '1' - include: + # Defaults: + - slib: '1' + - static: '1' + # Assign variants to the basic configurations: - - variant: 'package' + - variant: 'prebuilt' - llvm: '11' variant: 'upstream' - - llvm: '12.0.1' - variant: 'prebuilt' - - llvm: '13.0.1' - variant: 'prebuilt' - - llvm: '14.0.6' - variant: 'prebuilt' - - llvm: '15.0.2' - variant: 'prebuilt' - - llvm: '16.0.3' - variant: 'prebuilt' # Some additional configurations: - # LLVM 6.0 on Ubuntu 16.04, 20.04 - - distro: 'ubuntu-16.04' - llvm: '6.0' - lua: 'luajit' - cuda: '0' - variant: 'package' - test: '1' - - distro: 'ubuntu-20.04' - llvm: '6.0' + # LLVM 12, 13, 14 on Ubuntu 22.04 + - distro: 'ubuntu-22.04' + llvm: '12' lua: 'luajit' cuda: '0' variant: 'package' + slib: '1' + static: '1' test: '1' - - # LLVM 12, 13, 14 on Ubuntu 22.04 - distro: 'ubuntu-22.04' - llvm: '12' + llvm: '13' lua: 'luajit' cuda: '0' variant: 'package' + slib: '1' + static: '1' test: '1' - distro: 'ubuntu-22.04' - llvm: '13' + llvm: '14' lua: 'luajit' cuda: '0' variant: 'package' + slib: '1' + static: '1' test: '1' + + # LLVM 14, no-slib/no-static, Ubuntu 22.04 - distro: 'ubuntu-22.04' llvm: '14' lua: 'luajit' cuda: '0' variant: 'package' + slib: '0' + static: '1' test: '1' + # - distro: 'ubuntu-22.04' + # llvm: '14' + # lua: 'luajit' + # cuda: '0' + # variant: 'package' + # slib: '0' + # static: '0' + # test: '1' steps: - uses: actions/checkout@v1 - run: ./travis.sh @@ -396,7 +258,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - nixpkgs: ['unstable', '22.05'] + nixpkgs: ['unstable', '23.05'] cuda: ['false', 'true'] steps: - uses: actions/checkout@v2.3.4 diff --git a/CHANGES.md b/CHANGES.md index 9715ff5a3..b0605058f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,8 @@ -# Unreleased Changes +# Unreleased Changes (Intended to be Version 1.2.0) + +## Removed features + + * Removed support for LLVM <= 10 # Release 1.1.1 (2023-08-22) diff --git a/CMakeLists.txt b/CMakeLists.txt index d39018953..cdc499233 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ set(TERRA_ENABLE_CUDA ${CUDA_FOUND} CACHE BOOL "Build Terra with support for CUD if(DEFINED TERRA_STATIC_LINK_LLVM) set(DEFAULT_TERRA_SLIB_INCLUDE_LLVM ${TERRA_STATIC_LINK_LLVM}) else() - if((LLVM_VERSION_MAJOR GREATER 6 AND LLVM_VERSION_MAJOR LESS 8) OR WIN32) + if(WIN32) set(DEFAULT_TERRA_SLIB_INCLUDE_LLVM OFF) else() set(DEFAULT_TERRA_SLIB_INCLUDE_LLVM ON) @@ -30,10 +30,6 @@ if(TERRA_SLIB_INCLUDE_LLVM AND NOT TERRA_STATIC_LINK_LLVM) message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LLVM requires TERRA_STATIC_LINK_LLVM to be set") endif() -if((LLVM_VERSION_MAJOR GREATER 6 AND LLVM_VERSION_MAJOR LESS 8) AND TERRA_SLIB_INCLUDE_LLVM) - message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LLVM is not supported in LLVM version 7") -endif() - if(WIN32 AND TERRA_SLIB_INCLUDE_LLVM) message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LLVM is not supported on Windows") endif() @@ -66,10 +62,8 @@ include(ExtractLLVM) if(LLVM_VERSION_MAJOR GREATER 15) set(CMAKE_CXX_STANDARD 17) -elseif(LLVM_VERSION_MAJOR GREATER 9) - set(CMAKE_CXX_STANDARD 14) else() - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 14) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/appveyor.yml b/appveyor.yml index 8c8386d3c..fe35142d3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,28 +5,10 @@ environment: LLVM_VERSION_SHORT: 110 VS_MAJOR_VERSION: 17 USE_CUDA: 1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - LLVM_VERSION: 7.0.0 - LLVM_VERSION_SHORT: 70 - VS_MAJOR_VERSION: 14 # Just use LLVM built with VS 2015 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - LLVM_VERSION: 7.0.0 - LLVM_VERSION_SHORT: 70 - VS_MAJOR_VERSION: 14 # Just use LLVM built with VS 2015 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - LLVM_VERSION: 7.0.0 - LLVM_VERSION_SHORT: 70 - VS_MAJOR_VERSION: 14 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - LLVM_VERSION: 6.0.1 - LLVM_VERSION_SHORT: 60 - VS_MAJOR_VERSION: 14 install: - - set LLVM_BASE_NAME=llvm-%LLVM_VERSION%-windows-amd64-msvc%VS_MAJOR_VERSION%-msvcrt - - set LLVM_URL=https://github.com/Mx7f/llvm-package-windows/releases/download/clang-%LLVM_VERSION%-nvptx/%LLVM_BASE_NAME%.7z - - if %LLVM_VERSION_SHORT% GEQ 110 (set LLVM_BASE_NAME=clang+llvm-%LLVM_VERSION%-x86_64-windows-msvc17) - - if %LLVM_VERSION_SHORT% GEQ 110 (set LLVM_URL=https://github.com/terralang/llvm-build/releases/download/llvm-%LLVM_VERSION%/%LLVM_BASE_NAME%.7z) + - set LLVM_BASE_NAME=clang+llvm-%LLVM_VERSION%-x86_64-windows-msvc17 + - set LLVM_URL=https://github.com/terralang/llvm-build/releases/download/llvm-%LLVM_VERSION%/%LLVM_BASE_NAME%.7z - appveyor DownloadFile %LLVM_URL% - 7z x %LLVM_BASE_NAME%.7z diff --git a/release/share/terra/README.md b/release/share/terra/README.md index 811d838c3..862c2ff2e 100644 --- a/release/share/terra/README.md +++ b/release/share/terra/README.md @@ -122,19 +122,19 @@ If the binary releases are not appropriate, then you can also build Terra from s On recent versions of Ubuntu, you can get these dependencies with: ``` -sudo apt-get install build-essential cmake git llvm-11-dev libclang-11-dev clang-11 libedit-dev libncurses5-dev zlib1g-dev libpfm4-dev +sudo apt-get install build-essential cmake git llvm-13-dev libclang-13-dev clang-13 libmlir-13-dev libedit-dev libncurses5-dev zlib1g-dev libpfm4-dev ``` On macOS with Homebrew, the following should be sufficient: ``` -brew install cmake llvm@11 +brew install cmake llvm@13 ``` On FreeBSD, use: ``` -pkg install -y cmake llvm11 +pkg install -y cmake llvm13 ``` Terra also supports an older build system based on GNU Make (for @@ -148,11 +148,6 @@ The current recommended version of LLVM is **13**. The following versions are al | Version | Linux | macOS | FreeBSD | Windows | CUDA | AMD GPU \* | Notes | | ------- | ----- | ----- | ------- | ------- | ---- | ---------- | ----- | -| 6 | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | [deprecated](https://github.com/terralang/terra/issues/543) | -| 7 | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | requires CMake, [deprecated](https://github.com/terralang/terra/issues/543) | -| 8 | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | [deprecated](https://github.com/terralang/terra/issues/543) | -| 9 | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | [deprecated](https://github.com/terralang/terra/issues/543) | -| 10 | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | [deprecated](https://github.com/terralang/terra/issues/543) | | 11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | 12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | 13 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | @@ -172,12 +167,17 @@ The following versions were previously supported by Terra: | 3.8 | 1.0.6 | | 3.9 | 1.0.6 | | 5 | 1.0.6 | +| 6 | 1.1.1 | +| 7 | 1.1.1 | +| 8 | 1.1.1 | +| 9 | 1.1.1 | +| 10 | 1.1.1 | ### Instructions for Building LLVM from Source If you need to build LLVM from source, the following recipe has been known to work with Terra. The same basic procedure should work for all -LLVM versions >= 6. +LLVM versions >= 11. ``` wget https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-13.0.0.src.tar.xz diff --git a/src/llvmheaders.h b/src/llvmheaders.h index d089e446c..630303996 100644 --- a/src/llvmheaders.h +++ b/src/llvmheaders.h @@ -44,17 +44,7 @@ #include "llvm/Object/ObjectFile.h" #include "llvm-c/Linker.h" -#if LLVM_VERSION < 70 -#include "llvmheaders_60.h" -#elif LLVM_VERSION < 80 -#include "llvmheaders_70.h" -#elif LLVM_VERSION < 90 -#include "llvmheaders_80.h" -#elif LLVM_VERSION < 100 -#include "llvmheaders_90.h" -#elif LLVM_VERSION < 110 -#include "llvmheaders_100.h" -#elif LLVM_VERSION < 120 +#if LLVM_VERSION < 120 #include "llvmheaders_110.h" #elif LLVM_VERSION < 130 #include "llvmheaders_120.h" @@ -69,8 +59,8 @@ #else #error "unsupported LLVM version" // for OSX code completion -#define LLVM_VERSION 150 -#include "llvmheaders_150.h" +#define LLVM_VERSION 160 +#include "llvmheaders_160.h" #endif #define UNIQUEIFY(T, x) (std::unique_ptr(x)) diff --git a/src/llvmheaders_100.h b/src/llvmheaders_100.h deleted file mode 100644 index 172db8e47..000000000 --- a/src/llvmheaders_100.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "llvm/IR/CallingConv.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/InlineAsm.h" -#include "llvm/Analysis/CallGraphSCCPass.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/IR/DIBuilder.h" -#include "llvm/IR/DebugInfo.h" -#include "llvm/IR/Mangler.h" -//#include "llvm/ExecutionEngine/ObjectImage.h" -#include "llvm/IR/Verifier.h" -#include "llvm/Linker/Linker.h" -#include "llvm/IR/CFG.h" -#include "llvm/IR/InstVisitor.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" - -#include "llvm/Support/VirtualFileSystem.h" -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Rewrite/Frontend/Rewriters.h" -#include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Object/SymbolSize.h" - -#include "llvm/Bitcode/BitcodeReader.h" -#include "llvm/Support/Error.h" - -#define LLVM_PATH_TYPE std::string -#define RAW_FD_OSTREAM_NONE sys::fs::F_None -#define RAW_FD_OSTREAM_BINARY sys::fs::F_None diff --git a/src/llvmheaders_60.h b/src/llvmheaders_60.h deleted file mode 100644 index 64b3542e9..000000000 --- a/src/llvmheaders_60.h +++ /dev/null @@ -1,33 +0,0 @@ -#include "llvm/IR/CallingConv.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/InlineAsm.h" -#include "llvm/Analysis/CallGraphSCCPass.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/IR/DIBuilder.h" -#include "llvm/IR/DebugInfo.h" -#include "llvm/IR/Mangler.h" -//#include "llvm/ExecutionEngine/ObjectImage.h" -#include "llvm/IR/Verifier.h" -#include "llvm/Linker/Linker.h" -#include "llvm/IR/CFG.h" -#include "llvm/IR/InstVisitor.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" - -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Rewrite/Frontend/Rewriters.h" -#include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Object/SymbolSize.h" - -#include "llvm/Bitcode/BitcodeReader.h" -#include "llvm/Support/Error.h" - -#define LLVM_PATH_TYPE std::string -#define RAW_FD_OSTREAM_NONE sys::fs::F_None -#define RAW_FD_OSTREAM_BINARY sys::fs::F_None diff --git a/src/llvmheaders_70.h b/src/llvmheaders_70.h deleted file mode 100644 index 64b3542e9..000000000 --- a/src/llvmheaders_70.h +++ /dev/null @@ -1,33 +0,0 @@ -#include "llvm/IR/CallingConv.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/InlineAsm.h" -#include "llvm/Analysis/CallGraphSCCPass.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/IR/DIBuilder.h" -#include "llvm/IR/DebugInfo.h" -#include "llvm/IR/Mangler.h" -//#include "llvm/ExecutionEngine/ObjectImage.h" -#include "llvm/IR/Verifier.h" -#include "llvm/Linker/Linker.h" -#include "llvm/IR/CFG.h" -#include "llvm/IR/InstVisitor.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" - -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Rewrite/Frontend/Rewriters.h" -#include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Object/SymbolSize.h" - -#include "llvm/Bitcode/BitcodeReader.h" -#include "llvm/Support/Error.h" - -#define LLVM_PATH_TYPE std::string -#define RAW_FD_OSTREAM_NONE sys::fs::F_None -#define RAW_FD_OSTREAM_BINARY sys::fs::F_None diff --git a/src/llvmheaders_80.h b/src/llvmheaders_80.h deleted file mode 100644 index 172db8e47..000000000 --- a/src/llvmheaders_80.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "llvm/IR/CallingConv.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/InlineAsm.h" -#include "llvm/Analysis/CallGraphSCCPass.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/IR/DIBuilder.h" -#include "llvm/IR/DebugInfo.h" -#include "llvm/IR/Mangler.h" -//#include "llvm/ExecutionEngine/ObjectImage.h" -#include "llvm/IR/Verifier.h" -#include "llvm/Linker/Linker.h" -#include "llvm/IR/CFG.h" -#include "llvm/IR/InstVisitor.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" - -#include "llvm/Support/VirtualFileSystem.h" -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Rewrite/Frontend/Rewriters.h" -#include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Object/SymbolSize.h" - -#include "llvm/Bitcode/BitcodeReader.h" -#include "llvm/Support/Error.h" - -#define LLVM_PATH_TYPE std::string -#define RAW_FD_OSTREAM_NONE sys::fs::F_None -#define RAW_FD_OSTREAM_BINARY sys::fs::F_None diff --git a/src/llvmheaders_90.h b/src/llvmheaders_90.h deleted file mode 100644 index 172db8e47..000000000 --- a/src/llvmheaders_90.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "llvm/IR/CallingConv.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/IRBuilder.h" -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" -#include "llvm/IR/InlineAsm.h" -#include "llvm/Analysis/CallGraphSCCPass.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/IR/DIBuilder.h" -#include "llvm/IR/DebugInfo.h" -#include "llvm/IR/Mangler.h" -//#include "llvm/ExecutionEngine/ObjectImage.h" -#include "llvm/IR/Verifier.h" -#include "llvm/Linker/Linker.h" -#include "llvm/IR/CFG.h" -#include "llvm/IR/InstVisitor.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" - -#include "llvm/Support/VirtualFileSystem.h" -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Rewrite/Frontend/Rewriters.h" -#include "llvm/IR/DiagnosticPrinter.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Object/SymbolSize.h" - -#include "llvm/Bitcode/BitcodeReader.h" -#include "llvm/Support/Error.h" - -#define LLVM_PATH_TYPE std::string -#define RAW_FD_OSTREAM_NONE sys::fs::F_None -#define RAW_FD_OSTREAM_BINARY sys::fs::F_None diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index 8f10fb678..4e52694f3 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -81,17 +81,6 @@ struct DisassembleFunctionListener : public JITEventListener { TerraCompilationUnit *CU; terra_State *T; DisassembleFunctionListener(TerraCompilationUnit *CU_) : CU(CU_), T(CU_->T) {} -#if LLVM_VERSION < 80 - virtual void NotifyFunctionEmitted(const Function &f, void *data, size_t sz, - const EmittedFunctionDetails &EFD) { - TerraFunctionInfo &fi = T->C->functioninfo[data]; - fi.ctx = CU->TT->ctx; - fi.name = f.getName(); - fi.addr = data; - fi.size = sz; - DEBUG_ONLY(T) { fi.efd = EFD; } - } -#endif void InitializeDebugData(StringRef name, object::SymbolRef::Type type, uint64_t sz) { if (type == object::SymbolRef::ST_Function) { @@ -352,11 +341,7 @@ int terra_initcompilationunit(lua_State *L) { } else if (strcmp(flag, "arcp") == 0) { fastmath.setAllowReciprocal(); } else if (strcmp(flag, "contract") == 0) { -#if LLVM_VERSION < 70 - fastmath.setAllowContract(true); -#else fastmath.setAllowContract(); -#endif } else if (strcmp(flag, "afn") == 0) { fastmath.setApproxFunc(); } else if (strcmp(flag, "reassoc") == 0) { @@ -407,11 +392,7 @@ static void InitializeJIT(TerraCompilationUnit *CU) { .setEngineKind(EngineKind::JIT) .setTargetOptions(CU->TT->tm->Options) .setOptLevel(CodeGenOpt::Aggressive) -#if LLVM_VERSION <= 90 - .setMCJITMemoryManager(make_unique(CU)) -#else .setMCJITMemoryManager(std::make_unique(CU)) -#endif #if LLVM_VERSION < 120 .setUseOrcMCJITReplacement(true) #endif @@ -542,11 +523,7 @@ class Types { Type *baseType = ttype->type; t->issigned = ttype->issigned; t->islogical = ttype->islogical; -#if LLVM_VERSION < 90 - t->type = VectorType::get(baseType, N); -#else t->type = VectorType::get(baseType, N, false); -#endif } break; case T_primitive: { CreatePrimitiveType(typ, t); @@ -816,12 +793,10 @@ struct CCallingConv { ppc64_int_limit = 8; ppc64_count_used = true; } break; -#if LLVM_VERSION >= 100 case Triple::ArchType::wasm32: case Triple::ArchType::wasm64: { wasm_cconv = true; } break; -#endif } switch (Triple.getOS()) { @@ -934,12 +909,8 @@ struct CCallingConv { case 8: return (C_SSE_DOUBLE == clz) ? Type::getDoubleTy(*CU->TT->ctx) - : VectorType::get(Type::getFloatTy(*CU->TT->ctx), 2 -#if LLVM_VERSION >= 90 - , - false -#endif - ); + : VectorType::get(Type::getFloatTy(*CU->TT->ctx), + 2, false); default: assert(!"unexpected size for floating point class"); } @@ -1208,9 +1179,7 @@ struct CCallingConv { } template void addNoUndefAttr(FnOrCall *r, int idx) { -#if LLVM_VERSION >= 110 r->addParamAttr(idx - 1, Attribute::NoUndef); -#endif } template void addExtAttrIfNeeded(TType *t, FnOrCall *r, int idx, bool return_value = false) { @@ -1266,11 +1235,7 @@ struct CCallingConv { Value *addr_dest = B->CreateBitCast(addr_dst, t_dst); Value *addr_source = B->CreateBitCast(addr_src, t_src); uint64_t size = 0; -#if LLVM_VERSION < 100 - unsigned a1 = 0; -#else MaybeAlign a1(0); -#endif if (t1->isStructTy()) { // size of bytes to copy StructType *st = cast(t1); @@ -1283,20 +1248,12 @@ struct CCallingConv { StoreInst *st = B->CreateStore(src, addr_dst); return st; } -#if LLVM_VERSION < 100 - a1 = CU->getDataLayout().getABITypeAlignment(t1); -#else a1 = MaybeAlign(CU->getDataLayout().getABITypeAlignment(t1)); -#endif } else assert(!"unhandled type in emitStoreAgg"); Value *size_v = ConstantInt::get(Type::getInt64Ty(*CU->TT->ctx), size); // perform the copy -#if LLVM_VERSION < 70 - Value *m = B->CreateMemCpy(addr_dest, addr_source, size_v, a1); -#else Value *m = B->CreateMemCpy(addr_dest, a1, addr_source, a1, size_v); -#endif return m; } else { StoreInst *st = B->CreateStore(src, addr_dst); @@ -1354,13 +1311,7 @@ struct CCallingConv { } break; case C_AGGREGATE_MEM: // TODO: check that LLVM optimizes this copy away - emitStoreAgg(B, p->type->type, - B->CreateLoad( -#if LLVM_VERSION >= 80 - p->type->type, -#endif - &*ai), - v); + emitStoreAgg(B, p->type->type, B->CreateLoad(p->type->type, &*ai), v); ++ai; break; case C_AGGREGATE_REG: { @@ -1373,12 +1324,7 @@ struct CCallingConv { unsigned as = scratch->getType()->getPointerAddressSpace(); emitStoreAgg(B, p->cctype, &*ai, scratch); Value *casted = B->CreateBitCast(scratch, Ptr(p->type->type, as)); - emitStoreAgg(B, p->type->type, - B->CreateLoad( -#if LLVM_VERSION >= 80 - p->type->type, -#endif - casted), + emitStoreAgg(B, p->type->type, B->CreateLoad(p->type->type, casted), v); ++ai; } break; @@ -1411,22 +1357,14 @@ struct CCallingConv { result_type = type->getElementType(0); } while ((type = dyn_cast(result_type))); } - B->CreateRet(B->CreateLoad( -#if LLVM_VERSION >= 80 - result_type, -#endif - result)); + B->CreateRet(B->CreateLoad(result_type, result)); } else if (C_ARRAY_REG == kind) { Value *dest = CreateAlloca(B, info->returntype.type->type); unsigned as = dest->getType()->getPointerAddressSpace(); emitStoreAgg(B, info->returntype.type->type, result, dest); ArrayType *result_type = cast(info->returntype.cctype); Value *result = B->CreateBitCast(dest, Ptr(result_type, as)); - B->CreateRet(B->CreateLoad( -#if LLVM_VERSION >= 80 - result_type, -#endif - result)); + B->CreateRet(B->CreateLoad(result_type, result)); } else { assert(!"unhandled return value"); } @@ -1443,11 +1381,8 @@ struct CCallingConv { arguments); } } else { - arguments.push_back(B->CreateLoad( -#if LLVM_VERSION >= 80 - value->getType()->getPointerElementType(), -#endif - value)); + arguments.push_back( + B->CreateLoad(value->getType()->getPointerElementType(), value)); } } @@ -1532,11 +1467,8 @@ struct CCallingConv { } else { assert(!"unhandled argument kind"); } - return B->CreateLoad( -#if LLVM_VERSION >= 80 - aggregate->getType()->getPointerElementType(), -#endif - aggregate); + return B->CreateLoad(aggregate->getType()->getPointerElementType(), + aggregate); } } void GatherArgumentsAggReg(Type *type, std::vector &arguments) { @@ -1680,10 +1612,8 @@ static CallingConv::ID ParseCallingConv(const char *cc) { ccmap["preserve_allcc"] = CallingConv::PreserveAll; ccmap["cxx_fast_tlscc"] = CallingConv::CXX_FAST_TLS; ccmap["ghccc"] = CallingConv::GHC; -#if LLVM_VERSION >= 100 ccmap["tailcc"] = CallingConv::Tail; ccmap["cfguard_checkcc"] = CallingConv::CFGuard_Check; -#endif ccmap["x86_stdcallcc"] = CallingConv::X86_StdCall; ccmap["x86_fastcallcc"] = CallingConv::X86_FastCall; ccmap["x86_thiscallcc"] = CallingConv::X86_ThisCall; @@ -1693,12 +1623,8 @@ static CallingConv::ID ParseCallingConv(const char *cc) { ccmap["arm_apcscc"] = CallingConv::ARM_APCS; ccmap["arm_aapcscc"] = CallingConv::ARM_AAPCS; ccmap["arm_aapcs_vfpcc"] = CallingConv::ARM_AAPCS_VFP; -#if LLVM_VERSION >= 80 ccmap["aarch64_vector_pcs"] = CallingConv::AArch64_VectorCall; -#endif -#if LLVM_VERSION >= 100 ccmap["aarch64_sve_vector_pcs"] = CallingConv::AArch64_SVE_VectorCall; -#endif ccmap["msp430_intrcc"] = CallingConv::MSP430_INTR; ccmap["avr_intrcc"] = CallingConv::AVR_INTR; ccmap["avr_signalcc"] = CallingConv::AVR_SIGNAL; @@ -1750,10 +1676,8 @@ static AtomicRMWInst::BinOp ParseAtomicBinOp(const char *op) { opmap["min"] = AtomicRMWInst::BinOp::Min; opmap["umax"] = AtomicRMWInst::BinOp::UMax; opmap["umin"] = AtomicRMWInst::BinOp::UMin; -#if LLVM_VERSION >= 90 opmap["fadd"] = AtomicRMWInst::BinOp::FAdd; opmap["fsub"] = AtomicRMWInst::BinOp::FSub; -#endif #if LLVM_VERSION >= 150 opmap["fmax"] = AtomicRMWInst::BinOp::FMax; opmap["fmin"] = AtomicRMWInst::BinOp::FMin; @@ -2236,18 +2160,12 @@ struct FunctionEmitter { Value *emitPointerArith(T_Kind kind, Value *pointer, TType *numTy, Value *number) { number = emitIndex(numTy, 64, number); if (kind == T_add) { - return B->CreateGEP( -#if LLVM_VERSION >= 80 - pointer->getType()->getPointerElementType(), -#endif - pointer, number); + return B->CreateGEP(pointer->getType()->getPointerElementType(), pointer, + number); } else if (kind == T_sub) { Value *numNeg = B->CreateNeg(number); - return B->CreateGEP( -#if LLVM_VERSION >= 80 - pointer->getType()->getPointerElementType(), -#endif - pointer, numNeg); + return B->CreateGEP(pointer->getType()->getPointerElementType(), pointer, + numNeg); } else { assert(!"unexpected pointer arith"); return NULL; @@ -2483,52 +2401,27 @@ struct FunctionEmitter { Type *t_src = Type::getInt8PtrTy(*CU->TT->ctx, as_src); addr_src = B->CreateBitCast(addr_src, t_src); uint64_t size = 0; -#if LLVM_VERSION <= 90 - unsigned a1 = 0; -#else MaybeAlign a1(0); -#endif if (t1->isStructTy()) { // size of bytes to copy StructType *st = cast(t1); const StructLayout *sl = CU->getDataLayout().getStructLayout(st); size = sl->getSizeInBytes(); -#if LLVM_VERSION <= 90 - a1 = hasAlignment ? alignment : sl->getAlignment(); -#else a1 = hasAlignment ? MaybeAlign(alignment) : sl->getAlignment(); -#endif } else if (t1->isArrayTy() && (CU->getDataLayout().getTypeAllocSize(t1) >= MEM_ARRAY_THRESHOLD)) { size = CU->getDataLayout().getTypeAllocSize(t1); -#if LLVM_VERSION <= 90 - a1 = hasAlignment ? alignment - : CU->getDataLayout().getABITypeAlignment(t1); -#else a1 = MaybeAlign(hasAlignment ? alignment : CU->getDataLayout().getABITypeAlignment(t1)); -#endif } else { StoreInst *st = B->CreateStore(value, addr); if (isVolatile) st->setVolatile(true); -#if LLVM_VERSION <= 90 - if (hasAlignment) st->setAlignment(alignment); -#elif LLVM_VERSION <= 100 - if (hasAlignment) st->setAlignment(MaybeAlign(alignment)); -#else if (hasAlignment) st->setAlignment(Align(alignment)); -#endif return st; } Value *size_v = ConstantInt::get(Type::getInt64Ty(*CU->TT->ctx), size); // perform the copy -#if LLVM_VERSION <= 60 - Value *m = B->CreateMemCpy(addr_dst, addr_src, size_v, a1, isVolatile); -#elif LLVM_VERSION <= 90 - Value *m = B->CreateMemCpy(addr_dst, a1, addr_src, l->getAlignment(), size_v, - isVolatile); -#else Value *m = B->CreateMemCpy(addr_dst, a1, addr_src, MaybeAlign( #if LLVM_VERSION < 150 @@ -2538,18 +2431,11 @@ struct FunctionEmitter { #endif ), size_v, isVolatile); -#endif return m; } else { StoreInst *st = B->CreateStore(value, addr); if (isVolatile) st->setVolatile(true); -#if LLVM_VERSION <= 90 - if (hasAlignment) st->setAlignment(alignment); -#elif LLVM_VERSION <= 100 - if (hasAlignment) st->setAlignment(MaybeAlign(alignment)); -#else if (hasAlignment) st->setAlignment(Align(alignment)); -#endif return st; } } @@ -2568,11 +2454,7 @@ struct FunctionEmitter { exp->obj("type", &type); Ty->EnsureTypeIsComplete(&type); Type *ttype = getType(&type)->type; - raw = B->CreateLoad( -#if LLVM_VERSION >= 80 - raw->getType()->getPointerElementType(), -#endif - raw); + raw = B->CreateLoad(raw->getType()->getPointerElementType(), raw); } return raw; } @@ -2689,17 +2571,12 @@ struct FunctionEmitter { // otherwise we have a pointer access which will use a GEP instruction std::vector idxs; Ty->EnsurePointsToCompleteType(&aggTypeO); - Value *result = B->CreateGEP( -#if LLVM_VERSION >= 80 - valueExp->getType()->getPointerElementType(), -#endif - valueExp, idxExp); + Value *result = + B->CreateGEP(valueExp->getType()->getPointerElementType(), + valueExp, idxExp); if (!exp->boolean("lvalue")) - result = B->CreateLoad( -#if LLVM_VERSION >= 80 - result->getType()->getPointerElementType(), -#endif - result); + result = B->CreateLoad(result->getType()->getPointerElementType(), + result); return result; } } break; @@ -2811,11 +2688,7 @@ struct FunctionEmitter { // structvariable and perform any casts necessary B->CreateStore(in, oe); } - return B->CreateLoad( -#if LLVM_VERSION >= 80 - output->getType()->getPointerElementType(), -#endif - output); + return B->CreateLoad(output->getType()->getPointerElementType(), output); } break; case T_cast: { Obj a; @@ -2867,11 +2740,8 @@ struct FunctionEmitter { Value *result = emitStructSelect(&typ, v, offset); Type *ttype = getType(&typ)->type; if (!exp->boolean("lvalue")) - result = B->CreateLoad( -#if LLVM_VERSION >= 80 - result->getType()->getPointerElementType(), -#endif - result); + result = B->CreateLoad(result->getType()->getPointerElementType(), + result); return result; } break; case T_constructor: @@ -2921,20 +2791,10 @@ struct FunctionEmitter { Ty->EnsureTypeIsComplete(&type); Type *ttype = getType(&type)->type; Value *v = emitExp(&addr); - LoadInst *l = B->CreateLoad( -#if LLVM_VERSION >= 80 - v->getType()->getPointerElementType(), -#endif - v); + LoadInst *l = B->CreateLoad(v->getType()->getPointerElementType(), v); if (attr.hasfield("alignment")) { int alignment = attr.number("alignment"); -#if LLVM_VERSION <= 90 - l->setAlignment(alignment); -#elif LLVM_VERSION <= 100 - l->setAlignment(MaybeAlign(alignment)); -#else l->setAlignment(Align(alignment)); -#endif } if (attr.boolean("nontemporal")) { auto list = ConstantAsMetadata::get( @@ -3012,14 +2872,8 @@ struct FunctionEmitter { a->setVolatile(attr.boolean("isvolatile")); a->setWeak(attr.boolean("isweak")); if (has_alignment) { -#if LLVM_VERSION >= 110 #if LLVM_VERSION < 130 a->setAlignment(Align(attr.number("alignment"))); -#endif -#else - assert(false && - "cmpxchg does not support alignment in this version of " - "LLVM, please upgrade to 11.0.0 or higher"); #endif } Value *a_result = B->CreateExtractValue(a, ArrayRef(0)); @@ -3059,14 +2913,8 @@ struct FunctionEmitter { ordering, syncscope); a->setVolatile(attr.boolean("isvolatile")); if (has_alignment) { -#if LLVM_VERSION >= 110 #if LLVM_VERSION < 130 a->setAlignment(Align(attr.number("alignment"))); -#endif -#else - assert(false && - "atomicrmw does not support alignment in this version of " - "LLVM, please upgrade to 11.0.0 or higher"); #endif } return a; @@ -3093,9 +2941,7 @@ struct FunctionEmitter { Type *resultType = Type::getInt1Ty(*CU->TT->ctx); if (cond->getType()->isVectorTy()) { VectorType *vt = cast(cond->getType()); -#if LLVM_VERSION < 90 - resultType = VectorType::get(resultType, vt->getNumElements()); -#elif LLVM_VERSION < 130 +#if LLVM_VERSION < 130 resultType = VectorType::get(resultType, vt->getNumElements(), false); #else resultType = VectorType::get(resultType, @@ -3173,19 +3019,12 @@ struct FunctionEmitter { auto TA = DB->getOrCreateTypeArray(ArrayRef()); -#if LLVM_VERSION >= 80 SP = DB->createFunction( CU, fstate->func->getName(), fstate->func->getName(), file, lineno, DB->createSubroutineType(TA), 0, llvm::DINode::FlagZero, llvm::DISubprogram::DISPFlags::SPFlagOptimized | llvm::DISubprogram::DISPFlags::SPFlagDefinition); fstate->func->setSubprogram(SP); -#else - SP = DB->createFunction(CU, fstate->func->getName(), fstate->func->getName(), - file, lineno, DB->createSubroutineType(TA), false, - true, 0, llvm::DINode::FlagZero, true); - fstate->func->setSubprogram(SP); -#endif if (!M->getModuleFlagsMetadata()) { M->addModuleFlag(llvm::Module::Warning, "Dwarf Version", 2); @@ -3303,11 +3142,7 @@ struct FunctionEmitter { Value *addr = CreateConstGEP2_32(B, result, 0, i); B->CreateStore(values[i], addr); } - return B->CreateLoad( -#if LLVM_VERSION >= 80 - result->getType()->getPointerElementType(), -#endif - result); + return B->CreateLoad(result->getType()->getPointerElementType(), result); } void emitStmtList(Obj *stmts) { int NS = stmts->size(); @@ -3478,11 +3313,7 @@ struct FunctionEmitter { BasicBlock *cond = createAndInsertBB("forcond"); B->CreateBr(cond); setInsertBlock(cond); - Value *v = B->CreateLoad( -#if LLVM_VERSION >= 80 - vp->getType()->getPointerElementType(), -#endif - vp); + Value *v = B->CreateLoad(vp->getType()->getPointerElementType(), vp); Value *c = B->CreateOr(B->CreateAnd(emitCompare(T_lt, t, v, limitv), emitCompare(T_gt, t, stepv, zero)), B->CreateAnd(emitCompare(T_gt, t, v, limitv), @@ -3881,11 +3712,7 @@ static bool SaveObject(TerraCompilationUnit *CU, Module *M, const std::string &f return true; } } else if (filekind == "bitcode") { -#if LLVM_VERSION < 70 - llvm::WriteBitcodeToFile(M, dest); -#else llvm::WriteBitcodeToFile(*M, dest); -#endif } else if (filekind == "llvmir") { dest << *M; } diff --git a/src/tcompilerstate.h b/src/tcompilerstate.h index 82104c5c4..48124ea58 100644 --- a/src/tcompilerstate.h +++ b/src/tcompilerstate.h @@ -9,9 +9,6 @@ struct TerraFunctionInfo { std::string name; void *addr; size_t size; -#if LLVM_VERSION < 80 - llvm::JITEvent_EmittedFunctionDetails efd; -#endif }; class Types; struct CCallingConv; diff --git a/src/tcuda.cpp b/src/tcuda.cpp index 6aeb176c4..a461954b7 100644 --- a/src/tcuda.cpp +++ b/src/tcuda.cpp @@ -145,11 +145,7 @@ void moduleToPTX(terra_State *T, llvm::Module *M, int major, int minor, std::str PMB.SizeLevel = 0; PMB.Inliner = llvm::createFunctionInliningPass(PMB.OptLevel, 0, false); PMB.LoopVectorize = false; -#if LLVM_VERSION <= 90 - auto FileType = llvm::TargetMachine::CGFT_AssemblyFile; -#else auto FileType = llvm::CGFT_AssemblyFile; -#endif llvm::legacy::PassManager PM; #if LLVM_VERSION < 160 @@ -158,17 +154,10 @@ void moduleToPTX(terra_State *T, llvm::Module *M, int major, int minor, std::str PMB.populateModulePassManager(PM); -#if LLVM_VERSION >= 70 if (TargetMachine->addPassesToEmitFile(PM, str_dest, nullptr, FileType)) { llvm::errs() << "TargetMachine can't emit a file of this type\n"; return; } -#else - if (TargetMachine->addPassesToEmitFile(PM, str_dest, FileType)) { - llvm::errs() << "TargetMachine can't emit a file of this type\n"; - return; - } -#endif PM.run(*M); buf->resize(dest.size()); diff --git a/src/tcwrapper.cpp b/src/tcwrapper.cpp index 35b1c0bb7..77ff50313 100644 --- a/src/tcwrapper.cpp +++ b/src/tcwrapper.cpp @@ -26,9 +26,7 @@ extern "C" { #include "clang/Driver/Driver.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/ToolChain.h" -#if LLVM_VERSION >= 100 #include "clang/Basic/Builtins.h" -#endif #include "tcompilerstate.h" using namespace clang; @@ -624,7 +622,6 @@ class CodeGenProxy : public ASTConsumer { virtual bool shouldSkipFunctionBody(Decl *D) { return CG->shouldSkipFunctionBody(D); } }; -#if LLVM_VERSION >= 80 class LuaProvidedFile : public llvm::vfs::File { private: std::string Name; @@ -644,33 +641,11 @@ class LuaProvidedFile : public llvm::vfs::File { } virtual std::error_code close() override { return std::error_code(); } }; -#else -class LuaProvidedFile : public clang::vfs::File { -private: - std::string Name; - clang::vfs::Status Status; - StringRef Buffer; - -public: - LuaProvidedFile(const std::string &Name_, const clang::vfs::Status &Status_, - const StringRef &Buffer_) - : Name(Name_), Status(Status_), Buffer(Buffer_) {} - virtual ~LuaProvidedFile() override {} - virtual llvm::ErrorOr status() override { return Status; } - virtual llvm::ErrorOr> getBuffer( - const Twine &Name, int64_t FileSize, bool RequiresNullTerminator, - bool IsVolatile) override { - return llvm::MemoryBuffer::getMemBuffer(Buffer, "", RequiresNullTerminator); - } - virtual std::error_code close() override { return std::error_code(); } -}; -#endif static llvm::sys::TimePoint<> ZeroTime() { return llvm::sys::TimePoint<>(std::chrono::nanoseconds::zero()); } -#if LLVM_VERSION >= 80 class LuaOverlayFileSystem : public llvm::vfs::FileSystem { private: IntrusiveRefCntPtr RFS; @@ -758,92 +733,6 @@ class LuaOverlayFileSystem : public llvm::vfs::FileSystem { return std::error_code(); } }; -#else -class LuaOverlayFileSystem : public clang::vfs::FileSystem { -private: - IntrusiveRefCntPtr RFS; - lua_State *L; - -public: - LuaOverlayFileSystem(lua_State *L_) : RFS(vfs::getRealFileSystem()), L(L_) {} - - bool GetFile(const llvm::Twine &Path, clang::vfs::Status *status, - StringRef *contents) { - lua_pushvalue(L, HEADERPROVIDER_POS); - lua_pushstring(L, Path.str().c_str()); - lua_call(L, 1, 1); - if (!lua_istable(L, -1)) { - lua_pop(L, 1); - return false; - } - llvm::sys::fs::file_type filetype = llvm::sys::fs::file_type::directory_file; - int64_t size = 0; - lua_getfield(L, -1, "kind"); - const char *kind = lua_tostring(L, -1); - if (strcmp(kind, "file") == 0) { - filetype = llvm::sys::fs::file_type::regular_file; - lua_getfield(L, -2, "contents"); - const char *data = (const char *)lua_touserdata(L, -1); - if (!data) { - data = lua_tostring(L, -1); - } - if (!data) { - lua_pop(L, 3); // pop table,kind,contents - return false; - } - lua_getfield(L, -3, "size"); - size = (lua_isnumber(L, -1)) ? lua_tonumber(L, -1) : ::strlen(data); - *contents = StringRef(data, size); - lua_pop(L, 2); // pop contents, size - } - *status = clang::vfs::Status(Path.str(), clang::vfs::getNextVirtualUniqueID(), - ZeroTime(), 0, 0, size, filetype, - llvm::sys::fs::all_all); - lua_pop(L, 2); // pop table, kind - return true; - } - virtual ~LuaOverlayFileSystem() {} - - virtual llvm::ErrorOr status(const llvm::Twine &Path) override { - static const std::error_code noSuchFileErr = - std::make_error_code(std::errc::no_such_file_or_directory); - llvm::ErrorOr RealStatus = RFS->status(Path); - if (RealStatus || RealStatus.getError() != noSuchFileErr) return RealStatus; - clang::vfs::Status Status; - StringRef Buffer; - if (GetFile(Path, &Status, &Buffer)) { - return Status; - } - return llvm::errc::no_such_file_or_directory; - } - virtual llvm::ErrorOr> openFileForRead( - const llvm::Twine &Path) override { - llvm::ErrorOr> ec = RFS->openFileForRead(Path); - if (ec || ec.getError() != llvm::errc::no_such_file_or_directory) return ec; - clang::vfs::Status Status; - StringRef Buffer; - if (GetFile(Path, &Status, &Buffer)) { - return std::unique_ptr( - new LuaProvidedFile(Path.str(), Status, Buffer)); - } - return llvm::errc::no_such_file_or_directory; - } - virtual clang::vfs::directory_iterator dir_begin(const llvm::Twine &Dir, - std::error_code &EC) override { - printf("BUGBUG: unexpected call to directory iterator in C header include. " - "report this a bug on github.com/terralang/terra"); - // as far as I can tell this isn't used by the things we are using, so - // I am leaving it unfinished until this changes. - return RFS->dir_begin(Dir, EC); - } - llvm::ErrorOr getCurrentWorkingDirectory() const override { - return std::string("cwd"); - } - std::error_code setCurrentWorkingDirectory(const Twine &Path) override { - return std::error_code(); - } -}; -#endif // Clang's initialization happens in two phases: // @@ -939,23 +828,13 @@ void InitHeaderSearchFlagsAndArgs(std::string const &TripleStr, HeaderSearchOpti static void initializeclang(terra_State *T, llvm::MemoryBuffer *membuffer, const std::vector &args, CompilerInstance *TheCompInst, -#if LLVM_VERSION < 80 - llvm::IntrusiveRefCntPtr FS -#else - llvm::IntrusiveRefCntPtr FS -#endif -) { + llvm::IntrusiveRefCntPtr FS) { // CompilerInstance will hold the instance of the Clang compiler for us, // managing the various objects needed to run the compiler. TheCompInst->createDiagnostics(); -#if LLVM_VERSION <= 90 - CompilerInvocation::CreateFromArgs(TheCompInst->getInvocation(), &args[0], - &args[args.size()], TheCompInst->getDiagnostics()); -#else CompilerInvocation::CreateFromArgs(TheCompInst->getInvocation(), args, TheCompInst->getDiagnostics()); -#endif // need to recreate the diagnostics engine so that it actually listens to warning // flags like -Wno-deprecated this cannot go before CreateFromArgs TheCompInst->createDiagnostics(); @@ -964,12 +843,7 @@ static void initializeclang(terra_State *T, llvm::MemoryBuffer *membuffer, TargetInfo *TI = TargetInfo::CreateTargetInfo(TheCompInst->getDiagnostics(), to); TheCompInst->setTarget(TI); -#if LLVM_VERSION < 90 - TheCompInst->setVirtualFileSystem(FS); - TheCompInst->createFileManager(); -#else TheCompInst->createFileManager(FS); -#endif FileManager &FileMgr = TheCompInst->getFileManager(); TheCompInst->createSourceManager(FileMgr); SourceManager &SourceMgr = TheCompInst->getSourceManager(); @@ -1006,13 +880,9 @@ static void AddMacro(terra_State *T, Preprocessor &PP, const IdentifierInfo *II, SmallString<64> IntegerBuffer; bool NumberInvalid = false; StringRef Spelling = PP.getSpelling(*Tok, IntegerBuffer, &NumberInvalid); -#if LLVM_VERSION <= 100 - NumericLiteralParser Literal(Spelling, Tok->getLocation(), PP); -#else NumericLiteralParser Literal(Spelling, Tok->getLocation(), PP.getSourceManager(), PP.getLangOpts(), PP.getTargetInfo(), PP.getDiagnostics()); -#endif if (Literal.hadError) return; double V; if (Literal.isFloatingLiteral()) { @@ -1066,11 +936,7 @@ static int dofile(terra_State *T, TerraTarget *TT, const char *code, // managing the various objects needed to run the compiler. CompilerInstance TheCompInst; -#if LLVM_VERSION < 80 - llvm::IntrusiveRefCntPtr FS = new LuaOverlayFileSystem(T->L); -#else llvm::IntrusiveRefCntPtr FS = new LuaOverlayFileSystem(T->L); -#endif llvm::MemoryBuffer *membuffer = llvm::MemoryBuffer::getMemBuffer(code, "").release(); diff --git a/src/tinline.cpp b/src/tinline.cpp index 7a809e9a6..2c630b03b 100644 --- a/src/tinline.cpp +++ b/src/tinline.cpp @@ -44,17 +44,9 @@ void ManualInliner::run(std::vector::iterator fbegin, CallGraphNode *n = CG->getOrInsertFunction(F); for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB) for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE; ++II) { -#if LLVM_VERSION < 90 - CallSite CS(cast(II)); -#else CallBase *CS(dyn_cast(II)); -#endif if (CS) { -#if LLVM_VERSION < 90 - const Function *Callee = CS.getCalledFunction(); -#else const Function *Callee = CS->getCalledFunction(); -#endif if (Callee && !Callee->isIntrinsic()) { CallGraphNode *n2 = CG->getOrInsertFunction(Callee); n->addCalledFunction(CS, n2); diff --git a/src/tllvmutil.cpp b/src/tllvmutil.cpp index ce9f17e7a..966fcfeb8 100644 --- a/src/tllvmutil.cpp +++ b/src/tllvmutil.cpp @@ -40,9 +40,6 @@ void llvmutil_addoptimizationpasses(PassManagerBase *fpm) { PassManagerBuilder PMB; PMB.OptLevel = 3; PMB.SizeLevel = 0; -#if LLVM_VERSION < 90 - PMB.DisableUnitAtATime = true; -#endif PMB.LoopVectorize = true; PMB.SLPVectorize = true; @@ -58,13 +55,8 @@ void llvmutil_disassemblefunction(void *data, size_t numBytes, size_t numInst) { const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error); assert(TheTarget && "Unable to create target!"); - const MCAsmInfo *MAI = - TheTarget->createMCAsmInfo(*TheTarget->createMCRegInfo(TripleName), TripleName -#if LLVM_VERSION >= 100 - , - MCTargetOptions() -#endif - ); + const MCAsmInfo *MAI = TheTarget->createMCAsmInfo( + *TheTarget->createMCRegInfo(TripleName), TripleName, MCTargetOptions()); assert(MAI && "Unable to create target asm info!"); const MCInstrInfo *MII = TheTarget->createMCInstrInfo(); assert(MII && "Unable to create target instruction info!"); @@ -100,28 +92,12 @@ void llvmutil_disassemblefunction(void *data, size_t numBytes, size_t numInst) { raw_fd_ostream Out(fileno(stdout), false); for (size_t i = 0, b = 0; b < numBytes || i < numInst; i++, b += Size) { MCInst Inst; -#if LLVM_VERSION <= 90 - MCDisassembler::DecodeStatus S = DisAsm->getInstruction( - Inst, Size, Bytes.slice(b), addr + b, nulls(), Out); -#else MCDisassembler::DecodeStatus S = DisAsm->getInstruction(Inst, Size, Bytes.slice(b), addr + b, Out); -#endif if (MCDisassembler::Fail == S || MCDisassembler::SoftFail == S) break; Out << (void *)((uintptr_t)data + b) << "(+" << b << ")" << ":\t"; - IP->printInst(&Inst, -#if LLVM_VERSION <= 90 - Out, -#else - addr + b, -#endif - "", *STI -#if LLVM_VERSION >= 100 - , - Out -#endif - ); + IP->printInst(&Inst, addr + b, "", *STI, Out); Out << "\n"; } Out.flush(); @@ -139,25 +115,13 @@ bool llvmutil_emitobjfile(Module *Mod, TargetMachine *TM, bool outputobjectfile, PassManagerT pass; llvmutil_addtargetspecificpasses(&pass, TM); -#if LLVM_VERSION <= 90 - TargetMachine::CodeGenFileType ft = outputobjectfile - ? TargetMachine::CGFT_ObjectFile - : TargetMachine::CGFT_AssemblyFile; -#else CodeGenFileType ft = outputobjectfile ? CGFT_ObjectFile : CGFT_AssemblyFile; -#endif emitobjfile_t &destf = dest; -#if LLVM_VERSION >= 70 if (TM->addPassesToEmitFile(pass, destf, nullptr, ft)) { return true; } -#else - if (TM->addPassesToEmitFile(pass, destf, ft)) { - return true; - } -#endif pass.run(*Mod); @@ -224,20 +188,10 @@ struct CopyConnectedComponent : public ValueMaterializer { if (SP) { F->setSubprogram(DI->createFunction( -#if LLVM_VERSION < 90 - SP->getScope().resolve(), SP->getName(), SP->getLinkageName(), -#else SP->getScope(), SP->getName(), SP->getLinkageName(), -#endif DI->createFile(SP->getFilename(), SP->getDirectory()), -#if LLVM_VERSION >= 80 SP->getLine(), SP->getType(), SP->getScopeLine(), SP->getFlags(), SP->getSPFlags(), SP->getTemplateParams(), -#else - SP->getLine(), SP->getType(), SP->isLocalToUnit(), - SP->isDefinition(), SP->getScopeLine(), SP->getFlags(), - SP->isOptimized(), SP->getTemplateParams(), -#endif SP->getDeclaration(), SP->getThrownTypes())); } } else { @@ -291,12 +245,8 @@ struct CopyConnectedComponent : public ValueMaterializer { CU->isOptimized(), CU->getFlags(), CU->getRuntimeVersion(), CU->getSplitDebugFilename(), CU->getEmissionKind(), CU->getDWOId(), CU->getSplitDebugInlining(), -#if LLVM_VERSION >= 80 CU->getDebugInfoForProfiling(), CU->getNameTableKind(), CU->getRangesBaseAddress()); -#else - CU->getDebugInfoForProfiling(), CU->getGnuPubnames()); -#endif } } } @@ -309,20 +259,10 @@ struct CopyConnectedComponent : public ValueMaterializer { if (MD != NULL && DI != NULL && SP != NULL) { { DISubprogram *NSP = DI->createFunction( -#if LLVM_VERSION < 90 - SP->getScope().resolve(), SP->getName(), SP->getLinkageName(), -#else SP->getScope(), SP->getName(), SP->getLinkageName(), -#endif DI->createFile(SP->getFilename(), SP->getDirectory()), -#if LLVM_VERSION >= 80 SP->getLine(), SP->getType(), SP->getScopeLine(), SP->getFlags(), SP->getSPFlags(), SP->getTemplateParams(), -#else - SP->getLine(), SP->getType(), SP->isLocalToUnit(), - SP->isDefinition(), SP->getScopeLine(), SP->getFlags(), - SP->isOptimized(), SP->getTemplateParams(), -#endif SP->getDeclaration(), SP->getThrownTypes()); Function *newfn = dest->getFunction(SP->getName()); @@ -396,14 +336,9 @@ error_code llvmutil_createtemporaryfile(const Twine &Prefix, StringRef Suffix, int llvmutil_executeandwait(LLVM_PATH_TYPE program, const char **args, std::string *err) { bool executionFailed = false; -#if LLVM_VERSION >= 70 llvm::sys::ProcessInfo Info = llvm::sys::ExecuteNoWait(program, llvm::toStringRefArray(args), llvm::None, {}, 0, err, &executionFailed); -#else - llvm::sys::ProcessInfo Info = llvm::sys::ExecuteNoWait(program, args, nullptr, {}, 0, - err, &executionFailed); -#endif if (executionFailed) return -1; #ifndef _WIN32 // WAR for llvm bug (http://llvm.org/bugs/show_bug.cgi?id=18869) diff --git a/tests/amdgpu_kernel.t b/tests/amdgpu_kernel.t index 89d9b685e..b82acff7e 100644 --- a/tests/amdgpu_kernel.t +++ b/tests/amdgpu_kernel.t @@ -1,8 +1,3 @@ -if terralib.llvm_version < 90 then - print("LLVM is too old, skipping AMD GPU test...") - return -end - local arch = 'gfx908' local amd_target = terralib.newtarget { Triple = 'amdgcn-amd-amdhsa', diff --git a/tests/amdgpu_struct.t b/tests/amdgpu_struct.t index e8aab9385..abf001402 100644 --- a/tests/amdgpu_struct.t +++ b/tests/amdgpu_struct.t @@ -1,8 +1,3 @@ -if terralib.llvm_version < 90 then - print("LLVM is too old, skipping AMD GPU test...") - return -end - -- This tests a bug that occurred when using C structs imported from a -- header file. The structs were associated with a certain target, and -- if used from a different target could cause issues. diff --git a/tests/atomicrmw.t b/tests/atomicrmw.t index e043955ee..3846bc9c6 100644 --- a/tests/atomicrmw.t +++ b/tests/atomicrmw.t @@ -1,8 +1,6 @@ -local has_align = terralib.llvm_version >= 110 -local has_fadd = terralib.llvm_version >= 90 local has_fmin = terralib.llvm_version >= 150 -print("atomicrmw test settings: align " .. tostring(has_align) .. ", fadd " .. tostring(has_fadd)) +print("atomicrmw test settings: fmin " .. tostring(has_fmin)) @@ -12,17 +10,7 @@ terra atomic_add(x : &int, y : int, z : int, w : int, u : int) terralib.atomicrmw("add", x, y, {ordering = "seq_cst"}) terralib.atomicrmw("add", x, z, {ordering = "acq_rel"}) terralib.fence({ordering = "release"}) - escape - if has_align then - emit quote - terralib.atomicrmw("add", x, w, {ordering = "monotonic", syncscope = "singlethread", align = 16}) - end - else - emit quote - terralib.atomicrmw("add", x, w, {ordering = "monotonic", syncscope = "singlethread"}) - end - end - end + terralib.atomicrmw("add", x, w, {ordering = "monotonic", syncscope = "singlethread", align = 16}) terralib.fence({ordering = "acquire"}) terralib.atomicrmw("add", x, u, {ordering = "monotonic", isvolatile = true}) end @@ -83,25 +71,23 @@ assert(add_and_return() == 22) -- Floating point -if has_fadd then - terra atomic_fadd(x : &double, y : double) - terralib.atomicrmw("fadd", x, y, {ordering = "monotonic"}) - end - atomic_fadd:printpretty(false) - atomic_fadd:disas() +terra atomic_fadd(x : &double, y : double) + terralib.atomicrmw("fadd", x, y, {ordering = "monotonic"}) +end +atomic_fadd:printpretty(false) +atomic_fadd:disas() - terra fadd() - var f : double = 1.0 +terra fadd() + var f : double = 1.0 - atomic_fadd(&f, 20.0) + atomic_fadd(&f, 20.0) - return f - end - - print(fadd()) - assert(fadd() == 21.0) + return f end +print(fadd()) +assert(fadd() == 21.0) + if has_fmin then terra atomic_fmin(x : &double, y : double) terralib.atomicrmw("fmin", x, y, {ordering = "monotonic"}) diff --git a/tests/dgemm3.t b/tests/dgemm3.t index cba69a921..1260cf73c 100644 --- a/tests/dgemm3.t +++ b/tests/dgemm3.t @@ -11,11 +11,7 @@ end local function isinteger(x) return math.floor(x) == x end -if terralib.llvm_version < 100 then - llvmprefetch = terralib.intrinsic("llvm.prefetch",{&opaque,int,int,int} -> {}) -else - llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) -end +llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) local function alignedload(addr) return `terralib.attrload(addr, { align = 8 }) diff --git a/tests/dgemmpaper.t b/tests/dgemmpaper.t index 58aa093fd..d41569308 100644 --- a/tests/dgemmpaper.t +++ b/tests/dgemmpaper.t @@ -7,11 +7,7 @@ function symmat(typ,name,I,...) end return r end -if terralib.llvm_version < 100 then - prefetch = terralib.intrinsic("llvm.prefetch",{&opaque,int,int,int} -> {}) -else - prefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) -end +prefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) function genkernel(NB, RM, RN, V,alpha) local VT = vector(double,V) diff --git a/tests/diffuse.t b/tests/diffuse.t index 19535ef92..169af608d 100644 --- a/tests/diffuse.t +++ b/tests/diffuse.t @@ -99,11 +99,7 @@ terra diffuse(output : &float, N : int, M : int, stride : int, x : &float, x0 : end -if terralib.llvm_version < 100 then - llvmprefetch = terralib.intrinsic("llvm.prefetch",{&opaque,int,int,int} -> {}) -else - llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) -end +llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) terra diffuse2(output : &float, N : int, M : int, stride : int, x : &float, x0 : &float, a : float,xi : &float) var invD = 1.f / (1 + 4.f*a) diff --git a/tests/gemm.t b/tests/gemm.t index f74e4e060..19c6497a2 100644 --- a/tests/gemm.t +++ b/tests/gemm.t @@ -13,11 +13,7 @@ end local function isinteger(x) return math.floor(x) == x end -if terralib.llvm_version < 100 then - llvmprefetch = terralib.intrinsic("llvm.prefetch",{&opaque,int,int,int} -> {}) -else - llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) -end +llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) local function unalignedload(addr) return `terralib.attrload(addr, { align = alignment }) end diff --git a/tests/sgemm3.t b/tests/sgemm3.t index 44d4e25a0..7af73a5c4 100644 --- a/tests/sgemm3.t +++ b/tests/sgemm3.t @@ -9,11 +9,7 @@ function symmat(typ,name,I,...) end -if terralib.llvm_version < 100 then - llvmprefetch = terralib.intrinsic("llvm.prefetch",{&opaque,int,int,int} -> {}) -else - llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) -end +llvmprefetch = terralib.intrinsic("llvm.prefetch.p0i8",{&opaque,int,int,int} -> {}) diff --git a/travis.sh b/travis.sh index 6e3a2ae06..baadea507 100755 --- a/travis.sh +++ b/travis.sh @@ -76,36 +76,6 @@ elif [[ $(uname) = Darwin ]]; then ln -s clang+llvm-11.1.0-x86_64-apple-darwin/bin/llvm-config llvm-config-11 ln -s clang+llvm-11.1.0-x86_64-apple-darwin/bin/clang clang-11 export CMAKE_PREFIX_PATH=$PWD/clang+llvm-11.1.0-x86_64-apple-darwin - elif [[ $LLVM_CONFIG = llvm-config-10 ]]; then - curl -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz - tar xf clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz - ln -s clang+llvm-10.0.0-x86_64-apple-darwin/bin/llvm-config llvm-config-10 - ln -s clang+llvm-10.0.0-x86_64-apple-darwin/bin/clang clang-10 - export CMAKE_PREFIX_PATH=$PWD/clang+llvm-10.0.0-x86_64-apple-darwin - elif [[ $LLVM_CONFIG = llvm-config-9 ]]; then - curl -L -O http://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz - tar xf clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz - ln -s clang+llvm-9.0.0-x86_64-darwin-apple/bin/llvm-config llvm-config-9 - ln -s clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang clang-9 - export CMAKE_PREFIX_PATH=$PWD/clang+llvm-9.0.0-x86_64-darwin-apple - elif [[ $LLVM_CONFIG = llvm-config-8 ]]; then - curl -L -O http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz - tar xf clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz - ln -s clang+llvm-8.0.0-x86_64-apple-darwin/bin/llvm-config llvm-config-8 - ln -s clang+llvm-8.0.0-x86_64-apple-darwin/bin/clang clang-8 - export CMAKE_PREFIX_PATH=$PWD/clang+llvm-8.0.0-x86_64-apple-darwin - elif [[ $LLVM_CONFIG = llvm-config-7 ]]; then - curl -L -O http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz - tar xf clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz - ln -s clang+llvm-7.0.0-x86_64-apple-darwin/bin/llvm-config llvm-config-7 - ln -s clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang clang-7 - export CMAKE_PREFIX_PATH=$PWD/clang+llvm-7.0.0-x86_64-apple-darwin - elif [[ $LLVM_CONFIG = llvm-config-6.0 ]]; then - curl -L -O http://releases.llvm.org/6.0.0/clang+llvm-6.0.0-x86_64-apple-darwin.tar.xz - tar xf clang+llvm-6.0.0-x86_64-apple-darwin.tar.xz - ln -s clang+llvm-6.0.0-x86_64-apple-darwin/bin/llvm-config llvm-config-6.0 - ln -s clang+llvm-6.0.0-x86_64-apple-darwin/bin/clang clang-6.0 - export CMAKE_PREFIX_PATH=$PWD/clang+llvm-6.0.0-x86_64-apple-darwin else echo "Don't know this LLVM version: $LLVM_CONFIG" exit 1