Jlm
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
jlm::rvsdg::Region Class Reference

Represent acyclic RVSDG subgraphs. More...

#include <region.hpp>

Collaboration diagram for jlm::rvsdg::Region:
Collaboration graph
[legend]

Public Types

using Id = uint64_t
 

Public Member Functions

 ~Region () noexcept
 
 Region (Graph *graph)
 
 Region (rvsdg::StructuralNode *node, size_t index)
 
 Region (const Region &)=delete
 
Regionoperator= (const Region &)=delete
 
Graphgraph () const noexcept
 
Id getRegionId () const noexcept
 
size_t getDepth () const noexcept
 
rvsdg::StructuralNodenode () const noexcept
 
size_t index () const noexcept
 
RegionArgumentRange Arguments () noexcept
 
RegionArgumentConstRange Arguments () const noexcept
 
RegionResultRange Results () noexcept
 
RegionResultConstRange Results () const noexcept
 
TopNodeRange TopNodes () noexcept
 
TopNodeConstRange TopNodes () const noexcept
 
NodeRange Nodes () noexcept
 
NodeConstRange Nodes () const noexcept
 
BottomNodeRange BottomNodes () noexcept
 
BottomNodeConstRange BottomNodes () const noexcept
 
bool IsRootRegion () const noexcept
 
RegionArgumentaddArgument (std::unique_ptr< RegionArgument > argument)
 
RegionArgumentinsertArgument (size_t index, std::unique_ptr< RegionArgument > argument)
 
size_t RemoveArguments (const util::HashSet< size_t > &indices)
 
size_t PruneArguments ()
 
size_t narguments () const noexcept
 
RegionArgumentargument (size_t index) const noexcept
 
RegionResultaddResult (std::unique_ptr< RegionResult > result)
 
size_t RemoveResults (const util::HashSet< size_t > &indices)
 
size_t nresults () const noexcept
 
RegionResultresult (size_t index) const noexcept
 
size_t numNodes () const noexcept
 
size_t numTopNodes () const noexcept
 
size_t numBottomNodes () const noexcept
 
void removeNode (Node *node)
 
void copy (Region *target, SubstitutionMap &smap) const
 Copy a region with substitutions.
 
void prune (bool recursive)
 
void view () const
 
Node::Id getNextNodeId () const noexcept
 

Static Public Member Functions

template<class TOperation >
static bool containsOperation (const Region &region, bool checkSubregions)
 
template<class TNodeType >
static bool containsNodeType (const Region &region, bool checkSubregions)
 
static size_t NumRegions (const rvsdg::Region &region) noexcept
 
static bool isAncestor (const rvsdg::Region &region, const rvsdg::Region &ancestor) noexcept
 
static std::string ToTree (const rvsdg::Region &region, const util::AnnotationMap &annotationMap) noexcept
 
static std::string ToTree (const rvsdg::Region &region) noexcept
 
static std::string toJson (const Region &region, const util::AnnotationMap &annotationMap) noexcept
 
static std::string toJson (const Region &region) noexcept
 

Private Types

using RegionArgumentIterator = std::vector< RegionArgument * >::iterator
 
using RegionArgumentConstIterator = std::vector< RegionArgument * >::const_iterator
 
using RegionArgumentRange = util::IteratorRange< RegionArgumentIterator >
 
using RegionArgumentConstRange = util::IteratorRange< RegionArgumentConstIterator >
 
using RegionResultIterator = std::vector< RegionResult * >::iterator
 
using RegionResultConstIterator = std::vector< RegionResult * >::const_iterator
 
using RegionResultRange = util::IteratorRange< RegionResultIterator >
 
using RegionResultConstRange = util::IteratorRange< RegionResultConstIterator >
 
using region_nodes_list = util::IntrusiveList< Node, Node::region_node_list_accessor >
 
using region_top_node_list = util::IntrusiveList< Node, Node::region_top_node_list_accessor >
 
using region_bottom_node_list = util::IntrusiveList< Node, Node::region_bottom_node_list_accessor >
 
using TopNodeIterator = region_top_node_list::Iterator
 
