59 unsigned int _function_id,
const DesignFlowManagerConstRef _design_flow_manager)
69 switch(relationship_type)
73 relationships.insert(std::make_pair(DATAFLOW_CG_EXT, CALLING_FUNCTIONS));
75 relationships.insert(std::make_pair(USE_COUNTING,
SAME_FUNCTION));
101 const auto gn = GetPointerS<gimple_node>(
GET_NODE(call_stmt));
107 std::for_each(gn->vuses.begin(), gn->vuses.end(),
108 [&](
auto& it) { GetPointer<ssa_name>(
GET_NODE(it))->RemoveUse(call_stmt); });
110 std::for_each(gn->vovers.begin(), gn->vovers.end(),
111 [&](
auto& it) { GetPointer<ssa_name>(
GET_NODE(it))->RemoveUse(call_stmt); });
113 THROW_ASSERT(!gn->memdef && !gn->memuse,
"Unexpected condition");
118 const auto HLSMgr = GetPointer<HLS_manager>(
AppM);
119 const auto fsymbol =
function_behavior->CGetBehavioralHelper()->GetMangledFunctionName();
120 const auto func_arch = HLSMgr->module_arch->GetArchitecture(fsymbol);
121 const auto is_dataflow_top = func_arch &&
122 func_arch->attrs.find(FunctionArchitecture::func_dataflow) != func_arch->attrs.end() &&
123 func_arch->attrs.find(FunctionArchitecture::func_dataflow)->second ==
"top";
129 const auto TM =
AppM->get_tree_manager();
130 const auto CGM =
AppM->GetCallGraphManager();
131 const auto CG = CGM->CGetCallGraph();
137 std::vector<unsigned int> new_modules;
140 const auto target_id = CGM->get_function(
boost::target(ie, *CG));
141 const auto tsymbol =
AppM->CGetFunctionBehavior(target_id)->CGetBehavioralHelper()->GetMangledFunctionName();
142 const auto tarch = HLSMgr->module_arch->GetArchitecture(tsymbol);
143 const auto is_dataflow_module = tarch &&
144 tarch->attrs.find(FunctionArchitecture::func_dataflow) != tarch->attrs.end() &&
145 tarch->attrs.find(FunctionArchitecture::func_dataflow)->second ==
"module";
146 if(!is_dataflow_module)
151 const auto call_info = CG->CGetFunctionEdgeInfo(ie);
152 if(call_info->function_addresses.size() || call_info->indirect_call_points.size())
154 THROW_ERROR(
"Address/indirect function calls not supported in dataflow.");
157 const auto fnode = TM->CGetTreeReindex(
function_id);
158 std::vector<unsigned int> call_points(++call_info->direct_call_points.begin(),
159 call_info->direct_call_points.end());
161 const auto first_call = TM->CGetTreeReindex(*call_info->direct_call_points.begin());
164 for(
auto call_id : call_points)
166 const auto call_node = TM->CGetTreeReindex(call_id);
167 const auto module_suffix =
"_" + std::to_string(call_id);
169 "---Clone module " + tsymbol +
" -> " + tsymbol + module_suffix);
172 const auto version_symbol = tsymbol + module_suffix;
173 const auto version_fnode = TM->GetFunction(version_symbol);
174 THROW_ASSERT(version_fnode,
"Expected version function node for " + version_symbol);
177 march->attrs.at(FunctionArchitecture::func_symbol) += module_suffix;
178 march->attrs.at(FunctionArchitecture::func_symbol) += module_suffix;
179 HLSMgr->module_arch->AddArchitecture(version_symbol, march);
184 if(new_modules.size())
186 auto root_functions = CGM->GetRootFunctions();
187 root_functions.insert(new_modules.begin(), new_modules.end());
188 CGM->SetRootFunctions(root_functions);
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
DesignFlowStep_Status InternalExec() override
Execute the step.
#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;.
static void CleanVirtuals(const tree_managerRef &TM, const tree_nodeRef &call_stmt)
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.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
unsigned int bb_version
The version of the basic block intermediate representation on which this step has been applied...
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.
Dataflow call graph extension.
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.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
static tree_nodeRef kill_vdef(const tree_managerRef &TM, const tree_nodeRef &vdef)
Replace virtual ssa definition with gimple nop.
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.
bool VersionFunctionCall(const tree_nodeRef &call_node, const tree_nodeRef &caller_node, const std::string &version_suffix)
Perform function call versioning.
Class specification of the tree_reindex support class.
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.
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.
dataflow_cg_ext(const ParameterConstRef _parameters, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
#define GET_INDEX_CONST_NODE(t)
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.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...