62 const DesignFlowManagerConstRef _design_flow_manager,
75 switch(relationship_type)
79 relationships.insert(std::make_pair(EXTRACT_GIMPLE_COND_OP,
SAME_FUNCTION));
80 relationships.insert(std::make_pair(USE_COUNTING,
SAME_FUNCTION));
101 bool modified =
false;
102 const auto TreeM =
AppM->get_tree_manager();
104 const auto curr_tn = TreeM->CGetTreeNode(
function_id);
105 const auto Scpe = TreeM->CGetTreeReindex(
function_id);
106 const auto fd = GetPointerS<const function_decl>(curr_tn);
107 const auto sl = GetPointerS<const statement_list>(
GET_CONST_NODE(fd->body));
108 for(
const auto&
block : sl->list_of_bloc)
111 for(
const auto& stmt :
block.second->CGetStmtList())
119 const auto ga = GetPointerS<const gimple_assign>(
GET_CONST_NODE(stmt));
121 if(rhs_kind == unlt_expr_K || rhs_kind == unge_expr_K || rhs_kind == ungt_expr_K || rhs_kind == unle_expr_K ||
122 rhs_kind == ltgt_expr_K)
124 const auto be = GetPointerS<const binary_expr>(
GET_CONST_NODE(ga->op1));
125 const auto srcp_string = be->include_name +
":" +
STR(be->line_number) +
":" +
STR(be->column_number);
126 kind new_kind = error_mark_K;
127 if(rhs_kind == unlt_expr_K)
129 new_kind = ge_expr_K;
131 else if(rhs_kind == unge_expr_K)
133 new_kind = lt_expr_K;
135 else if(rhs_kind == ungt_expr_K)
137 new_kind = le_expr_K;
139 else if(rhs_kind == unle_expr_K)
141 new_kind = gt_expr_K;
143 else if(rhs_kind == ltgt_expr_K)
145 new_kind = eq_expr_K;
152 const auto booleanType = tree_man->GetBooleanType();
153 const auto new_be = tree_man->create_binary_operation(booleanType, be->op0, be->op1, srcp_string, new_kind);
154 const auto new_ga = tree_man->CreateGimpleAssign(booleanType, TreeM->CreateUniqueIntegerCst(0, booleanType),
155 TreeM->CreateUniqueIntegerCst(1, booleanType), new_be,
157 block.second->PushBefore(new_ga, stmt,
AppM);
159 const auto new_not = tree_man->create_unary_operation(
160 booleanType, GetPointerS<const gimple_assign>(
GET_CONST_NODE(new_ga))->op0, srcp_string,
164 const auto new_ga_not = tree_man->CreateGimpleAssign(
165 booleanType, TreeM->CreateUniqueIntegerCst(0, booleanType),
166 TreeM->CreateUniqueIntegerCst(1, booleanType), new_not,
function_id, srcp_string);
167 block.second->PushBefore(new_ga_not, stmt,
AppM);
168 const auto new_nop = tree_man->create_unary_operation(
169 be->type, GetPointerS<const gimple_assign>(
GET_CONST_NODE(new_ga_not))->op0, srcp_string,
171 TreeM->ReplaceTreeNode(stmt, ga->op1, new_nop);
175 TreeM->ReplaceTreeNode(stmt, ga->op1, new_not);
178 THROW_ASSERT(!ga->vdef && ga->vuses.empty() && ga->vovers.empty(),
"Unhandled virtual ssas");
#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;.
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.
Definition of the class representing a generic C application.
refcount< tree_manipulation > tree_manipulationRef
RelationshipType
The relationship type.
Source must be executed to satisfy target.
~UnComparisonLowering() override
Destructor.
Data structure describing a basic block at tree level.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
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.
DesignFlowStep_Status InternalExec() override
Fixes the var_decl duplication.
UnComparisonLowering(const application_managerRef AppM, unsigned int _function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
Target must be reexecuted.
#define GET_CONST_NODE(t)
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Step that replace uneq_expr, ltgt_expr, unge_expr, ungt_expr, unle_expr and unlt_expr.
Class defining some useful functions to create tree nodes and to manipulate the tree manager...
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.
int debug_level
The debug level.
#define GET_INDEX_CONST_NODE(t)
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
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 ...