71                          unsigned int _function_id, 
const DesignFlowManagerConstRef _design_flow_manager)
    83    switch(relationship_type)
    87          relationships.insert(std::make_pair(BLOCK_FIX, 
SAME_FUNCTION));
    88          relationships.insert(std::make_pair(SWITCH_FIX, 
SAME_FUNCTION));
    89          relationships.insert(std::make_pair(USE_COUNTING, 
SAME_FUNCTION));
    98          relationships.insert(std::make_pair(CSE_STEP, 
SAME_FUNCTION));
    99          relationships.insert(std::make_pair(REMOVE_CLOBBER_GA, 
SAME_FUNCTION));
   107    return relationships;
   112    if(
parameters->IsParameter(
"disable-SplitReturn") && 
parameters->GetParameter<
int>(
"disable-SplitReturn") == 1)
   117    if(
parameters->isOption(OPT_scheduling_algorithm) &&
   120       return GetPointer<const HLS_manager>(
AppM) && GetPointer<const HLS_manager>(
AppM)->get_HLS(
function_id) &&
   133    const auto TM = 
AppM->get_tree_manager();
   137    const auto fd = GetPointerS<const function_decl>(f_node);
   138    const auto sl = GetPointerS<statement_list>(
GET_NODE(fd->body));
   140    const auto create_return_and_fix_cfg = [&](
const tree_nodeRef& new_gr, 
const blocRef& pred_block,
   141                                               const blocRef& curr_bb) -> 
void {
   142       const auto bb_index = curr_bb->number;
   143       if(pred_block->list_of_succ.size() == 1)
   145          pred_block->PushBack(new_gr, 
AppM);
   146          pred_block->list_of_succ.erase(
   147              std::find(pred_block->list_of_succ.begin(), pred_block->list_of_succ.end(), bb_index));
   148          pred_block->list_of_succ.push_back(curr_bb->list_of_succ.front());
   152          const auto new_basic_block_index = (sl->list_of_bloc.rbegin())->first + 1;
   154                         "---Created BB" + 
STR(new_basic_block_index) + 
" as new successor of BB" +
   155                             STR(pred_block->number));
   156          const auto new_block = blocRef(
new bloc(new_basic_block_index));
   157          sl->list_of_bloc[new_basic_block_index] = new_block;
   158          new_block->loop_id = curr_bb->loop_id;
   159          new_block->SetSSAUsesComputed();
   160          new_block->schedule = curr_bb->schedule;
   161          new_block->PushBack(new_gr, 
AppM);
   163          new_block->list_of_pred.push_back(pred_block->number);
   165          new_block->list_of_succ.push_back(curr_bb->list_of_succ.front());
   167          pred_block->list_of_succ.erase(
   168              std::find(pred_block->list_of_succ.begin(), pred_block->list_of_succ.end(), bb_index));
   169          pred_block->list_of_succ.push_back(new_basic_block_index);
   170          if(pred_block->true_edge == bb_index)
   172             pred_block->true_edge = new_basic_block_index;
   174          if(pred_block->false_edge == bb_index)
   176             pred_block->false_edge = new_basic_block_index;
   179          if(pred_block->CGetStmtList().size())
   181             const auto pred_last_stmt = 
GET_NODE(pred_block->CGetStmtList().back());
   182             if(pred_last_stmt->get_kind() == gimple_multi_way_if_K)
   184                const auto gmwi = GetPointerS<gimple_multi_way_if>(pred_last_stmt);
   185                for(
auto& cond : gmwi->list_of_cond)
   187                   if(cond.second == bb_index)
   189                      cond.second = new_basic_block_index;
   197    const auto list_of_bloc = sl->list_of_bloc;
   198    bool modified = 
false;
   199    for(
const auto& bbi_bb : list_of_bloc)
   201       auto& bb = bbi_bb.second;
   203                      "--- Considering BB" + 
STR(bb->number) + 
" " + 
STR(bb->CGetPhiList().size()) + 
" " +
   204                          STR(bb->CGetStmtList().size()));
   205       if(bb->list_of_pred.size() > 1 && bb->CGetPhiList().size() == 1 && bb->CGetStmtList().size() == 1)
   208          if(stmt->get_kind() == gimple_return_K)
   210             const auto bb_index = bb->number;
   211             const auto gp = GetPointerS<const gimple_phi>(
GET_CONST_NODE(bb->CGetPhiList().front()));
   212             const auto gr = GetPointerS<const gimple_return>(stmt);
   216                               "--- There is a split return possible at BB" + 
