PandA-2024.02
operations_graph_constructor.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
44 #ifndef OPERATIONS_GRAPH_CONSTRUCTOR_HPP
45 #define OPERATIONS_GRAPH_CONSTRUCTOR_HPP
46 
47 #include "custom_map.hpp" // for map
48 #include "graph.hpp"
49 #include "refcount.hpp"
50 #include "strong_typedef.hpp"
51 
52 #include <string> // for string
53 
60 STRONG_TYPEDEF_FORWARD_DECL(unsigned int, MemoryAddress);
66 
71 {
72  private:
75 
78 
80  std::map<std::string, vertex> index_map;
81 
82  public:
88  vertex getIndex(const std::string& source);
89 
95  vertex CgetIndex(const std::string& source) const;
96 
103  EdgeDescriptor AddEdge(const vertex source, const vertex dest, int selector);
104 
111  void RemoveEdge(const vertex source, const vertex dest, int selector);
112 
118  void RemoveSelector(const EdgeDescriptor edge, const int selector);
119 
123  void CompressEdges();
124 
128  void Clear();
129 
137  void add_edge_info(const vertex src, const vertex tgt, const int selector, unsigned int NodeID);
138 
147  void AddOperation(const tree_managerRef TM, const std::string& src, const std::string& oper, unsigned int bb_index,
148  const unsigned int node_id);
149 
155  void add_type(const std::string& src, unsigned int type);
156 
162 
167 
175  void AddVariable(const vertex op_vertex, const unsigned int variable,
176  const FunctionBehavior_VariableType variable_type,
177  const FunctionBehavior_VariableAccessType access_type);
178 
184  void AddSourceCodeVariable(const vertex& Ver, unsigned int Vargc);
185 
191  void add_parameter(const vertex& Ver, unsigned int Vargc);
192 
198  void add_called_function(const std::string& source, unsigned int called_function);
199 };
200 
201 #endif
const OpGraphRef op_graph
The graph with all the edges.
const OpGraphsCollectionRef og
reference to the bulk operations graph
void add_called_function(const std::string &source, unsigned int called_function)
Adds a call to the vertex.
class providing methods to manage an operations graph.
void CompressEdges()
Remove all redundant edges.
This class manages the tree structures extracted from the raw file.
Class specification of the graph structures.
void add_edge_info(const vertex src, const vertex tgt, const int selector, unsigned int NodeID)
Add edge info to the graph.
FunctionBehavior_VariableType
The possible type of a variable.
void Clear()
Remove all vertices and edges.
void add_type(const std::string &src, unsigned int type)
Add the type associated with a vertex.
redefinition of map to manage ordered/unordered structures
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.
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.
This class macros for the definition of strong typedef.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
FunctionBehavior_VariableAccessType
The access type to a variable.
void RemoveEdge(const vertex source, const vertex dest, int selector)
remove a selector between two vertices
void add_parameter(const vertex &Ver, unsigned int Vargc)
Adds a parameter to the vertex.
operations_graph_constructor(OpGraphsCollectionRef _og)
Constructor.
vertex CgetIndex(const std::string &source) const
Return the vertex index given the id of the vertex node.
~operations_graph_constructor()
Destructor.
Template definition of refcount.
REF_FORWARD_DECL(operations_graph_constructor)
void AddSourceCodeVariable(const vertex &Ver, unsigned int Vargc)
Adds a (ssa-)variable to the set of variables referred by the operation vertex.
STRONG_TYPEDEF_FORWARD_DECL(unsigned int, MemoryAddress)
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
EdgeDescriptor AddEdge(const vertex source, const vertex dest, int selector)
add an edge between vertex source and vertex dest
vertex getIndex(const std::string &source)
Return the vertex index given the id of the vertex node.
Class used to describe a particular graph with operations as nodes.
Definition: op_graph.hpp:783
void RemoveSelector(const EdgeDescriptor edge, const int selector)
set the selector of an edge between vertex source and vertex dest
std::map< std::string, vertex > index_map
Mapping between id to index.
This structure defines graphs where nodes are operations.
Definition: op_graph.hpp:715
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.
Definition: graph.hpp:1316

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13