template<typename
State>
class sdfg::analysis::ForwardStructuredDataFlowAnalysis< State >
Base class for forward data-flow analysis over structured control flow.
The analysis walks the structured CFG tree (Sequence, Block, IfElse, StructuredLoop, While, Return, Break, Continue) in forward order and propagates sets of instances of type T using the classic gen/kill framework:
out(n) = gen(n) ∪ (in(n) − kill(n))
Merge at join points (after IfElse branches, loop back-edges) is performed by the virtual merge function which defaults to set union.
Usage:
- Derive per-node State from DataFlowState<T> or ElementIdMapDataFlowState
1a. Pick the container T that will represent the live sets between the per-node states 1b. implement the static functions empty_in() and merge(a, b, MergeMode) on the DataFlowState impl.
Derive from ForwardDataFlowAnalysis<YourStateType>.
Implement create_initial_state(node) to fill the per-node gen & kill lists
Optionally override boundary to provide the initial set that flows into the root of the tree.
Call run_forward(root_sequence). Afterwards query state(node) for any visited node.
- Template Parameters
-
| T | Element type. Must support operator< (used in std::set). |