46 #include "config_HAVE_FROM_DISCREPANCY_BUILT.hpp" 47 #include "config_HAVE_PRAGMA_BUILT.hpp" 50 #if HAVE_FROM_DISCREPANCY_BUILT 77 call_graph_manager(new
CallGraphManager(function_expander, _allow_recursive_functions, TM, _Param)),
80 _Param->isOption(OPT_addr_bus_bitsize) ?
81 _Param->getOption<unsigned int>(OPT_addr_bus_bitsize) :
82 (_Param->getOption<
std::string>(OPT_gcc_m32_mx32).find(
"-m64") !=
std::string::npos ? 64 : 32)),
86 cfg_transformations(0),
88 #if HAVE_FROM_DISCREPANCY_BUILT
90 RDiscr(((_Param->isOption(OPT_discrepancy) and _Param->getOption<
bool>(OPT_discrepancy)) or
91 (_Param->isOption(OPT_discrepancy_hw) and _Param->getOption<
bool>(OPT_discrepancy_hw))) ?
96 const auto in_files = _Param->getOption<std::list<std::string>>(OPT_input_file);
98 std::copy(in_files.begin(), in_files.end(), std::back_inserter(
input_files));
129 return root_functions.count(funId) || addressed_functions.count(funId);
134 const auto& behaviors =
call_graph_manager->CGetCallGraph()->CGetCallGraphInfo()->behaviors;
135 THROW_ASSERT(behaviors.find(index) != behaviors.end(),
"There is no function with index " +
STR(index));
136 return behaviors.at(index);
141 const auto& behaviors =
call_graph_manager->CGetCallGraph()->CGetCallGraphInfo()->behaviors;
142 THROW_ASSERT(behaviors.count(index),
"There is no function with index " +
STR(index));
143 return behaviors.at(index);
166 #if HAVE_PRAGMA_BUILT 195 switch(tn->get_kind())
199 const auto we = GetPointerS<const gimple_while>(tn);
204 const auto gc = GetPointerS<const gimple_cond>(tn);
208 case gimple_return_K:
212 case gimple_multi_way_if_K:
219 const auto gp = GetPointerS<const gimple_phi>(tn);
222 case gimple_switch_K:
224 const auto se = GetPointerS<const gimple_switch>(tn);
227 case gimple_assign_K:
229 const auto gm = GetPointerS<const gimple_assign>(tn);
231 if(gm->init_assignment || gm->clobber)
235 else if(op0->get_kind() == array_ref_K)
239 else if(op0->get_kind() == indirect_ref_K)
243 else if(op0->get_kind() == misaligned_indirect_ref_K)
247 else if(op0->get_kind() == mem_ref_K)
251 else if(op0->get_kind() == target_mem_ref_K)
255 else if(op0->get_kind() == target_mem_ref461_K)
267 const auto ga = GetPointerS<const gimple_asm>(tn);
270 const auto tl = GetPointerS<const tree_list>(
GET_CONST_NODE(ga->out));
290 case aggr_init_expr_K:
291 case case_label_expr_K:
295 case gimple_pragma_K:
296 case gimple_predict_K:
298 case identifier_node_K:
300 case statement_list_K:
302 case target_mem_ref_K:
303 case target_mem_ref461_K:
317 THROW_ERROR(
"Operation not yet supported: " + tn->get_kind_text());
364 std::string tn_str =
"";
367 const auto tn = new_tn->get_kind() == tree_reindex_K ?
GET_CONST_NODE(new_tn) : new_tn;
368 tn_str = tn->get_kind() == function_decl_K ?
369 (
"@" +
STR(new_tn->index) +
373 THROW_ASSERT(cfg_transformations < Param->getOption<size_t>(OPT_max_transformations),
385 THROW_ASSERT(parm_index,
"unexpected null parm_decl index");
389 const auto parm = fun_parms->second.find(parm_index);
390 if(parm != fun_parms->second.end())
400 THROW_ASSERT(functionID,
"unexpected null function id: " +
STR(functionID));
401 THROW_ASSERT(parm_index,
"unexpected null parm_decl index " +
STR(parm_index));
402 THROW_ASSERT(ssa_index,
"unexpected null ssa_name index " +
STR(ssa_index));
416 "unexpected condition " +
STR(functionID) +
" " +
STR(parm_index) +
" " +
STR(ssa_index));
application_manager(const FunctionExpanderConstRef function_expander, const bool allow_recursive_functions, const ParameterConstRef _Param)
Constructor.
const ParameterConstRef get_parameter() const
Returns the parameter data-structure.
CustomMap< unsigned, unsigned > getACopyParm2SSA(unsigned int functionID)
return a copy of parameter to SSA map
CustomOrderedSet< unsigned int > get_functions_with_body() const
Returns the set of functions whose implementation is present in the parsed input specification (i...
File containing functions and utilities to support the printing of debug messagges.
std::vector< std::string > input_files
The original input file and the actual source code file to be elaborated.
#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.
tree_nodeConstRef GetProducedValue(const tree_nodeConstRef &tn) const
Returns the values produced by a vertex (recursive version)
const tree_managerRef get_tree_manager() const
Returns the tree manager associated with the application.
Definition of the class representing a generic C application.
CallGraphManagerRef GetCallGraphManager()
Returns the call graph associated with the application.
#define CASE_DECL_NODES
NOTE that cast_expr is a unary expression but it could not be included in the CASE_UNARY_EXPRESSION b...
const tree_managerRef TM
class representing the application information at low level
This class manages the tree structures extracted from the raw file.
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
const FunctionBehaviorConstRef CGetFunctionBehavior(unsigned int index) const
Returns the data-structure associated with the given identifier.
CustomOrderedSet< unsigned int > get_functions_without_body() const
Returns the set of functions whose implementation is not present in the parsed input specification (i...
CustomOrderedMap< T, U > CustomMap
exceptions managed by PandA
bool hasToBeInterfaced(unsigned int funId) const
Check for interface generation.
Definition of hash function for EdgeDescriptor.
static std::string print_function_name(const tree_managerConstRef &TM, const function_decl *fd)
Return the name of the function in a string.
const ParameterConstRef Param
class containing all the parameters
size_t cfg_transformations
The number of cfg transformations applied to this function.
virtual enum kind get_kind() const =0
Virtual function returning the type of the actual class.
A set of const tree node.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
CustomOrderedSet< unsigned int > written_objects
store memory objects which can be written
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
void add_written_object(unsigned int node_id)
Add the node_id to the set of object modified by a store.
void setSSAFromParm(unsigned int functionID, unsigned int parm_index, unsigned ssa_index)
setSSAFromParm defines the parm_decl versus ssa_name relation
#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.
This C++ header file contains common macros for the tree structure.
This class is used to manage the pragma directives found in the source code.
void AddGlobalVariable(const tree_nodeConstRef &var)
Adds a global variable.
Manager for pragma annotations.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
#define GET_CONST_NODE(t)
const TreeNodeConstSet & GetGlobalVariables() const
Returns the set of original global variables.
Classes specification of the tree_node data structures.
void clearParm2SSA(unsigned int functionID)
clearParm2SSA cleans the map putting into relation parm_decl and ssa_name
#define DEBUG_LEVEL_NONE
no debugging print is performed.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
This file collects some utility functions.
CustomMap< unsigned, CustomMap< unsigned, unsigned > > Parm2SSA_map
put into relation formal parameters and the associated ssa variables in a given function ...
TreeNodeConstSet global_variables
set of global variables
bool ApplyNewTransformation() const
Return true if a new transformation can be applied.
virtual ~application_manager()
Destructor.
#define CASE_CST_NODES
This macro collects all case labels for cast nodes.
Class specification of the tree_reindex support class.
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
void clean_written_objects()
clean_written_objects clean the written object data structure
FunctionBehaviorRef GetFunctionBehavior(unsigned int index)
Returns the data structure associated with the given identifier.
const OpGraphConstRef CGetOpGraph(FunctionBehavior::graph_type gt) const
This method returns the operation graphs.
unsigned int get_produced_value(const tree_nodeRef &tn) const
Returns the values produced by a vertex (recursive version)
const CallGraphManagerRef call_graph_manager
class representing the call graph of the application
This class manages the accesses to the CallGraph.
Data structures used in operations graph.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
interface of loops finding algorithm
void RegisterTransformation(const std::string &step, const tree_nodeConstRef new_tn)
Register a transformation.
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.
#define GET_INDEX_CONST_NODE(t)
unsigned getSSAFromParm(unsigned int functionID, unsigned parm_index) const
getSSAFromParm returns the ssa_name index associated with the parm_decl index, 0 in case there is not...
const CustomOrderedSet< unsigned int > & get_written_objects() const
Return the set of variables modified by a store.
#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.
const CallGraphManagerConstRef CGetCallGraphManager() const
Returns the call graph associated with the application.
#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 ...