using TopNodeConstIterator = region_top_node_list::ConstIterator
 
using TopNodeRange = util::IteratorRange< TopNodeIterator >
 
using TopNodeConstRange = util::IteratorRange< TopNodeConstIterator >
 
using NodeIterator = region_nodes_list::Iterator
 
using NodeConstIterator = region_nodes_list::ConstIterator
 
using NodeRange = util::IteratorRange< NodeIterator >
 
using NodeConstRange = util::IteratorRange< NodeConstIterator >
 
using BottomNodeIterator = region_bottom_node_list::Iterator
 
using BottomNodeConstIterator = region_bottom_node_list::ConstIterator
 
using BottomNodeRange = util::IteratorRange< BottomNodeIterator >
 
using BottomNodeConstRange = util::IteratorRange< BottomNodeConstIterator >
 

Private Member Functions

void onTopNodeAdded (Node &node)
 Adds node to the top nodes of the region.
 
void onTopNodeRemoved (Node &node)
 
void onBottomNodeAdded (Node &node)
 Adds node to the set of bottom nodes in the region.
 
void onBottomNodeRemoved (Node &node)
 
void onNodeAdded (Node &node)
 Adds node to the list of nodes in the region.
 
void onNodeRemoved (Node &node)
 
Node::Id generateNodeId () noexcept
 
void notifyNodeCreate (Node *node)
 
void notifyNodeDestroy (Node *node)
 
void notifyInputCreate (Input *input)
 
void notifyInputChange (Input *input, Output *old_origin, Output *new_origin)
 
void notifyInputDestroy (Input *input)
 

Static Private Member Functions

static void ToTree (const rvsdg::Region &region, const util::AnnotationMap &annotationMap, size_t indentationDepth, std::stringstream &stream) noexcept
 
static void toJson (const Region &region, const util::AnnotationMap &annotationMap, std::stringstream &stream) noexcept
 
static void toJson (const StructuralNode &structuralNode, const util::AnnotationMap &annotationMap, std::stringstream &stream) noexcept
 
static std::string toJsonKeyValue (const util::Annotation &annotation) noexcept
 
static std::string GetAnnotationString (const void *key, const util::AnnotationMap &annotationMap, char annotationSeparator, char labelValueSeparator)
 
static std::string ToString (const std::vector< util::Annotation > &annotations, char annotationSeparator, char labelValueSeparator)
 
static std::string ToString (const util::Annotation &annotation, char labelValueSeparator)
 

Private Attributes

Graph *const graph_
 
const Id id_
 
const size_t depth_
 
rvsdg::StructuralNode *const node_
 
const size_t index_
 
Node::Id nextNodeId_
 
std::vector< RegionResult * > results_
 
std::vector< RegionArgument * > arguments_
 
region_top_node_list topNodes_
 
size_t numTopNodes_
 
region_bottom_node_list bottomNodes_
 
size_t numBottomNodes_
 
region_nodes_list nodes_
 
size_t numNodes_
 
RegionObserverobservers_ = nullptr
 

Friends

class Node
 
class RegionObserver
 
class SimpleNode
 
class StructuralNode
 
class Input
 
class Output
 
class RegionResult
 

Detailed Description

Represent acyclic RVSDG subgraphs.

Regions represent acyclic RVSDG subgraphs and are instantiated with an index in StructuralNodes. Each region has RegionArguments and RegionResults that represent the values at the beginning and end of the acyclic graph, respectively. In addition, each region keeps track of the following properties:

  1. The nodes of the acyclic subgraph. They represent the computations performed in the region.
  2. The top nodes of the acyclic subgraph. These are all nodes of the region that have no inputs, i.e., constants.
  3. The bottom nodes of the acyclic subgraph. These are all nodes of the region that have no users, i.e. that are dead. See Output::IsDead() for more information.

Definition at line 212 of file region.hpp.

Member Typedef Documentation

◆ BottomNodeConstIterator

using jlm::rvsdg::Region::BottomNodeConstIterator = region_bottom_node_list::ConstIterator
private

