Skip to content

Commit

Permalink
Introduce the basic skeleton for the compiler (#74)
Browse files Browse the repository at this point in the history
* Implement the skeleton of a pass infrastructure

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.

* Implement the module mapping pass

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.

* Miscellaneous fixes and updates

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.
  • Loading branch information
iamrecursion authored Oct 23, 2024
1 parent ab303cc commit df36ce7
Show file tree
Hide file tree
Showing 28 changed files with 4,280 additions and 143 deletions.
222 changes: 212 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ anyhow = "1.0.89"
ariadne = "0.4.1"
bimap = { version = "0.6.3", features = ["serde"] }
clap = "4.5.16"
inkwell = { version = "0.5.0", features = ["llvm18-0"] }
itertools = "0.13.0"
ltc-cli = { path = "crates/cli" }
ltc-compiler = { path = "crates/compiler" }
ltc-driver = { path = "crates/driver" }
ltc-errors = { path = "crates/error" }
ltc-flo = { path = "crates/flo" }
Expand Down
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rust-version.workspace = true
ariadne.workspace = true
clap.workspace = true
itertools.workspace = true
ltc-compiler.workspace = true
tracing.workspace = true

[[bin]]
Expand Down
Loading

0 comments on commit df36ce7

Please sign in to comment.