Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum required LLVM version to 12 #2685

Merged
merged 2 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
- name: Install LLVM
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf ${{ env.LLVM_URL }} -L -o llvm.tar.gz
curl --proto '=https' --tlsv1.2 -sSf ${{ env.LLVM_URL }} -L -o llvm.tar.xz
mkdir ${{ env.LLVM_DIR }}
tar xf llvm.tar.gz --strip-components=1 -C ${{ env.LLVM_DIR }}
tar xf llvm.tar.xz --strip-components=1 -C ${{ env.LLVM_DIR }}
echo "${{ env.LLVM_DIR }}/bin" >> $GITHUB_PATH
echo "LLVM_SYS_110_PREFIX=${{ env.LLVM_DIR }}" >> $GITHUB_ENV
echo "LLVM_SYS_120_PREFIX=${{ env.LLVM_DIR }}" >> $GITHUB_ENV
env:
LLVM_DIR: ${{ github.workspace }}/llvm-11
LLVM_URL: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-amd64.tar.gz'
LLVM_DIR: ${{ github.workspace }}/llvm-13
LLVM_URL: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz'
- name: Build & package documentation
run: make package-docs
- name: Publish documentation
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
components: rustfmt, clippy
- name: Install LLVM (Linux)
run: |
curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-amd64.tar.gz -L -o /opt/llvm.tar.gz
mkdir -p /opt/llvm-11
tar xf /opt/llvm.tar.gz --strip-components=1 -C /opt/llvm-11
echo '/opt/llvm-11/bin' >> $GITHUB_PATH
echo 'LLVM_SYS_110_PREFIX=/opt/llvm-11' >> $GITHUB_ENV
curl --proto '=https' --tlsv1.2 -sSf https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz -L -o /opt/llvm.tar.xz
mkdir -p /opt/llvm-12
tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-12
echo '/opt/llvm-12/bin' >> $GITHUB_PATH
echo 'LLVM_SYS_120_PREFIX=/opt/llvm-12' >> $GITHUB_ENV
- run: make lint
env:
ENABLE_CRANELIFT: "1"
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test-sys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
include:
- build: linux-x64
os: ubuntu-18.04
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-amd64.tar.gz'
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz'
artifact_name: 'wasmer-linux-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_linux'
run_test: true
Expand All @@ -51,7 +51,7 @@ jobs:
use_sccache: true
- build: macos-x64
os: macos-11
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/darwin-amd64.tar.gz'
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz'
artifact_name: 'wasmer-darwin-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_mac'
run_test: true
Expand All @@ -68,8 +68,8 @@ jobs:
run_test_capi: false
- build: windows-x64
os: windows-latest
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/windows-amd64.tar.gz'
llvm_choco_version: 12.0.1
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/windows-amd64.tar.gz'
llvm_choco_version: 13.0.0
artifact_name: 'wasmer-windows-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_win'
run_integration_tests: true
Expand All @@ -80,7 +80,7 @@ jobs:
# os: [self-hosted, linux, ARM64]
# random_sccache_port: true
# use_sccache: true
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-aarch64.tar.gz'
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/linux-aarch64.tar.gz'
# artifact_name: 'wasmer-linux-aarch64'
# run_integration_tests: false
- build: linux-musl-x64
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
choco install llvm --version ${{ matrix.llvm_choco_version }} --allow-downgrade
cd 'C:\Program Files\LLVM\'
LLVM_DIR=$(pwd)
echo "LLVM_SYS_110_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
- name: Install LLVM (macOS Apple Silicon)
if: matrix.os == 'macos-11.0' && !matrix.llvm_url
run: |
Expand All @@ -131,12 +131,12 @@ jobs:
if: matrix.llvm_url
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.gz
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.xz
LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }}
mkdir ${LLVM_DIR}
tar xf llvm.tar.gz --strip-components=1 -C ${LLVM_DIR}
tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR}
echo "${LLVM_DIR}/bin" >> $GITHUB_PATH
echo "LLVM_SYS_110_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
env:
LLVM_DIR: .llvm
- name: Set up dependencies for Mac OS
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,18 @@ ifneq ($(ENABLE_LLVM), 0)
LLVM_VERSION := $(shell llvm-config --version)

