76 #define TOSTRING(id) std::to_string(id) 79 unsigned int _function_id,
const DesignFlowManagerConstRef _design_flow_manager)
81 ogc(function_behavior->ogc),
83 behavioral_helper(function_behavior->GetBehavioralHelper())
94 switch(relationship_type)
98 relationships.insert(std::make_pair(OPERATIONS_CFG_COMPUTATION,
SAME_FUNCTION));
107 relationships.insert(std::make_pair(BUILD_VIRTUAL_PHI,
SAME_FUNCTION));
115 return relationships;
123 if(boost::num_vertices(*mod_cfg) != 0)
126 for(boost::tie(op, op_end) = boost::vertices(*mod_cfg); op != op_end; op++)
128 const OpNodeInfoRef op_node_info = mod_cfg->GetOpNodeInfo(*op);
129 op_node_info->cited_variables.clear();
130 op_node_info->variables.clear();
131 op_node_info->actual_parameters.clear();
132 op_node_info->Initialize();
141 std::list<vertex> Vertices;
142 for(boost::tie(VerIt, VerItEnd) = boost::vertices(*
cfg); VerIt != VerItEnd; VerIt++)
144 Vertices.push_back(*VerIt);
146 std::list<vertex> PhiNodes;
147 for(
auto Ver = Vertices.begin(); Ver != Vertices.end();)
153 PhiNodes.push_back(*curr_Ver);
154 Vertices.erase(curr_Ver);
157 for(
const auto& Ver : Vertices)
165 for(
const auto& PhiNode : PhiNodes)
173 if(
parameters->getOption<
bool>(OPT_print_dot))
188 const auto gn = GetPointer<const gimple_node>(
tree_node);
190 if(GetPointer<const gimple_node>(
tree_node) && (gn->vuses.size() || gn->vdef))
198 case gimple_pragma_K:
200 case gimple_assign_K:
202 const auto* ga = GetPointerS<const gimple_assign>(
tree_node);
213 const auto* pn = GetPointerS<const gimple_phi>(
tree_node);
214 for(
const auto& def_edge : pn->CGetDefEdgesList())
221 case gimple_return_K:
223 const auto* gr = GetPointerS<const gimple_return>(
tree_node);
224 const auto& op = gr->op;
231 case aggr_init_expr_K:
234 const auto* ce = GetPointerS<const call_expr>(
tree_node);
240 for(
const auto&
arg : ce->args)
243 ogc->add_parameter(op_vertex,
arg->index);
250 const auto* gc = GetPointer<const gimple_call>(
tree_node);
256 for(
const auto&
arg : gc->args)
259 ogc->add_parameter(op_vertex,
arg->index);
279 const auto* fe = GetPointerS<const gimple_for>(
tree_node);
285 case gimple_multi_way_if_K:
287 const auto* gmwi = GetPointerS<const gimple_multi_way_if>(
tree_node);
288 for(
const auto& cond : gmwi->list_of_cond)
297 case gimple_switch_K:
299 const auto* gs = GetPointerS<const gimple_switch>(
tree_node);
321 const auto* asme = GetPointerS<const gimple_asm>(
tree_node);
336 case function_decl_K:
343 const auto* vd = GetPointer<const var_decl>(
tree_node);
344 if(vd && (!vd->scpe ||
GET_CONST_NODE(vd->scpe)->get_kind() == translation_unit_decl_K))
346 AppM->AddGlobalVariable(_tree_node);
364 const auto* sn = GetPointer<const ssa_name>(
tree_node);
388 if((sn->volatile_flag ||
389 (sn->CGetDefStmts().size() == 1 &&
GET_CONST_NODE(sn->CGetDefStmt())->get_kind() == gimple_nop_K)) &&
393 "---Adding " + sn->ToString() +
" to defs of Entry");
427 const auto* tl = GetPointerS<const tree_list>(
tree_node);
435 const auto* current_tree_list = GetPointerS<const tree_list>(current_args);
437 if(current_tree_list->chan)
450 const auto* tv = GetPointerS<const tree_vec>(
tree_node);
451 for(
const auto& op : tv->list_of_op)
459 const auto* ue = GetPointerS<const unary_expr>(
tree_node);
460 if(ue->get_kind() == addr_expr_K)
472 const auto* be = GetPointerS<const binary_expr>(
tree_node);
473 if(be->get_kind() == postincrement_expr_K || be->get_kind() == postdecrement_expr_K)
484 const auto* te = GetPointerS<const ternary_expr>(
tree_node);
486 if(te->get_kind() == component_ref_K || te->get_kind() == bit_field_ref_K)
503 const auto* qe = GetPointerS<const quaternary_expr>(
tree_node);
504 if((qe->get_kind() == array_ref_K || qe->get_kind() == array_range_ref_K) &&
526 auto* le = GetPointerS<const lut_expr>(
tree_node);
559 case target_mem_ref_K:
561 const auto* tm = GetPointerS<const target_mem_ref>(
tree_node);
576 case target_mem_ref461_K:
578 const auto* tm = GetPointerS<const target_mem_ref461>(
tree_node);
595 const auto* constr = GetPointerS<const constructor>(
tree_node);
596 for(
const auto& valu : constr->list_of_idx_valu)
602 case case_label_expr_K:
604 const auto* cle = GetPointerS<const case_label_expr>(
tree_node);
620 case namespace_decl_K:
621 case template_decl_K:
632 case gimple_predict_K:
634 case identifier_node_K:
635 case translation_unit_decl_K:
642 case blackbox_pragma_K:
643 case profiling_pragma_K:
644 case statistical_profiling_K:
646 case call_hw_pragma_K:
647 case call_point_hw_pragma_K:
650 case omp_atomic_pragma_K:
651 case omp_critical_pragma_K:
652 case omp_declare_simd_pragma_K:
653 case omp_for_pragma_K:
654 case omp_parallel_pragma_K:
655 case omp_sections_pragma_K:
656 case omp_simd_pragma_K:
657 case omp_parallel_sections_pragma_K:
658 case omp_section_pragma_K:
659 case omp_task_pragma_K:
660 case omp_target_pragma_K:
661 case statement_list_K:
680 for(
const auto& vuse : vop->
vuses)
690 for(
auto const& vover : vop->
vovers)
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
Analyzes operations and creates the sets of read and written variables.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
DesignFlowStep_Status InternalExec() override
Computes the set of read and written variables.
#define GET_TYPE(data, vertex_index)
Helper macro returning the type associated with a node.
File containing functions and utilities to support the printing of debug messagges.
#define CASE_BINARY_EXPRESSION
This macro collects all case labels for binary_expr objects.
#define TYPE_VPHI
constant string identifying an operation node of type virtual phi-nodes
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
void RecursivelyAnalyze(const vertex op_vertex, const tree_nodeConstRef &tree_node, const FunctionBehavior_VariableAccessType access_type) const
Recursively analyze a tree_node.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
static std::string GetString(const enum kind k)
Given a kind, return the corresponding string.
Class specification of the graph structures.
exceptions managed by PandA
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_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
unsigned int bb_version
The version of the basic block intermediate representation on which this step has been applied...
Abstract pure class for the tree structure.
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.
const OpGraphConstRef cfg
The control flow graph of the function.
const OpNodeInfoConstRef CGetOpNodeInfo(const vertex node) const
Returns the info associated with a node.
TreeNodeSet vovers
vovers of this statement
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
const operations_graph_constructorRef ogc
The operation graph constructor.
#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.
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...
Target must be reexecuted.
const OpGraphInfoConstRef CGetOpGraphInfo() const
Returns the property associated with the graph.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
#define GET_CONST_NODE(t)
FunctionBehavior_VariableAccessType
The access type to a variable.
boost::graph_traits< graph >::vertex_iterator VertexIterator
vertex_iterator definition.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
~VarComputation() override
Destructor.
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
This file collects some utility functions.
VarComputation(const ParameterConstRef _parameters, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
struct definition of the common part of a gimple with virtual operands
Data structures used in operations graph.
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.
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.
TreeNodeSet vuses
vuses of this statement
tree_nodeRef vdef
vdef of this statement
int debug_level
The debug level.
void AnalyzeVops(const vertex op_vertex, const gimple_node *vops) const
Analyze virtual operands associated with a gimple node.
This class provides methods to build an operations graph.
#define CASE_TERNARY_EXPRESSION
This macro collects all case labels for ternary_expr objects.
A brief description of the C++ Header File.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
Implementation of the wrapper to Gcc for C sources.