Jlm
Public Member Functions | Static Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | List of all members
jlm::llvm::ControlFlowGraph Class Referencefinal

#include <cfg.hpp>

Collaboration diagram for jlm::llvm::ControlFlowGraph:
Collaboration graph
[legend]

Public Member Functions

 ~ControlFlowGraph () noexcept=default
 
 ControlFlowGraph (InterProceduralGraphModule &im)
 
 ControlFlowGraph (const ControlFlowGraph &)=delete
 
 ControlFlowGraph (ControlFlowGraph &&)=delete
 
ControlFlowGraphoperator= (const ControlFlowGraph &)=delete
 
ControlFlowGraphoperator= (ControlFlowGraph &&)=delete
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
EntryNodeentry () const noexcept
 
ExitNodeexit () const noexcept
 
BasicBlockadd_node (std::unique_ptr< BasicBlock > bb)
 
ControlFlowGraph::iterator find_node (BasicBlock *bb)
 
size_t nnodes () const noexcept
 
InterProceduralGraphModulemodule () const noexcept
 
rvsdg::FunctionType fcttype () const
 
void view () const
 

Static Public Member Functions

static ControlFlowGraph::iterator remove_node (ControlFlowGraph::iterator &it)
 
static ControlFlowGraph::iterator remove_node (BasicBlock *bb)
 
static std::unique_ptr< ControlFlowGraphcreate (InterProceduralGraphModule &im)
 
static std::string ToAscii (const ControlFlowGraph &controlFlowGraph)
 
static util::graph::GraphtoDot (util::graph::Writer &writer, const ControlFlowGraph &controlFlowGraph)
 

Private Types

using iterator = util::PtrIterator< BasicBlock, std::unordered_set< std::unique_ptr< BasicBlock > >::iterator >
 
using const_iterator = util::PtrIterator< const BasicBlock, std::unordered_set< std::unique_ptr< BasicBlock > >::const_iterator >
 

Static Private Member Functions

static std::string ToAscii (const EntryNode &entryNode)
 
static std::string ToAscii (const ExitNode &exitNode)
 
static std::string ToAscii (const BasicBlock &basicBlock, const std::unordered_map< ControlFlowGraphNode *, std::string > &labels)
 
static std::string CreateTargets (const ControlFlowGraphNode &node, const std::unordered_map< ControlFlowGraphNode *, std::string > &labels)
 
static std::unordered_map< ControlFlowGraphNode *, std::string > CreateLabels (const std::vector< ControlFlowGraphNode * > &nodes)
 

Private Attributes

InterProceduralGraphModulemodule_
 
std::unique_ptr< ExitNodeexit_
 
std::unique_ptr< EntryNodeentry_
 
std::unordered_set< std::unique_ptr< BasicBlock > > nodes_
 

Detailed Description

Definition at line 158 of file cfg.hpp.

Member Typedef Documentation

◆ const_iterator

using jlm::llvm::ControlFlowGraph::const_iterator = util::PtrIterator< const BasicBlock, std::unordered_set<std::unique_ptr<BasicBlock> >::const_iterator>
private

Definition at line 162 of file cfg.hpp.

◆ iterator

using jlm::llvm::ControlFlowGraph::iterator = util::PtrIterator<BasicBlock, std::unordered_set<std::unique_ptr<BasicBlock> >::iterator>
private

Definition at line 160 of file cfg.hpp.

Constructor & Destructor Documentation

◆ ~ControlFlowGraph()

jlm::llvm::ControlFlowGraph::~ControlFlowGraph ( )
defaultnoexcept

◆ ControlFlowGraph() [1/3]

jlm::llvm::ControlFlowGraph::ControlFlowGraph ( InterProceduralGraphModule im)
explicit

Definition at line 27 of file cfg.cpp.

◆ ControlFlowGraph() [2/3]

jlm::llvm::ControlFlowGraph::ControlFlowGraph ( const ControlFlowGraph )
delete

◆ ControlFlowGraph() [3/3]

jlm::llvm::ControlFlowGraph::ControlFlowGraph ( ControlFlowGraph &&  )
delete

Member Function Documentation

◆ add_node()

BasicBlock* jlm::llvm::ControlFlowGraph::add_node ( std::unique_ptr< BasicBlock bb)
inline

Definition at line 218 of file cfg.hpp.

◆ begin() [1/2]

iterator jlm::llvm::ControlFlowGraph::begin ( )
inline

Definition at line 188 of file cfg.hpp.

◆ begin() [2/2]

const_iterator jlm::llvm::ControlFlowGraph::begin ( ) const
inline

Definition at line 182 of file cfg.hpp.

◆ create()

static std::unique_ptr<ControlFlowGraph> jlm::llvm::ControlFlowGraph::create ( InterProceduralGraphModule im)
inlinestatic

Definition at line 267 of file cfg.hpp.

◆ CreateLabels()

