PandA-2024.02
Public Member Functions | Private Attributes
BasicBlocksGraphConstructor Class Reference

class providing methods to manage a basic blocks graph. More...

#include <basic_blocks_graph_constructor.hpp>

Collaboration diagram for BasicBlocksGraphConstructor:
Collaboration graph
[legend]

Public Member Functions

vertex add_vertex (const blocRef info)
 Add a new vertex to the basic blocks graphs. More...
 
EdgeDescriptor AddEdge (const vertex source, const vertex target, const int selector)
 Add an edge selector. More...
 
void RemoveEdge (const vertex source, const vertex target, const int selector)
 Remove an edge selector. More...
 
void RemoveEdge (const EdgeDescriptor edge, const int selector)
 Remove an edge selector. More...
 
void Clear ()
 Remove all vertices and edges. More...
 
void add_bb_edge_info (const vertex source, const vertex target, int type, const unsigned int label)
 add label to edge between vertex source and vertex target More...
 
EdgeDescriptor connect_to_exit (const vertex source)
 add edge between source and exit More...
 
EdgeDescriptor connect_to_entry (const vertex target)
 add edge between entry and target More...
 
bool check_vertex (unsigned int block_index) const
 return true in case the vertex has been already created More...
 
vertex Cget_vertex (unsigned int block_index) const
 return a vertex of the graph given the functionID. More...
 
void add_operation_to_bb (vertex op, unsigned int index)
 Add an operation to its basic block. More...
 
 BasicBlocksGraphConstructor (BBGraphsCollectionRef _bg)
 Constructor. More...
 
 ~BasicBlocksGraphConstructor ()
 Destructor. More...
 

Private Attributes

const BBGraphsCollectionRef bg
 reference to the bulk basic blocks graph More...
 
const BBGraphRef bb_graph
 Reference to graph with all the edges. More...
 
CustomUnorderedMap< unsigned int, vertex > & bb_index_map
 Map between basic block node index and vertices. More...
 

Detailed Description

class providing methods to manage a basic blocks graph.

Definition at line 64 of file basic_blocks_graph_constructor.hpp.

Constructor & Destructor Documentation

◆ BasicBlocksGraphConstructor()

BasicBlocksGraphConstructor::BasicBlocksGraphConstructor ( BBGraphsCollectionRef  _bg)
explicit

Constructor.

Parameters
_ogis the reference to the bulk operations graph.

Definition at line 55 of file basic_blocks_graph_constructor.cpp.

References ~BasicBlocksGraphConstructor().

Here is the call graph for this function:

◆ ~BasicBlocksGraphConstructor()

BasicBlocksGraphConstructor::~BasicBlocksGraphConstructor ( )
default

Destructor.

Referenced by BasicBlocksGraphConstructor().

Here is the caller graph for this function:

Member Function Documentation

◆ add_bb_edge_info()

void BasicBlocksGraphConstructor::add_bb_edge_info ( const vertex  source,
const vertex  target,
int  type,
const unsigned int  label 
)

add label to edge between vertex source and vertex target

Parameters
sourceis the source vertex
targetis the target vertexes
typeis the type of the label
labelis the label to be added

Definition at line 102 of file basic_blocks_graph_constructor.cpp.

References bb_graph, bg, CDG_SELECTOR, CFG_SELECTOR, FB_CDG_SELECTOR, FB_CFG_SELECTOR, STR, THROW_ASSERT, and test_panda::type.

◆ add_operation_to_bb()

void BasicBlocksGraphConstructor::add_operation_to_bb ( vertex  op,
unsigned int  index 
)

Add an operation to its basic block.

Parameters
opis the name of the operation vertex
indexis the index of the basic blocks

Definition at line 136 of file basic_blocks_graph_constructor.cpp.

References bb_graph, and Cget_vertex().

Here is the call graph for this function:

◆ add_vertex()

vertex BasicBlocksGraphConstructor::add_vertex ( const blocRef  info)

Add a new vertex to the basic blocks graphs.

Parameters
infois the bloc associated with basic block node
Returns
the vertex just added

Definition at line 62 of file basic_blocks_graph_constructor.cpp.

