PandA-2024.02
update_schedule.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) 2016-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 #include "update_schedule.hpp"
43 
45 #include "application_manager.hpp"
46 #include "basic_block.hpp"
47 
49 #include "Parameter.hpp"
50 
52 #include "hls.hpp"
53 #include "hls_manager.hpp"
54 #include "hls_step.hpp"
55 
57 #include "schedule.hpp"
58 
60 #include "dbgPrintHelper.hpp" // for DEBUG_LEVEL_
61 #include "string_manipulation.hpp" // for GET_CLASS
62 #include "tree_basic_block.hpp"
63 #include "tree_manager.hpp"
64 #include "tree_reindex.hpp"
65 
66 UpdateSchedule::UpdateSchedule(const application_managerRef _AppM, unsigned int _function_id,
67  const DesignFlowManagerConstRef _design_flow_manager,
68  const ParameterConstRef _parameters)
69  : FunctionFrontendFlowStep(_AppM, _function_id, UPDATE_SCHEDULE, _design_flow_manager, _parameters)
70 {
71  debug_level = parameters->get_class_debug_level(GET_CLASS(*this), DEBUG_LEVEL_NONE);
72 }
73 
75 
78 {
80  switch(relationship_type)
81  {
83  {
84  break;
85  }
87  {
88  break;
89  }
91  {
92  break;
93  }
94  default:
95  {
97  }
98  }
99  return relationships;
100 }
101 
103 {
104  if(GetPointer<const HLS_manager>(AppM) and GetPointer<const HLS_manager>(AppM)->get_HLS(function_id) and
105  GetPointer<const HLS_manager>(AppM)->get_HLS(function_id)->Rsch)
106  {
107  schedule = GetPointer<const HLS_manager>(AppM)->get_HLS(function_id)->Rsch;
109  const auto basic_block_graph = function_behavior->GetBBGraph(FunctionBehavior::BB);
110  VertexIterator basic_block, basic_block_end;
111  for(boost::tie(basic_block, basic_block_end) = boost::vertices(*basic_block_graph);
112  basic_block != basic_block_end; basic_block++)
113  {
114  basic_block_graph->GetBBNodeInfo(*basic_block)->block->schedule = schedule;
115  }
116  }
117 }
118 
120 {
121 #if HAVE_ILP_BUILT
122  if(parameters->getOption<HLSFlowStep_Type>(OPT_scheduling_algorithm) == HLSFlowStep_Type::SDC_SCHEDULING and
123  GetPointer<const HLS_manager>(AppM) and GetPointer<const HLS_manager>(AppM)->get_HLS(function_id) and
124  GetPointer<const HLS_manager>(AppM)->get_HLS(function_id)->Rsch)
125  {
127  }
128  else
129 #endif
130  {
131  return false;
132  }
133 }
134 
136 {
137  const auto TM = AppM->get_tree_manager();
138  auto* fd = GetPointer<function_decl>(TM->get_tree_node_const(function_id));
139  auto* sl = GetPointer<statement_list>(GET_NODE(fd->body));
140  for(const auto& block : sl->list_of_bloc)
141  {
143  for(const auto& phi : block.second->CGetPhiList())
144  {
145  schedule->UpdateTime(phi->index);
146  }
147  for(const auto& statement : block.second->CGetStmtList())
148  {
149  schedule->UpdateTime(statement->index);
150  }
152  }
154 }
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
Data structure representing the entire HLS information.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
Basic block control flow graph.
File containing functions and utilities to support the printing of debug messagges.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Definition of the class representing a generic C application.
UpdateSchedule(const application_managerRef _AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
~UpdateSchedule() override
Destructor.
Data structure describing a basic block at tree level.
#define STR(s)
Macro which performs a lexical_cast to a string.
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
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
void UpdateTime(const unsigned int operation_index, bool update_cs=true)
Compute the starting and the ending time of a statement.
Definition: schedule.cpp:337
Data structure used to store the schedule of the operations.
HLSFlowStep_Type
Definition: hls_step.hpp:95
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
Definition: graph.hpp:1307
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
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.
This struct specifies the block node.
Definition: tree_node.hpp:1820
Analysis step which updates the schedule of all the instructions.
const unsigned int function_id
The index of the function to be analyzed.
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
Class specification of the basic_block structure.
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.
ScheduleRef schedule
The scheduling solution.
DesignFlowStep_Status InternalExec() override
Restructures the unstructured code.
int debug_level
The debug level.
Data structure definition for high-level synthesis flow.
Class specification of the manager of the tree structures extracted from the raw file.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
int sl
Definition: adpcm.c:105

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