Skip to content

Commit

Permalink
bump: LLVM 11.0.1 & inkwell beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Jan 22, 2021
1 parent ebcddbe commit f8404f7
Show file tree
Hide file tree
Showing 128 changed files with 603 additions and 593 deletions.
8 changes: 0 additions & 8 deletions .github/actions-rs/grcov.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/actions/install-llvm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1182,13 +1182,14 @@ async function execute(cmd) {
(async () => {
try {
if(isLinux) {
await exec.exec("sudo apt install llvm-8 llvm-8-* liblld-8*");
const installScript = path.join(__dirname, "../../../../scripts/install-llvm.sh");
await exec.exec(`sudo ${installScript}`);
} else if(isMacOS) {
await exec.exec("brew install llvm@8")
let llvmPath = await execute("brew --prefix llvm@8");
await exec.exec("brew install llvm@11")
let llvmPath = await execute("brew --prefix llvm@11");
core.addPath(`${llvmPath}/bin`)
} else if(isWindows) {
const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v8.0.1/llvm-8.0.1-windows-x64-msvc16.7z"
const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v11.0.1/llvm-11.0.1-windows-x64-msvc16.7z"
core.info(`downloading LLVM from '${downloadUrl}'`)
const downloadLocation = await tc.downloadTool(downloadUrl);

Expand Down
9 changes: 5 additions & 4 deletions .github/actions/install-llvm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ export async function execute(cmd) {
(async () => {
try {
if(isLinux) {
await exec.exec("sudo apt install llvm-8 llvm-8-* liblld-8*");
const installScript = path.join(__dirname, "../../../../scripts/install-llvm.sh");
await exec.exec(`sudo ${installScript}`);
} else if(isMacOS) {
await exec.exec("brew install llvm@8")
let llvmPath = await execute("brew --prefix llvm@8");
await exec.exec("brew install llvm@11")
let llvmPath = await execute("brew --prefix llvm@11");
core.addPath(`${llvmPath}/bin`)
} else if(isWindows) {
const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v8.0.1/llvm-8.0.1-windows-x64-msvc16.7z"
const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v11.0.1/llvm-11.0.1-windows-x64-msvc16.7z"
core.info(`downloading LLVM from '${downloadUrl}'`)
const downloadLocation = await tc.downloadTool(downloadUrl);

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
artifacts: "mun libmun_runtime.so"
}
- {
os: "windows-2016",
os: "windows-latest",
dir: win64,
artifacts: "mun.exe mun_runtime.dll mun_runtime.dll.lib"
}
Expand Down
51 changes: 19 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
- **Cross compilation** - The Mun compiler is able to compile to all supported
target platforms from any supported compiler platform.

- **Powerful IDE integration** *not implemented yet* - The Mun language and
compiler framework are designed to support source code queries, allowing for
powerful IDE integrations such as code completion and refactoring tools.
- **Powerful IDE integration** - The Mun language and compiler framework are
designed to support source code queries, allowing for powerful IDE
integrations such as code completion and refactoring tools.

## Example

Expand Down Expand Up @@ -153,53 +153,40 @@ rustup](https://www.rust-lang.org/tools/install).

#### LLVM

Mun targets LLVM 8.0.1. Installing LLVM is platform dependant and as such can be
a pain. The following steps are how we install LLVM on [our CI
Mun targets LLVM 11. Installing LLVM is platform dependant and as such can be
a pain.

The following steps are how we install LLVM on [our CI
runners](.github/actions/install-llvm/index.js):

* ***nix**: Package managers of recent *nix distros can install binary versions
of LLVM, e.g.:
```bash
# Ubuntu 18.04
sudo apt install llvm-8 llvm-8-* liblld-8*
```
* **Arch Linux** The binary version of LLVM can currently only be installed
using an AUR helper, such as `yay`:
* ***Debian/Ubuntu**: Execute the script in
[`scripts/install-llvm.sh`](scripts/install-llvm.sh) to install the required
LLVM packages from the official APT repository.
```bash
yay -Syu lld7-headers lld7-libs-static
./scripts/install-llvm.sh
```
It is also possible to perform a manual package installation as follows:
```bash
# NOTE: this installs all of the lld7 packages
cd /tmp
git clone https://aur.archlinux.org/lld7.git
cd lld7
makepkg -si
```
When running `llvm-config`, an error can occur signalling that
`/usr/lib/libtinfo.so.5` is missing. If a newer version is present, create a
symlink; e.g. `ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5`),
otherwise download the library.
* **macOS**: [Brew](https://brew.sh/) contains a binary distribution of LLVM
8.0.1. However, as it's not the latest version, it won't be added to the path.
11. However, when it's not the latest version, it won't be added to the path.
We are using [llvm-sys](https://crates.io/crates/llvm-sys) to manage version,
but another option is to export the `LLVM_SYS_80_PREFIX` variable, which will
but another option is to export the `LLVM_SYS_110_PREFIX` variable, which will
not clutter your `PATH`. To install:
```bash
brew install llvm@8
brew install llvm@11
# Export LLVM_SYS_PREFIX to not clubber PATH
export LLVM_SYS_PREFIX=$(brew --prefix llvm@8)
export LLVM_SYS_PREFIX=$(brew --prefix llvm@11)
```
* **windows**: Binary distrubutions are available for Windows on the LLVM
* **windows**: Binary distributions are available for Windows on the LLVM
website, but they do not contain a number of libraries that are required by
Mun. To avoid having to go to the trouble of compiling LLVM yourself, we
created a [repository](https://github.com/mun-lang/llvm-package-windows) that
automatically compiles the required binaries. It also contains a
[release](https://github.com/mun-lang/llvm-package-windows/releases/v8.0.1)
[release](https://github.com/mun-lang/llvm-package-windows/releases/v11.0.1)
that you can download and extract to your machine. Once downloaded and
extracted, add the `<extract_dir>/bin` folder to the `PATH` environment
variable.

Otherwise, your best bet is to build LLVM from source.

### Clone source

```bash
Expand Down
5 changes: 2 additions & 3 deletions crates/mun_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ hir = { version = "=0.2.0", path = "../mun_hir", package = "mun_hir" }
itertools = "0.9.0"
mun_codegen_macros = { path = "../mun_codegen_macros", package = "mun_codegen_macros" }
mun_target = { version = "=0.2.0", path = "../mun_target" }
mun_lld = { version = "=80.0.0", path = "../mun_lld" }
mun_lld = { path = "../mun_lld" }
anyhow = "1.0.31"
thiserror = "1.0.19"
salsa = "0.15.0"
Expand All @@ -28,8 +28,7 @@ array-init="0.1.0"
tempfile = "3"
paste = "0.1.6"
parking_lot = "0.10"
#inkwell = { version = "=0.1.0-llvm8sample", features = ["llvm8-0"]}
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm8-0", "no-libffi-linking"] }
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm11-0", "no-libffi-linking"] }
by_address = "1.0.4"

[dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ source_filename = "main.mun"

@global_type_table = external global [1 x %"mun_codegen::ir::types::TypeInfo"*]

define float @add(float, float) {
define float @add(float %0, float %1) {
body:
%add = fadd float %0, %1
ret float %add
}

define float @subtract(float, float) {
define float @subtract(float %0, float %1) {
body:
%sub = fsub float %0, %1
ret float %sub
}

define float @multiply(float, float) {
define float @multiply(float %0, float %1) {
body:
%mul = fmul float %0, %1
ret float %mul
}

define float @divide(float, float) {
define float @divide(float %0, float %1) {
body:
%div = fdiv float %0, %1
ret float %div
}

define float @remainder(float, float) {
define float @remainder(float %0, float %1) {
body:
%rem = frem float %0, %1
ret float %rem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ source_filename = "main.mun"

@global_type_table = external global [1 x %"mun_codegen::ir::types::TypeInfo"*]

define double @add(double, double) {
define double @add(double %0, double %1) {
body:
%add = fadd double %0, %1
ret double %add
}

define double @subtract(double, double) {
define double @subtract(double %0, double %1) {
body:
%sub = fsub double %0, %1
ret double %sub
}

define double @multiply(double, double) {
define double @multiply(double %0, double %1) {
body:
%mul = fmul double %0, %1
ret double %mul
}

define double @divide(double, double) {
define double @divide(double %0, double %1) {
body:
%div = fdiv double %0, %1
ret double %div
}

define double @remainder(double, double) {
define double @remainder(double %0, double %1) {
body:
%rem = frem double %0, %1
ret double %rem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ source_filename = "main.mun"

@global_type_table = external global [1 x %"mun_codegen::ir::types::TypeInfo"*]

define i128 @add(i128, i128) {
define i128 @add(i128 %0, i128 %1) {
body:
%add = add i128 %0, %1
ret i128 %add
}

define i128 @subtract(i128, i128) {
define i128 @subtract(i128 %0, i128 %1) {
body:
%sub = sub i128 %0, %1
ret i128 %sub
}

define i128 @multiply(i128, i128) {
define i128 @multiply(i128 %0, i128 %1) {
body:
%mul = mul i128 %0, %1
ret i128 %mul
}

define i128 @divide(i128, i128) {
define i128 @divide(i128 %0, i128 %1) {
body:
%div = sdiv i128 %0, %1
ret i128 %div
}

define i128 @remainder(i128, i128) {
define i128 @remainder(i128 %0, i128 %1) {
body:
%rem = srem i128 %0, %1
ret i128 %rem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ source_filename = "main.mun"

@global_type_table = external global [1 x %"mun_codegen::ir::types::TypeInfo"*]

define i16 @add(i16, i16) {
define i16 @add(i16 %0, i16 %1) {
body:
%add = add i16 %0, %1
ret i16 %add
}

define i16 @subtract(i16, i16) {
define i16 @subtract(i16 %0, i16 %1) {
body:
%sub = sub i16 %0, %1
ret i16 %sub
}

define i16 @multiply(i16, i16) {
define i16 @multiply(i16 %0, i16 %1) {
body:
%mul = mul i16 %0, %1
ret i16 %mul
}

define i16 @divide(i16, i16) {
define i16 @divide(i16 %0, i16 %1) {
body:
%div = sdiv i16 %0, %1
ret i16 %div
}

define i16 @remainder(i16, i16) {
define i16 @remainder(i16 %0, i16 %1) {
body:
%rem = srem i16 %0, %1
ret i16 %rem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ source_filename = "main.mun"

@global_type_table = external global [1 x %"mun_codegen::ir::types::TypeInfo"*]

define i32 @add(i32, i32) {
define i32 @add(i32 %0, i32 %1) {
body:
%add = add i32 %0, %1
ret i32 %add
}

define i32 @subtract(i32, i32) {
define i32 @subtract(i32 %0, i32 %1) {
body:
%sub = sub i32 %0, %1
ret i32 %sub
}

define i32 @multiply(i32, i32) {
define i32 @multiply(i32 %0, i32 %1) {
body:
%mul = mul i32 %0, %1
ret i32 %mul
}

define i32 @divide(i32, i32) {
define i32 @divide(i32 %0, i32 %1) {
body:
%div = sdiv i32 %0, %1
ret i32 %div
}

define i32 @remainder(i32, i32) {
define i32 @remainder(i32 %0, i32 %1) {
body:
%rem = srem i32 %0, %1
ret i32 %rem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ source_filename = "main.mun"

@global_type_table = external global [1 x %"mun_codegen::ir::types::TypeInfo"*]

define i64 @add(i64, i64) {
define i64 @add(i64 %0, i64 %1) {
body:
%add = add i64 %0, %1
ret i64 %add
}

define i64 @subtract(i64, i64) {
define i64 @subtract(i64 %0, i64 %1) {
body:
%sub = sub i64 %0, %1
ret i64 %sub
}

define i64 @multiply(i64, i64) {
define i64 @multiply(i64 %0, i64 %1) {
body:
%mul = mul i64 %0, %1
ret i64 %mul
}

define i64 @divide(i64, i64) {
define i64 @divide(i64 %0, i64 %1) {
body:
%div = sdiv i64 %0, %1
ret i64 %div
}

define i64 @remainder(i64, i64) {
define i64 @remainder(i64 %0, i64 %1) {
body:
%rem = srem i64 %0, %1
ret i64 %rem
Expand Down
Loading

0 comments on commit f8404f7

Please sign in to comment.