|
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) 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 |
| void | PrintFullId (std::ostream &out) const |
| 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 |
| void | outputJsonObjectOpening (std::ostream &out, size_t indent, bool &firstField) 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 | outputJson (std::ostream &out, size_t indent) const |
| void | MapProgramObjectToElement (GraphElement &element) |
| void | RemoveProgramObjectMapping (GraphElement &element) |
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 826 of file GraphWriter.hpp.
|
explicitprivate |
Definition at line 1378 of file GraphWriter.cpp.
Definition at line 1384 of file GraphWriter.cpp.
|
overridedefault |
| ArgumentNode & jlm::util::graph::Graph::CreateArgumentNode | ( | ) |
Adds a new argument node to the graph.
Definition at line 1450 of file GraphWriter.cpp.
Creates a new directed edge from from to to.
Definition at line 943 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 1492 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 1429 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 1421 of file GraphWriter.cpp.
| ResultNode & jlm::util::graph::Graph::CreateResultNode | ( | ) |
Adds a new result node to the graph.
Definition at line 1471 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 955 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 1570 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 1464 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 1511 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 1518 of file GraphWriter.cpp.
|
inline |
Definition at line 993 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 1531 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 1010 of file GraphWriter.hpp.
|
overridevirtual |
Gets a reference to the graph this GraphElement belongs to
Implements jlm::util::graph::GraphElement.
Definition at line 1397 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 1391 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 1443 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 1485 of file GraphWriter.cpp.
| Writer & jlm::util::graph::Graph::GetWriter | ( | ) |
Definition at line 1403 of file GraphWriter.cpp.
| const Writer & jlm::util::graph::Graph::GetWriter | ( | ) | const |
Definition at line 1409 of file GraphWriter.cpp.
| bool jlm::util::graph::Graph::IsSubgraph | ( | ) | const |
Definition at line 1415 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 1539 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1458 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1505 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1437 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1479 of file GraphWriter.cpp.
| void jlm::util::graph::Graph::Output | ( | std::ostream & | out, |
| OutputFormat | format, | ||
| size_t | indent | ||
| ) | 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 1742 of file GraphWriter.cpp.
|
private |
Definition at line 1586 of file GraphWriter.cpp.
|
private |
Definition at line 1631 of file GraphWriter.cpp.
|
private |
Definition at line 1689 of file GraphWriter.cpp.
|
private |
Removes the mapping of a program object to a graph element in the graph.
| element | the element that is currently mapped to a program object, whose mapping should be removed. |
Definition at line 1556 of file GraphWriter.cpp.
|
private |
Definition at line 1073 of file GraphWriter.hpp.
|
private |
Definition at line 1076 of file GraphWriter.hpp.
|
private |
Definition at line 829 of file GraphWriter.hpp.
|
private |
Definition at line 1070 of file GraphWriter.hpp.
|
private |
Definition at line 1067 of file GraphWriter.hpp.
|
private |
Definition at line 1079 of file GraphWriter.hpp.
|
private |
Definition at line 1074 of file GraphWriter.hpp.
|
private |
Definition at line 828 of file GraphWriter.hpp.
|
private |
Definition at line 1063 of file GraphWriter.hpp.