std::unordered_map< ControlFlowGraphNode *, std::string > jlm::llvm::ControlFlowGraph::CreateLabels ( const std::vector< ControlFlowGraphNode * > &  nodes)
staticprivate

Definition at line 255 of file cfg.cpp.

◆ CreateTargets()

std::string jlm::llvm::ControlFlowGraph::CreateTargets ( const ControlFlowGraphNode node,
const std::unordered_map< ControlFlowGraphNode *, std::string > &  labels 
)
staticprivate

Definition at line 237 of file cfg.cpp.

◆ end() [1/2]

iterator jlm::llvm::ControlFlowGraph::end ( )
inline

Definition at line 200 of file cfg.hpp.

◆ end() [2/2]

const_iterator jlm::llvm::ControlFlowGraph::end ( ) const
inline

Definition at line 194 of file cfg.hpp.

◆ entry()

EntryNode* jlm::llvm::ControlFlowGraph::entry ( ) const
inlinenoexcept

Definition at line 206 of file cfg.hpp.

◆ exit()

ExitNode* jlm::llvm::ControlFlowGraph::exit ( ) const
inlinenoexcept

Definition at line 212 of file cfg.hpp.

◆ fcttype()

rvsdg::FunctionType jlm::llvm::ControlFlowGraph::fcttype ( ) const
inline

Definition at line 253 of file cfg.hpp.

◆ find_node()

ControlFlowGraph::iterator jlm::llvm::ControlFlowGraph::find_node ( BasicBlock bb)
inline

Definition at line 226 of file cfg.hpp.

◆ module()

InterProceduralGraphModule& jlm::llvm::ControlFlowGraph::module ( ) const
inlinenoexcept

Definition at line 247 of file cfg.hpp.

◆ nnodes()

size_t jlm::llvm::ControlFlowGraph::nnodes ( ) const
inlinenoexcept

Definition at line 241 of file cfg.hpp.

◆ operator=() [1/2]

ControlFlowGraph& jlm::llvm::ControlFlowGraph::operator= ( const ControlFlowGraph )
delete

◆ operator=() [2/2]

ControlFlowGraph& jlm::llvm::ControlFlowGraph::operator= ( ControlFlowGraph &&  )
delete

◆ remove_node() [1/2]

ControlFlowGraph::iterator jlm::llvm::ControlFlowGraph::remove_node ( BasicBlock bb)
static

Definition at line 55 of file cfg.cpp.

◆ remove_node() [2/2]

ControlFlowGraph::iterator jlm::llvm::ControlFlowGraph::remove_node ( ControlFlowGraph::iterator it)
static

Definition at line 36 of file cfg.cpp.

◆ ToAscii() [1/4]

std::string jlm::llvm::ControlFlowGraph::ToAscii ( const BasicBlock basicBlock,
const std::unordered_map< ControlFlowGraphNode *, std::string > &  labels 
)
staticprivate

Definition at line 207 of file cfg.cpp.

◆ ToAscii() [2/4]

std::string jlm::llvm::ControlFlowGraph::ToAscii ( const ControlFlowGraph controlFlowGraph)
static

Definition at line 151 of file cfg.cpp.

◆ ToAscii() [3/4]

std::string jlm::llvm::ControlFlowGraph::ToAscii ( const EntryNode entryNode)
staticprivate

Definition at line 183 of file cfg.cpp.

◆ ToAscii() [4/4]

std::string jlm::llvm::ControlFlowGraph::ToAscii ( const ExitNode exitNode)
staticprivate

Definition at line 195 of file cfg.cpp.

◆ toDot()

util::graph::Graph & jlm::llvm::ControlFlowGraph::toDot ( util::graph::Writer writer,
const ControlFlowGraph controlFlowGraph 
)
static

Converts the control flow graph to a DOT graph.

Parameters
writerA graph writer for converting the controlFlowGraph to DOT.
controlFlowGraphControl flow graph that is converted.
Returns
A DOT graph

Definition at line 64 of file cfg.cpp.

◆ view()

void jlm::llvm::ControlFlowGraph::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 control flow graph. This depends on xdot being in the PATH.

Definition at line 136 of file cfg.cpp.

Member Data Documentation

◆ entry_

std::unique_ptr<EntryNode> jlm::llvm::ControlFlowGraph::entry_
private

Definition at line 315 of file cfg.hpp.

◆ exit_

std::unique_ptr<ExitNode> jlm::llvm::ControlFlowGraph::exit_
private

Definition at line 314 of file cfg.hpp.

◆ module_

InterProceduralGraphModule& jlm::llvm::ControlFlowGraph::module_
private

Definition at line 313 of file cfg.hpp.

◆ nodes_

std::unordered_set<std::unique_ptr<BasicBlock> > jlm::llvm::ControlFlowGraph::nodes_
private

Definition at line 316 of file cfg.hpp.


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