STR(bb_index));
   218                for(
const auto& def_edge : gp->CGetDefEdgesList())
   222                   auto& pred_block = sl->list_of_bloc.at(def_edge.second);
   223                   create_return_and_fix_cfg(new_gr, pred_block, bb);
   226                bb->RemovePhi(bb->CGetPhiList().front());
   227                bb->RemoveStmt(bb->CGetStmtList().front(), 
AppM);
   228                sl->list_of_bloc.erase(bb_index);
   231             else if(gp->virtual_flag)
   234                               "--- There is a split return possible at BB" + 
STR(bb_index));
   236                for(
const auto& def_edge : gp->CGetDefEdgesList())
   239                   GetPointerS<gimple_return>(
GET_NODE(new_gr))->AddVuse(def_edge.first);
   240                   const auto& pred_block = sl->list_of_bloc.at(def_edge.second);
   241                   create_return_and_fix_cfg(new_gr, pred_block, bb);
   244                bb->RemovePhi(bb->CGetPhiList().front());
   245                bb->RemoveStmt(bb->CGetStmtList().front(), 
AppM);
   246                sl->list_of_bloc.erase(bb_index);
   251       else if(bb->list_of_pred.size() > 1 && bb->CGetPhiList().size() == 0 && bb->CGetStmtList().size() == 1)
   253          const auto bb_index = bb->number;
   255          if(stmt->get_kind() == gimple_return_K)
   257             const auto gr = GetPointerS<const gimple_return>(stmt);
   258             for(
const auto& pred_block_index : bb->list_of_pred)
   260                const auto& pred_block = sl->list_of_bloc.at(pred_block_index);
   262                create_return_and_fix_cfg(new_gr, pred_block, bb);
   265             bb->RemoveStmt(bb->CGetStmtList().front(), 
AppM);
   266             sl->list_of_bloc.erase(bb_index);
 #define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
 
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed. 
 
Data structure representing the entire HLS information. 
 
This struct specifies the field bloc (basic block). 
 
#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. 
 
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
 
RelationshipType
The relationship type. 
 
Source must be executed to satisfy target. 
 
A simple interface to token object of the raw files. 
 
Analysis step that optimize the phis starting from the IR. 
 
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
 
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 
 
bool HasToBeExecuted() const override
Check if this step has actually to be executed. 
 
Target must be reexecuted. 
 
redefinition of set to manage ordered/unordered structures 
 
#define GET_CONST_NODE(t)
 
Classes specification of the tree_node data structures. 
 
const ParameterConstRef parameters
Set of input parameters. 
 
DesignFlowStep_Status
The status of a step. 
 
Class defining some useful functions to create tree nodes and to manipulate the tree manager...
 
#define DEBUG_LEVEL_NONE
no debugging print is performed. 
 
SplitReturn(const ParameterConstRef _Param, const application_managerRef _AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor. 
 
DesignFlowStep_Status InternalExec() override
Restructures the unstructured code. 
 
This file collects some utility functions. 
 
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. 
 
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. 
 
Data structure definition for high-level synthesis flow. 
 
static tree_nodeConstRef GetFunctionReturnType(const tree_nodeConstRef &function, bool void_as_null=true)
Return the return type of a function. 
 
~SplitReturn() override
Destructor. 
 
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
 
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. 
 
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.