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 backend #44

Open
thi8v opened this issue Jul 26, 2023 · 0 comments
Open

LLVM backend #44

thi8v opened this issue Jul 26, 2023 · 0 comments
Labels
A-CodeGen Area: the code generation from the AST A-Compiler Area: Ahead Of Time compilation enhancement New feature or request

Comments

@thi8v
Copy link
Member

thi8v commented Jul 26, 2023

For the code generation and compilation (LLVM related crates), in the Zom compiler. We could replace it with the C++ library, because it's the official way to use LLVM, there is some issues in this project that is related to LLVM not working : #24, #20, #23, #21. If we replace it with an a C++ package, we could just follow the doc and not wasting its time to found the function in Inkwell, etc ..

Pros

Cons

  • Safety, C++ is safer than C but C++ is not safe as Rust is.
  • Some layer between Rust and C++ is needed, you can find some solution below,

Solution N°1

Write a serializer that serialize the result of the type checking (or the end of the compilation pipeline that doesn't need LLVM). And the C++ program will be executed in a child process, with the serialized input, and we deserialize and return the output desired by the compiler.

Solution N°2

Write a C++ lib that uses LLVM and emit the desired output by the compiler, and his functions is called by the the Zom compiler with the Rust FFI to C++.

Originally posted by @Larsouille25 in #25 (comment)

@thi8v thi8v added this to Zom Aug 4, 2023
@thi8v thi8v added enhancement New feature or request A-Compiler Area: Ahead Of Time compilation A-CodeGen Area: the code generation from the AST labels Aug 4, 2023
@thi8v thi8v moved this to Todo v0.1.0 in Zom Aug 4, 2023
@thi8v thi8v changed the title LLVM ir generation LLVM backend Aug 8, 2023
@thi8v thi8v moved this from Todo v0.1.0 to Pool of Ideas in Zom Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CodeGen Area: the code generation from the AST A-Compiler Area: Ahead Of Time compilation enhancement New feature or request
Projects
Status: Pool of Ideas
Development

No branches or pull requests

1 participant