PandA-2024.02
basic_blocks_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 BASIC_BLOCKS_GRAPH_CONSTRUCTOR_HPP
45 #define BASIC_BLOCKS_GRAPH_CONSTRUCTOR_HPP
46 
47 #include "custom_map.hpp"
48 #include "graph.hpp"
49 #include "refcount.hpp"
50 
60 
65 {
66  private:
69 
72 
75 
76  public:
82  vertex add_vertex(const blocRef info);
83 
90  EdgeDescriptor AddEdge(const vertex source, const vertex target, const int selector);
91 
98  void RemoveEdge(const vertex source, const vertex target, const int selector);
99 
105  void RemoveEdge(const EdgeDescriptor edge, const int selector);
106 
110  void Clear();
111 
119  void add_bb_edge_info(const vertex source, const vertex target, int type, const unsigned int label);
120 
125  EdgeDescriptor connect_to_exit(const vertex source);
126 
132 
137  bool check_vertex(unsigned int block_index) const;
138 
144  vertex Cget_vertex(unsigned int block_index) const;
145 
151  void add_operation_to_bb(vertex op, unsigned int index);
152 
158 
163 };
164 
165 #endif
This struct specifies the field bloc (basic block).
bool check_vertex(unsigned int block_index) const
return true in case the vertex has been already created
string target
Definition: lenet_tvm.py:16
void add_operation_to_bb(vertex op, unsigned int index)
Add an operation to its basic block.
Class specification of the graph structures.
EdgeDescriptor AddEdge(const vertex source, const vertex target, const int selector)
Add an edge selector.
redefinition of map to manage ordered/unordered structures
BasicBlocksGraphConstructor(BBGraphsCollectionRef _bg)
Constructor.
CustomUnorderedMap< unsigned int, vertex > & bb_index_map
Map between basic block node index and vertices.
REF_FORWARD_DECL(BasicBlocksGraphConstructor)
~BasicBlocksGraphConstructor()
Destructor.
const BBGraphRef bb_graph
Reference to graph with all the edges.
vertex Cget_vertex(unsigned int block_index) const
return a vertex of the graph given the functionID.
Class used to describe a particular graph with basic blocks as nodes.
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
Definition: custom_map.hpp:148
void Clear()
Remove all vertices and edges.
void RemoveEdge(const vertex source, const vertex target, const int selector)
Remove an edge selector.
#define index(x, y)
Definition: Keccak.c:74
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
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
vertex add_vertex(const blocRef info)
Add a new vertex to the basic blocks graphs.
EdgeDescriptor connect_to_entry(const vertex target)
add edge between entry and target
class providing methods to manage a basic blocks graph.
Template definition of refcount.
const BBGraphsCollectionRef bg
reference to the bulk basic blocks graph
EdgeDescriptor connect_to_exit(const vertex source)
add edge between source and exit
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
This structure defines graphs where nodes are basic_blocks.
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