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

Mid-level intermediate representation (possibly using MLIR)? #28

Open
oroppas opened this issue Feb 22, 2021 · 3 comments
Open

Mid-level intermediate representation (possibly using MLIR)? #28

oroppas opened this issue Feb 22, 2021 · 3 comments

Comments

@oroppas
Copy link

oroppas commented Feb 22, 2021

Out of curiosity, I wonder if nlvm has any plans to implement IR like
other languages:

Julia https://docs.julialang.org/en/v1/devdocs/ssair/
Rust https://rustc-dev-guide.rust-lang.org/mir/index.html#the-mir-mid-level-ir
Swift https://github.com/apple/swift/blob/main/docs/SIL.rst
Flang https://github.com/llvm/llvm-project/tree/main/flang

Any comments will be greatly appreciated. Thanks!

@arnetheduck
Copy link
Owner

Yeah, I've thought about it, though it would actually be most powerful if done in the upstream compiler such that both the nlvm and C backends (which are quite similar at the end of the day) would use / benefit - one of the more difficult issues to deal with in nlvm is bug-for-bug compatibility.

Ideally it would also integrate with an llvm-based CTFE engine such that the nim VM is no longer used (currently there's a VM in nim which quite significantly differs from the runtime code, which incidentally also has its own IR) and instead, the same ir is used for both VM and final compile.

@Araq
Copy link

Araq commented Feb 23, 2021

--gc:arc pretty much uses a Nim specific IR, it keeps changing though and some form of SSA would be useful to have.

@oroppas
Copy link
Author

oroppas commented Feb 28, 2021

Perhaps,

CIL : Common MLIR abstraction for C / C++/ Fortran
https://github.com/compiler-tree-technologies/cil
https://llvm.org/devmtg/2020-09/slides/CIL_Common_MLIR_Abstraction.pdf
https://www.youtube.com/watch?v=3gcw-8C9UbA

might help (if and only if this or similar technologies are implemented in MLIR one day)?

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