PandA-2024.02
|
class providing methods to manage an operations graph. More...
#include <operations_graph_constructor.hpp>
Public Member Functions | |
vertex | getIndex (const std::string &source) |
Return the vertex index given the id of the vertex node. More... | |
vertex | CgetIndex (const std::string &source) const |
Return the vertex index given the id of the vertex node. More... | |
EdgeDescriptor | AddEdge (const vertex source, const vertex dest, int selector) |
add an edge between vertex source and vertex dest More... | |
void | RemoveEdge (const vertex source, const vertex dest, int selector) |
remove a selector between two vertices More... | |
void | RemoveSelector (const EdgeDescriptor edge, const int selector) |
set the selector of an edge between vertex source and vertex dest More... | |
void | CompressEdges () |
Remove all redundant edges. More... | |
void | Clear () |
Remove all vertices and edges. More... | |
void | add_edge_info (const vertex src, const vertex tgt, const int selector, unsigned int NodeID) |
Add edge info to the graph. More... | |
void | AddOperation (const tree_managerRef TM, const std::string &src, const std::string &oper, unsigned int bb_index, const unsigned int node_id) |
Add the operation associated with a vertex. More... | |
void | add_type (const std::string &src, unsigned int type) |
Add the type associated with a vertex. More... | |
operations_graph_constructor (OpGraphsCollectionRef _og) | |
Constructor. More... | |
~operations_graph_constructor () | |
Destructor. More... | |
void | AddVariable (const vertex op_vertex, const unsigned int variable, const FunctionBehavior_VariableType variable_type, const FunctionBehavior_VariableAccessType access_type) |
Adds an access to a variable to an operation vertex. More... | |
void | AddSourceCodeVariable (const vertex &Ver, unsigned int Vargc) |
Adds a (ssa-)variable to the set of variables referred by the operation vertex. More... | |
void | add_parameter (const vertex &Ver, unsigned int Vargc) |
Adds a parameter to the vertex. More... | |
void | add_called_function (const std::string &source, unsigned int called_function) |
Adds a call to the vertex. More... | |
Private Attributes | |
const OpGraphsCollectionRef | og |
reference to the bulk operations graph More... | |
const OpGraphRef | op_graph |
The graph with all the edges. More... | |
std::map< std::string, vertex > | index_map |
Mapping between id to index. More... | |
class providing methods to manage an operations graph.
Definition at line 70 of file operations_graph_constructor.hpp.
|
explicit |
Constructor.
Header include.
og | is the collection of operations graph |
Definition at line 60 of file operations_graph_constructor.cpp.
References ~operations_graph_constructor().
|
default |
Destructor.
Referenced by operations_graph_constructor().
void operations_graph_constructor::add_called_function | ( | const std::string & | source, |
unsigned int | called_function | ||
) |
Adds a call to the vertex.
source | is the vertex name at which the type is associated. |
called | is the called function |
Definition at line 181 of file operations_graph_constructor.cpp.
References getIndex(), and op_graph.
void operations_graph_constructor::add_edge_info | ( | const vertex | src, |
const vertex | tgt, | ||
const int | selector, | ||
unsigned int | NodeID | ||
) |
Add edge info to the graph.
src | is an unique id representing the source node. |
tgt | is an unique id representing the target node. |
ef | is the family of the edge. See cdfg_edge_info class for details. |
NodeID | is the NodeID of the variable carrying the data through the edge. |
Definition at line 112 of file operations_graph_constructor.cpp.
References GET_NAME, og, and THROW_ASSERT.
void operations_graph_constructor::add_parameter | ( | const vertex & | Ver, |
unsigned int | Vargc | ||
) |
Adds a parameter to the vertex.
Ver | is the operation vertex |
Var | is the node id associated to the variable referred by the operation vertex |
Definition at line 176 of file operations_graph_constructor.cpp.
References op_graph.
void operations_graph_constructor::add_type | ( | const std::string & | src, |
unsigned int | type | ||
) |
Add the type associated with a vertex.
source | is the vertex name at which the type is associated. |
type | is an unsigned int representing the type associated with source. |
Definition at line 154 of file operations_graph_constructor.cpp.
References GET_NODE_INFO, getIndex(), og, THROW_ASSERT, and TYPE_GENERIC.
EdgeDescriptor operations_graph_constructor::AddEdge | ( | const vertex | source, |
const vertex | dest, | ||
int | selector | ||
) |
add an edge between vertex source and vertex dest
source | is the source vertex |
dest | is the dest vertexes |
selector | is the type of the edge |
Definition at line 92 of file operations_graph_constructor.cpp.
References og.
void operations_graph_constructor::AddOperation | ( | const tree_managerRef | TM, |
const std::string & | src, | ||
const std::string & | oper, | ||
unsigned int | bb_index, | ||
const unsigned int | node_id | ||
) |
Add the operation associated with a vertex.
TM | is the tree manager |
source | is the vertex name at which the operation is associated. |
oper | is a string representing the operation associated with source. |
bb_index | is the basic block index associated with the operation. |
node_id | is the index of the tree node |
Definition at line 122 of file operations_graph_constructor.cpp.
References tree_manager::CGetTreeReindex(), ENTRY, ENTRY_ID, EXIT, EXIT_ID, GET_NODE_INFO, tree_manager::get_tree_node_const(), getIndex(), og, op_graph, STR, and THROW_ASSERT.
void operations_graph_constructor::AddSourceCodeVariable | ( | const vertex & | Ver, |
unsigned int | Vargc | ||
) |
Adds a (ssa-)variable to the set of variables referred by the operation vertex.
Ver | is the operation vertex |
Var | is the node id associated to the variable referred by the operation vertex |
Definition at line 186 of file operations_graph_constructor.cpp.
References op_graph.
void operations_graph_constructor::AddVariable | ( | const vertex | op_vertex, |
const unsigned int | variable, | ||
const FunctionBehavior_VariableType | variable_type, | ||
const FunctionBehavior_VariableAccessType | access_type | ||
) |
Adds an access to a variable to an operation vertex.
op_vertex | is the operation to be considered |
variable | is the index of the variable |
type | is the type of the variable |
access_type | is the type of the access |
Definition at line 169 of file operations_graph_constructor.cpp.
References op_graph.
vertex operations_graph_constructor::CgetIndex | ( | const std::string & | source | ) | const |
Return the vertex index given the id of the vertex node.
source | is the name of the vertex. |
Definition at line 86 of file operations_graph_constructor.cpp.
References index_map, and THROW_ASSERT.
void operations_graph_constructor::Clear | ( | ) |
Remove all vertices and edges.
Definition at line 67 of file operations_graph_constructor.cpp.
void operations_graph_constructor::CompressEdges | ( | ) |
Remove all redundant edges.
Definition at line 107 of file operations_graph_constructor.cpp.
References og.
vertex operations_graph_constructor::getIndex | ( | const std::string & | source | ) |
Return the vertex index given the id of the vertex node.
source | is the name of the vertex. |
Definition at line 73 of file operations_graph_constructor.cpp.
Referenced by add_called_function(), add_type(), and AddOperation().
void operations_graph_constructor::RemoveEdge | ( | const vertex | source, |
const vertex | dest, | ||
int | selector | ||
) |
remove a selector between two vertices
source | is the source vertex |
dest | is the dest vertexes |
selector | is the type of the edge |
Definition at line 97 of file operations_graph_constructor.cpp.
References og.
void operations_graph_constructor::RemoveSelector | ( | const EdgeDescriptor | edge, |
const int | selector | ||
) |
set the selector of an edge between vertex source and vertex dest
edge | is the edge descriptor from which the selector has to be removed |
selector | is the selector to be removed |
Definition at line 102 of file operations_graph_constructor.cpp.
References og.
Mapping between id to index.
Definition at line 80 of file operations_graph_constructor.hpp.
Referenced by CgetIndex(), Clear(), and getIndex().
|
private |
reference to the bulk operations graph
Definition at line 74 of file operations_graph_constructor.hpp.
Referenced by add_edge_info(), add_type(), AddEdge(), AddOperation(), Clear(), CompressEdges(), getIndex(), RemoveEdge(), and RemoveSelector().
|
private |
The graph with all the edges.
Definition at line 77 of file operations_graph_constructor.hpp.
Referenced by add_called_function(), add_parameter(), AddOperation(), AddSourceCodeVariable(), and AddVariable().