57 const DesignFlowManagerConstRef dfm)
70 switch(relationship_type)
74 relationships.insert(std::make_pair(CHECK_SYSTEM_TYPE,
SAME_FUNCTION));
75 relationships.insert(std::make_pair(FIX_STRUCTS_PASSED_BY_VALUE,
SAME_FUNCTION));
76 relationships.insert(std::make_pair(FUNCTION_CALL_TYPE_CLEANUP,
SAME_FUNCTION));
77 relationships.insert(std::make_pair(IR_LOWERING,
SAME_FUNCTION));
78 relationships.insert(std::make_pair(COMPUTE_IMPLICIT_CALLS,
SAME_FUNCTION));
100 const auto TM =
AppM->get_tree_manager();
103 auto* fd = GetPointer<function_decl>(tn);
104 THROW_ASSERT(fd && fd->body,
"Node " +
STR(tn) +
"is not a function_decl or has no body");
105 const auto*
sl = GetPointer<const statement_list>(
GET_NODE(fd->body));
109 "function " + fu_name +
" is varargs");
112 std::map<unsigned int, tree_nodeRef> parm_decl_var_decl_rel;
113 for(
auto&
block :
sl->list_of_bloc)
115 for(
const auto& stmt :
block.second->CGetStmtList())
117 if(
GET_NODE(stmt)->get_kind() == gimple_assign_K)
119 const auto* ga = GetPointer<const gimple_assign>(
GET_NODE(stmt));
120 if(
GET_NODE(ga->op1)->get_kind() == addr_expr_K)
122 auto* ae = GetPointer<addr_expr>(
GET_NODE(ga->op1));
123 if(
GET_NODE(ae->op)->get_kind() == parm_decl_K)
131 for(
auto par_index : parm_decl_addr)
133 auto par = TM->CGetTreeReindex(par_index);
134 const auto* pd = GetPointer<const parm_decl>(
GET_NODE(par));
136 const auto& p_type = pd->type;
138 const auto original_param_name =
139 pd->name ? GetPointer<const identifier_node>(
GET_NODE(pd->name))->strg :
STR(par_index);
140 const std::string local_var_name =
"bambu_artificial_local_parameter_copy_" + original_param_name;
141 const auto local_var_identifier = IRman->create_identifier_node(local_var_name);
142 const auto new_local_var_decl =
144 GetPointer<const type_node>(
GET_NODE(p_type))->algn, pd->used);
145 parm_decl_var_decl_rel[par_index] = new_local_var_decl;
147 for(
auto&
block :
sl->list_of_bloc)
150 for(
const auto& stmt :
block.second->CGetStmtList())
154 TM->ReplaceTreeNode(stmt, par, new_local_var_decl);
161 if(!parm_decl_addr.empty())
164 const auto entry_block =
sl->list_of_bloc.at(
BB_ENTRY);
165 const auto succ_blocks = entry_block->list_of_succ;
167 "entry basic block of function " + fu_name +
" has " +
STR(succ_blocks.size()) +
" successors");
168 auto bb_index = *succ_blocks.begin();
169 const auto first_block =
sl->list_of_bloc.at(bb_index);
170 for(
auto par_index : parm_decl_addr)
172 auto par = TM->CGetTreeReindex(par_index);
173 auto vd = parm_decl_var_decl_rel.at(par_index);
174 const auto* pd = GetPointer<const parm_decl>(
GET_NODE(par));
176 const std::string srcp_default = pd->include_name +
":" +
STR(pd->line_number) +
":" +
STR(pd->column_number);
177 auto new_ga_expr = IRman->CreateGimpleAssignAddrExpr(
GET_NODE(vd),
function_id, srcp_default);
178 first_block->PushFront(new_ga_expr,
AppM);
181 auto* nge = GetPointer<gimple_assign>(
GET_NODE(new_ga_expr));
182 nge->temporary_address =
true;
184 auto* sa = GetPointer<ssa_name>(
GET_NODE(ssa_addr));
188 auto mr = IRman->create_binary_operation(p_type, ssa_addr, offset, srcp_default, mem_ref_K);
191 first_block->PushAfter(ga, new_ga_expr,
AppM);
192 GetPointer<gimple_node>(
GET_NODE(ga))->artificial =
true;
#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.
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 INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
static std::string name_function(const tree_managerConstRef &tm, const unsigned int index)
Return the name of the function.
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
parm_decl_taken_address_fix(const ParameterConstRef params, const application_managerRef AM, unsigned int fun_id, const DesignFlowManagerConstRef dfm)
Constructor.
struct definition of the source position.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
#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.
std::string include_name
include_name is a filename string, this can be the location of a reference, if no definition has been...
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
std::string ToString(ActorGraphBackend_Type actor_graph_backend_type)
Header include.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Target must be reexecuted.
#define BB_ENTRY
constant identifying the basic block node of type entry
unsigned offset[NUM_VERTICES+1]
#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.
Class defining some useful functions to create tree nodes and to manipulate the tree manager...
#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.
~parm_decl_taken_address_fix() override
Destructor.
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...
static tree_nodeConstRef CGetType(const tree_nodeConstRef &node)
Return the treenode of the type of node.
this class is used to manage the command-line or XML options.
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
int debug_level
The debug level.
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.
DesignFlowStep_Status InternalExec() override
Execute the step.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...