PandA-2024.02
application_manager.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
43 #ifndef _APPLICATION_MANAGER_HPP_
44 #define _APPLICATION_MANAGER_HPP_
45 
46 #include "config_HAVE_FROM_DISCREPANCY_BUILT.hpp"
47 #include "config_HAVE_PRAGMA_BUILT.hpp"
48 
49 #include <cstddef> // for size_t
50 #include <string> // for string
51 
52 #include "custom_map.hpp" // for CustomMap
53 #include "custom_set.hpp" // for CustomSet
54 #include "graph.hpp" // for vertex
55 #include "refcount.hpp" // for REF_FORWARD_DECL
56 #include "tree_node.hpp"
57 
58 CONSTREF_FORWARD_DECL(ActorGraphManager);
59 REF_FORWARD_DECL(ActorGraphManager);
70 
72 {
73  protected:
76 
79 
82 
85 
86  unsigned int address_bitsize;
87 
90 
91 #if HAVE_PRAGMA_BUILT
94 #endif
95 
98 
100  const int debug_level;
101 
104 
108  unsigned int get_produced_value(const tree_nodeRef& tn) const;
110 
115 
116  public:
117 #if HAVE_FROM_DISCREPANCY_BUILT
118  DiscrepancyRef RDiscr;
120 #endif
121 
123  std::vector<std::string> input_files;
124 
131  application_manager(const FunctionExpanderConstRef function_expander, const bool allow_recursive_functions,
132  const ParameterConstRef _Param);
133 
137  virtual ~application_manager();
138 
142  const tree_managerRef get_tree_manager() const;
143 
148 
153 
164  bool hasToBeInterfaced(unsigned int funId) const;
165 
173 
180  const FunctionBehaviorConstRef CGetFunctionBehavior(unsigned int index) const;
181 
187 
193 
198  void AddGlobalVariable(const tree_nodeConstRef& var);
199 
204  const TreeNodeConstSet& GetGlobalVariables() const;
205 
206 #if HAVE_PRAGMA_BUILT
207 
210  const pragma_managerRef get_pragma_manager() const;
211 #endif
212 
216  unsigned int get_produced_value(unsigned int fun_id, const vertex& v) const;
218 
222  tree_nodeConstRef GetProducedValue(unsigned int fun_id, const vertex& v) const;
223 
227  const ParameterConstRef get_parameter() const;
228 
233  void add_written_object(unsigned int node_id);
234 
239 
243  void clean_written_objects();
244 
249  void set_address_bitsize(unsigned int value)
250  {
251  address_bitsize = value;
252  }
253 
257  unsigned int& Rget_address_bitsize()
258  {
259  return address_bitsize;
260  }
261  unsigned int get_address_bitsize() const
262  {
263  return address_bitsize;
264  }
265 
269  bool ApplyNewTransformation() const;
270 
276  void RegisterTransformation(const std::string& step, const tree_nodeConstRef new_tn);
277 
284  unsigned getSSAFromParm(unsigned int functionID, unsigned parm_index) const;
285 
291  void setSSAFromParm(unsigned int functionID, unsigned int parm_index, unsigned ssa_index);
292 
296  void clearParm2SSA(unsigned int functionID);
297 
301  CustomMap<unsigned, unsigned> getACopyParm2SSA(unsigned int functionID);
302 };
307 
308 #endif
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...
std::vector< std::string > input_files
The original input file and the actual source code file to be elaborated.
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.
CallGraphManagerRef GetCallGraphManager()
Returns the call graph associated with the application.
const tree_managerRef TM
class representing the application information at low level
This class manages the tree structures extracted from the raw file.
const FunctionBehaviorConstRef CGetFunctionBehavior(unsigned int index) const
Returns the data-structure associated with the given identifier.
Class specification of the graph structures.
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
Definition: custom_map.hpp:167
bool hasToBeInterfaced(unsigned int funId) const
Check for interface generation.
CONSTREF_FORWARD_DECL(ActorGraphManager)
redefinition of map to manage ordered/unordered structures
const ParameterConstRef Param
class containing all the parameters
REF_FORWARD_DECL(ActorGraphManager)
size_t cfg_transformations
The number of cfg transformations applied to this function.
A set of const tree node.
Definition: tree_node.hpp:267
CustomOrderedSet< unsigned int > written_objects
store memory objects which can be written
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
This class is used to manage the pragma directives found in the source code.
void AddGlobalVariable(const tree_nodeConstRef &var)
Adds a global variable.
#define index(x, y)
Definition: Keccak.c:74
redefinition of set to manage ordered/unordered structures
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
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
used to avoid expansion of c library function or type
Template definition of refcount.
const int debug_level
debugging level of the class
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.
void clean_written_objects()
clean_written_objects clean the written object data structure
unsigned int get_address_bitsize() const
FunctionBehaviorRef GetFunctionBehavior(unsigned int index)
Returns the data structure associated with the given identifier.
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.
void RegisterTransformation(const std::string &step, const tree_nodeConstRef new_tn)
Register a transformation.
unsigned int & Rget_address_bitsize()
return the address bitsize
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.
void set_address_bitsize(unsigned int value)
set the value of the address bitsize
const CallGraphManagerConstRef CGetCallGraphManager() const
Returns the call graph associated with the application.

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13