-
Notifications
You must be signed in to change notification settings - Fork 0
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
Introduce the basic skeleton for the compiler #74
Conversation
e669323
to
cda996d
Compare
cda996d
to
03556a2
Compare
Most of the LLVM IR instructions come in the form of just an opcode followed by operands, but some introduce an extra `to` keyword, e.g. `zext` is called as follows: ```llvm %X = zext i32 257 to i64 ``` As discussed in the compiler skeleton PR[1], this naming duality make the instructions-to-polyfills mapping more complex without adding any benefits. Remove the `to` keyword from polyfill names. Affected instructions: trunc, zext, sext, ptrtoint, inttoptr, bitcast. -- [1] #74 (comment) Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
Most of the LLVM IR instructions come in the form of just an opcode followed by operands, but some introduce an extra `to` keyword, e.g. `zext` is called as follows: ```llvm %X = zext i32 257 to i64 ``` As discussed in the compiler skeleton PR[1], this naming duality make the instructions-to-polyfills mapping more complex without adding any benefits. Remove the `to` keyword from polyfill names. Affected instructions: trunc, zext, sext, ptrtoint, inttoptr, bitcast. -- [1] #74 (comment) Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
e1112ab
to
4fb9092
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew, I went through everything! There's a few open comments so I'm not acking just yet, but overall it looks amazing. I'm especially grateful for these detailed comments, they were enormously helpful.
59c88ab
to
785a1a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beyond being +4179
, this looks excellent.
You asked for nitpicks, so I've provided them~. Feel free to disregard the nitpicking in the name of expediency and/or because the nitpicks are Wild (TM).
While it is incomplete, an initial skeleton for the pass management infrastructure ensures that we do not paint ourselves into any corners that might be hard to design our way out of later. It provides the infrastructure for creating and managing passes, as well as shuffling pass data between passes. Please note that this we make use of self-referential structs via Ouroboros to better encapsulate the LLVM context and the modules that exist in it. Added `libffi` and `libxml2` as build and runtime dependencies to the project as these are required by inkwell now that it is actually in use. This fixes an issue preventing compilation in tests.
This pass runs an analysis of LLVM modules to resolve all top-level entities. The results are written out as pass data, and are intended for use as part of a consistency check during the compilation to FLO. As part of implementing this pass, this commit also implements: - A proxy for the portions of the LLVM type system that we support, enabling us to do pre- and during-compilation consistency checking where necessary. - A parser for LLVM's data-layout specifications, allowing us to ensure that the provided modules are not making any assumptions that would be unsafe for our target machine.
785a1a2
to
b8ac5e5
Compare
This commit performs a number of small miscellaneous refactorings and fixes in response to looking at the code with a fresh set of eyes. It also accounts for feedback given during code review.
b8ac5e5
to
72aecf4
Compare
Summary
This PR consists of two commits:
DataLayout
strings as Inkwell exposes no such facility to rust.Details
The code is functional, if under-tested at the moment. This is intentional as the missing tests are likely to undergo significant change in the future and it is not worth the churn.
Please pay attention to:
In terms of how to review, I would honestly start from
lib.rs
and step through each of the modules. They should be relatively self-contained with good boundaries.Checklist