Crate cranelift_isle

source ·
Expand description

ISLE: Instruction Selection / Lowering Expressions

ISLE is a domain specific language (DSL) for instruction selection and lowering clif instructions to vcode’s MachInsts in Cranelift.

ISLE is a statically-typed term-rewriting language. You define rewriting rules that map input terms (clif instructions) into output terms (MachInsts). These rules get compiled down into Rust source test that uses a tree of match expressions that is as good or better than what you would have written by hand.

Modules

  • Abstract syntax tree (AST) created from parsed ISLE.
  • Generate Rust code from a series of Sequences.
  • Compilation process, from AST to Sema to Sequences of Insts.
  • Error types.
  • Lowered matching IR.
  • Lexer for the ISLE language.
  • Overlap detection for rules in ISLE.
  • Parser for ISLE language.
  • Semantic analysis.
  • Trie construction.
  • A strongly-normalizing intermediate representation for ISLE rules. This representation is chosen to closely reflect the operations we can implement in Rust, to make code generation easy.

Macros

  • Log a compiler-internal message for debugging purposes.

Structs

  • Stores disjoint sets and provides efficient operations to merge two sets, and to find a representative member of a set given any member of that set. In this implementation, sets always have at least two members, and can only be formed by the merge operation.
  • A wrapper around a HashMap which prevents accidentally observing the non-deterministic iteration order.
  • A wrapper around a HashSet which prevents accidentally observing the non-deterministic iteration order.