PandA-2024.02
design_flow_graph.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 DESIGN_FLOW_GRAPH_HPP
45 #define DESIGN_FLOW_GRAPH_HPP
46 
47 #include "edge_info.hpp" // for EdgeInfo, EdgeIn...
48 #include "graph.hpp" // for vertex, EdgeDesc...
49 #include "graph_info.hpp" // for GraphInfo
50 #include "node_info.hpp" // for NodeInfo
51 #include "refcount.hpp" // for refcount, Refcou...
52 #include <cstddef> // for size_t
53 #include <iosfwd> // for ostream
54 #include <string> // for string
55 
56 #include "custom_map.hpp" // for unordered_map
57 
61 enum class DesignFlowStep_Status;
62 class SdfGraph;
63 
65 {
66  public:
69 
72 
76  DesignFlowStepInfo(const DesignFlowStepRef _design_flow_step, const bool unnecessary);
77 };
80 
82 {
83  public:
88 
92  ~DesignFlowDependenceInfo() override;
93 };
96 
98 {
99  public:
102 
105 };
108 
110 {
111  protected:
114 
115  public:
120 
124  ~DesignFlowGraphsCollection() override;
125 
130  vertex GetDesignFlowStep(const std::string& signature) const;
131 
137  inline EdgeDescriptor AddDesignFlowDependence(const vertex source, const vertex target, const int selector)
138  {
139  if(ExistsEdge(source, target))
140  {
141  return AddSelector(source, target, selector);
142  }
143  else
144  {
145  return InternalAddEdge(source, target, selector, EdgeInfoRef(new DesignFlowDependenceInfo()));
146  }
147  }
148 
154  vertex AddDesignFlowStep(const DesignFlowStepRef design_flow_step, const bool unnecessary);
155 };
158 
159 class DesignFlowGraph : public graph
160 {
161  public:
163  static const int DEPENDENCE_SELECTOR;
164 
166  static const int PRECEDENCE_SELECTOR;
167 
169  static const int AUX_SELECTOR;
170 
173 
177  enum Type
178  {
179  ALL,
180  };
181 
187  DesignFlowGraph(const DesignFlowGraphsCollectionRef design_flow_graphs_collection, const int _selector);
188 
195  DesignFlowGraph(const DesignFlowGraphsCollectionRef design_flow_graphs_collection, const int _selector,
196  const CustomUnorderedSet<vertex>& vertices);
197 
201  ~DesignFlowGraph() override;
202 
207  vertex GetDesignFlowStep(const std::string& signature) const;
208 
214  {
215  return RefcountCast<DesignFlowStepInfo>(graph::GetNodeInfo(step));
216  }
217 
224  {
225  return RefcountCast<const DesignFlowStepInfo>(graph::CGetNodeInfo(step));
226  }
227 
233  {
234  return RefcountCast<DesignFlowGraphInfo>(graph::GetGraphInfo());
235  }
236 
242  {
243  return RefcountCast<const DesignFlowGraphInfo>(graph::CGetGraphInfo());
244  }
245 
251  void WriteDot(const std::string& file_name, const int detail_level = 0) const;
252 
253 #ifndef NDEBUG
254 
261  void WriteDot(const std::string& file_name,
262  const CustomMap<size_t, CustomMap<vertex, DesignFlowStep_Status>>& vertex_history,
263  const CustomMap<size_t, CustomUnorderedMapStable<EdgeDescriptor, int>>& edge_history,
264  const CustomMap<vertex, std::string>& vertex_names, const size_t writing_step_counter) const;
265 #endif
266 };
269 
274 {
275  private:
278 
281 
282  public:
290  const DesignFlowGraph* design_flow_graph,
293  const int detail_level = 0);
294 
298  ~DesignFlowStepWriter() override;
299 
305  void operator()(std::ostream& out, const vertex& v) const override;
306 };
307 
312 {
313  private:
316 
319 
320  public:
329  const DesignFlowGraph* design_flow_graph,
333  const int detail_level = 0);
334 
340  void operator()(std::ostream& out, const EdgeDescriptor& edge) const override;
341 };
342 
343 #endif
Graph with all the edges.
Base class storing user data information to the whole graph.
Definition: graph_info.hpp:60
string target
Definition: lenet_tvm.py:16
DesignFlowGraphInfoRef GetDesignFlowGraphInfo()
Return the info associated with the graph.
Class specification of the graph structures.
The base class for design step.
static const int DEPENDENCE_SELECTOR
The dependence selector.
CustomOrderedMap< T, U > CustomMap
Definition: custom_map.hpp:167
DesignFlowStep_Status status
Status of a step.
static const int DEPENDENCE_FEEDBACK_SELECTOR
The dependence feedback selector.
NodeInfoRef GetNodeInfo(typename boost::graph_traits< graphs_collection >::vertex_descriptor node)
FIXME: this method should become protected and called by equivalent method in subclasses Get the node...
Definition: graph.hpp:1039
redefinition of map to manage ordered/unordered structures
DesignFlowStepInfo(const DesignFlowStepRef _design_flow_step, const bool unnecessary)
Constructor.
vertex entry
The entry vertex of the graph.
const CustomMap< vertex, DesignFlowStep_Status > & vertex_history
Actors which have to be printed (empty means all)
const CustomMap< vertex, std::string > & actor_names
The name of the actors (when they cannot be taken from graph.
CONSTREF_FORWARD_DECL(Parameter)
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
Definition: custom_map.hpp:148
Type
The type of view of design flow graph.
Functor used to write the content of a vertex to dotty file.
Definition: graph.hpp:1406
const NodeInfoConstRef CGetNodeInfo(typename boost::graph_traits< graphs_collection >::vertex_descriptor node) const
Get the node property.
Definition: graph.hpp:781
Base class description of data information associated with each node of a graph.
refcount< EdgeInfo > EdgeInfoRef
RefCount type definition of the edge_info class structure.
Definition: edge_info.hpp:67
REF_FORWARD_DECL(DesignFlowGraphsCollection)
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
const DesignFlowGraphInfoConstRef CGetDesignFlowGraphInfo() const
Return the info associated with the graph.
static const int PRECEDENCE_SELECTOR
The condition selector.
General class used to describe a graph in PandA.
Definition: graph.hpp:771
DesignFlowStepInfoRef GetDesignFlowStepInfo(const vertex step)
DesignFlowStep_Status
The status of a step.
vertex exit
The exit vertex of the graph.
Base class storing user data information.
Definition: edge_info.hpp:55
Base class for graph property.
GraphInfoRef GetGraphInfo()
FIXME: this method should become protected and called by equivalent method in subclasses Get the grap...
Definition: graph.hpp:1051
Template definition of refcount.
Base class description of data information associated with each edge of a graph.
bulk graph.
Definition: graph.hpp:287
Functor used to write the content of the edges to a dotty file.
Definition: graph.hpp:1441
Functor used to write the content of the design flow edge to dotty file.
const GraphInfoConstRef CGetGraphInfo() const
FIXME: this method should become protected and called by equivalent method in subclasses Get the grap...
Definition: graph.hpp:1062
CustomUnorderedMap< std::string, vertex > signature_to_vertex
Map a signature of a step to the corresponding vertex.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
const DesignFlowStepRef design_flow_step
The step corresponding to a vertex.
EdgeDescriptor AddDesignFlowDependence(const vertex source, const vertex target, const int selector)
Add a design flow dependence.
Functor used to write the content of the design flow step to dotty file.
absl::node_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapStable
Definition: custom_map.hpp:152
const CustomUnorderedMapStable< EdgeDescriptor, int > & edge_history
Edges which have to be printed (empty means all)
static const int AUX_SELECTOR
The auxiliary selector.
const DesignFlowStepInfoConstRef CGetDesignFlowStepInfo(const vertex step) const
Return the info associated with a step.
const CustomMap< vertex, DesignFlowStep_Status > & vertex_history
Actors which have to be printed (empty means all)
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.
Definition: graph.hpp:1316

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