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

Support LLVM 16 #13181

Merged
merged 25 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
6 changes: 5 additions & 1 deletion .github/workflows/llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
llvm_version: ["13.0.0", "14.0.0", "15.0.6"]
llvm_version: ["13.0.0", "14.0.0", "15.0.6", "16.0.0"]
name: "LLVM ${{ matrix.llvm_version }}"
steps:
- name: Checkout Crystal source
Expand All @@ -36,6 +36,10 @@ jobs:
version: "${{ matrix.llvm_version }}"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Install libtinfo5
run: apt-get install -y libtinfo5
if: "${{ matrix.llvm_version == '16.0.0' }}"
straight-shoota marked this conversation as resolved.
Show resolved Hide resolved

- name: Set LLVM_CONFIG
# LLVM_PATH is set by install-llvm-action
run: echo "LLVM_CONFIG=$LLVM_PATH/bin/llvm-config" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion src/llvm/ext/llvm-versions.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.0 14.0 13.0 12.0 11.1 11.0 10.0 9.0 8.0
16.0 15.0 14.0 13.0 12.0 11.1 11.0 10.0 9.0 8.0
10 changes: 9 additions & 1 deletion src/llvm/ext/llvm_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ using namespace llvm;
#include <llvm/Bitcode/BitcodeWriter.h>
#include <llvm/Analysis/ModuleSummaryAnalysis.h>

#if LLVM_VERSION_GE(16, 0)
#define makeArrayRef ArrayRef
#endif

typedef DIBuilder *DIBuilderRef;
#define DIArray DINodeArray
template <typename T> T *unwrapDIptr(LLVMMetadataRef v) {
Expand Down Expand Up @@ -232,7 +236,11 @@ LLVMMetadataRef LLVMExtDIBuilderCreatePointerType(
uint64_t SizeInBits, uint64_t AlignInBits, const char *Name) {
DIDerivedType *T = Dref->createPointerType(unwrapDI<DIType>(PointeeType),
SizeInBits, AlignInBits,
#if LLVM_VERSION_GE(16, 0)
std::nullopt,
#else
None,
#endif
Name);
return wrap(T);
}
Expand Down Expand Up @@ -358,7 +366,7 @@ LLVMBool LLVMExtCreateMCJITCompilerForModule(
.setOptLevel((CodeGenOpt::Level)options.OptLevel)
.setTargetOptions(targetOptions);
bool JIT;
if (Optional<CodeModel::Model> CM = unwrap(options.CodeModel, JIT))
if (auto CM = unwrap(options.CodeModel, JIT))
builder.setCodeModel(*CM);
if (options.MCJMM)
builder.setMCJITMemoryManager(
Expand Down