Skip to content

Commit

Permalink
Add a new crate for the FLIR data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
iamrecursion committed Oct 3, 2024
1 parent 6571743 commit 9d1d314
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 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 @@ -7,6 +7,7 @@ members = [
"crates/compiler",
"crates/driver",
"crates/error",
"crates/flir",
"crates/rust-test-input",
]

Expand Down Expand Up @@ -42,6 +43,7 @@ itertools = "0.13.0"
ltc-cli = { path = "crates/cli" }
ltc-driver = { path = "crates/driver" }
ltc-errors = { path = "crates/error" }
ltc-flir = { path = "crates/flir" }
thiserror = "1.0.63"
tracing = "0.1.40"

Expand Down
16 changes: 16 additions & 0 deletions crates/flir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "ltc-flir"
version.workspace = true
homepage.workspace = true
repository.workspace = true
license-file.workspace = true

authors.workspace = true
description = "The FlatLowered Intermediate Representation, or FLIR, is a FlatLowered-based IR customized to the needs of the LTC project."
keywords.workspace = true
categories.workspace = true

edition.workspace = true
rust-version.workspace = true

[dependencies]
17 changes: 17 additions & 0 deletions crates/flir/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `FlatLowered` Intermediate Representation

The `FlatLowered` Intermediate Representation (`FLIR`) is an intermediate representation for the
LLVM to Cairo project that is based on Cairo's `FlatLowered` but tailored for our use-case.

In particular, it removes any dependency on the [Salsa](https://github.com/salsa-rs/salsa) database
structures, as well as:

- Allowing round-tripping to and from `FlatLowered`.
- Forming the basis of the `.flo` (FlatLowered Object) object format for exchange between tools in
the LTC pipeline.
- Adding support for features (such as linkage and relocations) that are not supported by the
`FlatLowered`.

While we could spend the time to add these features to upstream `FlatLowered`, having our own IR
means that we can iterate and experiment far more rapidly as needed. Some portions of this work
_may_ be upstreamed in the future, but we make no guarantees.
3 changes: 3 additions & 0 deletions crates/flir/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! The `FlatLowered` Intermediate Representation (`FLIR`) is the IR designed
//! for use as an interchange format between tools in the LLVM to Cairo project,
//! and the basis for the `.flo` object format.

0 comments on commit 9d1d314

Please sign in to comment.