docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::visitor::StructuredSDFGWalker Class Reference

A sequential walker for traversing structured control flow nodes in a StructuredSDFG with iterators Iterators traverse the SDFG same as our visitors do. More...

#include <sdfg/visitor/structured_sdfg_walker.h>

Classes

class  ParentScopeLoc
class  Iterator

Public Types

enum class  Scope {
  NONE , ENTRY , EXIT , IF_ENTRY ,
  IF_EXIT , IF_NEXT_BRANCH
}

Static Public Member Functions

static constexpr std::string_view scope_to_string (Scope scope)
static Iterator root (StructuredSDFG &sdfg)
static Iterator from_node (ControlFlowNode &node)
static Iterator sequence_exit (Sequence &seq)
static Iterator ifelse_exit (IfElse &ifelse)
static Iterator loop_exit (While &loop)
static Iterator loop_exit (StructuredLoop &loop)
static Iterator end ()
static Iterator from_after (ControlFlowNode &node)

Detailed Description

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:

  1. Root Seq Scope::ENTRY
  2. Map0 Scope::ENTRY
  3. Map0.root-Seq Scope::ENTRY
  4. Block0 Scope::NONE
  5. Map0.root-Seq Scope::EXIT
  6. Map0 Scope::EXIT
  7. Root Seq Scope::EXIT

Example from SequentialWalker::from_node(Map0.root-seq) != SequentialWalker::loop_exit(Map0) with no_descend:

  1. Map0.root-seq Scope::ENTRY
  2. 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:

  1. IfElse Scope::IF_ENTRY
  2. IfElse.branch0.root Scope::ENTRY
  3. IfElse.branch0.root Scope::EXIT
  4. IfElse Scope::IF_NEXT_BRANCH
  5. IfElse.branch1.root Scope::ENTRY ...
  6. IfElse.branch1.root Scope::EXIT
  7. IfElse Scope::IF_EXIT

Member Enumeration Documentation

◆ Scope

Enumerator
NONE 
ENTRY 
EXIT 
IF_ENTRY 
IF_EXIT 
IF_NEXT_BRANCH 

Member Function Documentation

◆ end()

Iterator sdfg::visitor::StructuredSDFGWalker::end ( )
static

◆ from_after()

Iterator sdfg::visitor::StructuredSDFGWalker::from_after ( ControlFlowNode & node)
static

◆ from_node()

Iterator sdfg::visitor::StructuredSDFGWalker::from_node ( ControlFlowNode & node)
static

◆ ifelse_exit()

Iterator sdfg::visitor::StructuredSDFGWalker::ifelse_exit ( IfElse & ifelse)
static

◆ loop_exit() [1/2]

Iterator sdfg::visitor::StructuredSDFGWalker::loop_exit ( StructuredLoop & loop)
static

◆ loop_exit() [2/2]

Iterator sdfg::visitor::StructuredSDFGWalker::loop_exit ( While & loop)
static

◆ root()

Iterator sdfg::visitor::StructuredSDFGWalker::root ( StructuredSDFG & sdfg)
static

◆ scope_to_string()

constexpr std::string_view sdfg::visitor::StructuredSDFGWalker::scope_to_string ( Scope scope)
inlinestaticconstexpr

◆ sequence_exit()

Iterator sdfg::visitor::StructuredSDFGWalker::sequence_exit ( Sequence & seq)
static

The documentation for this class was generated from the following file: