|
Jlm
|
Represent acyclic RVSDG subgraphs. More...
#include <region.hpp>

Public Types | |
| using | Id = uint64_t |
Static Public Member Functions | |
| template<class TOperation > | |
| static bool | containsOperation (const Region ®ion, bool checkSubregions) |
| template<class TNodeType > | |
| static bool | containsNodeType (const Region ®ion, bool checkSubregions) |
| static size_t | NumRegions (const rvsdg::Region ®ion) noexcept |
| static bool | isAncestor (const rvsdg::Region ®ion, const rvsdg::Region &ancestor) noexcept |
| static std::string | ToTree (const rvsdg::Region ®ion, const util::AnnotationMap &annotationMap) noexcept |
| static std::string | ToTree (const rvsdg::Region ®ion) noexcept |
| static std::string | toJson (const Region ®ion, const util::AnnotationMap &annotationMap) noexcept |
| static std::string | toJson (const Region ®ion) noexcept |
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 ®ion, const util::AnnotationMap &annotationMap, size_t indentationDepth, std::stringstream &stream) noexcept |
| static void | toJson (const Region ®ion, 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_ |
| RegionObserver * | observers_ = nullptr |
Friends | |
| class | Node |
| class | RegionObserver |
| class | SimpleNode |
| class | StructuralNode |
| class | Input |
| class | Output |
| class | RegionResult |
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:
Definition at line 212 of file region.hpp.
|
private |
Definition at line 239 of file region.hpp.
|
private |
Definition at line 241 of file region.hpp.
|
private |
Definition at line 238 of file region.hpp.
Definition at line 240 of file region.hpp.
Definition at line 244 of file region.hpp.
|
private |
Definition at line 234 of file region.hpp.
Definition at line 236 of file region.hpp.
|
private |
Definition at line 233 of file region.hpp.
Definition at line 235 of file region.hpp.
|
private |
Definition at line 226 of file region.hpp.
|
private |
Definition at line 224 of file region.hpp.
|
private |
Definition at line 225 of file region.hpp.
|
private |
Definition at line 215 of file region.hpp.
|
private |
Definition at line 217 of file region.hpp.
|
private |
Definition at line 214 of file region.hpp.
Definition at line 216 of file region.hpp.
|
private |
Definition at line 220 of file region.hpp.
|
private |
Definition at line 222 of file region.hpp.
|
private |
Definition at line 219 of file region.hpp.
Definition at line 221 of file region.hpp.
|
private |
Definition at line 229 of file region.hpp.
Definition at line 231 of file region.hpp.
|
private |
Definition at line 228 of file region.hpp.
Definition at line 230 of file region.hpp.
|
noexcept |
Definition at line 122 of file region.cpp.
| jlm::rvsdg::Region::Region | ( | Graph * | graph | ) |
Constructor for the root region of a graph
Definition at line 148 of file region.cpp.
| 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.
| 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.
| argument | the argument to add |
Definition at line 179 of file region.cpp.
| 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.
| result | the result to add |
Definition at line 265 of file region.cpp.
|
inlinenoexcept |
Definition at line 466 of file region.hpp.
|
inlinenoexcept |
Definition at line 328 of file region.hpp.
|
inlinenoexcept |
Definition at line 319 of file region.hpp.
|
inlinenoexcept |
Definition at line 404 of file region.hpp.
|
inlinenoexcept |
Definition at line 394 of file region.hpp.
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.
| TNodeType | The node type to check for. |
| region | The region to check. |
| checkSubregions | If true, then the subregions of all contained structural nodes will be checked as well. |
Definition at line 201 of file structural-node.hpp.
|
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.
| TOperation | The operation to check for. |
| region | The region to check. |
| checkSubregions | If true, then the subregions of all contained structural nodes will be checked as well. |
Definition at line 163 of file structural-node.hpp.
| void jlm::rvsdg::Region::copy | ( | Region * | target, |
| SubstitutionMap & | smap | ||
| ) | const |
Copy a region with substitutions.
| target | Target region to create nodes in |
| smap | Operand 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.
|
inlineprivatenoexcept |
Definition at line 642 of file region.hpp.
|
staticprivate |
Definition at line 710 of file region.cpp.
|
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.
Definition at line 291 of file region.hpp.
|
inlinenoexcept |
Definition at line 573 of file region.hpp.
|
inlinenoexcept |
Definition at line 278 of file region.hpp.
|
inlinenoexcept |
Definition at line 267 of file region.hpp.
|
inlinenoexcept |
Definition at line 310 of file region.hpp.
| 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.
| index | the position to add the result |
| argument | the argument to add |
Definition at line 190 of file region.cpp.
|
staticnoexcept |
Determines if ancestor is a direct or indirect parent region of region in the RVSDG.
| region | The region to check the ancestry of. |
| ancestor | The region to test as a potential ancestor. |
ancestor appears somewhere above region in the RVSDG, false otherwise. Definition at line 474 of file region.cpp.
|
noexcept |
Checks if the region is the RVSDG root region.
Definition at line 173 of file region.cpp.
|
inlinenoexcept |
Definition at line 460 of file region.hpp.
|
inlinenoexcept |
Definition at line 301 of file region.hpp.
|
inlinenoexcept |
Definition at line 384 of file region.hpp.
|
inlinenoexcept |
Definition at line 375 of file region.hpp.
|
private |
Definition at line 438 of file region.cpp.
Definition at line 429 of file region.cpp.
Definition at line 447 of file region.cpp.
Definition at line 411 of file region.cpp.
Definition at line 420 of file region.cpp.
|
inlinenoexcept |
Definition at line 494 of file region.hpp.
|
inlinenoexcept |
Definition at line 528 of file region.hpp.
|
inlinenoexcept |
Definition at line 510 of file region.hpp.
|
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.
| region | The region for which to count the contained (sub-)regions. |
Definition at line 456 of file region.cpp.
|
inlinenoexcept |
Definition at line 519 of file region.hpp.
Adds node to the set of bottom nodes in the region.
| node | The node that is now a bottom node. |
Definition at line 378 of file region.cpp.
Removes node from the list of bottom nodes in the region.
| node | The node that is no longer a bottom node. |
Definition at line 387 of file region.cpp.
Adds node to the list of nodes in the region.
| node | The node that has been created in the region. |
Definition at line 395 of file region.cpp.
Remove node from the region.
| node | The node that is removed. |
Definition at line 403 of file region.cpp.
Adds node to the top nodes of the region.
| node | The node that is now a top node. |
Definition at line 361 of file region.cpp.
Removes node from the list of top nodes in the region.
| node | The node that is no longer a top node. |
Definition at line 370 of file region.cpp.
Removes all dead nodes from the region, including nodes that become dead during pruning.
| recursive | if true, any subregions are also pruned, as well as their subregions etc. |
Definition at line 326 of file region.cpp.
| size_t jlm::rvsdg::Region::PruneArguments | ( | ) |
Remove all arguments that have no users.
Definition at line 241 of file region.cpp.
| 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.
| indices | The indices of the arguments that should be removed. |
Definition at line 213 of file region.cpp.
Deletes the given node from the region. The node must belong to this region, and be dead.
| node | the node to remove |
Definition at line 309 of file region.cpp.
| size_t jlm::rvsdg::Region::RemoveResults | ( | const util::HashSet< size_t > & | indices | ) |
Remove all results that have an index contained in indices.
| indices | The indices of the results that should be removed. |
Definition at line 281 of file region.cpp.
|
inlinenoexcept |
Definition at line 500 of file region.hpp.
|
inlinenoexcept |
Definition at line 346 of file region.hpp.
|
inlinenoexcept |
Definition at line 337 of file region.hpp.
Converts region and all of its contained structural nodes with subregions to a JSON string.
| region | The top-level region that is converted. |
region. Definition at line 500 of file region.cpp.
|
staticnoexcept |
Converts region and all of its contained structural nodes with subregions to a JSON string.
| region | The top-level region that is converted. |
| annotationMap | A map with annotations for instances of Regions or StructuralNodes. |
region. Definition at line 492 of file region.cpp.
|
staticprivatenoexcept |
Definition at line 509 of file region.cpp.
|
staticprivatenoexcept |
Definition at line 570 of file region.cpp.
|
staticprivatenoexcept |
Definition at line 622 of file region.cpp.
|
inlinenoexcept |
Definition at line 366 of file region.hpp.
|
inlinenoexcept |
Definition at line 356 of file region.hpp.
|
staticprivate |
Definition at line 724 of file region.cpp.
|
staticprivate |
Definition at line 740 of file region.cpp.
|
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.
| region | The top-level region that is converted |
region Definition at line 658 of file region.cpp.
|
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.
| region | The top-level region that is converted |
| annotationMap | A map with annotations for instances of Regions or StructuralNodes. |
region. Definition at line 650 of file region.cpp.
|
staticprivatenoexcept |
Definition at line 667 of file region.cpp.
| 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.
Definition at line 873 of file region.hpp.
Definition at line 869 of file region.hpp.
Definition at line 874 of file region.hpp.
|
friend |
Definition at line 870 of file region.hpp.
|
friend |
Definition at line 875 of file region.hpp.
|
friend |
Definition at line 871 of file region.hpp.
|
friend |
Definition at line 872 of file region.hpp.
|
private |
Definition at line 855 of file region.hpp.
|
private |
Definition at line 858 of file region.hpp.
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.
The graph this region belongs to.
Definition at line 829 of file region.hpp.
A region ID unique to all regions in the graph.
Definition at line 833 of file region.hpp.
The index of the region, if it is a subregion of a structural node.
Definition at line 846 of file region.hpp.
|
private |
The ID that will be given to the next node created in this region.
Definition at line 851 of file region.hpp.
|
private |
The structural node this region belongs to, or nullptr if it is the root region.
Definition at line 842 of file region.hpp.
|
private |
Definition at line 860 of file region.hpp.
|
private |
Definition at line 859 of file region.hpp.
|
private |
Definition at line 861 of file region.hpp.
|
private |
Definition at line 857 of file region.hpp.
|
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.
|
private |
Definition at line 854 of file region.hpp.
|
private |
Definition at line 856 of file region.hpp.