Skip to main content

Crate rucc_opt

Crate rucc_opt 

Source
Expand description

The pass manager, the acyclic e-graph, the rewrite rules and the analyses.

Design: spec/09-optimizer.md. Layer rank 9, see spec/18-package-layout.md.

§What is here

The pass manager and three passes. pipeline holds the six pipelines, one per optimization level, written out rather than assembled from flags, along with the fuel, the dumps and the verification that section 9.10 asks of every pass. fold is the first pass through it, simplify is the peephole the e-graph will eventually absorb, and dce is what clears up after both of them.

The e-graph, the rewrite rule set and the analyses are still M4 work and are not here yet. So is the analysis manager, which section 9.10 also asks for: a pass declares which analyses it requires, preserves and invalidates, and a debug check recomputes one it claimed to preserve and compares. There are no analyses to declare, so that machinery lands with the dominator tree rather than being guessed at now.

§Stability

Every crate in the workspace is published, and publishing implies a promise. This one is tier 3: its Rust API is explicitly unstable and will change without a major version bump. Depend on the rucc binary’s behaviour, not on this.

Re-exports§

pub use fuel::Fuel;
pub use pass::PASSES;
pub use pass::Pass;
pub use pipeline::Dump;
pub use pipeline::Dumps;
pub use pipeline::Options;
pub use pipeline::Report;
pub use pipeline::run;

Modules§

dce
Dead code elimination: an instruction nothing uses and nothing depends on goes away.
fold
Constant folding: an instruction whose operands are all constants becomes a constant.
fuel
How many transformations a pass is allowed before it stops transforming.
pass
What a pass is, and the list of the ones this compiler has.
pipeline
The pipelines, one per optimization level, and the manager that runs one.
simplify
Peephole rewrites: a small pattern of instructions becomes a smaller one.

Constants§

MILESTONE
The milestone in spec/17-milestones.md that fills this crate in.