Definition at line 239 of file region.hpp.

◆ BottomNodeConstRange

Definition at line 241 of file region.hpp.

◆ BottomNodeIterator

using jlm::rvsdg::Region::BottomNodeIterator = region_bottom_node_list::Iterator
private

Definition at line 238 of file region.hpp.

◆ BottomNodeRange

Definition at line 240 of file region.hpp.

◆ Id

Definition at line 244 of file region.hpp.

◆ NodeConstIterator

using jlm::rvsdg::Region::NodeConstIterator = region_nodes_list::ConstIterator
private

Definition at line 234 of file region.hpp.

◆ NodeConstRange

Definition at line 236 of file region.hpp.

◆ NodeIterator

using jlm::rvsdg::Region::NodeIterator = region_nodes_list::Iterator
private

Definition at line 233 of file region.hpp.

◆ NodeRange

Definition at line 235 of file region.hpp.

◆ region_bottom_node_list

Definition at line 226 of file region.hpp.

◆ region_nodes_list

Definition at line 224 of file region.hpp.

◆ region_top_node_list

Definition at line 225 of file region.hpp.

◆ RegionArgumentConstIterator

using jlm::rvsdg::Region::RegionArgumentConstIterator = std::vector<RegionArgument *>::const_iterator
private

Definition at line 215 of file region.hpp.

◆ RegionArgumentConstRange

Definition at line 217 of file region.hpp.

◆ RegionArgumentIterator

Definition at line 214 of file region.hpp.

◆ RegionArgumentRange

Definition at line 216 of file region.hpp.

◆ RegionResultConstIterator

using jlm::rvsdg::Region::RegionResultConstIterator = std::vector<RegionResult *>::const_iterator
private

Definition at line 220 of file region.hpp.

◆ RegionResultConstRange

Definition at line 222 of file region.hpp.

◆ RegionResultIterator

using jlm::rvsdg::Region::RegionResultIterator = std::vector<RegionResult *>::iterator
private

Definition at line 219 of file region.hpp.

◆ RegionResultRange

Definition at line 221 of file region.hpp.

◆ TopNodeConstIterator

using jlm::rvsdg::Region::TopNodeConstIterator = region_top_node_list::ConstIterator
private

Definition at line 229 of file region.hpp.

◆ TopNodeConstRange

Definition at line 231 of file region.hpp.

◆ TopNodeIterator

using jlm::rvsdg::Region::TopNodeIterator = region_top_node_list::Iterator
private

Definition at line 228 of file region.hpp.

◆ TopNodeRange

Definition at line 230 of file region.hpp.

Constructor & Destructor Documentation

◆ ~Region()

jlm::rvsdg::Region::~Region ( )
noexcept

Definition at line 122 of file region.cpp.

◆ Region() [1/3]

jlm::rvsdg::Region::Region ( Graph graph)

Constructor for the root region of a graph

Definition at line 148 of file region.cpp.

◆ Region() [2/3]

jlm::rvsdg::Region::Region ( rvsdg::StructuralNode node,
size_t  index 
)

Constructor for a subregion in a structural node

Definition at line 160 of file region.cpp.

◆ Region() [3/3]

jlm::rvsdg::Region::Region ( const Region )
delete

Member Function Documentation

◆ addArgument()

RegionArgument & jlm::rvsdg::Region::addArgument ( std::unique_ptr< RegionArgument argument)

Appends the given region argument to the list of region arguments. Invalidates any existing iterators to the argument list.

Parameters
argumentthe argument to add
Returns
a reference to the added argument

Definition at line 179 of file region.cpp.

◆ addResult()

RegionResult & jlm::rvsdg::Region::addResult ( std::unique_ptr< RegionResult result)

Appends the given region result to the list of region results. Invalidates any existing iterators to the result list.

Parameters
resultthe result to add
Returns
a reference to the added result

Definition at line 265 of file region.cpp.

◆ argument()

RegionArgument * jlm::rvsdg::Region::argument ( size_t  index) const
inlinenoexcept

Definition at line 466 of file region.hpp.

