|
Jlm
|
#include <GraphWriter.hpp>


Public Member Functions | |
| ~Graph () override=default | |
| const char * | GetIdPrefix () const override |
| Graph & | GetGraph () override |
| Writer & | GetWriter () |
| const Writer & | GetWriter () const |
| bool | IsSubgraph () const |
| Node & | CreateNode () |
| InOutNode & | CreateInOutNode (size_t inputPorts, size_t outputPorts) |
| size_t | NumNodes () const noexcept |
| Node & | GetNode (size_t index) |
| ArgumentNode & | CreateArgumentNode () |
| size_t | NumArgumentNodes () const noexcept |
| Node & | GetArgumentNode (size_t index) |
| ResultNode & | CreateResultNode () |
| size_t | NumResultNodes () const noexcept |
| Node & | GetResultNode (size_t index) |
| Edge & | CreateEdge (Port &from, Port &to, bool directed) |
| Edge & | CreateDirectedEdge (Port &from, Port &to) |
| Edge & | CreateUndirectedEdge (Port &a, Port &b) |
| size_t | NumEdges () const noexcept |
| Edge & | GetEdge (size_t index) |
| Edge * | GetEdgeBetween (Port &a, Port &b) |
| GraphElement * | GetElementFromProgramObject (uintptr_t object) const |
| template<typename T > | |
| GraphElement * | GetElementFromProgramObject (const T &object) const |
| template<typename Element , typename ProgramObject > | |
| Element & | GetFromProgramObject (const ProgramObject &object) const |
| void | Finalize () override |
| void | Output (std::ostream &out, OutputFormat format, size_t indent=0) const |
Public Member Functions inherited from jlm::util::graph::GraphElement | |
| virtual | ~GraphElement ()=default |
| GraphElement () | |
| GraphElement (const GraphElement &other)=delete | |
| GraphElement (GraphElement &&other)=delete | |
| GraphElement & | operator= (const GraphElement &other)=delete |
| GraphElement & | operator= (GraphElement &&other)=delete |
| std::string | GetFullId () const |
| const Graph & | GetGraph () const |
| void | SetLabel (std::string label) |
| void | AppendToLabel (std::string_view text, std::string_view sep="\n") |
| bool | HasLabel () const |
| const std::string & | GetLabel () const |
| std::string_view | GetLabelOr (std::string_view otherwise) const |
| size_t | GetUniqueIdSuffix () const |
| template<typename T > | |
| void | SetProgramObject (const T &object) |
| void | RemoveProgramObject () |
| bool | HasProgramObject () const noexcept |
| uintptr_t | GetProgramObject () const noexcept |
| void | SetAttribute (const std::string &attribute, std::string value) |
| void | SetAttributeObject (const std::string &attribute, uintptr_t object) |
| template<typename T > | |
| void | SetAttributeObject (const std::string &attribute, const T &object) |
| void | SetAttributeGraphElement (const std::string &attribute, const GraphElement &element) |
| bool | HasAttribute (const std::string &attribute) const |
| std::optional< std::string_view > | GetAttributeString (const std::string &attribute) const |
| std::optional< uintptr_t > | GetAttributeObject (const std::string &attribute) const |
| const GraphElement * | GetAttributeGraphElement (const std::string &attribute) const |
| bool | RemoveAttribute (const std::string &attribute) |
| bool | IsFinalized () const |
| void | OutputAttributes (std::ostream &out, AttributeOutputFormat format) const |
Private Member Functions | |
| Graph (Writer &writer) | |
| Graph (Writer &writer, Node &parentNode) | |
| void | OutputASCII (std::ostream &out, size_t indent) const |
| void | OutputDot (std::ostream &out, size_t indent) const |
| void | MapProgramObjectToElement (GraphElement &element) |
| void | RemoveProgramObjectMapping (uintptr_t object) |
Private Attributes | |
| friend | Writer |
| friend | GraphElement |
| Writer & | Writer_ |
| Node * | ParentNode_ |
| std::vector< std::unique_ptr< Node > > | Nodes_ |
| std::vector< std::unique_ptr< ArgumentNode > > | ArgumentNodes_ |
| std::vector< std::unique_ptr< ResultNode > > | ResultNodes_ |
| std::vector< std::unique_ptr< Edge > > | Edges_ |
| std::unordered_map< uintptr_t, GraphElement * > | ProgramObjectMapping_ |
Definition at line 768 of file GraphWriter.hpp.
|
explicitprivate |
Definition at line 1102 of file GraphWriter.cpp.
Definition at line 1108 of file GraphWriter.cpp.
|
overridedefault |
| ArgumentNode & jlm::util::graph::Graph::CreateArgumentNode | ( | ) |
Adds a new argument node to the graph.
Definition at line 1174 of file GraphWriter.cpp.
Creates a new directed edge from from to to.
Definition at line 885 of file GraphWriter.hpp.
Creates a new edge between from and to. Both ports must belong to this graph. If the edge is directed, the ports must support being the tail and head of an edge.
| from | the port the edge goes from. |
| to | the port the edge goes to. |
| directed | if true, the edge is a directed edge, otherwise undirected |
Definition at line 1216 of file GraphWriter.cpp.
| InOutNode & jlm::util::graph::Graph::CreateInOutNode | ( | size_t | inputPorts, |
| size_t | outputPorts | ||
| ) |
Creates an InOutNode in the graph with the given number of input and output ports.
| inputPorts | the number of input ports. |
| outputPorts | the number of output ports. |
Definition at line 1153 of file GraphWriter.cpp.
| Node & jlm::util::graph::Graph::CreateNode | ( | ) |
Creates a basic Node in the graph. It has a single port: itself.
Definition at line 1145 of file GraphWriter.cpp.
| ResultNode & jlm::util::graph::Graph::CreateResultNode | ( | ) |
Adds a new result node to the graph.
Definition at line 1195 of file GraphWriter.cpp.
Creates a new undirected edge between a and b. The ordering of a and b may affect graph layout.
Definition at line 897 of file GraphWriter.hpp.
|
overridevirtual |
Assigns unique IDs to all graph elements. Finalizing is recursive, visiting all sub graphs.
Reimplemented from jlm::util::graph::GraphElement.
Definition at line 1283 of file GraphWriter.cpp.
| Node & jlm::util::graph::Graph::GetArgumentNode | ( | size_t | index | ) |
Retrieves the argument node with the given index, which must be less than NumArgumentNodes()
Definition at line 1188 of file GraphWriter.cpp.
| Edge & jlm::util::graph::Graph::GetEdge | ( | size_t | index | ) |
Retrieves the edge with the given index, which must be lower than NumEdges()
Definition at line 1235 of file GraphWriter.cpp.
Retrieves an edge connecting ports a and b. If the edge is directed, it must go from a, to b.
| a | the first port |
| b | the second port |
Definition at line 1242 of file GraphWriter.cpp.
|
inline |
Definition at line 935 of file GraphWriter.hpp.
| GraphElement * jlm::util::graph::Graph::GetElementFromProgramObject | ( | uintptr_t | object | ) | const |
Retrieves the GraphElement in this graph associated with a given ProgramObject. This function does not look for graph elements inside sub graphs.
| object | the program object that is possibly mapped to a GraphElement in the graph |
Definition at line 1255 of file GraphWriter.cpp.
|
inline |
Retrieves the GraphElement in this graph associated with the given program object. Requires the program object to be mapped to a GraphElement in this graph, and that the graph element is of type T.
| object | the program object mapped to a GraphElement |
Definition at line 952 of file GraphWriter.hpp.
|
overridevirtual |
Gets a reference to the graph this GraphElement belongs to
Implements jlm::util::graph::GraphElement.
Definition at line 1121 of file GraphWriter.cpp.
|
overridevirtual |
Gets a short string that will serve as the base for a unique ID. This base should be a valid C-like identifier.
Implements jlm::util::graph::GraphElement.
Definition at line 1115 of file GraphWriter.cpp.
| Node & jlm::util::graph::Graph::GetNode | ( | size_t | index | ) |
Retrieves the node with the given index, which must be lower than NumNodes(). Argument nodes and result nodes are not accessed through this function.
Definition at line 1167 of file GraphWriter.cpp.
| Node & jlm::util::graph::Graph::GetResultNode | ( | size_t | index | ) |
Retrieves the result node with the given index, which must be less than NumResultNodes()
Definition at line 1209 of file GraphWriter.cpp.
| Writer & jlm::util::graph::Graph::GetWriter | ( | ) |
Definition at line 1127 of file GraphWriter.cpp.
| const Writer & jlm::util::graph::Graph::GetWriter | ( | ) | const |
Definition at line 1133 of file GraphWriter.cpp.
| bool jlm::util::graph::Graph::IsSubgraph | ( | ) | const |
Definition at line 1139 of file GraphWriter.cpp.
|
private |
Creates a mapping from a GraphElement's assigned program object to the GraphElement. The GraphElement must be a direct member of this graph.
| element | the graph element to map |
Definition at line 1263 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1182 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1229 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1161 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1203 of file GraphWriter.cpp.
| void jlm::util::graph::Graph::Output | ( | std::ostream & | out, |
| OutputFormat | format, | ||
| size_t | indent = 0 |
||
| ) | const |
Prints the graph to the given ostream, in the specified format. Requires the graph to be finalized first.
| out | the stream to which output is written |
| format | the format to output the graph in |
| indent | the amount of indentation levels the graph should be printed with |
Definition at line 1408 of file GraphWriter.cpp.
|
private |
Definition at line 1299 of file GraphWriter.cpp.
|
private |
Definition at line 1344 of file GraphWriter.cpp.
|
private |
Removes the mapping of a program object to a graph element in the graph.
| object | the program object that should no longer be mapped. |
Definition at line 1276 of file GraphWriter.cpp.
|
private |
Definition at line 1011 of file GraphWriter.hpp.
|
private |
Definition at line 1014 of file GraphWriter.hpp.
|
private |
Definition at line 771 of file GraphWriter.hpp.
|
private |
Definition at line 1008 of file GraphWriter.hpp.
|
private |
Definition at line 1005 of file GraphWriter.hpp.
|
private |
Definition at line 1017 of file GraphWriter.hpp.
|
private |
Definition at line 1012 of file GraphWriter.hpp.
|
private |
Definition at line 770 of file GraphWriter.hpp.
|
private |
Definition at line 1001 of file GraphWriter.hpp.