|
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 (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 824 of file GraphWriter.hpp.
|
explicitprivate |
Definition at line 1377 of file GraphWriter.cpp.
Definition at line 1383 of file GraphWriter.cpp.
|
overridedefault |
| ArgumentNode & jlm::util::graph::Graph::CreateArgumentNode | ( | ) |
Adds a new argument node to the graph.
Definition at line 1449 of file GraphWriter.cpp.
Creates a new directed edge from from to to.
Definition at line 941 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 1491 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 1428 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 1420 of file GraphWriter.cpp.
| ResultNode & jlm::util::graph::Graph::CreateResultNode | ( | ) |
Adds a new result node to the graph.
Definition at line 1470 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 953 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 1558 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 1463 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 1510 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 1517 of file GraphWriter.cpp.
|
inline |
Definition at line 991 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 1530 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 1008 of file GraphWriter.hpp.
|
overridevirtual |
Gets a reference to the graph this GraphElement belongs to
Implements jlm::util::graph::GraphElement.
Definition at line 1396 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 1390 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 1442 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 1484 of file GraphWriter.cpp.
| Writer & jlm::util::graph::Graph::GetWriter | ( | ) |
Definition at line 1402 of file GraphWriter.cpp.
| const Writer & jlm::util::graph::Graph::GetWriter | ( | ) | const |
Definition at line 1408 of file GraphWriter.cpp.
| bool jlm::util::graph::Graph::IsSubgraph | ( | ) | const |
Definition at line 1414 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 1538 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1457 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1504 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1436 of file GraphWriter.cpp.
|
noexcept |
Definition at line 1478 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 1730 of file GraphWriter.cpp.
|
private |
Definition at line 1574 of file GraphWriter.cpp.
|
private |
Definition at line 1619 of file GraphWriter.cpp.
|
private |
Definition at line 1677 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 1551 of file GraphWriter.cpp.
|
private |
Definition at line 1070 of file GraphWriter.hpp.
|
private |
Definition at line 1073 of file GraphWriter.hpp.
|
private |
Definition at line 827 of file GraphWriter.hpp.
|
private |
Definition at line 1067 of file GraphWriter.hpp.
|
private |
Definition at line 1064 of file GraphWriter.hpp.
|
private |
Definition at line 1076 of file GraphWriter.hpp.
|
private |
Definition at line 1071 of file GraphWriter.hpp.
|
private |
Definition at line 826 of file GraphWriter.hpp.
|
private |
Definition at line 1060 of file GraphWriter.hpp.