91 switch(relationship_type)
111 return relationships;
116 const auto CG =
AppM->CGetCallGraphManager();
117 const auto TM =
AppM->get_tree_manager();
118 const auto reached_body_fun_ids = CG->GetReachedBodyFunctions();
120 for(
const auto& function_id : reached_body_fun_ids)
122 const auto curr_tn = TM->GetTreeNode(function_id);
123 const auto fd = GetPointerS<function_decl>(curr_tn);
124 const auto sl = GetPointerS<statement_list>(
GET_NODE(fd->body));
125 const std::string srcp_default = fd->include_name +
":" +
STR(fd->line_number) +
":" +
STR(fd->column_number);
127 for(
auto&
arg : fd->list_of_args)
132 std::map<unsigned int, blocRef>& blocks = sl->list_of_bloc;
133 std::map<unsigned int, blocRef>::iterator it, it_end;
135 it_end = blocks.end();
136 for(it = blocks.begin(); it != it_end; ++it)
138 for(
auto stmt : it->second->CGetStmtList())
142 for(
auto phi : it->second->CGetPhiList())
164 case aggr_init_expr_K:
166 auto* ce = GetPointer<call_expr>(curr_tn);
167 for(
auto&
arg : ce->args)
175 auto* ce = GetPointer<gimple_call>(curr_tn);
176 for(
auto&
arg : ce->args)
182 case gimple_assign_K:
184 auto* gm = GetPointer<gimple_assign>(curr_tn);
187 if(
GET_NODE(gm->op0)->get_kind() == var_decl_K &&
188 (
GET_NODE(gm->op1)->get_kind() == string_cst_K ||
GET_NODE(gm->op1)->get_kind() == constructor_K))
190 auto* vd = GetPointer<var_decl>(
GET_NODE(gm->op0));
192 if(vd->readonly_flag)
195 gm->init_assignment =
true;
199 else if(
GET_NODE(gm->op0)->get_kind() == var_decl_K &&
GET_NODE(gm->op1)->get_kind() == var_decl_K &&
200 GetPointer<var_decl>(
GET_NODE(gm->op1))->
init && GetPointer<var_decl>(
GET_NODE(gm->op1))->used == 0)
202 auto* vd = GetPointer<var_decl>(
GET_NODE(gm->op0));
204 if(vd->readonly_flag)
206 vd->init = GetPointer<var_decl>(
GET_NODE(gm->op1))->
init;
207 gm->init_assignment =
true;
212 auto* vd1 = GetPointer<var_decl>(
GET_NODE(gm->op1));
213 vd1->include_name = gm->include_name;
214 vd1->line_number = gm->line_number;
215 vd1->column_number = gm->column_number;
218 if(!gm->init_assignment)
220 if(
GET_NODE(gm->op0)->get_kind() == var_decl_K &&
221 GetPointer<var_decl>(
GET_NODE(gm->op0))->readonly_flag &&
GET_NODE(gm->op1)->get_kind() == ssa_name_K)
223 GetPointer<var_decl>(
GET_NODE(gm->op0))->readonly_flag =
false;
246 auto* sn = GetPointer<ssa_name>(curr_tn);
259 current = GetPointer<tree_list>(
GET_NODE(current))->chan;
265 if(curr_tn->
get_kind() == addr_expr_K)
273 auto* ue = GetPointer<unary_expr>(curr_tn);
279 auto* be = GetPointer<binary_expr>(curr_tn);
286 auto* te = GetPointer<ternary_expr>(curr_tn);
300 auto* qe = GetPointer<quaternary_expr>(curr_tn);
318 auto* le = GetPointer<lut_expr>(curr_tn);
353 auto* co = GetPointer<constructor>(curr_tn);
354 std::vector<std::pair<tree_nodeRef, tree_nodeRef>>& list_of_idx_valu = co->list_of_idx_valu;
355 std::vector<std::pair<tree_nodeRef, tree_nodeRef>>::iterator it, it_end = list_of_idx_valu.end();
356 for(it = list_of_idx_valu.begin(); it != it_end; ++it)
364 auto* gc = GetPointer<gimple_cond>(curr_tn);
368 case gimple_switch_K:
370 auto* se = GetPointer<gimple_switch>(curr_tn);
374 case gimple_multi_way_if_K:
376 auto* gmwi = GetPointer<gimple_multi_way_if>(curr_tn);
377 for(
auto cond : gmwi->list_of_cond)
386 case gimple_return_K:
388 auto* re = GetPointer<gimple_return>(curr_tn);
397 auto* fe = GetPointer<gimple_for>(curr_tn);
405 auto* we = GetPointer<gimple_while>(curr_tn);
411 auto* gp = GetPointer<gimple_phi>(curr_tn);
412 for(
auto def_edge_pair : gp->list_of_def_edge)
423 case target_mem_ref_K:
425 auto* tmr = GetPointer<target_mem_ref>(curr_tn);
440 case target_mem_ref461_K:
442 auto* tmr = GetPointer<target_mem_ref461>(curr_tn);
461 auto* sc = GetPointer<string_cst>(curr_tn);
463 const auto* type_sc = GetPointer<const type_node>(
GET_NODE(sc->type));
464 const std::string local_var_name =
"__bambu_artificial_var_string_cst_" +
STR(
GET_INDEX_NODE(tn));
465 auto local_var_identifier = tree_man->create_identifier_node(local_var_name);
466 auto global_scpe = tree_man->create_translation_unit_decl();
468 tree_man->create_var_decl(local_var_identifier, TM->CGetTreeReindex(
GET_INDEX_NODE(sc->type)),
471 1,
true, -1,
false,
false,
true,
false,
true);
485 case function_decl_K:
488 case template_decl_K:
492 case case_label_expr_K:
496 case gimple_pragma_K:
505 case gimple_predict_K:
506 case identifier_node_K:
508 case namespace_decl_K:
510 case placeholder_expr_K:
511 case statement_list_K:
512 case translation_unit_decl_K:
#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.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
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.
File containing functions and utilities to support the printing of debug messagges.
std::string ToString() const
Print this node as string in gimple format.
#define CASE_BINARY_EXPRESSION
This macro collects all case labels for binary_expr objects.
CustomUnorderedSet< unsigned int > already_visited_ae
Already visited address expression (used to avoid infinite recursion)
#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
struct definition of the source position.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
exceptions managed by PandA
#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.
redefinition of map to manage ordered/unordered structures
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.
string_cst_fix(const application_managerRef AppM, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
#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.
Pre-analysis step fixing readonly initializations and string_cst references.
DesignFlowStep_Status Exec() override
Fixes the var_decl duplication.
#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.
Target must be reexecuted.
void recursive_analysis(tree_nodeRef &tn, const std::string &srcp)
Recursive tree node analysis.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Class defining some useful functions to create tree nodes and to manipulate the tree manager...
#define DEBUG_LEVEL_NONE
no debugging print is performed.
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
void init(int bucket[BUCKETSIZE])
CustomUnorderedMap< unsigned int, tree_nodeRef > string_cst_map
relation between constant string and read-only variable initialized with the string_cst.
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...
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
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.
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
int debug_level
The debug level.
~string_cst_fix() override
Destructor.
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
#define CASE_TERNARY_EXPRESSION
This macro collects all case labels for ternary_expr objects.
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
#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 ...