65 const DesignFlowManagerConstRef _design_flow_manager,
const ParameterConstRef _parameters,
79 switch(relationship_type)
83 relationships.insert(std::make_pair(CHECK_SYSTEM_TYPE,
SAME_FUNCTION));
92 relationships.insert(std::make_pair(PARM_DECL_TAKEN_ADDRESS,
SAME_FUNCTION));
101 return relationships;
108 auto* fd = GetPointer<function_decl>(curr_tn);
109 auto*
sl = GetPointer<statement_list>(
GET_NODE(fd->body));
123 for(
const auto&
arg : fd->list_of_args)
125 recursive_examinate(
arg, already_examinated_decls, already_examinated_names, already_examinated_type_names,
129 std::map<unsigned int, blocRef>& blocks = sl->list_of_bloc;
130 std::map<unsigned int, blocRef>::iterator it, it_end;
132 it_end = blocks.end();
133 for(it = blocks.begin(); it != it_end; ++it)
135 for(
const auto& stmt : it->second->CGetStmtList())
137 recursive_examinate(stmt, already_examinated_decls, already_examinated_names, already_examinated_type_names,
158 case aggr_init_expr_K:
160 const call_expr* ce = GetPointer<call_expr>(curr_tn);
161 const std::vector<tree_nodeRef>&
args = ce->
args;
162 std::vector<tree_nodeRef>::const_iterator
arg, arg_end = args.end();
163 for(arg = args.begin(); arg != arg_end; ++
arg)
165 recursive_examinate(*arg, already_examinated_decls, already_examinated_names, already_examinated_type_names,
172 const gimple_call* ce = GetPointer<gimple_call>(curr_tn);
173 const std::vector<tree_nodeRef>&
args = ce->
args;
174 std::vector<tree_nodeRef>::const_iterator
arg, arg_end = args.end();
175 for(arg = args.begin(); arg != arg_end; ++
arg)
177 recursive_examinate(*arg, already_examinated_decls, already_examinated_names, already_examinated_type_names,
182 case gimple_assign_K:
184 auto* gm = GetPointer<gimple_assign>(curr_tn);
185 recursive_examinate(gm->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
187 recursive_examinate(gm->op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
192 already_examinated_type_names, already_visited_ae);
203 if(already_examinated_decls.find(
GET_INDEX_NODE(tn)) == already_examinated_decls.end())
206 auto* dn = GetPointer<decl_node>(
GET_NODE(tn));
208 already_examinated_type_names, already_visited_ae);
212 if(curr_tn->
get_kind() == var_decl_K)
214 auto* cast_res = GetPointer<var_decl>(curr_tn);
215 if(cast_res->static_flag)
218 "Found a static variable with identifier <" +
219 GetPointer<identifier_node>(
GET_NODE(dn->name))->strg +
"> within function #" +
224 std::string original_name =
Normalize(GetPointer<identifier_node>(
GET_NODE(dn->name))->strg);
226 if(already_examinated_names.find(original_name) == already_examinated_names.end())
228 already_examinated_names.insert(original_name);
234 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
235 unsigned int var_decl_name_nid_test;
236 unsigned var_decl_unique_id = 0;
240 var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
241 }
while(var_decl_name_nid_test);
242 unsigned int var_decl_name_nid = TM->new_tree_node_id();
243 TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
245 tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
246 dn->name = tr_new_id;
256 const ssa_name* sn = GetPointer<ssa_name>(curr_tn);
260 already_examinated_type_names, already_visited_ae);
270 already_examinated_names, already_examinated_type_names, already_visited_ae);
271 current = GetPointer<tree_list>(
GET_NODE(current))->chan;
277 if(curr_tn->
get_kind() == addr_expr_K)
279 if(already_visited_ae.find(
GET_INDEX_NODE(tn)) != already_visited_ae.end())
285 const unary_expr* ue = GetPointer<unary_expr>(curr_tn);
286 recursive_examinate(ue->
op, already_examinated_decls, already_examinated_names, already_examinated_type_names,
292 const binary_expr* be = GetPointer<binary_expr>(curr_tn);
293 recursive_examinate(be->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
295 recursive_examinate(be->
op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
301 const ternary_expr* te = GetPointer<ternary_expr>(curr_tn);
302 recursive_examinate(te->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
307 already_examinated_type_names, already_visited_ae);
312 already_examinated_type_names, already_visited_ae);
319 recursive_examinate(qe->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
324 already_examinated_type_names, already_visited_ae);
329 already_examinated_type_names, already_visited_ae);
334 already_examinated_type_names, already_visited_ae);
340 auto* le = GetPointer<lut_expr>(curr_tn);
341 recursive_examinate(le->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
343 recursive_examinate(le->op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
348 already_examinated_type_names, already_visited_ae);
353 already_examinated_type_names, already_visited_ae);
358 already_examinated_type_names, already_visited_ae);
363 already_examinated_type_names, already_visited_ae);
368 already_examinated_type_names, already_visited_ae);
373 already_examinated_type_names, already_visited_ae);
378 already_examinated_type_names, already_visited_ae);
384 const constructor* co = GetPointer<constructor>(curr_tn);
385 const std::vector<std::pair<tree_nodeRef, tree_nodeRef>>& list_of_idx_valu = co->
list_of_idx_valu;
386 std::vector<std::pair<tree_nodeRef, tree_nodeRef>>::const_iterator it, it_end = list_of_idx_valu.end();
387 for(it = list_of_idx_valu.begin(); it != it_end; ++it)
390 already_examinated_type_names, already_visited_ae);
396 const gimple_cond* gc = GetPointer<gimple_cond>(curr_tn);
397 recursive_examinate(gc->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
401 case gimple_switch_K:
403 const gimple_switch* se = GetPointer<gimple_switch>(curr_tn);
404 recursive_examinate(se->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
408 case gimple_multi_way_if_K:
410 auto* gmwi = GetPointer<gimple_multi_way_if>(curr_tn);
411 for(
const auto& cond : gmwi->list_of_cond)
416 already_examinated_type_names, already_visited_ae);
421 case gimple_return_K:
423 const gimple_return* re = GetPointer<gimple_return>(curr_tn);
427 already_examinated_type_names, already_visited_ae);
433 const gimple_for* fe = GetPointer<gimple_for>(curr_tn);
434 recursive_examinate(fe->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
436 recursive_examinate(fe->
op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
438 recursive_examinate(fe->
op2, already_examinated_decls, already_examinated_names, already_examinated_type_names,
444 const gimple_while* we = GetPointer<gimple_while>(curr_tn);
445 recursive_examinate(we->
op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
451 if(already_examinated_decls.find(
GET_INDEX_NODE(tn)) == already_examinated_decls.end())
454 auto* ty = GetPointer<type_node>(
GET_NODE(tn));
455 if(ty && ty->name &&
GET_NODE(ty->name)->get_kind() == type_decl_K)
458 already_examinated_type_names, already_visited_ae);
460 else if(ty and (not ty->system_flag) and ty->name and
461 (
GET_NODE(ty->name)->get_kind() == identifier_node_K) and (ty->get_kind() != integer_type_K))
463 std::string name_id = GetPointer<identifier_node>(
GET_NODE(ty->name))->strg;
464 if(already_examinated_type_names.find(name_id) == already_examinated_type_names.end())
466 already_examinated_type_names.insert(name_id);
472 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
473 unsigned int var_decl_name_nid_test;
474 unsigned var_decl_unique_id = 0;
478 var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
479 }
while(var_decl_name_nid_test);
480 unsigned int var_decl_name_nid = TM->new_tree_node_id();
481 TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
483 tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
484 ty->name = tr_new_id;
493 auto* td = GetPointer<type_decl>(
GET_NODE(tn));
494 if(td and td->name and td->include_name !=
"<built-in>" and (not td->operating_system_flag) and
495 (not td->library_system_flag))
497 std::string name_id = GetPointer<identifier_node>(
GET_NODE(td->name))->strg;
498 if(already_examinated_type_names.find(name_id) == already_examinated_type_names.end())
500 already_examinated_type_names.insert(name_id);
506 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
507 unsigned int var_decl_name_nid_test;
508 unsigned var_decl_unique_id = 0;
512 var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
513 }
while(var_decl_name_nid_test);
514 unsigned int var_decl_name_nid = TM->new_tree_node_id();
515 TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
517 tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
518 td->name = tr_new_id;
524 case target_mem_ref_K:
530 already_examinated_type_names, already_visited_ae);
535 already_examinated_type_names, already_visited_ae);
540 already_examinated_type_names, already_visited_ae);
544 case target_mem_ref461_K:
550 already_examinated_type_names, already_visited_ae);
555 already_examinated_type_names, already_visited_ae);
560 already_examinated_type_names, already_visited_ae);
569 case function_decl_K:
572 case template_decl_K:
576 case case_label_expr_K:
580 case gimple_pragma_K:
590 case gimple_predict_K:
591 case identifier_node_K:
593 case namespace_decl_K:
595 case placeholder_expr_K:
596 case statement_list_K:
597 case translation_unit_decl_K:
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
DesignFlowStep_Status InternalExec() override
Fixes the var_decl duplication.
#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.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
std::string ToString() const
Print this node as string in gimple format.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
Step successfully executed.
#define CASE_BINARY_EXPRESSION
This macro collects all case labels for binary_expr objects.
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 GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
tree_nodeRef idx
INDEX register.
std::vector< std::pair< tree_nodeRef, tree_nodeRef > > list_of_idx_valu
store the list initializers: <index, value>
RelationshipType
The relationship type.
Source must be executed to satisfy target.
tree_nodeRef var
var is the variable being referenced (macro SSA_NAME_VAR).
exceptions managed by PandA
tree_nodeRef op2
The third operand of the ternary expression.
tree_nodeRef op1
The second operand of the Quaternary expression.
A simple interface to token object of the raw files.
struct definition of the unary node structures.
tree_nodeRef base
BASE register.
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
tree_nodeRef op1
The second operand of the binary expression.
struct definition of the ternary node structures.
This struct specifies the gimple_cond node.
std::vector< tree_nodeRef > args
The arguments of the gimple_call.
Data structure describing a basic block at tree level.
Constructor: return an aggregate value made from specified components.
redefinition of map to manage ordered/unordered structures
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
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.
std::vector< tree_nodeRef > args
The arguments of the call_expr.
tree_nodeRef op3
The fourth operand of the Quaternary expression.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
virtual std::string get_kind_text() const =0
Virtual function returning the name of the actual class.
struct definition of the Quaternary node structures.
#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.
VarDeclFix(const application_managerRef AppM, unsigned int _function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters, const FrontendFlowStepType frontend_flow_step_type=VAR_DECL_FIX)
Constructor.
Low-level memory addressing.
This struct specifies the gimple_return node.
tree_nodeRef idx
INDEX register.
Target must be reexecuted.
Pre-analysis step fixing var_decl duplication.
tree_nodeRef base
BASE register.
tree_nodeRef op0
the branch var
Classes specification of the tree_node data structures.
static std::string NormalizeTypename(const std::string &id)
Return normalized name of types and variables.
GIMPLE_SWITCH <INDEX, DEFAULT_LAB, LAB1, ..., LABN> represents the multiway branch: ...
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
tree_nodeRef op0
The first operand of the ternary expression.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
virtual const std::string Normalize(const std::string &identifier) const
Return the normalized identifier; in this class it is the identifier itself.
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
This file collects some utility functions.
tree_nodeRef op0
The first operand of the binary expression.
tree_nodeRef GetTreeNode(const unsigned int index) const
Return the index-th tree_node (modifiable version)
enum FrontendFlowStepType { CREATE_TREE_MANAGER, FIND_MAX_TRANSFORMATIONS, FUNCTION_ANALYSIS, SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP, ADD_BB_ECFG_EDGES, ADD_ARTIFICIAL_CALL_FLOW_EDGES, ADD_OP_EXIT_FLOW_EDGES, ADD_OP_LOOP_FLOW_EDGES, ADD_OP_PHI_FLOW_EDGES, BAMBU_FRONTEND_FLOW, BASIC_BLOCKS_CFG_COMPUTATION, BB_CONTROL_DEPENDENCE_COMPUTATION, BB_FEEDBACK_EDGES_IDENTIFICATION, BB_ORDER_COMPUTATION, BB_REACHABILITY_COMPUTATION, BIT_VALUE, BIT_VALUE_OPT, BITVALUE_RANGE, BIT_VALUE_IPA, BLOCK_FIX, BUILD_VIRTUAL_PHI, CALL_EXPR_FIX, CALL_GRAPH_BUILTIN_CALL, CHECK_SYSTEM_TYPE, COMPLETE_BB_GRAPH, COMPLETE_CALL_GRAPH, COMPUTE_IMPLICIT_CALLS, COMMUTATIVE_EXPR_RESTRUCTURING, COND_EXPR_RESTRUCTURING, CSE_STEP, DATAFLOW_CG_EXT, DEAD_CODE_ELIMINATION, DEAD_CODE_ELIMINATION_IPA, DETERMINE_MEMORY_ACCESSES, DOM_POST_DOM_COMPUTATION, EXTRACT_GIMPLE_COND_OP, EXTRACT_PATTERNS, FIX_STRUCTS_PASSED_BY_VALUE, FUNCTION_CALL_TYPE_CLEANUP, FUNCTION_CALL_OPT, FANOUT_OPT, FIX_VDEF, HDL_FUNCTION_DECL_FIX, HDL_VAR_DECL_FIX, HLS_DIV_CG_EXT, HWCALL_INJECTION, INTERFACE_INFER, IR_LOWERING, LOOP_COMPUTATION, LOOPS_ANALYSIS_BAMBU, LOOPS_COMPUTATION, LUT_TRANSFORMATION, MULTI_WAY_IF, MULTIPLE_ENTRY_IF_REDUCTION, NI_SSA_LIVENESS, OP_CONTROL_DEPENDENCE_COMPUTATION, OP_FEEDBACK_EDGES_IDENTIFICATION, OP_ORDER_COMPUTATION, OP_REACHABILITY_COMPUTATION, OPERATIONS_CFG_COMPUTATION, PARM2SSA, PARM_DECL_TAKEN_ADDRESS, PHI_OPT, PREDICATE_STATEMENTS, ESSA, RANGE_ANALYSIS, REBUILD_INITIALIZATION, REBUILD_INITIALIZATION2, REMOVE_CLOBBER_GA, REMOVE_ENDING_IF, SCALAR_SSA_DATA_FLOW_ANALYSIS, SERIALIZE_MUTUAL_EXCLUSIONS, SPLIT_RETURN, SHORT_CIRCUIT_TAF, SIMPLE_CODE_MOTION, SOFT_FLOAT_CG_EXT, STRING_CST_FIX, SWITCH_FIX, UN_COMPARISON_LOWERING, UNROLLING_DEGREE, USE_COUNTING, VAR_ANALYSIS, VAR_DECL_FIX, VECTORIZE, VERIFICATION_OPERATION, VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS, VIRTUAL_PHI_NODES_SPLIT } FrontendFlowStepType
~VarDeclFix() override
Destructor.
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.
This struct specifies the call_expr node.
tree_nodeRef op1
initialization
tree_nodeRef op0
The first operand of the Quaternary expression.
tree_nodeRef op0
The first operand of the ternary expression.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
void recursive_examinate(const tree_nodeRef &tn, CustomUnorderedSet< unsigned int > &already_examinated_decls, CustomUnorderedSet< std::string > &already_examinated_names, CustomUnorderedSet< std::string > &already_examinated_type_names, CustomUnorderedSet< unsigned int > &already_visited_ae)
Recursive examinate tree node.
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
tree_nodeRef idx2
INDEX register.
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 CASE_CPP_NODES
This macro collects all case labels for cpp nodes.
Low-level memory addressing.
This struct specifies the ssa_name node.
tree_nodeRef op
op field is the operand of this node
This struct specifies the for expression Used to represent a for construct.
int debug_level
The debug level.
tree_nodeRef op2
postincrement
struct definition of the binary node structures.
tree_nodeRef op
op field is the operand of the unary expression
tree_nodeRef op0
The boolean condition.
tree_nodeRef symbol
static or global variable
tree_nodeRef op1
The second operand of the ternary expression.
This struct specifies the gimple_call node.
#define CASE_TERNARY_EXPRESSION
This macro collects all case labels for ternary_expr objects.
tree_nodeRef op2
The third operand of the Quaternary expression.
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
This struct specifies the while expression Used to represent a while construct.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
#define CASE_PRAGMA_NODES
This macro collects all case labels for pragma objects.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...