◆ Arguments() [1/2]

RegionArgumentConstRange jlm::rvsdg::Region::Arguments ( ) const
inlinenoexcept
Returns
Returns an iterator range for iterating through the arguments of the region.

Definition at line 328 of file region.hpp.

◆ Arguments() [2/2]

RegionArgumentRange jlm::rvsdg::Region::Arguments ( )
inlinenoexcept
Returns
Returns an iterator range for iterating through the arguments of the region.

Definition at line 319 of file region.hpp.

◆ BottomNodes() [1/2]

BottomNodeConstRange jlm::rvsdg::Region::BottomNodes ( ) const
inlinenoexcept
Returns
Returns an iterator range for iterating through the bottom nodes of the region. The bottom nodes are all nodes with only unused outputs, aka. dead nodes.

Definition at line 404 of file region.hpp.

◆ BottomNodes() [2/2]

BottomNodeRange jlm::rvsdg::Region::BottomNodes ( )
inlinenoexcept
Returns
Returns an iterator range for iterating through the bottom nodes of the region. The bottom nodes are all nodes with only unused outputs, aka. dead nodes.

Definition at line 394 of file region.hpp.

◆ containsNodeType()

template<class TNodeType >
bool jlm::rvsdg::Region::containsNodeType ( const Region region,
bool  checkSubregions 
)
static

Checks if a node type is contained within the given region. If checkSubregions is true, then the subregions of all contained structural nodes are recursively checked as well.

Template Parameters
TNodeTypeThe node type to check for.
Parameters
regionThe region to check.
checkSubregionsIf true, then the subregions of all contained structural nodes will be checked as well.
Returns
True, if the node type is found. Otherwise, false.

Definition at line 201 of file structural-node.hpp.

◆ containsOperation()

template<class TOperation >
bool jlm::rvsdg::Region::containsOperation ( const Region region,
bool  checkSubregions 
)
static

Checks if an operation is contained within the given region. If checkSubregions is true, then the subregions of all contained structural nodes are recursively checked as well.

Template Parameters
TOperationThe operation to check for.
Parameters
regionThe region to check.
checkSubregionsIf true, then the subregions of all contained structural nodes will be checked as well.
Returns
True, if the operation is found. Otherwise, false.

Definition at line 163 of file structural-node.hpp.

◆ copy()

void jlm::rvsdg::Region::copy ( Region target,
SubstitutionMap smap 
) const

Copy a region with substitutions.

Parameters
targetTarget region to create nodes in
smapOperand substitutions

Copies all nodes of the specified region and its subregions into the target region. Substitutions will be performed as specified, and the substitution map will be updated as nodes are copied.

Definition at line 317 of file region.cpp.

◆ generateNodeId()

Node::Id jlm::rvsdg::Region::generateNodeId ( )
inlineprivatenoexcept
Returns
A unique identifier for a node within this region.
Note
This method is automatically invoked when a node is created. The identifier is only unique within this region.

Definition at line 642 of file region.hpp.

◆ GetAnnotationString()

std::string jlm::rvsdg::Region::GetAnnotationString ( const void key,
const util::AnnotationMap annotationMap,
char  annotationSeparator,
char  labelValueSeparator 
)
staticprivate

Definition at line 710 of file region.cpp.

◆ getDepth()

size_t jlm::rvsdg::Region::getDepth ( ) const
inlinenoexcept

Gets the depth of the region. Region depth is defined as 0 for the root region, while all other regions have a depth equal to the depth of their parent region + 1.

Returns
the depth of the region

Definition at line 291 of file region.hpp.

◆ getNextNodeId()

Node::Id jlm::rvsdg::Region::getNextNodeId ( ) const
inlinenoexcept
Returns
the Node:Id that will be used for the next node created in the region.

Definition at line 573 of file region.hpp.

◆ getRegionId()

Id jlm::rvsdg::Region::getRegionId ( ) const
inlinenoexcept
Returns
The unique identifier of the region instance within the graph.
See also
Graph::generateRegionId()

Definition at line 278 of file region.hpp.

◆ graph()

