65 const DesignFlowManagerConstRef _design_flow_manager,
69 frontend_flow_step_type(_frontend_flow_step_type),
79 const CustomUnorderedSet<std::pair<FrontendFlowStepType, FunctionRelationship>>& frontend_relationships,
83 const auto* frontend_flow_step_factory =
84 GetPointer<const FrontendFlowStepFactory>(design_flow_manager->CGetDesignFlowStepFactory(
"Frontend"));
86 frontend_relationship_end = frontend_relationships.end();
87 for(frontend_relationship = frontend_relationships.begin(); frontend_relationship != frontend_relationship_end;
88 ++frontend_relationship)
90 switch(frontend_relationship->second)
94 const auto call_graph_computation_step = design_flow_manager->GetDesignFlowStep(
96 const auto cg_design_flow_step =
97 call_graph_computation_step ?
98 design_flow_graph->CGetDesignFlowStepInfo(call_graph_computation_step)->design_flow_step :
99 frontend_flow_step_factory->CreateApplicationFrontendFlowStep(FUNCTION_ANALYSIS);
100 relationships.insert(cg_design_flow_step);
101 const auto functions_with_body = application_manager->CGetCallGraphManager()->GetReachedBodyFunctions();
102 for(
const auto function_with_body_id : functions_with_body)
104 const auto sdf_step = design_flow_manager->GetDesignFlowStep(
106 const auto design_flow_step =
107 sdf_step ? design_flow_graph->CGetDesignFlowStepInfo(sdf_step)->design_flow_step :
108 frontend_flow_step_factory->CreateFunctionFrontendFlowStep(frontend_relationship->first,
109 function_with_body_id);
110 relationships.insert(design_flow_step);
114 case(CALLING_FUNCTIONS):
124 const auto sdf_step = design_flow_manager->GetDesignFlowStep(sdf_signature);
128 design_flow_step = design_flow_graph->CGetDesignFlowStepInfo(sdf_step)->design_flow_step;
132 design_flow_step = frontend_flow_step_factory->GenerateFrontendStep(frontend_relationship->first);
134 relationships.insert(design_flow_step);
160 switch(frontend_flow_step_type)
162 case(ADD_BB_ECFG_EDGES):
163 return "AddBbEcfgdges";
164 case ADD_ARTIFICIAL_CALL_FLOW_EDGES:
165 return "AddArtificialCallFlowEdges";
166 case(ADD_OP_EXIT_FLOW_EDGES):
167 return "AddOpExitFlowEdges";
168 case(ADD_OP_LOOP_FLOW_EDGES):
169 return "AddOpLoopFlowEdges";
170 case(ADD_OP_PHI_FLOW_EDGES):
171 return "AddOpPhiFlowEdges";
172 case(BAMBU_FRONTEND_FLOW):
173 return "BambuFrontendFlow";
174 case(BASIC_BLOCKS_CFG_COMPUTATION):
175 return "BasicBlocksCfgComputation";
176 case(BB_CONTROL_DEPENDENCE_COMPUTATION):
177 return "BBControlDependenceComputation";
178 case(BB_FEEDBACK_EDGES_IDENTIFICATION):
179 return "BBFeedbackEdgesIdentification";
180 case(BB_ORDER_COMPUTATION):
181 return "BBOrderComputation";
182 #if HAVE_HOST_PROFILING_BUILT 183 case(BASIC_BLOCKS_PROFILING):
184 return "BasicBlocksProfiling";
186 case(BB_REACHABILITY_COMPUTATION):
187 return "BBReachabilityComputation";
191 return "BitValueOpt";
192 case(BITVALUE_RANGE):
193 return "BitValueRange";
195 return "BitValueIPA";
198 case BUILD_VIRTUAL_PHI:
199 return "BuildVirtualPhi";
201 return "CallExprFix";
202 case CALL_GRAPH_BUILTIN_CALL:
203 return "CallGraphBuiltinCall";
204 case(CHECK_SYSTEM_TYPE):
205 return "CheckSystemType";
206 case(COMPLETE_BB_GRAPH):
207 return "CompleteBBGraph";
208 case(COMPLETE_CALL_GRAPH):
209 return "CompleteCallGraph";
210 case COMPUTE_IMPLICIT_CALLS:
211 return "ComputeImplicitCalls";
212 case COMMUTATIVE_EXPR_RESTRUCTURING:
213 return "CommutativeExprRestructuring";
214 case COND_EXPR_RESTRUCTURING:
215 return "CondExprRestructuring";
219 case CREATE_ADDRESS_TRANSLATION:
220 return "CreateAddressTranslation";
222 case(CREATE_TREE_MANAGER):
223 return "CreateTreeManager";
224 case DATAFLOW_CG_EXT:
225 return "DataflowCGExt";
226 case(DEAD_CODE_ELIMINATION):
227 return "DeadCodeElimination";
228 case(DEAD_CODE_ELIMINATION_IPA):
229 return "DeadCodeEliminationIPA";
230 case(DETERMINE_MEMORY_ACCESSES):
231 return "DetermineMemoryAccesses";
232 case(DOM_POST_DOM_COMPUTATION):
233 return "DomPostDomComputation";
236 case(MULTIPLE_ENTRY_IF_REDUCTION):
237 return "MultipleEntryIfReduction";
240 case(EXTRACT_GIMPLE_COND_OP):
241 return "ExtractGimpleCondOp";
242 #if HAVE_FROM_PRAGMA_BUILT 243 case(EXTRACT_OMP_ATOMIC):
244 return "ExtractOmpAtomic";
245 case(EXTRACT_OMP_FOR):
246 return "ExtractOmpFor";
248 case(EXTRACT_PATTERNS):
249 return "ExtractPatterns";
250 case FIND_MAX_TRANSFORMATIONS:
251 return "FindMaxTransformations";
252 case(FUNCTION_ANALYSIS):
253 return "CallGraphComputation";
254 case FIX_STRUCTS_PASSED_BY_VALUE:
255 return "FixStructsPassedByValue";
258 case FUNCTION_CALL_TYPE_CLEANUP:
259 return "FunctionCallTypeCleanup";
260 case FUNCTION_CALL_OPT:
261 return "FunctionCallOpt";
262 case(HDL_FUNCTION_DECL_FIX):
263 return "HDLFunctionDeclFix";
264 case(HDL_VAR_DECL_FIX):
265 return "HDLVarDeclFix";
266 case(HLS_DIV_CG_EXT):
267 return "HLSDivCGExt";
268 case(HWCALL_INJECTION):
269 return "HWCallInjection";
270 #if HAVE_HOST_PROFILING_BUILT 271 case(HOST_PROFILING):
272 return "HostProfiling";
274 case(INTERFACE_INFER):
275 return "InterfaceInfer";
278 case(LOOP_COMPUTATION):
279 return "LoopComputation";
280 case(LOOPS_ANALYSIS_BAMBU):
281 return "LoopsAnalysisBambu";
282 case(LOOPS_COMPUTATION):
283 return "LoopsComputation";
284 case(LUT_TRANSFORMATION):
285 return "LutTransformation";
288 case NI_SSA_LIVENESS:
289 return "NiSsaLiveness";
290 case(OP_CONTROL_DEPENDENCE_COMPUTATION):
291 return "OpControlDependenceComputation";
292 case(OP_FEEDBACK_EDGES_IDENTIFICATION):
293 return "OpFeedbackEdgesIdentification";
294 case(OP_ORDER_COMPUTATION):
295 return "OpOrderComputation";
296 case(OP_REACHABILITY_COMPUTATION):
297 return "OpReachabilityComputation";
298 case(OPERATIONS_CFG_COMPUTATION):
299 return "OperationsCfgComputation";
302 case PARM_DECL_TAKEN_ADDRESS:
303 return "ParmDeclTakenAddressFix";
306 #if HAVE_FROM_PRAGMA_BUILT 307 case(PRAGMA_ANALYSIS):
308 return "PragmaAnalysis";
309 case(PRAGMA_SUBSTITUTION):
310 return "PragmaSubstitution";
312 case PREDICATE_STATEMENTS:
313 return "PredicateStatements";
315 return "RangeAnalysis";
316 case(REBUILD_INITIALIZATION):
317 return "RebuildInitialization";
318 case(REBUILD_INITIALIZATION2):
319 return "RebuildInitialization2";
320 case REMOVE_CLOBBER_GA:
321 return "RemoveClobberGA";
322 case REMOVE_ENDING_IF:
323 return "RemoveEndingIf";
325 case SDC_CODE_MOTION:
326 return "SdcCodeMotion";
328 case SERIALIZE_MUTUAL_EXCLUSIONS:
329 return "SerializeMutualExclusions";
332 return "SplitReturn";
333 case SHORT_CIRCUIT_TAF:
334 return "ShortCircuitTAF";
335 case SIMPLE_CODE_MOTION:
336 return "SimpleCodeMotion";
337 case(SOFT_FLOAT_CG_EXT):
338 return "SoftFloatCgExt";
339 case(SCALAR_SSA_DATA_FLOW_ANALYSIS):
340 return "ScalarSsaDataFlowAnalysis";
341 case(SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP):
342 return "SymbolicApplicationFrontendFlowStep";
344 return "StringCstFix";
347 case UN_COMPARISON_LOWERING:
348 return "UnComparisonLowering";
349 case(UNROLLING_DEGREE):
350 return "UnrollingDegree";
352 case UPDATE_SCHEDULE:
353 return "UpdateSchedule";
356 return "UseCounting";
358 return "VarAnalysis";
363 case(VERIFICATION_OPERATION):
364 return "VerificationOperation";
365 case(VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS):
366 return "VirtualAggregateDataFlowAnalysis";
367 case VIRTUAL_PHI_NODES_SPLIT:
368 return "VirtualPhiNodesSplit";
383 const std::string prefix = before ?
"before" :
"after";
384 const std::string file_name =
385 parameters->getOption<std::string>(OPT_output_temporary_directory) + prefix +
"_" +
GetName();
387 const std::string raw_file_name = file_name + suffix +
".raw";
388 std::ofstream raw_file(raw_file_name.c_str());
389 tree_manager->
print(raw_file);
391 const std::string gimple_file_name = file_name +
".gimple";
392 std::ofstream gimple_file(gimple_file_name.c_str());
399 if(!
parameters->IsParameter(
"print-tree-manager") ||
parameters->GetParameter<
unsigned int>(
"print-tree-manager"))
407 if(!
parameters->IsParameter(
"print-tree-manager") ||
parameters->GetParameter<
unsigned int>(
"print-tree-manager"))
virtual const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const =0
Return the set of analyses in relationship with this design step.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
FrontendFlowStep(const application_managerRef AppM, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
~FrontendFlowStep() override
Destructor.
RelationshipType
The relationship type.
This class manages the tree structures extracted from the raw file.
DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory() const override
Return the factory to create this type of steps.
Class specification of the graph structures.
The base class for design step.
exceptions managed by PandA
static const std::string EnumToKindText(const FrontendFlowStepType frontend_flow_step_type)
Given a frontend flow step type, return the name of the type.
void PrintTreeManager(const bool before) const
Dump the tree manager.
virtual std::string GetKindText() const
Return the name of the type of this frontend flow step.
This class contains the base representation for a generic frontend flow step which works on a single ...
const FrontendFlowStepType frontend_flow_step_type
The type of this step.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Classes to describe design flow graph.
redefinition of set to manage ordered/unordered structures
void PrintInitialIR() const override
Dump the initial intermediate representation.
static const std::string ComputeSignature(const FrontendFlowStepType frontend_flow_step_type)
Compute the signature of a function frontend flow step.
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
This class contains the base representation for a generic frontend flow step.
const ParameterConstRef parameters
Set of input parameters.
virtual std::string GetName() const =0
Return the name of this design step.
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
refcount< T > lock() const
unsigned int print_counter
Print counter.
void ComputeRelationships(DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
const application_managerRef AppM
The application manager.
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...
this class is used to manage the command-line or XML options.
int debug_level
The debug level.
void print(std::ostream &os) const
Function that prints the class tree_manager.
void PrintFinalIR() const override
Dump the final intermediate representation.
This class contains the base representation for a generic frontend flow step which works on the whole...
Class specification of the manager of the tree structures extracted from the raw file.
static void CreateSteps(const DesignFlowManagerConstRef design_flow_manager, const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship >> &frontend_relationships, const application_managerConstRef application_manager, DesignFlowStepSet &relationships)
Create the relationship steps of a step with other steps starting from already specified dependencies...
static const std::string ComputeSignature(const FrontendFlowStepType frontend_flow_step_type, const unsigned int function_id)
Compute the signature of a function frontend flow step.
void PrintGimple(std::ostream &os, const bool use_uid) const
Function that prints the bodies of function in gimple format.