A sequential walker for traversing structured control flow nodes in a StructuredSDFG with iterators Iterators traverse the SDFG same as our visitors do.
With elements that have children being visited
- on entering
- then all the children
- again on exiting Loops always have exactly 1 child: their root sequence. Empty sequences will still be visited twice, as Scope::ENTRY and as Scope::EXIT We can also move to the next element without entering children. In this case scopes will be visited as before, with Scope::ENTRY. But calling next_no_descend() on a Scope::ENTRY (Sequence, IfElse, While, StructuredLoop) will leave that node entirely, skipping over any potential children and the Scope::EXIT. If a scope was entered before, using no_descend has no effect. It will step through all the children and Scope::EXIT
Example SDFG { Map0 { Block0 } } from root:
- Root Seq Scope::ENTRY
- Map0 Scope::ENTRY
- Map0.root-Seq Scope::ENTRY
- Block0 Scope::NONE
- Map0.root-Seq Scope::EXIT
- Map0 Scope::EXIT
- Root Seq Scope::EXIT
Example from SequentialWalker::from_node(Map0.root-seq) != SequentialWalker::loop_exit(Map0) with no_descend:
- Map0.root-seq Scope::ENTRY
- Map0 Scope::EXIT
IfElse has special handling, as its children are not in execution order. To this end, the walker will use Scope::IF_ENTRY and Scope::IF_EXIT to signify that. It will additionally visit the IfElse node itself before every branch (other than the first one). Example:
- IfElse Scope::IF_ENTRY
- IfElse.branch0.root Scope::ENTRY
- IfElse.branch0.root Scope::EXIT
- IfElse Scope::IF_NEXT_BRANCH
- IfElse.branch1.root Scope::ENTRY ...
- IfElse.branch1.root Scope::EXIT
- IfElse Scope::IF_EXIT