Graph * jlm::rvsdg::Region::graph ( ) const
inlinenoexcept
Returns
the Graph the region belongs to

Definition at line 267 of file region.hpp.

◆ index()

size_t jlm::rvsdg::Region::index ( ) const
inlinenoexcept
Returns
the index of the region within the surrounding structural node.

Definition at line 310 of file region.hpp.

◆ insertArgument()

RegionArgument & jlm::rvsdg::Region::insertArgument ( size_t  index,
std::unique_ptr< RegionArgument argument 
)

Inserts the given region argument in the list of region arguments, at the given index. Shifts any results with equal or greater index one to the right to make room. Invalidates any existing iterators to the argument list.

Parameters
indexthe position to add the result
argumentthe argument to add
Returns
a reference to the added result
See also
addArgument to add to the end

Definition at line 190 of file region.cpp.

◆ isAncestor()

bool jlm::rvsdg::Region::isAncestor ( const rvsdg::Region region,
const rvsdg::Region ancestor 
)
staticnoexcept

Determines if ancestor is a direct or indirect parent region of region in the RVSDG.

Parameters
regionThe region to check the ancestry of.
ancestorThe region to test as a potential ancestor.
Returns
true if ancestor appears somewhere above region in the RVSDG, false otherwise.

Definition at line 474 of file region.cpp.

◆ IsRootRegion()

bool jlm::rvsdg::Region::IsRootRegion ( ) const
noexcept

Checks if the region is the RVSDG root region.

Returns
Returns true if it is the root region, otherwise false.

Definition at line 173 of file region.cpp.

◆ narguments()

size_t jlm::rvsdg::Region::narguments ( ) const
inlinenoexcept

Definition at line 460 of file region.hpp.

◆ node()

rvsdg::StructuralNode * jlm::rvsdg::Region::node ( ) const
inlinenoexcept
Returns
the structual node this region is a subregion of. If the region is the root region, nullptr is returned instead.

Definition at line 301 of file region.hpp.

◆ Nodes() [1/2]

NodeConstRange jlm::rvsdg::Region::Nodes ( ) const
inlinenoexcept
Returns
Returns an iterator range for iterating through the nodes of the region.

Definition at line 384 of file region.hpp.

◆ Nodes() [2/2]

NodeRange jlm::rvsdg::Region::Nodes ( )
inlinenoexcept
Returns
Returns an iterator range for iterating through the nodes of the region.

Definition at line 375 of file region.hpp.

◆ notifyInputChange()

void jlm::rvsdg::Region::notifyInputChange ( Input input,
Output old_origin,
Output new_origin 
)
private

Definition at line 438 of file region.cpp.

◆ notifyInputCreate()

void jlm::rvsdg::Region::notifyInputCreate ( Input input)
private

Definition at line 429 of file region.cpp.

◆ notifyInputDestroy()

void jlm::rvsdg::Region::notifyInputDestroy ( Input input)
private

Definition at line 447 of file region.cpp.

◆ notifyNodeCreate()

void jlm::rvsdg::Region::notifyNodeCreate ( Node node)
private

Definition at line 411 of file region.cpp.

◆ notifyNodeDestroy()

void jlm::rvsdg::Region::notifyNodeDestroy ( Node node)
private

Definition at line 420 of file region.cpp.

◆ nresults()

size_t jlm::rvsdg::Region::nresults ( ) const
inlinenoexcept

Definition at line 494 of file region.hpp.

◆ numBottomNodes()

size_t jlm::rvsdg::Region::numBottomNodes ( ) const
inlinenoexcept
Returns
The number of bottom nodes in the region.

Definition at line 528 of file region.hpp.

◆ numNodes()

size_t jlm::rvsdg::Region::numNodes ( ) const
inlinenoexcept
Returns
The number of nodes in the region.

Definition at line 510 of file region.hpp.

◆ NumRegions()

size_t jlm::rvsdg::Region::NumRegions ( const rvsdg::Region region)
staticnoexcept

Counts the number of (sub-)regions contained within region. The count includes region, i.e., if region does not contain any structural nodes and therefore no subregions, then the count is one.

