Skip to content

Commit

Permalink
Add support for LLVM 16 (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli authored Jan 14, 2025
1 parent d80aba7 commit 51b9799
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:

test:
timeout-minutes: 5
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
llvm-version: [14, 15]
llvm-version: [14, 15, 16]
# Testing all levels because there was a bug that only happened with -O1. (#224)
opt-level: ['-O0', '-O1', '-O2', '-O3']
steps:
Expand All @@ -65,12 +65,14 @@ jobs:
fi
doctest:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- run: sudo apt update
- run: sudo apt install -y llvm-{14,15}-dev clang-{14,15} make
- run: sudo apt install -y llvm-{14,15,16}-dev clang-{14,15,16} make
- run: LLVM_CONFIG=llvm-config-14 ./doctest.sh
- run: make clean
- run: LLVM_CONFIG=llvm-config-15 ./doctest.sh
- run: make clean
- run: LLVM_CONFIG=llvm-config-16 ./doctest.sh
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
timeout-minutes: 5
strategy:
matrix:
llvm-version: [14, 15]
llvm-version: [14, 15, 16]
# Testing all levels because there was a bug that only happened with -O1. (#224)
opt-level: ['-O0', '-O1', '-O2', '-O3']
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
llvm-version: [14, 15]
llvm-version: [14, 15, 16]
# Testing all levels because there was a bug that only happened with -O1. (#224)
opt-level: ['-O0', '-O1', '-O2', '-O3']
fail-fast: false
Expand Down
7 changes: 5 additions & 2 deletions Makefile.posix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# On macos, brew installs LLVM to a weird place in /usr/local/
# On NetBSD, use llvm-config from libLLVM (package from pkgsrc)
LLVM_CONFIG ?= $(shell \
which llvm-config-15 \
which llvm-config-16 \
|| which /usr/local/opt/llvm@16/bin/llvm-config \
|| which /opt/homebrew/opt/llvm@16/bin/llvm-config \
|| which llvm-config-15 \
|| which /usr/local/opt/llvm@15/bin/llvm-config \
|| which /opt/homebrew/opt/llvm@15/bin/llvm-config \
|| which llvm-config-14 \
Expand Down Expand Up @@ -33,7 +36,7 @@ config.h:
echo "#define JOU_CLANG_PATH \"$(CC)\"" >> config.h

config.jou:
@v=`$(LLVM_CONFIG) --version`; case "$$v" in 14.*|15.*) ;; *) echo "Error: Found unsupported LLVM version $$v. Only LLVM 14 and 15 are supported."; exit 1; esac
@v=`$(LLVM_CONFIG) --version`; case "$$v" in 14.*|15.*|16.*) ;; *) echo "Error: Found unsupported LLVM version $$v. Only LLVM 14, 15 and 16 are supported."; exit 1; esac
echo "# auto-generated by Makefile" > config.jou
echo "def get_jou_clang_path() -> byte*:" >> config.jou
echo " return \"$(CC)\"" >> config.jou
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The instructions for developing Jou are in [CONTRIBUTING.md](CONTRIBUTING.md).

1. Install the dependencies:
```
$ sudo apt install git llvm-15-dev clang-15 make
$ sudo apt install git llvm-16-dev clang-16 make
```
Let me know if you use a distro that doesn't have `apt`,
and you need help with this step.
Expand Down Expand Up @@ -121,6 +121,7 @@ The instructions for developing Jou are in [CONTRIBUTING.md](CONTRIBUTING.md).
These LLVM/clang versions are supported:
- LLVM 14 with clang 14
- LLVM 15 with clang 15
- LLVM 16 with clang 16
By default, the `make` command picks the latest available version.
You can also specify the version manually by setting the `LLVM_CONFIG` variable:
Expand Down
2 changes: 1 addition & 1 deletion bootstrap_compiler/jou_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ extern const Type *byteType; // byte (8-bit unsigned)
extern const Type *floatType; // float (32-bit)
extern const Type *doubleType; // double (64-bit)
extern const Type *voidPtrType; // void*
void init_types(); // Called once when compiler starts
void init_types(void); // Called once when compiler starts
const Type *get_integer_type(int size_in_bits, bool is_signed);
const Type *get_pointer_type(const Type *t); // result lives as long as t
const Type *get_array_type(const Type *t, int len); // result lives as long as t
Expand Down

0 comments on commit 51b9799

Please sign in to comment.