Jlm
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
jlm::util::graph::Writer Class Reference

#include <GraphWriter.hpp>

Public Member Functions

 ~Writer ()=default
 
 Writer ()=default
 
 Writer (const Writer &other)=delete
 
 Writer (Writer &&other)=delete
 
Writer & operator= (const Writer &other)=delete
 
Writer & operator= (Writer &&other)=delete
 
Graph & CreateGraph ()
 
size_t NumGraphs () const noexcept
 
Graph & GetGraph (size_t index)
 
GraphElement * GetElementFromProgramObject (uintptr_t object) const
 
template<typename T >
GraphElement * GetElementFromProgramObject (const T &object) const
 
void mapProgramObjectToElement (GraphElement &element)
 
void removeProgramObjectMapping (GraphElement &element)
 
void Finalize ()
 
void outputAllGraphs (std::ostream &out, OutputFormat format)
 

Private Member Functions

Graph & CreateSubGraph (Node &parentNode)
 
size_t GetNextUniqueIdStubSuffix (const char *idStub)
 

Private Attributes

std::vector< std::unique_ptr< Graph > > Graphs_
 
std::unordered_map< std::string, size_t > NextUniqueIdStubSuffix_
 
std::unordered_map< uintptr_t, GraphElement * > ProgramObjectMapping_
 

Friends

Graph & InOutNode::CreateSubgraph ()
 
void GraphElement::Finalize ()
 

Detailed Description

Utility class for creating graphs in memory, and printing them to a human or machine readable format.

Definition at line 1086 of file GraphWriter.hpp.

Constructor & Destructor Documentation

◆ ~Writer()

jlm::util::graph::Writer::~Writer ( )
default

◆ Writer() [1/3]

jlm::util::graph::Writer::Writer ( )
default

◆ Writer() [2/3]

jlm::util::graph::Writer::Writer ( const Writer &  other)
delete

◆ Writer() [3/3]

jlm::util::graph::Writer::Writer ( Writer &&  other)
delete

Member Function Documentation

◆ CreateGraph()

Graph & jlm::util::graph::Writer::CreateGraph ( )

Creates a new graph and appends it to the GraphWriter's list of graphs.

Returns
a reference to the newly created graph

Definition at line 1763 of file GraphWriter.cpp.

◆ CreateSubGraph()

Graph & jlm::util::graph::Writer::CreateSubGraph ( Node &  parentNode)
private

Definition at line 1784 of file GraphWriter.cpp.

◆ Finalize()

void jlm::util::graph::Writer::Finalize ( )

Ensures that all graphs added to the graph writer so far are finalized. Recursively finalizes the GraphElements of each graph.

Definition at line 1837 of file GraphWriter.cpp.

◆ GetElementFromProgramObject() [1/2]

template<typename T >
GraphElement * jlm::util::graph::Writer::GetElementFromProgramObject ( const T &  object) const
inline

Definition at line 1131 of file GraphWriter.hpp.

◆ GetElementFromProgramObject() [2/2]

GraphElement * jlm::util::graph::Writer::GetElementFromProgramObject ( uintptr_t  object) const

Attempts to find a GraphElement in one of the graphs that is associated with object

Returns
the graph element associated with object, or nullptr if none is found

Definition at line 1792 of file GraphWriter.cpp.

◆ GetGraph()

Graph & jlm::util::graph::Writer::GetGraph ( size_t  index)
Returns
a reference to the graph with the given index, which must be lower than NumGraphs()

Definition at line 1777 of file GraphWriter.cpp.

◆ GetNextUniqueIdStubSuffix()

size_t jlm::util::graph::Writer::GetNextUniqueIdStubSuffix ( const char *  idStub)
private

Returns a unique suffix for the given idStub, starting at 0 and counting up

Returns
the next unique integer suffix for the given idStub

Definition at line 1830 of file GraphWriter.cpp.

◆ mapProgramObjectToElement()

void jlm::util::graph::Writer::mapProgramObjectToElement ( GraphElement &  element)

Creates a mapping from a GraphElement's assigned program object to the GraphElement. The GraphElement can belong to any Graph in the writer.

Parameters
elementthe graph element to map

Definition at line 1800 of file GraphWriter.cpp.

◆ NumGraphs()

size_t jlm::util::graph::Writer::NumGraphs ( ) const
noexcept
Returns
the number of graphs in the GraphWriter

Definition at line 1771 of file GraphWriter.cpp.

◆ operator=() [1/2]

Writer & jlm::util::graph::Writer::operator= ( const Writer &  other)
delete

◆ operator=() [2/2]

Writer & jlm::util::graph::Writer::operator= ( Writer &&  other)
delete

◆ outputAllGraphs()

void jlm::util::graph::Writer::outputAllGraphs ( std::ostream &  out,
OutputFormat  format 
)

Finalizes and prints all graphs created in this GraphWriter.

Parameters
outthe output stream to write graphs to
formatthe format to emit the graphs in

Definition at line 1845 of file GraphWriter.cpp.

◆ removeProgramObjectMapping()

void jlm::util::graph::Writer::removeProgramObjectMapping ( GraphElement &  element)

Removes the mapping of a program object to a graph element.

Parameters
elementthe element that is currently mapped to a program object, whose mapping should be removed.

Definition at line 1813 of file GraphWriter.cpp.

Friends And Related Symbol Documentation

◆ GraphElement::Finalize

void GraphElement::Finalize ( )
friend

◆ InOutNode::CreateSubgraph

Member Data Documentation

◆ Graphs_

std::vector<std::unique_ptr<Graph> > jlm::util::graph::Writer::Graphs_
private

Definition at line 1190 of file GraphWriter.hpp.

◆ NextUniqueIdStubSuffix_

std::unordered_map<std::string, size_t> jlm::util::graph::Writer::NextUniqueIdStubSuffix_
private

Definition at line 1193 of file GraphWriter.hpp.

◆ ProgramObjectMapping_

std::unordered_map<uintptr_t, GraphElement *> jlm::util::graph::Writer::ProgramObjectMapping_
private

Definition at line 1198 of file GraphWriter.hpp.


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