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 14.0 #11905

Merged
merged 4 commits into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
- llvm_version: 13.0.0
llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz
base_image: ubuntu-20.04
- llvm_version: 14.0.0
llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0-rc2/clang+llvm-14.0.0-rc2-x86_64-linux-gnu-ubuntu-18.04.tar.xz
HertzDevil marked this conversation as resolved.
Show resolved Hide resolved
base_image: ubuntu-18.04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for using this old image?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's currently no ubuntu 20.04 image, so I'd guess it was the best choice?
https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.0

runs-on: ${{ matrix.base_image }}
name: "Test LLVM ${{ matrix.llvm_version }} (${{ matrix.base_image }})"
steps:
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 @@
13.0 12.0 11.1 11.0 10.0 9.0 8.0 7.1 6.0 5.0 4.0 3.9 3.8
14.0 13.0 12.0 11.1 11.0 10.0 9.0 8.0 7.1 6.0 5.0 4.0 3.9 3.8
12 changes: 8 additions & 4 deletions src/llvm/ext/llvm_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ LLVMValueRef LLVMExtDIBuilderInsertDeclareAtEnd(
}

LLVMMetadataRef LLVMExtDIBuilderCreateExpression(
DIBuilderRef Dref, int64_t *Addr, size_t Length) {
return wrap(Dref->createExpression(ArrayRef<int64_t>(Addr, Length)));
DIBuilderRef Dref, uint64_t *Addr, size_t Length) {
return wrap(Dref->createExpression(ArrayRef<uint64_t>(Addr, Length)));
}

LLVMMetadataRef LLVMExtDIBuilderCreateEnumerationType(
Expand Down Expand Up @@ -587,8 +587,12 @@ LLVMBool LLVMExtCreateMCJITCompilerForModule(
for (auto &F : *Mod) {
auto Attrs = F.getAttributes();
StringRef Value = options.NoFramePointerElim ? "all" : "none";
Attrs = Attrs.addAttribute(F.getContext(), AttributeList::FunctionIndex,
"frame-pointer", Value);
#if LLVM_VERSION_GE(14, 0)
Attrs = Attrs.addFnAttribute(F.getContext(), "frame-pointer", Value);
#else
Attrs = Attrs.addAttribute(F.getContext(), AttributeList::FunctionIndex,
"frame-pointer", Value);
#endif
F.setAttributes(Attrs);
}

Expand Down
1 change: 1 addition & 0 deletions src/llvm/lib_llvm.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ end

{% begin %}
lib LibLLVM
IS_140 = {{LibLLVM::VERSION.starts_with?("14.0")}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add IS_LT_140.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently there's no need for that, so why bother?

IS_130 = {{LibLLVM::VERSION.starts_with?("13.0")}}
IS_120 = {{LibLLVM::VERSION.starts_with?("12.0")}}
IS_111 = {{LibLLVM::VERSION.starts_with?("11.1")}}
Expand Down
2 changes: 1 addition & 1 deletion src/llvm/lib_llvm_ext.cr
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ lib LibLLVMExt
block : LibLLVM::BasicBlockRef) : LibLLVM::ValueRef

fun di_builder_create_expression = LLVMExtDIBuilderCreateExpression(builder : DIBuilder,
addr : Int64*, length : SizeT) : LibLLVM::MetadataRef
addr : UInt64*, length : SizeT) : LibLLVM::MetadataRef

fun di_builder_get_or_create_array = LLVMExtDIBuilderGetOrCreateArray(builder : DIBuilder, data : LibLLVM::MetadataRef*, length : SizeT) : LibLLVM::MetadataRef
fun di_builder_create_enumerator = LLVMExtDIBuilderCreateEnumerator(builder : DIBuilder, name : Char*, value : Int64) : LibLLVM::MetadataRef
Expand Down