47 #include "config_HAVE_HOST_PROFILING_BUILT.hpp" 67 #if HAVE_HOST_PROFILING_BUILT 83 function_behavior(_g->CGetBBGraphInfo()->AppM->CGetFunctionBehavior(_g->CGetBBGraphInfo()->function_index)),
84 helper(function_behavior->CGetBehavioralHelper()),
85 annotated(
std::move(_annotated))
91 GetPointer<const
HLS_manager>(_g->CGetBBGraphInfo()->AppM)->get_HLS(helper->get_function_index())->Rsch :
101 if(v == info->entry_vertex)
103 out <<
"[color=blue,shape=Msquare, ";
106 out <<
" style=filled, fillcolor=black, fontcolor=white,";
108 out <<
"label=\"ENTRY";
110 else if(v == info->exit_vertex)
112 out <<
"[color=blue,shape=Msquare, ";
115 out <<
" style=filled, fillcolor=black, fontcolor=white,";
117 out <<
"label=\"EXIT";
124 out <<
", style=filled, fillcolor=black, fontcolor=white";
126 if(bb_node_info and bb_node_info->block)
128 out <<
", label=\"BB" << bb_node_info->block->number <<
" - GCCLI: " << bb_node_info->block->loop_id
129 <<
" - HPL: " << bb_node_info->block->hpl <<
" - Cer: " << bb_node_info->cer;
130 out <<
" - Loop " << bb_node_info->loop_id;
131 #if HAVE_HOST_PROFILING_BUILT 132 out <<
" - Executions: " <<
function_behavior->CGetProfilingInformation()->GetBBExecutions(v);
135 if(bb_node_info and bb_node_info->block->CGetPhiList().size() and
helper)
138 for(
const auto&
phi : bb_node_info->block->CGetPhiList())
141 auto res =
STR(
phi->index);
145 res +=
" " + schedule->PrintTimingInformation(
phi->index) +
" ";
148 res +=
" -> " +
helper->PrintNode(
phi,
nullptr, svpf);
161 out << temp <<
"\\l";
164 if(bb_node_info and bb_node_info->block->CGetStmtList().size() and
helper)
166 if(bb_node_info->block->CGetPhiList().empty())
170 for(
const auto& statement : bb_node_info->block->CGetStmtList())
177 res +=
" " + schedule->PrintTimingInformation(statement->index) +
" ";
180 res +=
" -> " +
helper->PrintNode(statement,
nullptr, svpf);
184 case gimple_assign_K:
188 case gimple_predict_K:
196 case aggr_init_expr_K:
197 case case_label_expr_K:
202 case gimple_multi_way_if_K:
205 case gimple_pragma_K:
206 case gimple_return_K:
207 case gimple_switch_K:
209 case identifier_node_K:
211 case statement_list_K:
213 case target_mem_ref_K:
214 case target_mem_ref461_K:
244 out << temp <<
"\\l";
252 :
EdgeWriter(operation_graph, 0), BH(operation_graph->CGetOpGraphInfo()->BH)
260 out <<
"[color=gold";
264 out <<
"[fontcolor=red3";
269 out <<
"[color=gold,style=dotted";
273 out <<
"[color=gold";
278 out <<
"[color=red3,style=dotted";
282 out <<
"[color=red3";
286 out <<
"[color=lightblue";
290 out <<
"[color=blue, style=dotted";
294 out <<
"[color=blue";
298 out <<
"[color=lawngreen";
302 out <<
"[color=green4";
306 out <<
"[color=lawngreen";
310 out <<
"[color=green4";
314 out <<
"[color=red3";
318 out <<
"[color=blue";
322 out <<
"[color=gold";
326 out <<
"[color=lightblue";
330 out <<
"[color=red3";
334 out <<
"[color=red3";
339 out <<
"[color=pink,style=dotted";
343 out <<
"[color=pink";
347 out <<
"[color=pink";
350 const auto* edge_info = Cget_edge_info<OpEdgeInfo>(e, *
printing_graph);
357 if(edge_info->CdgEdgeT() || edge_info->CdgEdgeF() || edge_info->Switch())
364 if(edge_info->CfgEdgeT() || edge_info->CfgEdgeF() || edge_info->Switch())
371 if(edge_info->FlgEdgeT() || edge_info->FlgEdgeF())
395 BH(_g->CGetBBGraphInfo()
396 ->AppM->CGetFunctionBehavior(_g->CGetBBGraphInfo()->function_index)
397 ->CGetBehavioralHelper())
405 out <<
"[fontcolor=blue, color=gold";
409 out <<
"[fontcolor=blue, color=red3";
413 out <<
"[fontcolor=blue, color=red3";
417 out <<
"[fontcolor=blue";
421 out <<
"[fontcolor=blue";
425 out <<
"[fontcolor=blue, color=gold";
429 out <<
"[fontcolor=blue, color=gold";
433 out <<
"[fontcolor=blue, color=gold";
444 out << std::to_string(bb_edge_info->get_epp_value());
449 if(bb_edge_info->CfgEdgeT() || bb_edge_info->CfgEdgeF() || bb_edge_info->Switch())
458 if(bb_edge_info->CdgEdgeT() || bb_edge_info->CdgEdgeF() || bb_edge_info->Switch())
469 :
VertexWriter(operation_graph, _detail_level), helper(operation_graph->CGetOpGraphInfo()->
BH)
478 out <<
"[color=red,shape=diamond,";
482 out <<
"[color=green,shape=box,";
486 out <<
"[color=red,shape=box,";
490 out <<
"[color=green,shape=box,";
494 out <<
"[color=burlywood,shape=diamond,";
498 out <<
"[color=yellow,shape=box,";
502 out <<
"[color=burlywood,shape=box,";
506 out <<
"[color=blue,shape=Msquare,";
510 out <<
"[shape=ellipse,";
514 out <<
" - " << op_graph->CGetOpNodeInfo(v)->GetOperation();
517 if(op_graph->CGetOpNodeInfo(v)->node)
526 op_graph->CGetOpNodeInfo(v)->Print(out,
helper,
true);
533 TimedOpWriter::TimedOpWriter(
const OpGraph* op_graph,
const hlsConstRef _HLS,
535 :
OpWriter(op_graph, 0), HLS(_HLS), critical_paths(_critical_paths)
539 void TimedOpWriter::operator()(std::ostream& out,
const vertex& v)
const 541 const auto schedule = HLS->Rsch;
543 const unsigned node_id = op_graph->
CGetOpNodeInfo(v)->GetNodeId();
544 if(critical_paths.find(node_id) != critical_paths.end())
546 out <<
"[color=red,";
553 out <<
"[" << schedule->GetStartingTime(node_id) <<
"---" << schedule->GetEndingTime(node_id) <<
"]";
555 out <<
" - " << HLS->allocation_information->get_fu_name(HLS->allocation_information->GetFuType(node_id)).first;
572 TimedOpEdgeWriter::TimedOpEdgeWriter(
const OpGraph* _operation_graph,
const hlsConstRef _HLS,
574 :
OpEdgeWriter(_operation_graph), HLS(_HLS), critical_paths(std::move(_critical_paths))
578 void TimedOpEdgeWriter::operator()(std::ostream& out,
const EdgeDescriptor& e)
const 583 const auto source_id = op_graph->
CGetOpNodeInfo(source)->GetNodeId();
586 if(critical_paths.find(source_id) != critical_paths.end() and critical_paths.find(target_id) != critical_paths.end())
592 << HLS->allocation_information->GetConnectionTime(
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define TYPE_SWITCH
constant identifying the node type of a SWITCH operation.
#define FLG_SELECTOR
Flow edge selector.
int GetSelector() const
Return the selector of this graph.
Data structure representing the entire HLS information.
#define GET_TYPE(data, vertex_index)
Helper macro returning the type associated with a node.
const int detail_level
The detail level.
OpEdgeWriter(const OpGraph *operation_graph)
Constructor.
const graph * printing_graph
The graph to be printed.
#define CASE_BINARY_EXPRESSION
This macro collects all case labels for binary_expr objects.
#define TYPE_IF
constant identifying the node type of an IF operation.
Definition of the class representing a generic C application.
#define CASE_DECL_NODES
NOTE that cast_expr is a unary expression but it could not be included in the CASE_UNARY_EXPRESSION b...
void operator()(std::ostream &out, const vertex &v) const override
Operator used to print the label of a vertex.
Edge writer for operation graph.
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
exceptions managed by PandA
#define FCFG_SELECTOR
Control flow graph with feedback edges.
#define DEBUG_SELECTOR
Debug selector.
#define D_SELECTOR
Selectors used only in basic block graphs; numbers continue from cdfg_edge_info.hpp.
static const ControlStep UNKNOWN
Constant used to specify unknown control step.
const BehavioralHelperConstRef helper
The behavioral helper.
Definition of hash function for EdgeDescriptor.
refcount< const OpGraph > OpGraphConstRef
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define FADG_SELECTOR
Anti-dependence graph selector with feedback edges.
CustomUnorderedSet< vertex > annotated
The set of vertices to be annotated.
#define FB_FLG_SELECTOR
Feedback flow edge selector.
#define FB_CDG_SELECTOR
Feedback control dependence edge selector.
Data structure describing a basic block at tree level.
Base class description of data information associated with each node of a graph.
redefinition of map to manage ordered/unordered structures
Absolute Control step First field is the basic block Second field is the relative control step...
#define TYPE_LOAD
Constant string identifying a memory load operation.
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.
Auxiliary methods for manipulating string.
#define FB_CFG_SELECTOR
Feedback control flow edge selector.
const graph * printing_graph
The graph to be printed.
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
#define TYPE_EXIT
constant identifying the node type of an exit node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
const BehavioralHelperConstRef BH
The helper used to print the labels.
Standard functor that returns the name of a variable.
#define J_SELECTOR
j graph edge selector for dj graph (used during loop computation)
Class used to describe a particular graph with basic blocks as nodes.
#define TYPE_GOTO
A vertex is of type TYPE_GOTO when it is associated with a goto expression.
#define PP_SELECTOR
Path Profiling Basic Block edge selector.
#define CDG_SELECTOR
Control dependence edge selector.
Data structure used to store the schedule of the operations.
Functor used to write the content of a vertex to dotty file.
#define CASE_QUATERNARY_EXPRESSION
This macro collects all case labels for quaternary_expr objects.
#define CASE_UNARY_EXPRESSION
This macro collects all case labels for unary_expr objects.
#define ODG_SELECTOR
Output-dependence graph edge selector.
This C++ header file contains common macros for the tree structure.
#define TYPE_EXTERNAL
constant identifying the node type of a EXTERNAL operation (a function call)
#define CSG_SELECTOR
Control edge in a speculation graph.
#define TYPE_STORE
Constant string identifying a memory store operation.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
const int selector
The selector of the graph to be printed.
void operator()(std::ostream &out, const EdgeDescriptor &e) const override
Operator which print label of an EdgeDescriptor.
Classes specification of the tree_node data structures.
#define FDFG_SELECTOR
Data flow graph with feedback edges.
void operator()(std::ostream &out, const EdgeDescriptor &e) const override
Operator used to print an edge.
#define DFG_SELECTOR
Data flow graph edge selector.
#define ADG_SELECTOR
Anti-dependence graph edge selector.
#define TYPE_ASSIGN
constant string identifying the node type of an ASSIGN operation.
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
#define FB_DFG_SELECTOR
Feedback Data flow graph edge selector.
Data structures used to represent an edge in operation and basic block graphs.
#define FODG_SELECTOR
Output-dependence graph selector with feedback edges.
#define DFG_SCA_SELECTOR
Selectors used only in operation graphs; numbers continue from cdfg_edge_info.hpp.
#define TYPE_MEMCPY
A vertex is of type TYPE_MEMCPY when it is associated with a assignment between struct/union.
#define CASE_CST_NODES
This macro collects all case labels for cast nodes.
Functor used to write the content of the edges to a dotty file.
BBWriter(const BBGraph *g, CustomUnorderedSet< vertex > annotated=CustomUnorderedSet< vertex >())
The constructor.
Class specification of the tree_reindex support class.
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
Collect all structs used to write a graph in the dot format.
T * GetPointer(const refcount< U > &t)
Template function used to hide dynamic_cast The template parameter T represents a type of an object h...
Class specification of the basic_block structure.
const BehavioralHelperConstRef BH
The helper used to print the labels.
#define PD_SELECTOR
post-dominator graph edge selector
const FunctionBehaviorConstRef function_behavior
The function behavior.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
#define CASE_CPP_NODES
This macro collects all case labels for cpp nodes.
#define TYPE_ENTRY
constant identifying the node type of an entry node.
#define DFG_AGG_SELECTOR
Data flow graph edge selector between computed on aggregates.
void operator()(std::ostream &out, const vertex &v) const override
Functor to print the label of a vertex.
Class used to describe a particular graph with operations as nodes.
#define CFG_SELECTOR
Control flow graph edge selector.
Data structure definition for high-level synthesis flow.
#define FB_ODG_SELECTOR
Feedback Output-dependence graph edge selector.
#define ECFG_SELECTOR
Extended control flow graph selector.
BBEdgeWriter(const BBGraph *g)
Constructor.
#define CASE_TERNARY_EXPRESSION
This macro collects all case labels for ternary_expr objects.
const BehavioralHelperConstRef helper
The helper.
A brief description of the C++ Header File.
#define FB_ADG_SELECTOR
Feedback anti-dependence graph edge selector.
OpWriter(const OpGraph *operation_graph, const int detail_level)
Constructor.
#define FCDG_SELECTOR
Control dependence graph selector with feedback edges.
#define CASE_PRAGMA_NODES
This macro collects all case labels for pragma objects.
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.