70 const DesignFlowManagerConstRef _design_flow_manager,
const ParameterConstRef _parameters)
82 switch(relationship_type)
86 relationships.insert(std::make_pair(CALL_EXPR_FIX,
SAME_FUNCTION));
102 return relationships;
109 auto* fd = GetPointer<function_decl>(temp);
110 auto*
sl = GetPointer<statement_list>(
GET_NODE(fd->body));
112 std::map<unsigned int, blocRef>& list_of_bloc = sl->list_of_bloc;
113 std::map<unsigned int, blocRef>::iterator it3, it3_end = list_of_bloc.end();
118 std::vector<unsigned int>& succ_entry = entry_bloc->list_of_succ;
119 for(it3 = list_of_bloc.begin(); it3 != it3_end; ++it3)
121 std::vector<unsigned int>::iterator it2, it2_end;
124 it2_end = it3->second->list_of_pred.end();
125 for(it2 = it3->second->list_of_pred.begin(); it2 != it2_end; ++it2)
129 succ_entry.push_back(it3->second->number);
137 sl->list_of_bloc[
BB_ENTRY] = entry_bloc;
138 sl->list_of_bloc[
BB_EXIT] = exit_bloc;
143 for(
const auto&
block : sl->list_of_bloc)
145 for(
const auto& statement :
block.second->CGetStmtList())
147 const auto* gg = GetPointer<const gimple_goto>(
GET_NODE(statement));
151 "Unexpexted condition :" + gg->ToString());
155 const auto gs = GetPointer<const gimple_switch>(
GET_NODE(statement));
158 for(
const auto& vec_op : GetPointer<const tree_vec>(
GET_NODE(gs->op1))->list_of_op)
160 const auto cle = GetPointer<const case_label_expr>(
GET_NODE(vec_op));
161 if(cle->got and GetPointer<const label_decl>(
GET_NODE(cle->got)))
163 reachable_labels.insert(cle->got->index);
165 "---Found a reachable label " + cle->got->ToString());
171 std::list<std::pair<tree_nodeRef, unsigned int>> to_be_removed;
172 for(
const auto&
block : sl->list_of_bloc)
174 for(
const auto& statement :
block.second->CGetStmtList())
176 const auto* gl = GetPointer<const gimple_label>(
GET_NODE(statement));
179 const auto* ld = GetPointer<const label_decl>(
GET_NODE(gl->op));
180 if(ld and reachable_labels.find(ld->index) == reachable_labels.end())
183 "---Found a removable label " + statement->ToString());
184 to_be_removed.push_back(std::pair<tree_nodeRef, unsigned int>(statement,
block.first));
190 for(
const auto& removing : to_be_removed)
192 sl->list_of_bloc[removing.second]->RemoveStmt(removing.first,
AppM);
195 if(to_be_removed.empty())
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
This struct specifies the field bloc (basic block).
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
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.
#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.
BlockFix(const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Data structure describing a basic block at tree level.
Auxiliary methods for manipulating string.
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.
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 THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
~BlockFix() override
Destructor.
Target must be reexecuted.
#define BB_ENTRY
constant identifying the basic block node of type entry
Classes specification of the tree_node data structures.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
This struct specifies the block node.
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.
Class specification of the tree_reindex support class.
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.
DesignFlowStep_Status InternalExec() override
Updates the tree to have a more compliant CFG.
int debug_level
The debug level.
Analysis step that modifies the control flow graph of the tree to make it more compliant.
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 ...