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

Add support for LLVM 7 #7986

Merged
merged 12 commits into from
Jul 23, 2019
Merged

Add support for LLVM 7 #7986

merged 12 commits into from
Jul 23, 2019

Conversation

bcardiff
Copy link
Member

Fixes #6754

The issue with the exception handing was that the assumptions in the code traversing eh_table structures didn't hold in llvm-7 and the code didn't have assertions for them. They were harder to diagnose. The code is now extracted and reused for arm.

@KaneRoot
Copy link

Do you have a working Crystal compiler with LLVM7?

@bcardiff
Copy link
Member Author

@KaneRoot the head of this branch can be built to have a compiler powered by llvm-7 following https://crystal-lang.org/reference/installation/from_source_repository.html

This is not changing the llvm used in the distribution. Depending on the installation method you might get an update in the llvm version used or not. But building it from sources will allow you to pick which one you need/want.

bcardiff and others added 12 commits July 23, 2019 16:02
Similarly to how LLVM 6 support was added in commit 249a2ed:

- Rename functions that conflict with those added to llvm-c/DebugInfo.h
  in LLVM 7
- Pass a reference to a module to the bitcode writer (ref LLVM r325155)
Add LibIntrinsics to direct API. Create Intrinsics module to adapt different versions.
Since the arguments needs to be literals in mem operations, those methods are macros.
countleading and counttrailing are also macros since their arguments must be literals.
While finding the right way to set the alignment of the attributes a couple of other bindings were added. LLVMSetInstrParamAlignment is the one that we needed to use
@bcardiff
Copy link
Member Author

I finally found the way to set the alignment attributes
I prefix/format LibLLVMExt as suggested
Rebased on master

Since the are a couple of changes that could affect the distribution I trigger a maintenance build in https://circleci.com/workflow-run/6fafeb18-7aae-4b3b-a930-96a37f438ab0

Once the CI is happy we only need a review for merging.

@bcardiff bcardiff added this to the 0.30.0 milestone Jul 23, 2019
@bcardiff bcardiff merged commit a5f8d30 into crystal-lang:master Jul 23, 2019
@bcardiff bcardiff deleted the llvm7 branch July 23, 2019 22:00
@anatol
Copy link
Contributor

anatol commented Jul 23, 2019

Awesome, do you plan to look at LLVM8 port as well? It would be awesome to see Crystal working with the latest version of LLVM.

@bcardiff
Copy link
Member Author

Yes @anatol #7987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to build with LLVM 7
8 participants