module Savi::Compiler::Flow

Overview

The Flow pass is meant to clearly mark the order of expression evaluation, including the static order of expressions in the same sequential block, as well as the relative conditional branching among different blocks.

The analysis lets us look up relationships between expressions where one "sometimes happens before" the other, "always happens before" the other, or "never happens before" the other. This allows us to do other checks later in the compiler which make use of this information to validate safety.

This is similar to the purpose of LLVM's "dominator tree" data structure, which can be learned about in various video and text presentations on the web, though our own analysis doesn't take exactly the same data structure approach.

This pass does not mutate the Program topology. This pass does not mutate the AST. This pass may raise a compilation error. This pass keeps state at the per-function level. This pass produces output state at the per-function level.

Defined in:

savi/compiler/flow.cr