# If findstring is not empty, then it have found the value
ifneq (, $(findstring 12,$(LLVM_VERSION)))
ifneq (, $(findstring 13,$(LLVM_VERSION)))
compilers += llvm
else ifneq (, $(findstring 11,$(LLVM_VERSION)))
compilers += llvm
else ifneq (, $(findstring 10,$(LLVM_VERSION)))
else ifneq (, $(findstring 12,$(LLVM_VERSION)))
compilers += llvm
endif
# … or try to autodetect LLVM from `llvm-config-<version>`.
else
ifneq (, $(shell which llvm-config-12 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-12 --version)
ifneq (, $(shell which llvm-config-13 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-13 --version)
compilers += llvm
else ifneq (, $(shell which llvm-config-11 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-11 --version)
compilers += llvm
else ifneq (, $(shell which llvm-config-10 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-10 --version)
else ifneq (, $(shell which llvm-config-12 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-12 --version)
compilers += llvm
endif
endif
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ loupe = "0.1"
package = "inkwell"
version = "0.1.0-beta.4"
default-features = false
features = ["llvm11-0", "target-x86", "target-aarch64"]
features = ["llvm12-0", "target-x86", "target-aarch64"]

[build-dependencies]
cc = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler-llvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ to native speeds.
## Requirements

The LLVM compiler requires a valid installation of LLVM in your system.
It currently requires **LLVM 11**.
It currently requires **LLVM 12**.


You can install LLVM easily on your Debian-like system via this command:

```bash
wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
sudo bash /tmp/llvm.sh 11
sudo bash /tmp/llvm.sh 12
```

Or in macOS:
Expand Down
13 changes: 6 additions & 7 deletions lib/compiler-llvm/src/abi/aarch64_systemv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use inkwell::{
attributes::{Attribute, AttributeLoc},
builder::Builder,
context::Context,
types::{BasicMetadataTypeEnum, BasicType, FunctionType, StructType},
types::{AnyType, BasicMetadataTypeEnum, BasicType, FunctionType, StructType},
values::{BasicValue, BasicValueEnum, CallSiteValue, FunctionValue, IntValue, PointerValue},
AddressSpace,
};
Expand Down Expand Up @@ -206,17 +206,16 @@ impl Abi for Aarch64SystemV {
.map(|&ty| type_to_llvm(intrinsics, ty))
.collect::<Result<_, _>>()?;

let sret = context
.struct_type(&basic_types, false)
.ptr_type(AddressSpace::Generic);
let sret = context.struct_type(&basic_types, false);
let sret_ptr = sret.ptr_type(AddressSpace::Generic);

let param_types =
std::iter::once(Ok(sret.as_basic_type_enum())).chain(param_types);
std::iter::once(Ok(sret_ptr.as_basic_type_enum())).chain(param_types);

let mut attributes = vec![(
context.create_enum_attribute(
context.create_type_attribute(
Attribute::get_named_enum_kind_id("sret"),
0,
sret.as_any_type_enum(),
),
AttributeLoc::Param(0),
)];
Expand Down
15 changes: 9 additions & 6 deletions lib/compiler-llvm/src/abi/x86_64_systemv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use inkwell::{
attributes::{Attribute, AttributeLoc},
builder::Builder,
context::Context,
types::{BasicMetadataTypeEnum, BasicType, FunctionType, StructType},
types::{AnyType, BasicMetadataTypeEnum, BasicType, FunctionType, StructType},
values::{
BasicValue, BasicValueEnum, CallSiteValue, FloatValue, FunctionValue, IntValue,
PointerValue, VectorValue,
Expand Down Expand Up @@ -263,14 +263,17 @@ impl Abi for X86_64SystemV {
.map(|&ty| type_to_llvm(intrinsics, ty))
.collect::<Result<_, _>>()?;

let sret = context
.struct_type(&basic_types, false)
.ptr_type(AddressSpace::Generic);
let sret = context.struct_type(&basic_types, false);
let sret_ptr = sret.ptr_type(AddressSpace::Generic);

let param_types = std::iter::once(Ok(sret.as_basic_type_enum())).chain(param_types);
let param_types =
std::iter::once(Ok(sret_ptr.as_basic_type_enum())).chain(param_types);

let mut attributes = vec![(
context.create_enum_attribute(Attribute::get_named_enum_kind_id("sret"), 0),
context.create_type_attribute(
Attribute::get_named_enum_kind_id("sret"),
sret.as_any_type_enum(),
),
AttributeLoc::Param(0),
)];
attributes.append(&mut vmctx_attributes(1));
Expand Down