64 :
CWriter(_HLSMgr, _instruction_writer, _indented_output_stream, _Param, _verbose),
79 for(
const auto f :
HLSMgr->get_functions_with_body())
81 const auto FB =
HLSMgr->CGetFunctionBehavior(f);
82 const std::list<LoopConstRef> loops = FB->CGetLoops()->GetList();
83 std::list<LoopConstRef>::const_iterator l, l_end = loops.end();
84 for(l = loops.begin(); l != l_end; ++l)
127 const unsigned int bb_number = bb_node_info->block->number;
138 "current_vertex cannot be part of the basic block frontier");
153 std::to_string(bb_node_info->loop_id) +
"\n");
160 const unsigned int bb_number_PD = bb_node_info_pd->block->number;
161 std::string frontier_string;
163 for(bb_frontier_begin =
bb_frontier.begin(); bb_frontier_begin != bb_frontier_end; ++bb_frontier_begin)
165 frontier_string +=
"BB" + std::to_string(bb_fcfgGraph->
CGetBBNodeInfo(*bb_frontier_begin)->block->number) +
" ";
178 std::list<vertex>::const_reverse_iterator vRIter, vRIterEnd;
179 bool is_there =
false;
185 OpVertexSet::const_iterator it, it_end;
194 for(vRIter = bb_node_info->statements_list.rbegin(), vRIterEnd = bb_node_info->statements_list.rend();
195 vRIter != vRIterEnd; ++vRIter)
212 "This is basic block is not empty in this task. Last operation to be printed id " +
219 bool last_statement_is_a_cond_or_goto = is_there and
221 last_stmt == bb_node_info->statements_list.back();
222 THROW_ASSERT(!last_statement_is_a_cond_or_goto || !is_there ||
223 (last_statement_is_a_cond_or_goto && last_stmt == bb_node_info->statements_list.back()),
224 "inconsistent recursion");
228 if(start_with_a_label)
240 if(!add_bb_label and !start_with_a_label and boost::in_degree(current_vertex, *bb_fcfgGraph) > 1)
243 "Basic block has an indegree > 1 and not associated label");
245 for(boost::tie(inE, inEEnd) = boost::in_edges(current_vertex, *bb_fcfgGraph); inE != inEEnd; ++inE)
247 vertex source = boost::source(*inE, *bb_fcfgGraph);
251 if(pred_bb_node_info->statements_list.size() and
256 "Basic block is the first case of a case preceded by a case without break");
265 "Basic block should start with a label since is the body of a short-circuit");
271 (bb_node_info->statements_list.empty() or
275 "Basic block is the header of a loop and it does not end with while or for");
281 add_bb_label = add_bb_label && !start_with_a_label;
282 bool add_semicolon =
false;
286 if(analyze_bb_PD || is_there || add_bb_label || add_phi_nodes_assignment || add_phi_nodes_assignment_prefix)
292 add_semicolon =
true;
302 for(boost::tie(ei, ei_end) = boost::in_edges(current_vertex, *bb_fcfgGraph); ei != ei_end; ei++)
311 if(current_vertex == entry_vertex)
314 for(boost::tie(eo, eo_end) = boost::out_edges(current_vertex, *bb_fcfgGraph); eo != eo_end; eo++)
326 "---There is already an edge instrumentation associated with the current basic block");
331 if(first_loop_index != second_loop_index)
334 "---Changing from loop " + std::to_string(first_loop_index) +
" to " +
335 std::to_string(second_loop_index));
336 unsigned int first_depth = 0;
337 unsigned int second_depth = 0;
340 first_depth =
HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
342 if(second_loop_index)
344 second_depth =
HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
347 if(first_depth < second_depth)
352 else if(second_depth < first_depth)
369 if((bb_node_info->loop_id == bb_number) && bb_number)
374 "//Starting of a loop - average iteration number " +
376 HLSMgr->CGetFunctionBehavior(funId)->CGetProfilingInformation()->GetLoopAvgIterations(bb_number)) +
385 "I do not know the destination: " +
STR(bb_number));
387 add_semicolon =
true;
389 else if(start_with_a_label)
391 add_semicolon =
true;
393 std::list<vertex>::const_iterator vIter, vIterEnd, vIterBegin;
394 vIter = bb_node_info->statements_list.begin();
396 vIterEnd = bb_node_info->statements_list.end();
400 bool notFeedBack =
true;
401 for(boost::tie(oi, oend) = boost::out_edges(current_vertex, *bb_fcfgGraph); oi != oend and notFeedBack; oi++)
412 "There are instructions to be printed for this pair task - basic block");
417 const std::map<unsigned int, std::string>& rvt =
renaming_table.find(current_vertex)->second;
418 auto rvt_it_end = rvt.end();
419 for(
auto rvt_it = rvt.begin(); rvt_it != rvt_it_end; ++rvt_it)
424 bool label_has_to_be_printed = start_with_a_label;
426 unsigned int analyzed_statement = 0;
431 if(prefix_has_to_be_printed and not label_has_to_be_printed)
433 prefix_has_to_be_printed =
false;
440 analyzed_statement++;
443 label_has_to_be_printed =
false;
445 "Preparing printing of operation " +
GET_NAME(cfgGraph, *vIter));
452 if(start_with_a_label && vIter == vIterBegin)
455 for(boost::tie(inE, inEEnd) = boost::in_edges(current_vertex, *bb_fcfgGraph); inE != inEEnd; inE++)
463 bool isLastIntruction = last_stmt == *vIter;
468 if(add_phi_nodes_assignment && isLastIntruction && print_phi_now)
481 boost::out_degree(current_vertex, *bb_fcfgGraph) == 1)
484 boost::tie(eo1, eo_end1) = boost::out_edges(current_vertex, *bb_fcfgGraph);
501 add_semicolon =
false;
508 if(!isLastIntruction)
513 if(add_phi_nodes_assignment && !print_phi_now)
518 if(boost::out_degree(current_vertex, *
support_cfg) == 1 and
519 boost::out_degree(current_vertex, *bb_fcfgGraph) == 1)
522 boost::tie(eo1, eo_end1) = boost::out_edges(current_vertex, *
support_cfg);
527 "Function " + std::to_string(funId) +
" not found");
530 "Loop " + std::to_string(bb_node_info->loop_id) +
" not found");
539 const unsigned int bb_true_number = bb_node_info->block->true_edge;
540 const vertex true_vertex = bb_index_map.find(bb_true_number)->second;
541 const unsigned int bb_false_number = bb_node_info->block->false_edge;
542 vertex false_vertex = bb_index_map.find(bb_false_number)->second;
543 bool add_false_to_goto =
false;
550 add_false_to_goto =
true;
556 boost::tie(e, inserted) = boost::edge(current_vertex, true_vertex, *
support_cfg);
564 "I do not know the destination");
568 boost::tie(e, inserted) = boost::edge(current_vertex, true_vertex, *bb_fcfgGraph);
572 unsigned int first_loop_index =
574 unsigned int second_loop_index =
577 if(first_loop_index != second_loop_index)
579 unsigned int first_depth = 0;
580 unsigned int second_depth = 0;
584 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
586 if(second_loop_index)
589 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
592 if(first_depth < second_depth)
597 else if(second_depth < first_depth)
626 boost::tie(e, inserted) = boost::edge(current_vertex, true_vertex, *
support_cfg);
630 if(first_loop_index != second_loop_index)
632 unsigned int first_depth = 0;
633 unsigned int second_depth = 0;
636 first_depth =
HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
638 if(second_loop_index)
641 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
644 if(first_depth < second_depth)
649 else if(second_depth < first_depth)
665 if(add_false_to_goto)
674 boost::tie(e, ins) = boost::edge(current_vertex, false_vertex, *bb_fcfgGraph);
686 "I do not know the destination");
688 boost::tie(e, ins) = boost::edge(current_vertex, false_vertex, *
support_cfg);
690 unsigned int first_loop_index =
692 unsigned int second_loop_index =
695 if(first_loop_index != second_loop_index)
697 unsigned int first_depth = 0;
698 unsigned int second_depth = 0;
702 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
704 if(second_loop_index)
707 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
710 if(first_depth < second_depth)
715 else if(second_depth < first_depth)
742 if(target_bb_node_info->statements_list.empty() or
743 ((
GET_TYPE(cfgGraph, *(target_bb_node_info->statements_list.rbegin())) &
751 "I do not know the destination");
764 false_vertex = bb_fcfgGraph->
CGetBBGraphInfo()->bb_index_map.find(bb_false_number)->second;
765 boost::tie(e, inserted) = boost::edge(current_vertex, false_vertex, *bb_fcfgGraph);
769 if(first_loop_index != second_loop_index)
771 unsigned int first_depth = 0;
772 unsigned int second_depth = 0;
775 first_depth =
HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
777 if(second_loop_index)
780 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
783 if(first_depth < second_depth)
788 else if(second_depth < first_depth)
808 const unsigned int bb_true_number = bb_node_info->block->true_edge;
809 const vertex true_vertex = bb_index_map.find(bb_true_number)->second;
820 boost::tie(e, inserted) = boost::edge(current_vertex, true_vertex, *bb_fcfgGraph);
827 THROW_ERROR(
"Body of a loop has yet been printed before the while statement");
835 const unsigned int bb_false_number = bb_node_info->block->false_edge;
836 const vertex false_vertex = bb_index_map.find(bb_false_number)->second;
839 boost::tie(e, inserted) = boost::edge(current_vertex, false_vertex, *bb_fcfgGraph);
843 if(first_loop_index != second_loop_index)
845 unsigned int first_depth = 0;
846 unsigned int second_depth = 0;
849 first_depth =
HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
853 THROW_ERROR(
"Basic block of for or while it is not in a loop");
855 if(second_loop_index)
857 second_depth =
HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
860 if(first_depth < second_depth)
862 THROW_ERROR(
"A loop is followed by a loop with higher depth");
865 else if(second_depth < first_depth)
896 unsigned int node_id = cfgGraph->
CGetOpNodeInfo(last_stmt)->GetNodeId();
899 auto* gmwi = GetPointer<gimple_multi_way_if>(node);
900 std::map<unsigned int, bool> add_elseif_to_goto;
901 for(
const auto& cond : gmwi->list_of_cond)
903 unsigned int bb_index_num = cond.second;
904 const vertex bb_vertex = bb_index_map.find(bb_index_num)->second;
905 if(cond != gmwi->list_of_cond.front())
909 add_elseif_to_goto[bb_index_num] = to_be_added;
917 add_elseif_to_goto[bb_index_num] =
false;
920 for(
const auto& cond : gmwi->list_of_cond)
923 unsigned int bb_index_num = cond.second;
924 const vertex bb_vertex = bb_index_map.find(bb_index_num)->second;
925 if(cond != gmwi->list_of_cond.front())
938 if(add_elseif_to_goto.find(bb_index_num) != add_elseif_to_goto.end() &&
939 add_elseif_to_goto.find(bb_index_num)->second)
949 boost::tie(e, inserted) = boost::edge(current_vertex, bb_vertex, *
support_cfg);
959 "I do not know the destination " + std::to_string(bb_index_num));
963 boost::tie(e, inserted) = boost::edge(current_vertex, bb_vertex, *bb_fcfgGraph);
968 unsigned int first_loop_index =
970 unsigned int second_loop_index =
973 if(first_loop_index != second_loop_index)
975 unsigned int first_depth = 0;
976 unsigned int second_depth = 0;
980 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
982 if(second_loop_index)
985 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
988 "---Depth of first loop is " +
STR(first_depth));
990 "---Depth of second loop is " +
STR(second_depth));
992 if(first_depth < second_depth)
997 else if(second_depth < first_depth)
1027 boost::tie(e, inserted) = boost::edge(current_vertex, bb_vertex, *
support_cfg);
1031 if(first_loop_index != second_loop_index)
1033 unsigned int first_depth = 0;
1034 unsigned int second_depth = 0;
1035 if(first_loop_index)
1038 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(first_loop_index)->depth;
1040 if(second_loop_index)
1043 HLSMgr->CGetFunctionBehavior(funId)->CGetLoops()->CGetLoop(second_loop_index)->depth;
1046 "---Depth of first loop is " +
STR(first_depth));
1048 "---Depth of second loop is " +
STR(second_depth));
1050 if(first_depth < second_depth)
1055 else if(second_depth < first_depth)
1080 for(boost::tie(oE, oEEnd) = boost::out_edges(current_vertex, *bb_fcfgGraph); oE != oEEnd; oE++)
1082 bool empty_block =
false;
1086 const unsigned int bb_number_next_bb = next_bb_node_info->block->number;
1089 "Examining successor " + std::to_string(bb_number_next_bb));
1090 unsigned int in_edge_counter = 0;
1092 for(boost::tie(ei, ei_end) = boost::in_edges(next_bb, *bb_fcfgGraph); ei != ei_end; ei++)
1101 for(eIdBeg = Set.begin(), eIdEnd = Set.end(); eIdBeg != eIdEnd; ++eIdBeg)
1116 analyze_bb_PD =
true;
1121 if(in_edge_counter != 1)
1124 THROW_ERROR(
"Not yet supported type of switch in profiling");
1131 if(in_edge_counter != 1)
1134 std::to_string(funId) +
" - current basic block is " +
1135 std::to_string(bb_number));
1136 THROW_ERROR(
"Not yet supported type of switch in profiling");
1138 if(next_bb == bb_PD)
1162 const unsigned int next_bb_number = next_bb_node_info->block->number;
1165 "I do not know the destination " + std::to_string(next_bb_number));
1175 if(last_statement_is_a_cond_or_goto)
1179 for(boost::tie(oE, oEEnd) = boost::out_edges(current_vertex, *bb_fcfgGraph); oE != oEEnd; oE++)
1182 if(boost::out_degree(current_vertex, *bb_fcfgGraph) > 1)
1185 THROW_ERROR(
"Profiling does not support computed goto");
1199 if(current_vertex == bbentry)
1203 "<--Ended writing basic block " + std::to_string(bb_number));
1206 THROW_ASSERT(boost::out_degree(current_vertex, *bb_fcfgGraph) <= 1,
1207 "Only one edge expected as output of BB" +
1210 for(boost::tie(oE, oEEnd) = boost::out_edges(current_vertex, *bb_fcfgGraph); oE != oEEnd; oE++)
1221 "Not adding goto since target is in the frontier");
1229 if(target_bb_node_info->statements_list.size() and
1233 "Not adding a goto since target is a while/for");
1242 if(boost::in_degree(next_bb, *bb_fcfgGraph) == 1)
1249 const unsigned int next_bb_number = next_bb_node_info->block->number;
1251 "I do not know the destination");
1258 }
while(*vIter++ != last_stmt);
1268 if(add_phi_nodes_assignment)
1271 add_semicolon =
false;
1274 ((bb_node_info->statements_list.empty()) ||
1279 if(current_vertex == bbentry)
1283 "<--Ended writing basic block " + std::to_string(bb_number));
1286 THROW_ASSERT(boost::out_degree(current_vertex, *bb_fcfgGraph) <= 1,
"only one edge expected BB(" +
1287 std::to_string(bb_number) +
") Fun(" +
1288 std::to_string(funId) +
")");
1290 for(boost::tie(oE, oEEnd) = boost::out_edges(current_vertex, *bb_fcfgGraph); oE != oEEnd; oE++)
1294 if(boost::in_degree(next_bb, *bb_fcfgGraph) == 1)
1323 if(target_bb_node_info->statements_list.size() and
1332 const unsigned int next_bb_number = next_bb_node_info->block->number;
1334 "I do not know the destination");
1346 add_semicolon =
false;
1353 else if(add_semicolon)
1364 "something wrong happened " + std::to_string(bb_fcfgGraph->
CGetBBNodeInfo(bb_PD)->block->number) +
1365 " Fun(" + std::to_string(funId) +
")");
1369 if((analyze_bb_PD || is_there || add_bb_label || add_phi_nodes_assignment || add_phi_nodes_assignment_prefix) &&
1392 "-->Edge profiling writer - start to fwrite body of function " +
1394 if(instructions.empty())
1399 else if(instructions.size() == 1)
1424 "There are " + std::to_string(bb_exit.size()) +
" exit basic blocks");
1431 for(boost::tie(vi, vi_end) = boost::vertices(*bb_fcfgGraph); vi != vi_end; vi++)
1433 size_t delta = bb_exit.find(*vi) != bb_exit.end() ? 1u : 0u;
1434 if(boost::in_degree(*vi, *bb_fcfgGraph) <= (1 + delta))
1437 "---Skipped BB" + std::to_string(bb_fcfgGraph->
CGetBBNodeInfo(*vi)->block->number));
1444 (
"BB_LABEL_" + std::to_string(bb_node_info->block->number)) +
1447 "---Label of BB" + std::to_string(bb_fcfgGraph->
CGetBBNodeInfo(*vi)->block->number) +
" is " +
1453 bb_analyzed.insert(bb_exit.begin(), bb_exit.end());
1458 bb_frontier.insert(bb_exit.begin(), bb_exit.end());
1469 if(!bb_start && bb_end.size() == 0)
1471 for(boost::tie(oE, oEEnd) = boost::out_edges(bbentry, *bb_fcfgGraph); oE != oEEnd; oE++)
1473 if(bb_exit.find(
boost::target(*oE, *bb_fcfgGraph)) != bb_exit.end())
1486 std::inserter(not_yet_considered, not_yet_considered.begin())
1488 while(!not_yet_considered.empty())
1490 vertex next_bb = *not_yet_considered.begin();
1491 not_yet_considered.erase(next_bb);
1493 not_yet_considered.clear();
1496 std::inserter(not_yet_considered, not_yet_considered.begin()) );
1514 "Profiling Instrumentation of Edge of function " + behavioral_helper->
get_function_name() +
#define TYPE_SWITCH
constant identifying the node type of a SWITCH operation.
std::map< vertex, EdgeDescriptor > local_inc
Increment which should be added before the label in a basic block.
virtual void print_loop_escaping(EdgeDescriptor e)
Dump operations requested for record information about a path which exit from a loop.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
int GetSelector() const
Return the selector of this graph.
Vertex get_immediate_dominator(Vertex v) const
Return the immediate dominator of a Vertex.
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;.
boost::graph_traits< graph >::out_edge_iterator OutEdgeIterator
out_edge_iterator definition.
#define GET_TYPE(data, vertex_index)
Helper macro returning the type associated with a node.
const dominance< BBGraph > * dominators
virtual void print_end_path(unsigned int fun_id, unsigned int loop_id)
Print operations needed to store into symbol table information about last path.
unsigned int counter
The size of fun_loop_to_index.
CustomOrderedSet< vertex > goto_list
static void clear_renaming_table()
remove all the entries from the renaming table
const std::map< unsigned int, std::map< unsigned int, unsigned int > > & CGetFunctionLoopToId() const
Returns the map which associates to each loop a unique id.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
#define TYPE_MULTIIF
constant identifying the a multi-way if
#define TYPE_VPHI
constant string identifying an operation node of type virtual phi-nodes
const tree_nodeRef CGetTreeReindex(const unsigned int i) const
Return a tree_reindex wrapping the i-th tree_node.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
std::string get_function_name() const
Return the name of the function.
virtual unsigned int end_with_a_cond_or_goto(const blocRef &block) const
Return the nodeID of the last statement of a basic block in case that statement is a cond or a goto e...
int debug_level
the debug level
#define TYPE_IF
constant identifying the node type of an IF operation.
const dominance< BBGraph > * post_dominators
virtual void Initialize()
Initialize data structure.
Class used to write the C code representing a program, this class can't be directly instantiated sinc...
const BBGraphInfoConstRef CGetBBGraphInfo() const
Returns the property associated with the graph.
CustomOrderedSet< vertex > bb_frontier
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
Class specification of the graph structures.
boost::graph_traits< graph >::in_edge_iterator InEdgeIterator
in_edge_iterator definition.
std::map< unsigned int, std::map< unsigned int, unsigned int > > fun_loop_to_index
Map a pair function - loop to an unique index.
unsigned int get_function_index() const
Return the index of the function.
unsigned int fun_id
Index of the current function.
Class to print indented code.
Simple class to print single instruction.
static const unsigned int EXIT_BLOCK_ID
constant identifying the exit basic block
bool verbose
Verbosity means that a comment is printed for each line in the output file.
BBGraphConstRef support_cfg
Special control flow graphs.
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define TYPE_INIT
Constant string identifying an operation that is a variable initialization.
virtual void print_loop_starting(EdgeDescriptor e)
Dump initializations of variable for recording a loop path.
const tree_managerConstRef TM
The tree manager.
Data structure describing a basic block at tree level.
redefinition of map to manage ordered/unordered structures
Functor used to sort edges.
dominance< BBGraph > * post_dominators
This class stores post-dominator information.
A set of operation vertices.
virtual enum kind get_kind() const =0
Virtual function returning the type of the actual class.
#define STR(s)
Macro which performs a lexical_cast to a string.
#define FB_CFG_SELECTOR
Feedback control flow edge selector.
virtual std::string PrintConstant(const tree_nodeConstRef &var, const var_pp_functorConstRef vppf=var_pp_functorConstRef()) const
Print the constant associated with var.
boost::graph_traits< graph >::edge_iterator EdgeIterator
edge_iterator definition.
virtual void WriteFile(const std::string &file_name)
Writes the final C file.
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 TYPE_LABEL
A vertex is of type TYPE_LABEL when it is a target of a goto expression.
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
This file contains the routines necessary to create a C executable program with instrumented edges...
const BBEdgeInfoConstRef CGetBBEdgeInfo(const EdgeDescriptor e) const
Returns the info associated with an edge.
const IndentedOutputStreamRef indented_output_stream
Represents the stream we are currently writing to.
Class used to describe a particular graph with basic blocks as nodes.
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
virtual void WriteHeader() override
Writes the header of the file.
const ParameterConstRef Param
set of parameters
void Append(const std::string &str)
Append a string to the output.
void writeRoutineInstructions_rec(vertex current_vertex, bool bracket)
Write recursively instructions belonging to a basic block of task or of a function.
#define default_COND
constant used to represent label "default" of a switch construct
Basic block control flow graph with feedback.
virtual int unsigned start_with_a_label(const blocRef &block) const
Return the nodeID of the first statement of a basic block in case that statement is a label expressio...
static void rename_a_variable(unsigned int var, const std::string &new_name)
rename a variable
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
#define TYPE_FOR
constant string identifying the node type of an WHILE operation.
Support basic block for path profiling.
virtual ~EdgeCWriter() override
const BehavioralHelperConstRef CGetBehavioralHelper() const
Returns the helper associated with the function.
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
EdgeCWriter(const HLS_managerConstRef _HLSMgr, const InstructionWriterRef instruction_writer, const IndentedOutputStreamRef indented_output_stream, const ParameterConstRef Param, bool verbose=true)
Constructor of the class.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
std::string PrintVariable(unsigned int var) const
Print the name of the variable associated to the index.
void writeRoutineInstructions(const unsigned int function_index, const OpVertexSet &instructions, const var_pp_functorConstRef variableFunctor, vertex bb_start=NULL_VERTEX, CustomOrderedSet< vertex > bb_end=CustomOrderedSet< vertex >()) override
Writes the instructions of the current routine, being it a task or a function of the original program...
std::set< EdgeDescriptor, ltedge< BBGraph > > dumped_edges
Set of already dumped edges.
dominance< BBGraph > * dominators
This class stores dominator information.
const HLS_managerConstRef HLSMgr
the hls manager
std::map< unsigned int, std::string > basic_blocks_labels
size_t bb_label_counter
Counter of the invocations of writeRoutineInstructions; this counter allows to print different labels...
CustomOrderedSet< vertex > bb_analyzed
Class specification of the tree_reindex support class.
FunctionBehaviorConstRef local_rec_function_behavior
const OpGraphConstRef CGetOpGraph(FunctionBehavior::graph_type gt) const
This method returns the operation graphs.
virtual void print_edge(EdgeDescriptor e, unsigned int index)
Dump operation requested for instrument an edges.
Class specification of the basic_block structure.
virtual void print_loop_ending(EdgeDescriptor e)
Dump operations requested for record information about a loop path which ends.
const BBNodeInfoConstRef CGetBBNodeInfo(const vertex node) const
Return the info associated with a basic block.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
const BBGraphConstRef CGetBBGraph(FunctionBehavior::bb_graph_type gt=FunctionBehavior::BB) const
This method returns the basic block graphs.
const LoopsConstRef CGetLoops() const
Return the loops.
#define TYPE_WHILE
constant string identifying the node type of an WHILE operation.
interface of loops finding algorithm
virtual void print_loop_switching(EdgeDescriptor e)
Print operation requested for record information about a path which exit from a loop and immediately ...
Classes specification of the tree_node data structures not present in the gcc.
std::map< unsigned int, std::string > basic_block_prefix
string to be printed at the beginning of a given basic block
this class is used to manage the command-line or XML options.
#define TYPE_ENTRY
constant identifying the node type of an entry node.
Control flow graph with feedback.
unsigned counter[N_THREADS]
#define DOALL_LOOP
parallelizable for loop
std::map< vertex, std::map< unsigned int, std::string > > renaming_table
renaming table used by phi node destruction procedure
virtual const std::string get_label_name(unsigned int label_expr_nid) const
return the label name associated with the label expression
#define TYPE_RET
constant string identifying an operation node of type return expr
virtual void Initialize() override
Initialize data structure.
#define CFG_SELECTOR
Control flow graph edge selector.
var_pp_functorConstRef local_rec_variableFunctor
#define NULL_VERTEX
null vertex definition
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
CustomOrderedSet< vertex > local_rec_instructions
std::map< unsigned int, std::string > basic_block_tail
string to be printed at the end of a given basic block
const InstructionWriterRef instrWriter
Contains the class used to write instructions.
#define TYPE_LAST_OP
A vertex of type LAST_OP if it is the last operation of the application.
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 ...