120 unsigned int _function_id,
const DesignFlowManagerConstRef _design_flow_manager)
134 switch(relationship_type)
138 relationships.insert(std::make_pair(SWITCH_FIX,
SAME_FUNCTION));
139 relationships.insert(std::make_pair(BLOCK_FIX,
SAME_FUNCTION));
140 relationships.insert(std::make_pair(USE_COUNTING,
SAME_FUNCTION));
147 relationships.insert(std::make_pair(PHI_OPT,
SAME_FUNCTION));
153 relationships.insert(std::make_pair(PHI_OPT,
SAME_FUNCTION));
161 return relationships;
166 TM =
AppM->get_tree_manager();
169 auto fd = GetPointer<function_decl>(temp);
170 sl = GetPointer<statement_list>(
GET_NODE(fd->body));
173 GetPointer<const HLS_manager>(
AppM) and GetPointer<const HLS_manager>(
AppM)->get_HLS(
function_id) and
186 GetPointer<const HLS_manager>(
AppM) and GetPointer<const HLS_manager>(
AppM)->get_HLS(
function_id) and
197 bool bb_modified =
false;
198 const auto HLS = GetPointer<const HLS_manager>(
AppM)->get_HLS(
function_id);
199 const auto clock_period = HLS->HLS_C->get_clock_period();
200 const auto clock_period_margin = HLS->allocation_information->GetClockPeriodMargin();
201 const auto net_clock_period = clock_period - clock_period_margin;
206 if(not
AppM->ApplyNewTransformation())
209 "---Skipping remaining transformations because of reached limit of cfg transformations");
213 "---Checking if a bloc has just 2 incoming and 1 outcoming");
215 if(
block.second->list_of_succ.size() == 1 and
block.second->list_of_pred.size() == 2)
218 const auto successor_id =
block.second->list_of_succ.front();
224 if(
block.second->CGetStmtList().size() == 1)
226 auto last_stmt =
GET_NODE(
block.second->CGetStmtList().back());
228 if(last_stmt->get_kind() == gimple_return_K)
236 const std::pair<blocRef, blocRef> if_succ = [&]() -> std::pair<blocRef, blocRef> {
237 const blocRef if_block = [&]() -> blocRef {
239 if(block_pred1.second->list_of_succ.size() == 2 and block_pred1.second->loop_id == 0)
241 return block_pred1.second;
243 if(block_pred2.second->list_of_succ.size() == 2 and block_pred2.second->loop_id == 0)
245 return block_pred2.second;
251 return std::pair<blocRef, blocRef>(blocRef(), blocRef());
253 const auto dep_block =
254 block_pred1.first == if_block->number ? block_pred2.second : block_pred1.second;
255 if(dep_block->list_of_pred.size() != 1 or dep_block->list_of_succ.size() != 1 or
256 dep_block->list_of_pred.front() != if_block->number)
258 return std::pair<blocRef, blocRef>(blocRef(), blocRef());
260 return std::pair<blocRef, blocRef>(if_block, dep_block);
262 if(if_succ.first and if_succ.second)
264 const auto if_block = if_succ.first;
265 const auto dep_block = if_succ.second;
266 const bool to_be_removed = [&]() ->
bool {
267 if(dep_block->CGetStmtList().empty())
273 for(
const auto& stmt : dep_block->CGetStmtList())
283 if((
GET_NODE(stmt)->get_kind() == gimple_call_K) ||
284 ((GetPointer<const gimple_assign>(
GET_NODE(stmt))) &&
285 ((
GET_NODE(GetPointer<const gimple_assign>(
GET_NODE(stmt))->op1)->get_kind() ==
287 (
GET_NODE(GetPointer<const gimple_assign>(
GET_NODE(stmt))->op1)->get_kind() ==
292 if(GetPointer<const gimple_node>(
GET_NODE(stmt))->vdef)
297 if((max - min) > net_clock_period)
306 while(not dep_block->CGetStmtList().empty())
308 auto current_stmt = dep_block->CGetStmtList().front();
309 dep_block->RemoveStmt(current_stmt,
AppM);
310 if_block->PushBack(current_stmt,
AppM);
314 AppM->RegisterTransformation(
GetName(), last_stmt);
336 "---Skipped this bloc, because has more or less incoming/outcoming arcs than expected");
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
tree_managerRef TM
The tree manager.
#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;.
File containing functions and utilities to support the printing of debug messagges.
tree_manipulationRef tree_man
The tree manipulation.
Step successfully executed.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
refcount< tree_manipulation > tree_manipulationRef
std::string GetName() const override
Return the name of this design step.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
A simple interface to token object of the raw files.
std::map< unsigned int, blocRef > list_of_bloc
list_of_bloc field is the list of basic block. If this field is null then the list_of_stmt field is n...
static const unsigned int EXIT_BLOCK_ID
constant identifying the exit basic block
RemoveEndingIf(const ParameterConstRef _Param, const application_managerRef _AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
Data structure describing a basic block at tree level.
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
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.
Auxiliary methods for manipulating string.
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
std::string GetSignature() const override
Return the signature of this step.
const tree_nodeRef get_tree_node_const(unsigned int i) const
Return the reference to the i-th tree_node Constant version of get_tree_node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Data structure used to store the schedule of the operations.
DesignFlowStep_Status InternalExec() override
Restructures the unstructured code.
Target must be reexecuted.
redefinition of set to manage ordered/unordered structures
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Class defining some useful functions to create tree nodes and to manipulate the tree manager...
#define DEBUG_LEVEL_NONE
no debugging print is performed.
statement_list * sl
The statement list of the analyzed function.
Data structure definition for HLS constraints.
This struct specifies the block node.
This file collects some utility functions.
double GetStartingTime(const unsigned int operation) const
Return the starting time of the operation.
refcount< T > lock() const
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.
File used to compute the topological sort in a cyclic graph.
Class specification of the basic_block structure.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Classes specification of the tree_node data structures not present in the gcc.
this class is used to manage the command-line or XML options.
int debug_level
The debug level.
double GetEndingTime(const unsigned int operation) const
Return the starting time of the operation.
Data structure definition for high-level synthesis flow.
~RemoveEndingIf() override
Destructor.
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
ScheduleRef schedule
The scheduling solution.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.