Expand description
§CubeCL Optimizer
A library that parses CubeCL IR into a control flow graph, transforms it to static single-assignment form and runs various optimizations on it. The order of operations is as follows:
- Parse root scope recursively into a control flow graph
- Run optimizations that must be done before SSA transformation
- Analyze variable liveness
- Transform the graph to pruned SSA form
- Run post-SSA optimizations and analyses in a loop until no more improvements are found
- Speed
The output is represented as a petgraph graph of BasicBlocks terminated by ControlFlow.
This can then be compiled into actual executable code by walking the graph and generating all
phi nodes, instructions and branches.
§Representing PhiInstruction in non-SSA languages
Phi instructions can be simulated by generating a mutable variable for each phi, then assigning
value to it in each relevant block.
Structs§
- An atomic counter with a simplified interface.
- A basic block of instructions interrupted by control flow. Phi nodes are assumed to come before any instructions. See https://en.wikipedia.org/wiki/Basic_block
- Edge identifier.
- Node identifier.
- An optimizer that applies various analyses and optimization passes to the IR.
- A phi node that picks its value based on the
BasicBlockthat came immediately before. For more information, see https://en.wikipedia.org/wiki/Static_single-assignment_form
Enums§
- Control flow that terminates a block
Functions§
- A visitor that does nothing.