48 #if HAVE_HOST_PROFILING_BUILT 86 const DesignFlowManagerConstRef _design_flow_manager)
98 switch(relationship_type)
102 relationships.insert(std::make_pair(COMPLETE_BB_GRAPH,
SAME_FUNCTION));
105 relationships.insert(std::make_pair(HDL_VAR_DECL_FIX,
SAME_FUNCTION));
109 relationships.insert(std::make_pair(VAR_DECL_FIX,
SAME_FUNCTION));
111 relationships.insert(std::make_pair(EXTRACT_PATTERNS,
SAME_FUNCTION));
120 relationships.insert(std::make_pair(COND_EXPR_RESTRUCTURING,
SAME_FUNCTION));
121 relationships.insert(std::make_pair(CSE_STEP,
SAME_FUNCTION));
122 relationships.insert(std::make_pair(FANOUT_OPT,
SAME_FUNCTION));
123 relationships.insert(std::make_pair(FUNCTION_CALL_OPT,
SAME_FUNCTION));
124 relationships.insert(std::make_pair(IR_LOWERING,
SAME_FUNCTION));
126 relationships.insert(std::make_pair(SDC_CODE_MOTION,
SAME_FUNCTION));
128 relationships.insert(std::make_pair(UN_COMPARISON_LOWERING,
SAME_FUNCTION));
136 return relationships;
144 #if HAVE_HOST_PROFILING_BUILT 152 const auto TM =
AppM->get_tree_manager();
154 const auto fd = GetPointer<const function_decl>(TM->CGetTreeNode(
function_id));
155 THROW_ASSERT(fd && fd->body,
"Node is not a function or it hasn't a body");
158 for(
const auto& id_bb :
sl->list_of_bloc)
160 const auto& bb = id_bb.second;
165 bbgc->add_vertex(bb);
169 const auto exit = bbgc->Cget_vertex(
BB_EXIT);
170 bbgc->connect_to_entry(exit);
173 for(
const auto& id_bb :
sl->list_of_bloc)
175 const auto& bb = id_bb.second;
180 bbgc->add_vertex(bb);
183 for(
const auto& id_bb :
sl->list_of_bloc)
185 const auto& bb = id_bb.second;
191 const auto current = bbgc->Cget_vertex(bb->number);
192 if(bb->list_of_pred.empty() || std::count(bb->list_of_pred.begin(), bb->list_of_pred.end(),
bloc::ENTRY_BLOCK_ID))
195 "---Connecting Basic block " +
STR(bb->number) +
" to ENTRY");
196 bbgc->connect_to_entry(current);
198 for(
const auto su : bb->list_of_succ)
203 "---Connecting Basic block " +
STR(bb->number) +
" to EXIT");
204 bbgc->connect_to_exit(current);
209 "---Connecting Basic block " +
STR(bb->number) +
" to " +
STR(su));
210 bbgc->AddEdge(current, bbgc->Cget_vertex(su),
CFG_SELECTOR);
212 if(su == bb->true_edge)
216 if(su == bb->false_edge)
222 const auto& statements = bb->CGetStmtList();
223 if(!statements.empty())
225 const auto& last = statements.back();
231 std::map<tree_nodeRef, unsigned int> label_to_bb;
232 for(
const auto su : bb->list_of_succ)
234 THROW_ASSERT(
sl->list_of_bloc.at(su)->CGetStmtList().size(),
"Empty Basic Block");
235 const auto first =
sl->list_of_bloc.at(su)->CGetStmtList().front();
237 "First operation of BB" +
STR(su) +
" is a " +
GET_CONST_NODE(first)->get_kind_text() +
239 const auto le = GetPointerS<const gimple_label>(
GET_CONST_NODE(first));
244 const auto se = GetPointer<const gimple_switch>(
GET_CONST_NODE(last));
246 const auto tv = GetPointer<const tree_vec>(
GET_CONST_NODE(se->op1));
248 for(
const auto& op : tv->list_of_op)
250 const auto cl = GetPointer<const case_label_expr>(
GET_CONST_NODE(op));
252 "There is not corresponding case_label_exprs with index " +
268 else if(
GET_CONST_NODE(last)->get_kind() == gimple_goto_K && bb->list_of_succ.size() > 1)
271 for(
const auto su : bb->list_of_succ)
273 bbgc->add_bb_edge_info(current, bbgc->Cget_vertex(su),
CFG_SELECTOR, su);
277 else if(
GET_CONST_NODE(last)->get_kind() == gimple_multi_way_if_K)
279 const auto gmwi = GetPointerS<const gimple_multi_way_if>(
GET_CONST_NODE(last));
280 for(
const auto& cond : gmwi->list_of_cond)
282 bbgc->add_bb_edge_info(current, bbgc->Cget_vertex(cond.second),
CFG_SELECTOR,
289 const auto exit = bbgc->Cget_vertex(
BB_EXIT);
291 BOOST_FOREACH(
vertex v, boost::vertices(*fcfg))
293 if(boost::out_degree(v, *fcfg) == 0 && v != exit)
298 if(
parameters->getOption<
bool>(OPT_print_dot))
BasicBlocksCfgComputation(const ParameterConstRef _parameters, const application_managerRef AppM, unsigned int _function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
Basic block control flow graph.
File containing functions and utilities to support the printing of debug messagges.
~BasicBlocksCfgComputation() override
Destructor.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
#define BB_EXIT
constant identifying the basic block node of type exit
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
Class specification of the graph structures.
Analysis step creating the control flow graph for the operations.
A simple interface to token object of the raw files.
static const unsigned int EXIT_BLOCK_ID
constant identifying the exit basic block
This class provides methods to build a basic blocks graph.
Data structure describing a basic block at tree level.
unsigned int bb_version
The version of the basic block intermediate representation on which this step has been applied...
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
std::string ToString(ActorGraphBackend_Type actor_graph_backend_type)
Header include.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
DesignFlowStep_Status InternalExec() override
Computes the basic block graph structure.
Build basic block control flow graph data structure starting from the tree_manager.
#define default_COND
constant used to represent label "default" of a switch construct
Classes to describe design flow graph.
Basic block control flow graph with feedback.
Target must be reexecuted.
#define BB_ENTRY
constant identifying the basic block node of type entry
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
#define T_COND
constant used to represent control edges representing a true edge of a conditional statement...
#define GET_CONST_NODE(t)
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
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.
static const unsigned int ENTRY_BLOCK_ID
constant identifying the entry basic block
Collect all structs used to write a graph in the dot format.
Class specification of the basic_block structure.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
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.
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.
#define F_COND
constant used to represent control edges representing a false edge of a conditional statement...
int debug_level
The debug level.
This class provides methods to build an operations graph.
#define GET_INDEX_CONST_NODE(t)
#define CFG_SELECTOR
Control flow graph edge selector.
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.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...