Parameters
regionThe region for which to count the contained (sub-)regions.
Returns
The number of (sub-)regions.

Definition at line 456 of file region.cpp.

◆ numTopNodes()

size_t jlm::rvsdg::Region::numTopNodes ( ) const
inlinenoexcept
Returns
The number of top nodes in the region.

Definition at line 519 of file region.hpp.

◆ onBottomNodeAdded()

void jlm::rvsdg::Region::onBottomNodeAdded ( Node node)
private

Adds node to the set of bottom nodes in the region.

Parameters
nodeThe node that is now a bottom node.
See also
BottomNodes
Note
This method is automatically invoked when a node is created or becomes dead.

Definition at line 378 of file region.cpp.

◆ onBottomNodeRemoved()

void jlm::rvsdg::Region::onBottomNodeRemoved ( Node node)
private

Removes node from the list of bottom nodes in the region.

Parameters
nodeThe node that is no longer a bottom node.
Note
This method is automatically invoked when a node ceases to be dead.

Definition at line 387 of file region.cpp.

◆ onNodeAdded()

void jlm::rvsdg::Region::onNodeAdded ( Node node)
private

Adds node to the list of nodes in the region.

Parameters
nodeThe node that has been created in the region.
Note
This method is automatically invoked when a node is created.

Definition at line 395 of file region.cpp.

◆ onNodeRemoved()

void jlm::rvsdg::Region::onNodeRemoved ( Node node)
private

Remove node from the region.

Parameters
nodeThe node that is removed.
Note
This method is automatically invoked when a node is deleted.

Definition at line 403 of file region.cpp.

◆ onTopNodeAdded()

void jlm::rvsdg::Region::onTopNodeAdded ( Node node)
private

Adds node to the top nodes of the region.

Parameters
nodeThe node that is now a top node.
See also
TopNodes
Note
This method is automatically invoked when a top node is created.

Definition at line 361 of file region.cpp.

◆ onTopNodeRemoved()

void jlm::rvsdg::Region::onTopNodeRemoved ( Node node)
private

Removes node from the list of top nodes in the region.

Parameters
nodeThe node that is no longer a top node.
Note
This method is automatically invoked when inputs are added to a node.

Definition at line 370 of file region.cpp.

◆ operator=()

Region & jlm::rvsdg::Region::operator= ( const Region )
delete

◆ prune()

void jlm::rvsdg::Region::prune ( bool  recursive)

Removes all dead nodes from the region, including nodes that become dead during pruning.

Parameters
recursiveif true, any subregions are also pruned, as well as their subregions etc.

Definition at line 326 of file region.cpp.

◆ PruneArguments()

size_t jlm::rvsdg::Region::PruneArguments ( )

Remove all arguments that have no users.

Returns
The number of arguments that were removed.

Definition at line 241 of file region.cpp.

◆ RemoveArguments()

size_t jlm::rvsdg::Region::RemoveArguments ( const util::HashSet< size_t > &  indices)

Remove all arguments that have no users and an index contained in indices.

Parameters
indicesThe indices of the arguments that should be removed.
Returns
The number of arguments that were actually removed. This might be less than the number of indices as some arguments might not have been dead or a provided argument index does not belong to an actual argument.

Definition at line 213 of file region.cpp.

◆ removeNode()

void jlm::rvsdg::Region::removeNode ( Node node)

Deletes the given node from the region. The node must belong to this region, and be dead.

Parameters
nodethe node to remove

Definition at line 309 of file region.cpp.

◆ RemoveResults()

size_t jlm::rvsdg::Region::RemoveResults ( const util::HashSet< size_t > &  indices)

Remove all results that have an index contained in indices.

Parameters
indicesThe indices of the results that should be removed.
Returns
The number of results that were removed. This might be less than the number of indices as some provided result indices might not belong to an actual result.

Definition at line 281 of file region.cpp.

◆ result()

RegionResult * jlm::rvsdg::Region::result ( size_t  index) const
inlinenoexcept

Definition at line 500 of file region.hpp.

