PandA-2024.02
bambu_frontend_flow.cpp
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  */
39 #include "bambu_frontend_flow.hpp"
40 
41 #include "config_HAVE_HOST_PROFILING_BUILT.hpp" // for HAVE_HOST_PROFILING_...
42 #include "config_HAVE_ILP_BUILT.hpp" // for HAVE_ILP_BUILT
43 #include "config_HAVE_PRAGMA_BUILT.hpp" // for HAVE_PRAGMA_BUILT
44 #include "config_HAVE_TASTE.hpp" // for HAVE_TASTE
45 
46 #include "Parameter.hpp" // for Parameter, OPT_parse...
47 #include "application_manager.hpp" // for application_manager
48 #include "call_graph.hpp" // for CallGraph
49 #include "call_graph_manager.hpp" // for CallGraphConstRef
50 #include "dbgPrintHelper.hpp" // for DEBUG_LEVEL_PEDANTIC
51 #include "exceptions.hpp" // for THROW_UNREACHABLE
52 #include "frontend_flow_step_factory.hpp" // for application_managerRef
53 #include "function_frontend_flow_step.hpp" // for DesignFlowManagerCon...
54 #include "hash_helper.hpp" // for hash
55 #include "hls_step.hpp" // for HLSFlowStep_Type
56 #include <iosfwd> // for ofstream
57 #include <string> // for string, operator+
58 #if HAVE_HOST_PROFILING_BUILT
59 #include "host_profiling.hpp" // for HostProfiling_Method
60 #endif
61 #include "language_writer.hpp" // for HDLWriter_Language
62 #include "string_manipulation.hpp" // for GET_CLASS
63 #include "tree_manager.hpp" // for tree_managerConstRef
64 
66 #include "custom_set.hpp"
67 
69  const DesignFlowManagerConstRef _design_flow_manager,
70  const ParameterConstRef _parameters)
71  : ApplicationFrontendFlowStep(_AppM, BAMBU_FRONTEND_FLOW, _design_flow_manager, _parameters)
72 {
73  debug_level = parameters->get_class_debug_level(GET_CLASS(*this));
74 }
75 
77 
80 {
82  switch(relationship_type)
83  {
85  {
86  relationships.insert(std::make_pair(ADD_ARTIFICIAL_CALL_FLOW_EDGES, WHOLE_APPLICATION));
87  relationships.insert(std::make_pair(ADD_OP_EXIT_FLOW_EDGES, WHOLE_APPLICATION));
88  // relationships.insert(std::make_pair(ADD_OP_LOOP_FLOW_EDGES, WHOLE_APPLICATION));
89  relationships.insert(std::make_pair(VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS, WHOLE_APPLICATION));
90  relationships.insert(std::make_pair(OP_CONTROL_DEPENDENCE_COMPUTATION, WHOLE_APPLICATION));
91  relationships.insert(std::make_pair(SCALAR_SSA_DATA_FLOW_ANALYSIS, WHOLE_APPLICATION));
92 
93  if(!parameters->getOption<int>(OPT_gcc_openmp_simd))
94  {
95  relationships.insert(std::make_pair(BITVALUE_RANGE, ALL_FUNCTIONS));
96  }
97  relationships.insert(std::make_pair(BLOCK_FIX, WHOLE_APPLICATION));
98  relationships.insert(std::make_pair(CALL_EXPR_FIX, WHOLE_APPLICATION));
99  relationships.insert(std::make_pair(COMPLETE_CALL_GRAPH, WHOLE_APPLICATION));
100  relationships.insert(std::make_pair(CSE_STEP, WHOLE_APPLICATION));
101  relationships.insert(std::make_pair(CHECK_SYSTEM_TYPE, WHOLE_APPLICATION));
102  relationships.insert(std::make_pair(DEAD_CODE_ELIMINATION, WHOLE_APPLICATION));
103  relationships.insert(std::make_pair(DEAD_CODE_ELIMINATION_IPA, WHOLE_APPLICATION));
104  relationships.insert(std::make_pair(DETERMINE_MEMORY_ACCESSES, WHOLE_APPLICATION));
105  relationships.insert(std::make_pair(EXTRACT_PATTERNS, WHOLE_APPLICATION));
106  relationships.insert(std::make_pair(FANOUT_OPT, WHOLE_APPLICATION));
107  relationships.insert(std::make_pair(FIX_STRUCTS_PASSED_BY_VALUE, WHOLE_APPLICATION));
108  relationships.insert(std::make_pair(FIX_VDEF, WHOLE_APPLICATION));
109  if(!parameters->IsParameter("function-opt") || parameters->GetParameter<bool>("function-opt"))
110  {
111  relationships.insert(std::make_pair(FUNCTION_CALL_OPT, WHOLE_APPLICATION));
112  }
113  relationships.insert(std::make_pair(FUNCTION_CALL_TYPE_CLEANUP, WHOLE_APPLICATION));
114  if(static_cast<HDLWriter_Language>(parameters->getOption<unsigned int>(OPT_writer_language)) ==
116  {
117  relationships.insert(std::make_pair(HDL_FUNCTION_DECL_FIX, WHOLE_APPLICATION));
118  }
119  if(parameters->isOption(OPT_hls_div) && parameters->getOption<std::string>(OPT_hls_div) != "none")
120  {
121  relationships.insert(std::make_pair(HLS_DIV_CG_EXT, WHOLE_APPLICATION));
122  }
123  relationships.insert(std::make_pair(INTERFACE_INFER, WHOLE_APPLICATION));
124  relationships.insert(std::make_pair(IR_LOWERING, ALL_FUNCTIONS));
125  relationships.insert(std::make_pair(LUT_TRANSFORMATION, WHOLE_APPLICATION));
126  relationships.insert(std::make_pair(MULTIPLE_ENTRY_IF_REDUCTION, WHOLE_APPLICATION));
127  relationships.insert(std::make_pair(NI_SSA_LIVENESS, WHOLE_APPLICATION));
128  relationships.insert(std::make_pair(PHI_OPT, WHOLE_APPLICATION));
129  relationships.insert(std::make_pair(PARM2SSA, WHOLE_APPLICATION));
130  relationships.insert(std::make_pair(PREDICATE_STATEMENTS, WHOLE_APPLICATION));
131  relationships.insert(std::make_pair(REBUILD_INITIALIZATION, WHOLE_APPLICATION));
132  relationships.insert(std::make_pair(REBUILD_INITIALIZATION2, WHOLE_APPLICATION));
133  relationships.insert(std::make_pair(REMOVE_CLOBBER_GA, WHOLE_APPLICATION));
134  relationships.insert(std::make_pair(SHORT_CIRCUIT_TAF, WHOLE_APPLICATION));
135  relationships.insert(std::make_pair(SIMPLE_CODE_MOTION, WHOLE_APPLICATION));
136  if(parameters->isOption(OPT_soft_float) && parameters->getOption<bool>(OPT_soft_float))
137  {
138  relationships.insert(std::make_pair(SOFT_FLOAT_CG_EXT, WHOLE_APPLICATION));
139  }
140  relationships.insert(std::make_pair(SPLIT_RETURN, WHOLE_APPLICATION));
141  relationships.insert(std::make_pair(STRING_CST_FIX, WHOLE_APPLICATION));
142  relationships.insert(std::make_pair(SWITCH_FIX, WHOLE_APPLICATION));
143  relationships.insert(std::make_pair(LOOPS_ANALYSIS_BAMBU, WHOLE_APPLICATION));
144 
145  relationships.insert(std::make_pair(MULTI_WAY_IF, WHOLE_APPLICATION));
146 #if HAVE_ILP_BUILT
147  if(parameters->getOption<HLSFlowStep_Type>(OPT_scheduling_algorithm) == HLSFlowStep_Type::SDC_SCHEDULING)
148  {
149  relationships.insert(std::make_pair(ADD_OP_PHI_FLOW_EDGES, WHOLE_APPLICATION));
150  relationships.insert(std::make_pair(COMMUTATIVE_EXPR_RESTRUCTURING, WHOLE_APPLICATION));
151  relationships.insert(std::make_pair(COND_EXPR_RESTRUCTURING, WHOLE_APPLICATION));
152  relationships.insert(std::make_pair(REMOVE_ENDING_IF, WHOLE_APPLICATION));
153  relationships.insert(std::make_pair(SDC_CODE_MOTION, WHOLE_APPLICATION));
154  }
155 #endif
156 #if HAVE_PRAGMA_BUILT
157  if((parameters->isOption(OPT_parse_pragma) && parameters->getOption<bool>(OPT_parse_pragma)) ||
158  parameters->getOption<int>(OPT_gcc_openmp_simd))
159  {
160  relationships.insert(std::make_pair(PRAGMA_ANALYSIS, WHOLE_APPLICATION));
161  relationships.insert(std::make_pair(PRAGMA_SUBSTITUTION, WHOLE_APPLICATION));
162  }
163  if(parameters->getOption<int>(OPT_parse_pragma))
164  {
165  relationships.insert(std::make_pair(EXTRACT_OMP_ATOMIC, WHOLE_APPLICATION));
166  relationships.insert(std::make_pair(EXTRACT_OMP_FOR, WHOLE_APPLICATION));
167  }
168  if(parameters->getOption<int>(OPT_gcc_openmp_simd))
169  {
170  relationships.insert(std::make_pair(VECTORIZE, WHOLE_APPLICATION));
171  }
172 #endif
173 #if HAVE_HOST_PROFILING_BUILT
174  if(parameters->getOption<HostProfiling_Method>(OPT_profiling_method) != HostProfiling_Method::PM_NONE)
175  {
176  relationships.insert(std::make_pair(HOST_PROFILING, WHOLE_APPLICATION));
177  }
178 #endif
179 #if HAVE_TASTE
180  if(parameters->getOption<bool>(OPT_generate_taste_architecture))
181  {
182  relationships.insert(std::make_pair(CREATE_ADDRESS_TRANSLATION, WHOLE_APPLICATION));
183  }
184 #endif
185  break;
186  }
188  {
189  break;
190  }
192  {
193  break;
194  }
195  default:
196  {
197  THROW_UNREACHABLE("");
198  }
199  }
200  return relationships;
201 }
202 
204 {
205  return true;
206 }
207 
209 {
210  if(parameters->getOption<bool>(OPT_print_dot) || debug_level >= DEBUG_LEVEL_PEDANTIC)
211  {
212  AppM->CGetCallGraphManager()->CGetCallGraph()->WriteDot("call_graph_final.dot");
213  }
215 }
BambuFrontendFlow(const application_managerRef AppM, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
File containing functions and utilities to support the printing of debug messagges.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
exceptions managed by PandA
This class contains the base representation for a generic frontend flow step which works on a single ...
Auxiliary methods for manipulating string.
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Definition: exceptions.hpp:292
HostProfiling_Method
Different profiling method.
HLSFlowStep_Type
Definition: hls_step.hpp:95
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
Abstract class for passes performing a dynamic profiling of loops, paths or both by means of predepen...
redefinition of set to manage ordered/unordered structures
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Call graph hierarchy.
None profiling method selected.
DesignFlowStep_Status Exec() override
Execute this step.
const application_managerRef AppM
The application manager.
~BambuFrontendFlow() override
Destructor.
This file collects some hash functors.
This class contains the methods to create a frontend flow step.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
this class is used to manage the command-line or XML options.
Wrapper to call graph.
int debug_level
The debug level.
The step representing the frontend flow for bambu.
Class specification of the manager of the tree structures extracted from the raw file.

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