PandA-2024.02
frontend_flow_step.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  */
45 #ifndef FRONTEND_FLOW_STEP_HPP
46 #define FRONTEND_FLOW_STEP_HPP
47 
48 #include "config_HAVE_FROM_PRAGMA_BUILT.hpp"
49 #include "config_HAVE_HOST_PROFILING_BUILT.hpp"
50 #include "config_HAVE_ILP_BUILT.hpp"
51 #include "config_HAVE_PRAGMA_BUILT.hpp"
52 #include "config_HAVE_TASTE.hpp"
53 
54 #include "custom_set.hpp" // for unordered_set
55 #include "design_flow_step.hpp" // for DesignFlowStep
56 #include "refcount.hpp" // for REF_FORWARD_DECL
57 #include <cstddef> // for size_t
58 #include <functional>
59 #include <string> // for string
60 #include <typeindex> // for hash
61 #include <utility> // for pair
62 
66 REF_FORWARD_DECL(ArchManager);
68 
71 #if HAVE_HOST_PROFILING_BUILT
72  BASIC_BLOCKS_PROFILING,
73 #endif
74  CREATE_TREE_MANAGER,
75  FIND_MAX_TRANSFORMATIONS,
76  FUNCTION_ANALYSIS,
77 #if HAVE_HOST_PROFILING_BUILT
78  HOST_PROFILING,
79 #endif
80 #if HAVE_FROM_PRAGMA_BUILT
81  PRAGMA_SUBSTITUTION,
82 #endif
83  SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP,
85  ADD_BB_ECFG_EDGES,
86  ADD_ARTIFICIAL_CALL_FLOW_EDGES,
87  ADD_OP_EXIT_FLOW_EDGES,
88  ADD_OP_LOOP_FLOW_EDGES,
89  ADD_OP_PHI_FLOW_EDGES,
90  BAMBU_FRONTEND_FLOW,
91  BASIC_BLOCKS_CFG_COMPUTATION,
92  BB_CONTROL_DEPENDENCE_COMPUTATION,
93  BB_FEEDBACK_EDGES_IDENTIFICATION,
94  BB_ORDER_COMPUTATION,
95  BB_REACHABILITY_COMPUTATION,
96  BIT_VALUE,
97  BIT_VALUE_OPT,
98  BITVALUE_RANGE,
99  BIT_VALUE_IPA,
100  BLOCK_FIX,
101  BUILD_VIRTUAL_PHI,
102  CALL_EXPR_FIX,
103  CALL_GRAPH_BUILTIN_CALL,
104  CHECK_SYSTEM_TYPE,
105  COMPLETE_BB_GRAPH,
106  COMPLETE_CALL_GRAPH,
107  COMPUTE_IMPLICIT_CALLS,
108  COMMUTATIVE_EXPR_RESTRUCTURING,
109  COND_EXPR_RESTRUCTURING,
110 #if HAVE_TASTE
111  CREATE_ADDRESS_TRANSLATION,
112 #endif
113  CSE_STEP,
114  DATAFLOW_CG_EXT,
115  DEAD_CODE_ELIMINATION,
116  DEAD_CODE_ELIMINATION_IPA,
117  DETERMINE_MEMORY_ACCESSES,
118  DOM_POST_DOM_COMPUTATION,
119  EXTRACT_GIMPLE_COND_OP,
120 #if HAVE_FROM_PRAGMA_BUILT
121  EXTRACT_OMP_ATOMIC,
122  EXTRACT_OMP_FOR,
123 #endif
124  EXTRACT_PATTERNS,
125  FIX_STRUCTS_PASSED_BY_VALUE,
126  FUNCTION_CALL_TYPE_CLEANUP,
127  FUNCTION_CALL_OPT,
128  FANOUT_OPT,
129  FIX_VDEF,
130  HDL_FUNCTION_DECL_FIX,
131  HDL_VAR_DECL_FIX,
132  HLS_DIV_CG_EXT,
133  HWCALL_INJECTION,
134  INTERFACE_INFER,
135  IR_LOWERING,
136  LOOP_COMPUTATION,
137  LOOPS_ANALYSIS_BAMBU,
138  LOOPS_COMPUTATION,
139  LUT_TRANSFORMATION,
140  MULTI_WAY_IF,
141  MULTIPLE_ENTRY_IF_REDUCTION,
142  NI_SSA_LIVENESS,
143  OP_CONTROL_DEPENDENCE_COMPUTATION,
144  OP_FEEDBACK_EDGES_IDENTIFICATION,
145  OP_ORDER_COMPUTATION,
146  OP_REACHABILITY_COMPUTATION,
147  OPERATIONS_CFG_COMPUTATION,
148  PARM2SSA,
149  PARM_DECL_TAKEN_ADDRESS,
150  PHI_OPT,
151 #if HAVE_PRAGMA_BUILT
152  PRAGMA_ANALYSIS,
153 #endif
154  PREDICATE_STATEMENTS,
155  ESSA,
156  RANGE_ANALYSIS,
157  REBUILD_INITIALIZATION,
158  REBUILD_INITIALIZATION2,
159  REMOVE_CLOBBER_GA,
160  REMOVE_ENDING_IF,
161  SCALAR_SSA_DATA_FLOW_ANALYSIS,
162 #if HAVE_ILP_BUILT
163  SDC_CODE_MOTION,
164 #endif
165  SERIALIZE_MUTUAL_EXCLUSIONS,
166  SPLIT_RETURN,
167  SHORT_CIRCUIT_TAF,
168  SIMPLE_CODE_MOTION,
169  SOFT_FLOAT_CG_EXT,
170  STRING_CST_FIX,
171  SWITCH_FIX,
172  UN_COMPARISON_LOWERING,
173  UNROLLING_DEGREE,
174 #if HAVE_ILP_BUILT
175  UPDATE_SCHEDULE,
176 #endif
177  USE_COUNTING,
178  VAR_ANALYSIS,
179  VAR_DECL_FIX,
180  VECTORIZE,
181  VERIFICATION_OPERATION,
182  VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS,
183  VIRTUAL_PHI_NODES_SPLIT
184 };
185 
186 #if NO_ABSEIL_HASH
187 
191 namespace std
192 {
193  template <>
194  struct hash<FrontendFlowStepType> : public unary_function<FrontendFlowStepType, size_t>
195  {
196  size_t operator()(FrontendFlowStepType algorithm) const
197  {
198  hash<int> hasher;
199  return hasher(static_cast<int>(algorithm));
200  }
201  };
202 } // namespace std
203 #endif
205 {
206  public:
208  using FunctionRelationship = enum {
209  ALL_FUNCTIONS,
211  CALLING_FUNCTIONS,
212  SAME_FUNCTION,
214  };
215 
216  protected:
219 
222 
224  unsigned int print_counter;
225 
231  ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const = 0;
232 
233  public:
241  FrontendFlowStep(const application_managerRef AppM, const FrontendFlowStepType frontend_flow_step_type,
242  const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters);
243 
247  ~FrontendFlowStep() override;
248 
254  void ComputeRelationships(DesignFlowStepSet& relationship,
255  const DesignFlowStep::RelationshipType relationship_type) override;
256 
265  static void
266  CreateSteps(const DesignFlowManagerConstRef design_flow_manager,
267  const CustomUnorderedSet<std::pair<FrontendFlowStepType, FunctionRelationship>>& frontend_relationships,
269 
273  virtual std::string GetKindText() const;
274 
280  static const std::string EnumToKindText(const FrontendFlowStepType frontend_flow_step_type);
281 
286  DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory() const override;
287 
292  void PrintTreeManager(const bool before) const;
296  void PrintInitialIR() const override;
297 
301  void PrintFinalIR() const override;
302 };
303 
304 #if NO_ABSEIL_HASH
305 
309 namespace std
310 {
311  template <>
313  : public unary_function<FrontendFlowStep::FunctionRelationship, size_t>
314  {
315  size_t operator()(FrontendFlowStep::FunctionRelationship relationship) const
316  {
317  hash<int> hasher;
318  return hasher(static_cast<int>(relationship));
319  }
320  };
321 } // namespace std
322 #endif
323 #endif
CONSTREF_FORWARD_DECL(application_manager)
Forward declaration.
REF_FORWARD_DECL(application_manager)
RelationshipType
The relationship type.
This structure records a sequence of operations.
The base class for design step.
Definition of hash function for EdgeDescriptor.
Definition: graph.hpp:1321
const FrontendFlowStepType frontend_flow_step_type
The type of this step.
Base class for step of design flow.
redefinition of set to manage ordered/unordered structures
enum { ALL_FUNCTIONS, CALLED_FUNCTIONS, CALLING_FUNCTIONS, SAME_FUNCTION, WHOLE_APPLICATION } FunctionRelationship
The different relationship type between function analysis.
enum FrontendFlowStepType { CREATE_TREE_MANAGER, FIND_MAX_TRANSFORMATIONS, FUNCTION_ANALYSIS, SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP, ADD_BB_ECFG_EDGES, ADD_ARTIFICIAL_CALL_FLOW_EDGES, ADD_OP_EXIT_FLOW_EDGES, ADD_OP_LOOP_FLOW_EDGES, ADD_OP_PHI_FLOW_EDGES, BAMBU_FRONTEND_FLOW, BASIC_BLOCKS_CFG_COMPUTATION, BB_CONTROL_DEPENDENCE_COMPUTATION, BB_FEEDBACK_EDGES_IDENTIFICATION, BB_ORDER_COMPUTATION, BB_REACHABILITY_COMPUTATION, BIT_VALUE, BIT_VALUE_OPT, BITVALUE_RANGE, BIT_VALUE_IPA, BLOCK_FIX, BUILD_VIRTUAL_PHI, CALL_EXPR_FIX, CALL_GRAPH_BUILTIN_CALL, CHECK_SYSTEM_TYPE, COMPLETE_BB_GRAPH, COMPLETE_CALL_GRAPH, COMPUTE_IMPLICIT_CALLS, COMMUTATIVE_EXPR_RESTRUCTURING, COND_EXPR_RESTRUCTURING, CSE_STEP, DATAFLOW_CG_EXT, DEAD_CODE_ELIMINATION, DEAD_CODE_ELIMINATION_IPA, DETERMINE_MEMORY_ACCESSES, DOM_POST_DOM_COMPUTATION, EXTRACT_GIMPLE_COND_OP, EXTRACT_PATTERNS, FIX_STRUCTS_PASSED_BY_VALUE, FUNCTION_CALL_TYPE_CLEANUP, FUNCTION_CALL_OPT, FANOUT_OPT, FIX_VDEF, HDL_FUNCTION_DECL_FIX, HDL_VAR_DECL_FIX, HLS_DIV_CG_EXT, HWCALL_INJECTION, INTERFACE_INFER, IR_LOWERING, LOOP_COMPUTATION, LOOPS_ANALYSIS_BAMBU, LOOPS_COMPUTATION, LUT_TRANSFORMATION, MULTI_WAY_IF, MULTIPLE_ENTRY_IF_REDUCTION, NI_SSA_LIVENESS, OP_CONTROL_DEPENDENCE_COMPUTATION, OP_FEEDBACK_EDGES_IDENTIFICATION, OP_ORDER_COMPUTATION, OP_REACHABILITY_COMPUTATION, OPERATIONS_CFG_COMPUTATION, PARM2SSA, PARM_DECL_TAKEN_ADDRESS, PHI_OPT, PREDICATE_STATEMENTS, ESSA, RANGE_ANALYSIS, REBUILD_INITIALIZATION, REBUILD_INITIALIZATION2, REMOVE_CLOBBER_GA, REMOVE_ENDING_IF, SCALAR_SSA_DATA_FLOW_ANALYSIS, SERIALIZE_MUTUAL_EXCLUSIONS, SPLIT_RETURN, SHORT_CIRCUIT_TAF, SIMPLE_CODE_MOTION, SOFT_FLOAT_CG_EXT, STRING_CST_FIX, SWITCH_FIX, UN_COMPARISON_LOWERING, UNROLLING_DEGREE, USE_COUNTING, VAR_ANALYSIS, VAR_DECL_FIX, VECTORIZE, VERIFICATION_OPERATION, VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS, VIRTUAL_PHI_NODES_SPLIT } FrontendFlowStepType
Template definition of refcount.
unsigned int print_counter
Print counter.
const application_managerRef AppM
The application manager.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94

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