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

LLVM-6.0 support #72

Open
tehranixyz opened this issue Dec 6, 2020 · 6 comments
Open

LLVM-6.0 support #72

tehranixyz opened this issue Dec 6, 2020 · 6 comments

Comments

@tehranixyz
Copy link

Hi,
Is there any way to build the JLang project using LLVM-6.0?
I'm using JLang to generate LLVM IR out of java files. And I use the Java LLVM IR files for downstream tasks.
The problem is that I'm using some other tools that are compatible with LLVM-6.0. As a result, almost all of the .ll files generated by JLang are rejected by the other tools. This is because the other tools do not support LLVM-5.0 but JLang only uses LLVM-5.0. JLang raises an error if any other version of LLVM is used:
LLVM version is out of date (or too new)
Any help is greatly appreciated.

@dz333
Copy link
Collaborator

dz333 commented Dec 7, 2020

Hi,

Thanks for your interest!
At the moment we only support LLVM 5.0, but there is no fundamental reason for that.

We use Java shims for the LLVM C API that JLang uses to generate the LLVM code. Currently those shims are generated from the LLVM-5.0 API and thus produce code compatible w/ that version of LLVM.

No one is, at the moment, working on updating these shims or their use in the JLang compiler. Likely we would have to change some of the compiler code to match new signatures, etc. but I don't think we're using any functionality that is specific to 5.0.

As far as I know (without having looked too hard) there's also no nice way to do this generically across LLVM versions and so any efforts on our end to do this would likely target newer versions of LLVM rather than 6.0.

If you're interested in working on 6.0 compatibility then I could certainly give pointers as to what steps would need to be taken.


Another option is installing LLVM-5.0 on your system ONLY as a dependency for JLang.
If you plan to use the generated *.ll files with other LLVM tools - those files are possibly compatible for LLVM 6.0 use. I can't promise that will work, but it might!

@tehranixyz
Copy link
Author

Drew,
Thanks for your reply.
I've already installed llvm-5.0 and produced llvm ir via JLang. but those *.ll files were not compatible with other llvm-based tools. I've tried this. That's why I asked for the support of newer version of LLVM.

I mentioned LLVM-6.0 because this is the closest version to version 5.0. Obviously. targeting newer versions of llvm, like 10.0 is really great and helpful. I mentioned 6.0 because I thought perhaps the update steps would be more straightforward and doesn't require heavy modifications and edits.

@dz333
Copy link
Collaborator

dz333 commented Dec 8, 2020

Ah I see - yeah I haven't looked too closely at the API changes so I'm not sure how big a difference 6 vs 10 really is.

There isn't anyone actively working on JLang updates here (beyond bug fixes) at the moment so I can't promise a timeline or anything, but I'll create a ticket that outlines the work needed and if someone gets around to it we'll certainly let you know.

@tehranixyz
Copy link
Author

Thanks.
Drew, since you are an expert in this area, do you have any recommendations on generating LLVM IR for java programs? I searched a lot in this area to try different tools, but so far I found JLang is the only viable option.

@dz333
Copy link
Collaborator

dz333 commented Dec 8, 2020

The main tools I've heard of are JITs rather than ahead-of-time and also proprietary -- see Azul's Falcon compiler.

Most other efforts I know of go the other way -> allowing LLVM-based native code to run on a language VM (e.g, GraalVM).

I believe that's part of the reason that JLang was started originally - a surprising dearth of artifacts in this area!

Sorry I couldn't be more helpful.

@JianpingZeng
Copy link

@tehranixyz You can use llvm-as of LLVM 5.0 to transform the generated .ll file to llvm-5.0 bitcode which is supported in any version of LLVM after 5.0, the reason is LLVM keeps backward compatibility of bitcode format.

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

No branches or pull requests

3 participants