Skip to content

Commit

Permalink
Upgrade to LLVM-18 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivaswatha authored Sep 2, 2024
1 parent a30abba commit 565f479
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17 all
sudo ./llvm.sh 18 all
- name: Build
run: RUSTFLAGS="-D warnings" cargo build --workspace --verbose
Expand Down
2 changes: 1 addition & 1 deletion pliron-llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ combine.workspace = true
thiserror.workspace = true
linkme.workspace = true
rustc-hash.workspace = true
llvm-sys = "170"
llvm-sys = "180"

[dev-dependencies]
expect-test.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions pliron-llvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ This crate provides the following functionality:
converting to and from our LLVM dialect. This necessitates
that LLVM be installed locally.

We currently support LLVM-17, and hence LLVM-17 needs to be on your computer.
On Ubuntu, this means, you require the `libllvm17` and `libpolly-17-dev`
We currently support LLVM-18, and hence LLVM-18 needs to be on your computer.
On Ubuntu, this means, you require the `libllvm18` and `libpolly-18-dev`
[packages](https://apt.llvm.org/).

## llvm-opt tool
Expand All @@ -17,7 +17,7 @@ into `pliron`'s LLVM dialect and to emit LLVM bitcode back from the dialect.
Example usage:
1. Compile [fib.c](tests/resources/fib.c) into LLVM-IR:

`$clang-17 -c -emit-llvm -o /tmp/fib.bc tests/resources/fib.c `
`$clang-18 -c -emit-llvm -o /tmp/fib.bc tests/resources/fib.c `

2. Convert the LLVM bitcode to LLVM dialect in `pliron` and back to
LLVM bitcode (the binary `llvm-opt`, produced in your cargo's target
Expand All @@ -28,7 +28,7 @@ directory must be in $PATH):
3. Compile the output fibonacci LLVM-IR, along with a
[main function](tests/resources/fib-main.c) into a binary:

`$clang-17 -o /tmp/fib /tmp/fib.out.ll tests/resources/fib-main.c`
`$clang-18 -o /tmp/fib /tmp/fib.out.ll tests/resources/fib-main.c`

4. Run the fibonacci binary to see the first few fibonacci numbers
printed.
Expand Down
6 changes: 4 additions & 2 deletions pliron-llvm/tests/compile_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use assert_cmd::Command;
use expect_test::expect;
use tempfile::{tempdir, TempDir};

const CLANG_BINARY: &'static str = "clang-18";

static RESOURCES_DIR: LazyLock<PathBuf> = LazyLock::new(|| {
[env!("CARGO_MANIFEST_DIR"), "tests", "resources"]
.iter()
Expand Down Expand Up @@ -34,7 +36,7 @@ fn test_fib(tmp_dir: &TempDir, input_file: &str) {
);

// clang -o $tmp/fib $tmp/fib.out.ll tests/resources/fib-main.c
let mut cmd = Command::new("clang-17");
let mut cmd = Command::new(CLANG_BINARY);
let compile_fib = cmd
.current_dir(&*RESOURCES_DIR)
.args([
Expand Down Expand Up @@ -73,7 +75,7 @@ fn test_fib_from_c() {
let tmp_dir = tempdir().unwrap();

// clang -c -emit-llvm -o $tmp/fib.bc tests/resources/fib.c
let mut cmd = Command::new("clang-17");
let mut cmd = Command::new(CLANG_BINARY);
let compile_fib = cmd
.current_dir(&*RESOURCES_DIR)
.args([
Expand Down

0 comments on commit 565f479

Please sign in to comment.