rucc_opt/lib.rs
1//! The pass manager, the acyclic e-graph, the rewrite rules and the analyses.
2//!
3//! Design: `spec/09-optimizer.md`. Layer rank 9, see `spec/18-package-layout.md`.
4//!
5//! # What is here
6//!
7//! The pass manager and three passes. [`pipeline`] holds the six pipelines, one per optimization
8//! level, written out rather than assembled from flags, along with the fuel, the dumps and the
9//! verification that section 9.10 asks of every pass. [`fold`] is the first pass through it, [`simplify`] is the peephole the e-graph will
10//! eventually absorb, and [`dce`] is what clears up after both of them.
11//!
12//! The e-graph, the rewrite rule set and the analyses are still M4 work and are not here yet.
13//! So is the analysis manager, which section 9.10 also asks for: a pass declares which analyses
14//! it requires, preserves and invalidates, and a debug check recomputes one it claimed to
15//! preserve and compares. There are no analyses to declare, so that machinery lands with the
16//! dominator tree rather than being guessed at now.
17//!
18//! # Stability
19//!
20//! Every crate in the workspace is published, and publishing implies a promise. This one is
21//! tier 3: its Rust API is explicitly unstable and will change without a major version bump.
22//! Depend on the `rucc` binary's behaviour, not on this.
23
24#![doc(html_root_url = "https://docs.rs/rucc-opt/0.4.1")]
25
26pub mod dce;
27pub mod fold;
28pub mod fuel;
29pub mod pass;
30pub mod pipeline;
31pub mod simplify;
32
33pub use fuel::Fuel;
34pub use pass::{PASSES, Pass};
35pub use pipeline::{Dump, Dumps, Options, Report, run};
36
37/// The milestone in `spec/17-milestones.md` that fills this crate in.
38pub const MILESTONE: &str = "M4";
39
40#[cfg(test)]
41mod tests {
42 #[test]
43 fn milestone_is_recorded() {
44 assert!(super::MILESTONE.starts_with('M'));
45 }
46}