Skip to main content

Module rules

Module rules 

Source
Expand description

Matching the rewrite rules against the IR.

Design: spec/optimizer/13-rewrite-rules.md. The rules themselves are in rules/, one file per tier, and the automaton they compile into is generated by rucc-rules when this crate is built. What each rule means is crates/rucc-ir/rules/ir.model, and rucc-verify makes every one of them prove itself against that model before it may be used.

The walk over the automaton is rucc_base::rules, which is where it is because rucc-codegen matches its lowering rules with the same walk and neither crate can see the other. What an IR instruction looks like to that walk is rucc_ir::term, for the same reason: a rewrite rule and a lowering rule that spelled add.i32 differently would be two vocabularies over one IR.

The names are re-exported rather than reached for through rucc_base, because the generated file refers to them through super and that is the whole of the contract between the two.

Modules§

canonical
The tier three rewrite table.
identities
The tier one rewrite table.
strength
The tier two rewrite table.

Structs§

Match
What a successful match found.
Node
One node of the trie over the patterns.
Rule
One rule, as much of it as matching needs.
Table
A set of rules, as an automaton over their patterns.

Enums§

Piece
One piece of a replacement, in the pre-order that builds it.
Test
One test on one subterm.

Traits§

Subject
The bits of a term the automaton asks about.

Type Aliases§

Guard
A condition on the constants a pattern matched.