Expand description
ยงleo-passes
Modulesยง
- code_
generation ๐ - common ๐
- const_
propagation ๐ - const_
propagation_ ๐and_ unrolling - dead_
code_ ๐elimination - The Dead Code Elimination pass traverses the AST and eliminates unused code,
specifically assignment statements, within the boundary of
transition
s andfunction
s. The pass is run after the Function Inlining pass. - destructuring ๐
- The destructuring pass traverses the AST and destructures tuples into individual variables. This pass assumes that tuples have a depth of 1, which is ensured by the type checking pass.
- flattening ๐
- The flattening pass traverses the AST after the SSA pass and converts into a sequential code.
The pass flattens
ConditionalStatement
s into a sequence ofAssignStatement
s. The pass rewritesReturnStatement
s intoAssignStatement
s and consolidates the returned values as a singleReturnStatement
at the end of the function. The pass rewrites ternary expressions over composite data types, into ternary expressions over the individual fields of the composite data type, followed by an expression constructing the composite data type. Note that this transformation is not applied to async functions. - function_
inlining ๐ - The Function Inlining pass traverses the AST and inlines function at their call site.
See https://en.wikipedia.org/wiki/Inline_expansion for more information.
The pass also reorders
Function
s in a reconstructedProgramScope
so that they are in a post-order of the call graph. In other words, a callee function will appear before a caller function in the order. - loop_
unrolling ๐ - monomorphization ๐
- Performs monomorphization of const generic functions within a
ProgramScope
. - pass ๐
- processing_
script ๐ - static_
analysis ๐ - static_
single_ ๐assignment - The Static Single Assignment pass traverses the AST and converts it into SSA form.
See https://en.wikipedia.org/wiki/Static_single-assignment_form for more information.
The pass also replaces
DefinitionStatement
s withAssignmentStatement
s. The pass also simplifies complex expressions into a sequence ofAssignStatement
s. For example,(a + b) * c
is rewritten into$var$1 = a + b; $var$2 = $var$1 * c
. - symbol_
table_ ๐creation - type_
checking ๐ - write_
transforming ๐
Structsยง
- Assigner
- A struct used to create assignment statements.
- Assigner
Inner - Contains the actual data for
Assigner
. Modeled this way to afford an API using interior mutability. - Code
Generating - Compiler
State - Contains data share by many compiler passes.
- Const
Propagation - A pass to perform const propagation and folding.
- Const
Propagation AndUnrolling - Pass that runs const propagation and loop unrolling until a fixed point.
- Const
Propagation Output - Dead
Code Eliminating - Dead
Code Eliminating Output - Destructuring
- A pass to rewrite tuple creation and accesses into other code.
- DiGraph
- A directed graph.
- Finalizer
- Flattening
- Function
Inlining - Function
Symbol - Monomorphization
- Monomorphization
Output - Processing
Script - A pass to validate (and remove) uses of
interpret
. - Rename
Table RenameTable
tracks the names assigned by static single assignment in a single scope.- Replacer
- A
Replacer
appliesreplacer
to allIdentifier
s in an AST.Replacer
s are used to rename identifiers.Replacer
s are used to interpolate function arguments. - SsaForming
- SsaForming
Input - Static
Analyzing - Symbol
Table - Maps global and local symbols to information about them.
- Symbol
Table Creation - A pass to fill the SymbolTable.
- Type
Checking - A pass to check types.
- Type
Checking Input - Specify network limits for type checking.
- Type
Table - A mapping between node IDs and their types.
- Unrolling
- Unrolling
Output - Variable
Symbol - An entry for a variable in the symbol table.
- Write
Transforming - A pass to rewrite assignments to array accesses and struct accesses.
Enumsยง
- DiGraph
Error - Errors in directed graph operations.
- Variable
Type - An enumeration of the different types of variable type.
Traitsยง
Type Aliasesยง
- Call
Graph - A call graph.
- Conditional
Tree Node - A binary search tree to store all paths through nested conditional blocks.
- Import
Graph - An import dependency graph.
- Struct
Graph - A struct dependency graph.