◆ Results() [1/2]

RegionResultConstRange jlm::rvsdg::Region::Results ( ) const
inlinenoexcept
Returns
Returns an iterator range for iterating through the results of the region.

Definition at line 346 of file region.hpp.

◆ Results() [2/2]

RegionResultRange jlm::rvsdg::Region::Results ( )
inlinenoexcept
Returns
Returns an iterator range for iterating through the results of the region.

Definition at line 337 of file region.hpp.

◆ toJson() [1/4]

std::string jlm::rvsdg::Region::toJson ( const Region region)
staticnoexcept

Converts region and all of its contained structural nodes with subregions to a JSON string.

Parameters
regionThe top-level region that is converted.
Returns
A string containing the JSON of region.

Definition at line 500 of file region.cpp.

◆ toJson() [2/4]

std::string jlm::rvsdg::Region::toJson ( const Region region,
const util::AnnotationMap annotationMap 
)
staticnoexcept

Converts region and all of its contained structural nodes with subregions to a JSON string.

Parameters
regionThe top-level region that is converted.
annotationMapA map with annotations for instances of Regions or StructuralNodes.
Returns
A string containing the JSON of region.

Definition at line 492 of file region.cpp.

◆ toJson() [3/4]

void jlm::rvsdg::Region::toJson ( const Region region,
const util::AnnotationMap annotationMap,
std::stringstream &  stream 
)
staticprivatenoexcept

Definition at line 509 of file region.cpp.

◆ toJson() [4/4]

void jlm::rvsdg::Region::toJson ( const StructuralNode structuralNode,
const util::AnnotationMap annotationMap,
std::stringstream &  stream 
)
staticprivatenoexcept

Definition at line 570 of file region.cpp.

◆ toJsonKeyValue()

std::string jlm::rvsdg::Region::toJsonKeyValue ( const util::Annotation annotation)
staticprivatenoexcept

Definition at line 622 of file region.cpp.

◆ TopNodes() [1/2]

TopNodeConstRange jlm::rvsdg::Region::TopNodes ( ) const
inlinenoexcept
Returns
Returns an iterator range for iterating through the top nodes of the region. The top nodes are all nodes that do not have any inputs.

Definition at line 366 of file region.hpp.

◆ TopNodes() [2/2]

TopNodeRange jlm::rvsdg::Region::TopNodes ( )
inlinenoexcept
Returns
Returns an iterator range for iterating through the top nodes of the region. The top nodes are all nodes that do not have any inputs.

Definition at line 356 of file region.hpp.

◆ ToString() [1/2]

std::string jlm::rvsdg::Region::ToString ( const std::vector< util::Annotation > &  annotations,
char  annotationSeparator,
char  labelValueSeparator 
)
staticprivate

Definition at line 724 of file region.cpp.

◆ ToString() [2/2]

std::string jlm::rvsdg::Region::ToString ( const util::Annotation annotation,
char  labelValueSeparator 
)
staticprivate

Definition at line 740 of file region.cpp.

◆ ToTree() [1/3]

std::string jlm::rvsdg::Region::ToTree ( const rvsdg::Region region)
staticnoexcept

Converts region and all of its contained structural nodes with subregions to a tree in ASCII format of the following form:

RootRegion
-STRUCTURAL_TEST_NODE
Region[0]
Region[1]
—STRUCTURAL_TEST_NODE
-—Region[0]
-—Region[1]
-—Region[2]

The above tree has a single structural node in the RVSDG's root region. This node has two subregions, where the second subregion contains another structural node with three subregions.

Parameters
regionThe top-level region that is converted
Returns
A string containing the ASCII tree of region

Definition at line 658 of file region.cpp.

◆ ToTree() [2/3]

std::string jlm::rvsdg::Region::ToTree ( const rvsdg::Region region,
const util::AnnotationMap annotationMap 
)
staticnoexcept

Converts region and all of its contained structural nodes with subregions to a tree in ASCII format of the following form:

