69 case aggr_init_expr_K:
71 const call_expr* CE = GetPointer<call_expr>(currentTreeNode);
76 if(
GET_NODE(FN)->get_kind() == function_decl_K)
78 unsigned int functionDeclIdx = FN->index;
82 const std::vector<tree_nodeRef>&
args = CE->
args;
84 GetPointer<addr_expr>(
GET_NODE(args[0])) ? GetPointer<addr_expr>(
GET_NODE(args[0]))->op : args[0];
85 if(
GET_NODE(builtinArgZero)->get_kind() == function_decl_K)
87 unsigned int calledFunctionId = builtinArgZero->
index;
93 else if(
GET_NODE(builtinArgZero)->get_kind() == ssa_name_K)
104 const gimple_call* CE = GetPointer<gimple_call>(currentTreeNode);
109 if(
GET_NODE(FN)->get_kind() == function_decl_K)
111 unsigned int functionDeclIdx =
GET_NODE(FN)->index;
115 const std::vector<tree_nodeRef>&
args = CE->
args;
117 GetPointer<addr_expr>(
GET_NODE(args[0])) ? GetPointer<addr_expr>(
GET_NODE(args[0]))->op : args[0];
118 if(
GET_NODE(builtinArgZero)->get_kind() == function_decl_K)
120 unsigned int calledFunctionId = builtinArgZero->
index;
126 else if(
GET_NODE(builtinArgZero)->get_kind() == ssa_name_K)
136 case gimple_assign_K:
138 auto* gm = GetPointer<gimple_assign>(currentTreeNode);
139 if(GetPointer<call_expr>(
GET_NODE(gm->op1)))
158 case gimple_switch_K:
159 case gimple_multi_way_if_K:
160 case gimple_return_K:
166 case target_mem_ref_K:
167 case target_mem_ref461_K:
173 case function_decl_K:
179 case case_label_expr_K:
190 case gimple_pragma_K:
191 case gimple_predict_K:
193 case identifier_node_K:
195 case namespace_decl_K:
197 case placeholder_expr_K:
198 case statement_list_K:
199 case translation_unit_decl_K:
202 case template_decl_K:
232 relationships.insert(std::make_pair(HWCALL_INJECTION,
SAME_FUNCTION));
244 return relationships;
268 const auto root_functions = CGM->GetRootFunctions();
271 for(
const auto root_function : root_functions)
274 rf->
visit(&fdr_visitor);
276 for(
unsigned int allFunction : allFunctions)
280 "---Analyzing function " +
STR(allFunction) +
" " + functionName);
282 auto* funDecl = GetPointer<function_decl>(
function);
284 if(funDecl->body && functionName !=
"__start_pragma__" && functionName !=
"__close_pragma__" &&
300 auto* functionDecl = GetPointer<function_decl>(currentTreeNode);
301 auto* stmtList = GetPointer<statement_list>(
GET_NODE(functionDecl->body));
304 (!
parameters->IsParameter(
"print-dot-FF") ||
parameters->GetParameter<
unsigned int>(
"print-dot-FF")))
306 AppM->CGetCallGraphManager()->CGetCallGraph()->WriteDot(
"builtin-graph-pre" +
STR(
function_id) +
".dot");
313 for(
const auto&
block : stmtList->list_of_bloc)
315 for(
const auto& stmt :
block.second->CGetStmtList())
317 if(
GET_NODE(stmt)->get_kind() == gimple_call_K or
GET_NODE(stmt)->get_kind() == gimple_assign_K)
326 (!
parameters->IsParameter(
"print-dot-FF") ||
parameters->GetParameter<
unsigned int>(
"print-dot-FF")))
328 AppM->CGetCallGraphManager()->CGetCallGraph()->WriteDot(
"builtin-graph-post" +
STR(
function_id) +
".dot");
338 auto* sa = GetPointer<ssa_name>(fptr);
343 auto* var = GetPointer<decl_node>(
GET_NODE(sa->var));
344 THROW_ASSERT(var,
"Call expression does not point to a declaration node");
345 pt = GetPointer<pointer_type>(
GET_NODE(var->type));
349 pt = GetPointer<pointer_type>(
GET_NODE(sa->type));
352 THROW_ASSERT(pt,
"Declaration node has not information about pointer_type");
354 "Pointer type has not information about pointed function_type");
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
TypeDeclarationMap typeToDeclaration
Map function types to matching declarations.
tree_nodeRef ptd
ptd field points to the node for the type pointed to.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
CallGraphBuiltinCall(const application_managerRef AM, unsigned int functionId, const DesignFlowManagerConstRef DFM, const ParameterConstRef P)
Ctor.
#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.
#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.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
static std::string print_type(const tree_managerConstRef &TM, unsigned int type, bool global=false, bool print_qualifiers=false, bool print_storage=false, unsigned int var=0, const var_pp_functorConstRef &vppf=var_pp_functorConstRef(), const std::string &prefix="", const std::string &tail="")
Print a type and its variable in case var is not zero.
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(DesignFlowStep::RelationshipType RT) const override
State relationship with other design step.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
virtual void visit(tree_node_visitor *const v) const
virtual function used to traverse the tree_node data structure.
#define BUILTIN_WAIT_CALL
constant defining the builtin wait call intrinsic function
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
std::vector< tree_nodeRef > args
The arguments of the gimple_call.
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.
std::vector< tree_nodeRef > args
The arguments of the call_expr.
static void addCallPointAndExpand(CustomUnorderedSet< unsigned int > &AV, const application_managerRef AM, unsigned int caller_id, unsigned int called_id, unsigned int call_id, enum FunctionEdgeInfo::CallType call_type, int DL)
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
virtual std::string get_kind_text() const =0
Virtual function returning the name of the actual class.
bool starts_with(const std::string &str, const std::string &pattern)
#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.
void lookForBuiltinCall(const tree_nodeRef TN)
void buildTypeToDeclaration()
const unsigned int index
Represent the index read from the raw file and the index-1 of the vector of tree_node associated to t...
static tree_nodeRef getFunctionPointerType(tree_nodeRef fptr)
Target must be reexecuted.
tree_nodeRef fn
fn is the operand 0 of the call expression: this is the function
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
bool typeToDeclarationBuilt
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
struct definition of the pointer_type tree node.
This struct specifies the block node.
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
This file collects some utility functions.
tree_nodeRef GetTreeNode(const unsigned int index) const
Return the index-th tree_node (modifiable version)
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.
Class specification of the basic_block structure.
Data structures used in operations graph.
~CallGraphBuiltinCall() override
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.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
int debug_level
The debug level.
tree node visitor collecting the function_decl referred by starting from a given node ...
#define GET_INDEX_CONST_NODE(t)
DesignFlowStep_Status InternalExec() override
Execute the step.
This file contains the declaration of the CallGraphBuiltinCall pass that will add function called thr...
This class models the application of a analysis to all the functions of an application.
This struct specifies the gimple_call node.
CustomUnorderedSet< unsigned int > already_visited
Already visited tree node (used to avoid infinite recursion)
#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.
void ExtendCallGraph(unsigned int callerIdx, tree_nodeRef funType, unsigned int stmtIdx)
A brief description of the C++ Header File.
tree_nodeRef fn
fn is the operand 0 of the call expression: this is the function
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 ...