PandA-2024.02
|
class providing methods to manage a basic blocks graph. More...
#include <basic_blocks_graph_constructor.hpp>
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... | |
class providing methods to manage a basic blocks graph.
Definition at line 64 of file basic_blocks_graph_constructor.hpp.
|
explicit |
Constructor.
_og | is the reference to the bulk operations graph. |
Definition at line 55 of file basic_blocks_graph_constructor.cpp.
References ~BasicBlocksGraphConstructor().
|
default |
Destructor.
Referenced by BasicBlocksGraphConstructor().
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
source | is the source vertex |
target | is the target vertexes |
type | is the type of the label |
label | is 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.
void BasicBlocksGraphConstructor::add_operation_to_bb | ( | vertex | op, |
unsigned int | index | ||
) |
Add an operation to its basic block.
op | is the name of the operation vertex |
index | is the index of the basic blocks |
Definition at line 136 of file basic_blocks_graph_constructor.cpp.
References bb_graph, and Cget_vertex().
vertex BasicBlocksGraphConstructor::add_vertex | ( | const blocRef | info | ) |
Add a new vertex to the basic blocks graphs.
info | is the bloc associated with basic block node |
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.
EdgeDescriptor BasicBlocksGraphConstructor::AddEdge | ( | const vertex | source, |
const vertex | target, | ||
const int | selector | ||
) |
Add an edge selector.
source | is the source vertex |
target | is the target vertexes |
selector | is 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().
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
block_index | is 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().
bool BasicBlocksGraphConstructor::check_vertex | ( | unsigned int | block_index | ) | const |
return true in case the vertex has been already created
block_index | is the basic block identifier |
Definition at line 124 of file basic_blocks_graph_constructor.cpp.
References bb_index_map.
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.
EdgeDescriptor BasicBlocksGraphConstructor::connect_to_entry | ( | const vertex | target | ) |
add edge between entry and target
target | is 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.
EdgeDescriptor BasicBlocksGraphConstructor::connect_to_exit | ( | const vertex | source | ) |
add edge between source and exit
source | is the vertex to connect with exit |
Definition at line 114 of file basic_blocks_graph_constructor.cpp.
References AddEdge(), bb_graph, and CFG_SELECTOR.
void BasicBlocksGraphConstructor::RemoveEdge | ( | const vertex | source, |
const vertex | target, | ||
const int | selector | ||
) |
Remove an edge selector.
source | is the source vertex |
target | is the target vertexes |
selector | is the type of the edge |
Definition at line 92 of file basic_blocks_graph_constructor.cpp.
References bg.
void BasicBlocksGraphConstructor::RemoveEdge | ( | const EdgeDescriptor | edge, |
const int | selector | ||
) |
Remove an edge selector.
edge | is the edge to be removed |
sel | is the selector |
Definition at line 97 of file basic_blocks_graph_constructor.cpp.
References bg.
|
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().
|
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().
|
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().