PandA-2024.02
design_flow_manager.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  */
41 #ifndef DESIGN_FLOW_MANAGER_HPP
42 #define DESIGN_FLOW_MANAGER_HPP
43 
44 #include "custom_map.hpp"
45 #include "graph.hpp" // for vertex, Paramete...
46 #include "refcount.hpp" // for REF_FORWARD_DECL
47 #include <cstddef> // for size_t
48 #include <functional> // for binary_function
49 #include <set> // for set
50 #include <string> // for string
51 
52 class DesignFlowStepSet;
57 enum class DesignFlowStep_Status;
61 
66 class DesignFlowStepNecessitySorter : std::binary_function<vertex, vertex, bool>
67 {
68  private:
71 
72  public:
77  explicit DesignFlowStepNecessitySorter(const DesignFlowGraphConstRef _design_flow_graph);
78 
85  bool operator()(const vertex x, const vertex y) const;
86 };
87 
88 class DesignFlowManager final
89 {
90  private:
93  static size_t step_counter;
94 
97 
100 
103 
106  std::set<vertex, DesignFlowStepNecessitySorter> possibly_ready;
107 
110 
111 #ifndef NDEBUG
118 
124 
128 
131 
134 
137 
140 #endif
141 
144 
146  const int output_level;
147 
150 
157  void RecursivelyAddSteps(const DesignFlowStepSet& steps, const bool unnecessary);
158 
164  void DeExecute(const vertex starting_vertex, bool force_execution);
165 
169  void Consolidate();
170 
171 #ifndef NDEBUG
172  void WriteLoopDot() const;
173 #endif
174 
175  public:
179  explicit DesignFlowManager(const ParameterConstRef parameters);
180 
184  virtual ~DesignFlowManager();
185 
189  void virtual Exec() final;
190 
195  void AddStep(const DesignFlowStepRef step);
196 
201  void AddSteps(const DesignFlowStepSet& steps);
202 
207  const DesignFlowGraphConstRef CGetDesignFlowGraph() const;
208 
213  vertex GetDesignFlowStep(const std::string& signature) const;
214 
219  DesignFlowStep_Status GetStatus(const std::string& signature) const;
220 
226  DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory(const std::string& prefix) const;
227 
232  void RegisterFactory(const DesignFlowStepFactoryConstRef factory);
233 
239  const DesignFlowStepRef CreateFlowStep(const std::string& signature) const;
240 };
241 
243 #endif
The key comparison functor for design flow step; it puts necessary steps before unnecessary ones; in ...
const DesignFlowGraphRef design_flow_graph
The graph of steps composing the design flow.
DesignFlowStepNecessitySorter(const DesignFlowGraphConstRef _design_flow_graph)
Constructor.
const DesignFlowGraphConstRef design_flow_graph
The design flow graph.
CustomMap< size_t, CustomUnorderedMapStable< EdgeDescriptor, int > > edge_history
This structure stores "history of design flow graph manager - edges" First key is the iteration Secon...
std::set< vertex, DesignFlowStepNecessitySorter > possibly_ready
The set of potentially ready steps; when a step is added to set is ready to be executed, but it can become unready because of new added vertices.
static size_t step_counter
NOTE: static should be removed when all the design flow managers will be merged Counter of current it...
Class specification of the graph structures.
The base class for design step.
CustomOrderedMap< T, U > CustomMap
Definition: custom_map.hpp:167
CONSTREF_FORWARD_DECL(DesignFlowGraph)
Definition of hash function for EdgeDescriptor.
Definition: graph.hpp:1321
CustomUnorderedMap< std::string, DesignFlowStepFactoryConstRef > design_flow_step_factories
The registered factories.
redefinition of map to manage ordered/unordered structures
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
Definition: custom_map.hpp:148
const DesignFlowGraphConstRef feedback_design_flow_graph
The design flow graph with feedback edges.
CustomMap< vertex, std::string > step_names
The name of each vertex (we have to store since it is possible that it cannot be recomputed at the en...
int debug_level
The debug level.
CustomMap< vertex, size_t > unchanged_executions
The number of times each step is executed with unchanged exit.
const ParameterConstRef parameters
The set of input parameters.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
DesignFlowStep_Status
The status of a step.
const DesignFlowGraphsCollectionRef design_flow_graphs_collection
The bulk graph of steps composing the design flow.
Template definition of refcount.
const int output_level
The output level.
CustomMap< vertex, long > accumulated_execution_time
The accumulated times of each step.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
CustomMap< vertex, size_t > skipped_executions
The number of times the execution of a step is skipped.
REF_FORWARD_DECL(DesignFlowGraph)
x
Return the smallest n such that 2^n >= _x.
bool operator()(const vertex x, const vertex y) const
Compare position of two vertices.
CustomMap< vertex, size_t > success_executions
The number of times each step is executed with success.

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