References BB_ENTRY, BB_EXIT, bb_graph, bb_index_map, bg, index, and THROW_ASSERT.

◆ AddEdge()

EdgeDescriptor BasicBlocksGraphConstructor::AddEdge ( const vertex  source,
const vertex  target,
const int  selector 
)

Add an edge selector.

Parameters
sourceis the source vertex
targetis the target vertexes
selectoris the type of the edge

Definition at line 81 of file basic_blocks_graph_constructor.cpp.

References bg.

Referenced by connect_to_entry(), and connect_to_exit().

Here is the caller graph for this function:

◆ Cget_vertex()

vertex BasicBlocksGraphConstructor::Cget_vertex ( unsigned int  block_index) const

return a vertex of the graph given the functionID.

if vertex does not exist throw error

Parameters
block_indexis the function identifier

Definition at line 129 of file basic_blocks_graph_constructor.cpp.

References bb_index_map, and THROW_ASSERT.

Referenced by add_operation_to_bb().

Here is the caller graph for this function:

◆ check_vertex()

bool BasicBlocksGraphConstructor::check_vertex ( unsigned int  block_index) const

return true in case the vertex has been already created

Parameters
block_indexis the basic block identifier

Definition at line 124 of file basic_blocks_graph_constructor.cpp.

References bb_index_map.

◆ Clear()

void BasicBlocksGraphConstructor::Clear ( )

Remove all vertices and edges.

Definition at line 86 of file basic_blocks_graph_constructor.cpp.

References bb_index_map, and bg.

◆ connect_to_entry()

EdgeDescriptor BasicBlocksGraphConstructor::connect_to_entry ( const vertex  target)

add edge between entry and target

Parameters
targetis the vertex to which connect entry

Definition at line 119 of file basic_blocks_graph_constructor.cpp.

References AddEdge(), bb_graph, CFG_SELECTOR, and lenet_tvm::target.

Here is the call graph for this function:

◆ connect_to_exit()

EdgeDescriptor BasicBlocksGraphConstructor::connect_to_exit ( const vertex  source)

add edge between source and exit

Parameters
sourceis the vertex to connect with exit

Definition at line 114 of file basic_blocks_graph_constructor.cpp.

References AddEdge(), bb_graph, and CFG_SELECTOR.

Here is the call graph for this function:

◆ RemoveEdge() [1/2]

void BasicBlocksGraphConstructor::RemoveEdge ( const vertex  source,
const vertex  target,
const int  selector 
)

Remove an edge selector.

Parameters
sourceis the source vertex
targetis the target vertexes
selectoris the type of the edge

Definition at line 92 of file basic_blocks_graph_constructor.cpp.

References bg.

◆ RemoveEdge() [2/2]

void BasicBlocksGraphConstructor::RemoveEdge ( const EdgeDescriptor  edge,
const int  selector 
)

Remove an edge selector.

Parameters
edgeis the edge to be removed
selis the selector

Definition at line 97 of file basic_blocks_graph_constructor.cpp.

References bg.

Field Documentation

◆ bb_graph

const BBGraphRef BasicBlocksGraphConstructor::bb_graph
private

Reference to graph with all the edges.

Definition at line 71 of file basic_blocks_graph_constructor.hpp.

Referenced by add_bb_edge_info(), add_operation_to_bb(), add_vertex(), connect_to_entry(), and connect_to_exit().

◆ bb_index_map

CustomUnorderedMap<unsigned int, vertex>& BasicBlocksGraphConstructor::bb_index_map
private

Map between basic block node index and vertices.

Definition at line 74 of file basic_blocks_graph_constructor.hpp.

Referenced by add_vertex(), Cget_vertex(), check_vertex(), and Clear().

◆ bg

const BBGraphsCollectionRef BasicBlocksGraphConstructor::bg
private

reference to the bulk basic blocks graph

Definition at line 68 of file basic_blocks_graph_constructor.hpp.

Referenced by add_bb_edge_info(), add_vertex(), AddEdge(), Clear(), and RemoveEdge().


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

Generated on Mon Feb 12 2024 13:03:44 for PandA-2024.02 by doxygen 1.8.13