RootRegion
-STRUCTURAL_TEST_NODE
Region[0]
Region[1]
—STRUCTURAL_TEST_NODE
-—Region[0]
-—Region[1]
-—Region[2] NumNodes:0 NumArguments:0

The above tree has a single structural node in the RVSDG's root region. This node has two subregions, where the second subregion contains another structural node with three subregions. For the third subregion, two annotations with label NumNodes and NumArguments was provided in annotationMap.

Parameters
regionThe top-level region that is converted
annotationMapA map with annotations for instances of Regions or StructuralNodes.
Returns
A string containing the ASCII tree of region.

Definition at line 650 of file region.cpp.

◆ ToTree() [3/3]

void jlm::rvsdg::Region::ToTree ( const rvsdg::Region region,
const util::AnnotationMap annotationMap,
size_t  indentationDepth,
std::stringstream &  stream 
)
staticprivatenoexcept

Definition at line 667 of file region.cpp.

◆ view()

void jlm::rvsdg::Region::view ( ) const

This function is meant to be used from the debugger. You can just invoke it and a xdot window should pop up with a DOT visualization of the region. This depends on xdot being in the PATH.

Definition at line 345 of file region.cpp.

Friends And Related Symbol Documentation

◆ Input

friend class Input
friend

Definition at line 873 of file region.hpp.

◆ Node

friend class Node
friend

Definition at line 869 of file region.hpp.

◆ Output

Definition at line 874 of file region.hpp.

◆ RegionObserver

Definition at line 870 of file region.hpp.

◆ RegionResult

Definition at line 875 of file region.hpp.

◆ SimpleNode

Definition at line 871 of file region.hpp.

◆ StructuralNode

Definition at line 872 of file region.hpp.

Member Data Documentation

◆ arguments_

std::vector<RegionArgument *> jlm::rvsdg::Region::arguments_
private

Definition at line 855 of file region.hpp.

◆ bottomNodes_

region_bottom_node_list jlm::rvsdg::Region::bottomNodes_
private

Definition at line 858 of file region.hpp.

◆ depth_

const size_t jlm::rvsdg::Region::depth_
private

The depth of the region. The root region has depth 0, all others have parent region depth + 1.

Definition at line 837 of file region.hpp.

◆ graph_

Graph* const jlm::rvsdg::Region::graph_
private

The graph this region belongs to.

Definition at line 829 of file region.hpp.

◆ id_

const Id jlm::rvsdg::Region::id_
private

A region ID unique to all regions in the graph.

Definition at line 833 of file region.hpp.

◆ index_

const size_t jlm::rvsdg::Region::index_
private

The index of the region, if it is a subregion of a structural node.

Definition at line 846 of file region.hpp.

◆ nextNodeId_

Node::Id jlm::rvsdg::Region::nextNodeId_
private

The ID that will be given to the next node created in this region.

Definition at line 851 of file region.hpp.

◆ node_

rvsdg::StructuralNode* const jlm::rvsdg::Region::node_
private

The structural node this region belongs to, or nullptr if it is the root region.

Definition at line 842 of file region.hpp.

◆ nodes_

region_nodes_list jlm::rvsdg::Region::nodes_
private

Definition at line 860 of file region.hpp.

◆ numBottomNodes_

size_t jlm::rvsdg::Region::numBottomNodes_
private

Definition at line 859 of file region.hpp.

◆ numNodes_

size_t jlm::rvsdg::Region::numNodes_
private

Definition at line 861 of file region.hpp.

◆ numTopNodes_

size_t jlm::rvsdg::Region::numTopNodes_
private

Definition at line 857 of file region.hpp.

◆ observers_

RegionObserver* jlm::rvsdg::Region::observers_ = nullptr
mutableprivate

A linked list of RegionObservers registered on the Region. The field is mutable to allow observers to register on const Regions.

Definition at line 867 of file region.hpp.

◆ results_

std::vector<RegionResult *> jlm::rvsdg::Region::results_
private

Definition at line 854 of file region.hpp.

◆ topNodes_

region_top_node_list jlm::rvsdg::Region::topNodes_
private

Definition at line 856 of file region.hpp.


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