64 const DesignFlowManagerConstRef _design_flow_manager,
77 switch(relationship_type)
81 relationships.insert(std::make_pair(OPERATIONS_CFG_COMPUTATION,
SAME_FUNCTION));
82 relationships.insert(std::make_pair(DOM_POST_DOM_COMPUTATION,
SAME_FUNCTION));
83 relationships.insert(std::make_pair(EXTRACT_GIMPLE_COND_OP,
SAME_FUNCTION));
104 if(boost::num_vertices(*flg) != 0)
107 for(boost::tie(edge, edge_end) =
boost::edges(*flg); edge != edge_end; edge++)
127 const auto bb_index_map = dom_tree->CGetBBGraphInfo()->bb_index_map;
130 for(boost::tie(operation, operation_end) = boost::vertices(*fcfg); operation != operation_end; operation++)
136 const auto bb_vertex = bb_index_map.find(bb_index)->second;
138 bool found_feedback_edge =
false;
140 for(boost::tie(ie, ie_end) = boost::in_edges(bb_vertex, *bb_fcfg); ie != ie_end; ie++)
144 found_feedback_edge =
true;
148 if(found_feedback_edge)
152 boost::tie(ie, ie_end) = boost::in_edges(bb_vertex, *dom_tree);
153 const auto dominator = boost::source(*ie, *dom_tree);
154 const auto dominator_statements = dom_tree->CGetBBNodeInfo(dominator)->block->CGetStmtList();
156 "BB" +
STR(dom_tree->CGetBBNodeInfo(dominator)->block->number) +
" is empty");
157 const auto last_statement =
GET_NODE(dominator_statements.back());
159 if(last_statement->get_kind() == gimple_cond_K)
161 const auto gc = GetPointer<const gimple_cond>(last_statement);
162 if(
GET_NODE(gc->op0)->get_kind() == integer_cst_K)
168 "Operand of gimple_cond is " + gc->op0->ToString());
169 const auto ssa = GetPointer<const ssa_name>(
GET_NODE(gc->op0));
170 const auto def_stmt_node = ssa->CGetDefStmt();
171 if(GetPointer<gimple_nop>(
GET_NODE(def_stmt_node)))
176 const auto def_stmt_index = def_stmt_node->index;
179 "Vertex corresponding to " + ssa->CGetDefStmt()->ToString() +
" not found");
180 const auto def_stmt_vertex = fcfg->
CGetOpGraphInfo()->tree_node_to_operation.find(def_stmt_index)->second;
183 else if(last_statement->get_kind() == gimple_multi_way_if_K)
186 const auto gmwi = GetPointer<const gimple_multi_way_if>(last_statement);
187 for(
const auto& cond : gmwi->list_of_cond)
189 const auto cond_bb = bb_index_map.find(cond.second)->second;
191 ((cond.second == bb_index) or
function_behavior->CheckBBReachability(cond_bb, bb_vertex)))
193 if(
GET_NODE(cond.first)->get_kind() == integer_cst_K)
196 "<--Considered " +
GET_NAME(fcfg, *operation));
200 "Operand of gimple_multi_way_if is " + cond.first->ToString());
201 const auto ssa = GetPointer<const ssa_name>(
GET_NODE(cond.first));
203 const auto def_stmt_index = ssa->CGetDefStmt()->index;
204 const auto def_stmt_vertex =
205 fcfg->
CGetOpGraphInfo()->tree_node_to_operation.find(def_stmt_index)->second;
210 else if(last_statement->get_kind() == gimple_switch_K)
212 const auto gs = GetPointer<const gimple_switch>(last_statement);
214 "Operand of gimple_switch is " + gs->op0->ToString());
215 const auto ssa = GetPointer<const ssa_name>(
GET_NODE(gs->op0));
216 if(not ssa->var or
GET_NODE(ssa->var)->get_kind() != parm_decl_K)
218 const auto def_stmt_index = ssa->CGetDefStmt()->index;
221 "Vertex corresponding to " + ssa->CGetDefStmt()->ToString() +
" not found");
222 const auto def_stmt_vertex =
223 fcfg->
CGetOpGraphInfo()->tree_node_to_operation.find(def_stmt_index)->second;
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define FLG_SELECTOR
Flow edge selector.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
Analysis step which adds flow edges from the computation of the condition(s) of gimple_cond and gimpl...
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
#define GET_TYPE(data, vertex_index)
Helper macro returning the type associated with a node.
File containing functions and utilities to support the printing of debug messagges.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
#define GET_NAME(data, vertex_index)
Helper macro returning the name associated with a node.
boost::graph_traits< graph >::in_edge_iterator InEdgeIterator
in_edge_iterator definition.
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 TYPE_PHI
constant string identifying an operation node of type PHI
#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.
AddOpPhiFlowEdges(const application_managerRef AppM, const unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
boost::graph_traits< graph >::edge_iterator EdgeIterator
edge_iterator definition.
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
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.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
This class specifies the characteristic of a particular operation working on a given functional unit...
Basic block dominator tree.
Basic block control flow graph with feedback.
Target must be reexecuted.
const OpGraphInfoConstRef CGetOpGraphInfo() const
Returns the property associated with the graph.
~AddOpPhiFlowEdges() override
Destructor.
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
DesignFlowStep_Status InternalExec() override
Performs the adding of flow edges to operation graphs.
Class specification of the tree_reindex support class.
Class specification of the basic_block structure.
This file collects some hash functors.
Data structures used in operations graph.
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.
Control flow graph with feedback.
int debug_level
The debug level.
This class provides methods to build an operations graph.
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 ...