47 #ifndef FUNCTION_BEHAVIOR_HPP 48 #define FUNCTION_BEHAVIOR_HPP 50 #include "config_HAVE_ASSERTS.hpp" 51 #include "config_HAVE_HOST_PROFILING_BUILT.hpp" 89 #if HAVE_HOST_PROFILING_BUILT 96 template <
typename Graph>
98 class ParallelRegionsGraphsCollection;
115 memory_access(
unsigned int _node_id,
unsigned int _base_address,
unsigned int _offset = 0);
147 struct hash<FunctionBehavior_VariableAccessType> :
public unary_function<FunctionBehavior_VariableAccessType, size_t>
149 size_t operator()(FunctionBehavior_VariableAccessType variable_access_type)
const 152 return hasher(static_cast<int>(variable_access_type));
163 struct hash<FunctionBehavior_VariableType> :
public unary_function<FunctionBehavior_VariableType, size_t>
165 size_t operator()(FunctionBehavior_VariableType variable_access_type)
const 168 return hasher(static_cast<int>(variable_access_type));
187 friend class hpp_profiling;
189 friend class instr_sequences_detection;
190 friend struct loop_regions_computation;
191 friend class LoopsProfiling;
192 friend class probability_path;
194 friend class read_profiling_data;
195 friend class tp_profiling;
306 #if HAVE_HOST_PROFILING_BUILT 458 const operations_graph_constructorRef
ogc;
461 const BasicBlocksGraphConstructorRef
bbgc;
464 const level_constructorRef
lm;
499 const std::deque<vertex>& get_levels()
const;
504 const std::deque<vertex>& get_bb_levels()
const;
509 const std::map<vertex, unsigned int>& get_map_levels()
const;
514 const std::map<vertex, unsigned int>& get_bb_map_levels()
const;
555 void print(std::ostream& os)
const;
590 const LoopsConstRef CGetLoops()
const;
595 const LoopsRef GetLoops()
const;
597 #if HAVE_HOST_PROFILING_BUILT 602 const ProfilingInformationConstRef CGetProfilingInformation()
const;
608 void add_parm_decl_copied(
unsigned int node_id);
613 void add_parm_decl_loaded(
unsigned int node_id);
618 void add_parm_decl_stored(
unsigned int node_id);
623 void add_function_mem(
unsigned int node_id);
629 void add_dynamic_address(
unsigned int node_id);
634 void clean_dynamic_address();
639 bool is_variable_mem(
unsigned int node_id)
const;
647 void clean_function_mem();
662 void clean_parm_decl_copied();
672 void clean_parm_decl_loaded();
682 void clean_parm_decl_stored();
689 dereference_unknown_address = f;
697 return dereference_unknown_address;
705 unaligned_accesses = f;
713 return unaligned_accesses;
740 has_undefined_function_receiveing_pointers = f;
749 return has_undefined_function_receiveing_pointers;
757 state_variables.insert(node_id);
766 return state_variables.count(node_id);
774 state_variables.clear();
783 return state_variables;
792 packed_vars = packed_vars || packed;
805 return pipeline_enabled;
812 THROW_ASSERT(pipeline_enabled,
"Simple pipeline is true but pipeline is not enabled");
814 return simple_pipeline;
820 "Should not request initiation time when pipeline is not enabled or simple pipeline is requested");
821 return initiation_time;
830 bool CheckReachability(
const vertex first_operation,
const vertex second_operation)
const;
839 bool CheckBBReachability(
const vertex first_basic_block,
const vertex second_basic_block)
const;
847 bool CheckFeedbackReachability(
const vertex first_operation,
const vertex second_operation)
const;
855 bool CheckBBFeedbackReachability(
const vertex first_basic_block,
const vertex second_basic_block)
const;
861 unsigned int GetBBVersion()
const;
867 unsigned int UpdateBBVersion();
879 unsigned int UpdateBitValueVersion();
881 unsigned int GetChannelsNumber()
const;
883 void SetChannelsNumber(
unsigned int val);
904 const std::map<vertex, unsigned int>&
ref;
const OpGraphRef flg
The flow edge operation graph.
CONSTREF_FORWARD_DECL(application_manager)
const level_constructorRef lm
reference to the level constructor
const BBGraphRef dj
The dj graph (used for loop computation)
const BBGraphsCollectionRef bb_graphs_collection
Global graph storing CFG, dominators and post-dominators. The nodes of this graph are basic blocks...
Dominator o post-dominator data structure.
CustomOrderedSet< unsigned int > state_variables
set of global variables
Basic block control flow graph.
Anti dependence + data dependence + output dependence + flow graph with feedback. ...
bool get_dereference_unknown_addr() const
Return true if the function has dereference of unknown address.
bool has_undefined_function_receiveing_pointers
function calls undefined function passing pointers
const operations_graph_constructorRef ogc
reference to the operations graph constructor
class providing methods to manage an operations graph.
const OpGraphRef cdg
The control dependence graph.
const OpGraphRef odg
The output-dependencies flow graph.
Anti-dependence graph with feedback.
void set_unaligned_accesses(bool f)
Set if LOADs or STOREs perform unaligned accesses.
const OpGraphRef saodg
The system dependence, antidependence and output dependence graph.
Class specification of the graph structures.
unsigned int bb_version
The version of basic block intermediate representation.
void clean_state_variable()
clean_state_variable initialize the state variable data structure
const OpGraphRef fodg
The output-dependencies flow graph with feedback.
MemoryAllocation_ChannelsType
The number of channels.
const OpGraphRef fdfg
The data flow graph with feedback.
void set_packed_vars(bool packed)
update the the packed variables status
FunctionBehavior_VariableType
The possible type of a variable.
bool get_has_undefined_function_receiving_pointers() const
helper for has_undefined_function_receiveing_pointers variables property
Definition of hash function for EdgeDescriptor.
CustomOrderedSet< unsigned int > dynamic_address
store memory objects which can be indirectly addressed through a dynamic address computation ...
const std::map< vertex, unsigned int > & ref
Topological sorted vertices.
MemoryAllocation_Policy _allocation_policy
const BehavioralHelperRef helper
Behavioral helper associated with this behavioral_graph_manager.
Basic block post-dominator tree.
const OpGraphRef fcfg
The control flow graph with feedback.
const OpGraphRef fsdg
The system dependence graph with feedback.
void set_has_undefined_function_receiveing_pointers(bool f)
set if there are or not undefined functions called and which has pointers passed
redefinition of map to manage ordered/unordered structures
dominance< BBGraph > * post_dominators
This class stores post-dominator information.
A set of operation vertices.
Abstract pure class for the tree structure.
friend std::ostream & operator<<(std::ostream &os, const FunctionBehaviorRef &s)
Friend definition of the << operator.
const BBGraphRef bb
The basic block CFG.
System dependence + anti-dependence + output dependence graph + flow graph + debug graph...
const BBGraphRef dt
The dominator tree of the CFG on basic blocks.
The key comparison function for vertices set based on levels.
const OpGraphRef adg
The anti-dependencies graph.
const OpGraphRef sdg
The system dependence graph.
std::deque< vertex > bb_deque_levels
list of operations vertices sorted by topological order in control flow graph; in the sorting then pa...
Class to perform profiling.
const BBGraphRef cdg_bb
The control dependence graph among basic blocks.
graph_type
Declaration of enum representing the type of graph.
System dependence graph with feedback.
CustomOrderedSet< unsigned int > mem_nodeID
this set represents the memory variables accessed by the function
REF_FORWARD_DECL(FunctionBehavior)
System dependence + anti-dependence graph + output dependence graph with feedback.
Class used to describe a particular graph with basic blocks as nodes.
std::map< unsigned int, memory_accessRef > memory_info
map between node id and the corresponding memory allocation
const level_constructorRef bb_lm
reference to the level constructor
Control dependence graph.
const OpGraphRef flaoddg
The anti-dependence + data dependence + output dependence + flow graph.
bool is_simple_pipeline() const
const OpGraphRef sg
The speculation graph.
const OpGraphRef fflaoddg
The anti-dependence + data dependence + output dependence + flow graph with freedback.
bool get_unaligned_accesses() const
Return true if a LOADs or STOREs perform unaligned accesses.
const OpGraphRef cfg
The control flow graph.
const BBGraphRef extended_bb
The basic block Control Flow Graph extended with edges that impose that basic block inside a loop are...
const OpGraphRef dfg
The data flow graph.
Basic block dominator tree.
CustomUnorderedMapStable< vertex, CustomUnorderedSet< vertex > > feedback_bb_reachability
Reachability between basic blocks based on control flow graph with feedback.
Basic block control flow graph with feedback.
Extended control flow graph.
Control dependence graph with feedback.
void add_state_variable(unsigned int node_id)
Add a state variable: static, global or volatile variable.
redefinition of set to manage ordered/unordered structures
void print(std::ostream &os) const
Function that prints the class behavioral_manager.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
memory_access(unsigned int _node_id, unsigned int _base_address, unsigned int _offset=0)
const OpGraphRef flsaodg
The system dependence, antidependence, output dependence and flow graph.
General class used to describe a graph in PandA.
FunctionBehavior_VariableAccessType
The access type to a variable.
const OpGraphRef agg_virtualg
Anti + Data flow graph on aggregates.
Support basic block for path profiling.
const OpGraphRef extended_cfg
The extended control flow graph.
Basic block control dependence graph.
CustomOrderedSet< unsigned int > parm_decl_copied
this set represents the parameters that have to be copied from the caller
const OpGraphRef fsaodg
The system dependence, antidependence and output dependence graph with feedback.
bool packed_vars
True when there access to packed data.
int initiation_time
used only for stallable pipelines
class providing methods to manage a basic blocks graph.
MemoryAllocation_ChannelsType _channels_type
Function scope channels type.
std::deque< vertex > deque_levels
list of operations vertices sorted by topological order in control flow graph; in the sorting then pa...
Output dependence graph with feedback.
Template definition of refcount.
unsigned int GetBitValueVersion() const
dominance< BBGraph > * dominators
This class stores dominator information.
std::map< vertex, unsigned int > map_levels
Map operation vertex to position in topological order in control flow graph; in the sorting then part...
void set_has_globals(bool f)
set if there are or not externally visible global variables
bb_graph_type
Declaration of enum representing the type of bb_graph.
const BBGraphRef fbb
The basic block CFG with feedback.
CustomUnorderedMapStable< vertex, CustomUnorderedSet< vertex > > bb_reachability
Mutual exclusion between basic blocks (based on control flow graph with flow edges) ...
int get_initiation_time() const
unsigned int base_address
const application_managerRef AppM
The application manager.
Data flow graph with feedback.
std::map< vertex, unsigned int > bb_map_levels
Map basic block vertex to position in topological order in control flow graph; in the sorting then pa...
const OpGraphRef fadg
The anti-dependencies graph with feedback.
CustomOrderedSet< unsigned int > parm_decl_loaded
this set represents the actual parameters that has to be loaded into the formal parameter from the ac...
const ParameterConstRef parameters
The set of input parameters.
bool get_has_globals() const
helper for global variables property
unsigned int _channels_number
Function scope channels number.
Anti-dependence + data dependence + output dependence + flow graph.
const BBGraphRef ppg
The support basic block graph for path profiling.
LoopsRef loops
Loops of the function.
bool pipeline_enabled
true when pipelining is enabled for the function
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
unsigned int bitvalue_version
Version of the bitvalue information.
void set_dereference_unknown_addr(bool f)
Set the use of dereference of unknown address.
System dependence + anti-dependence + output dependence graph + flow graph.
friend std::ostream & operator<<(std::ostream &os, const FunctionBehavior &s)
Friend definition of the << operator.
Class to perform profiling.
bool simple_pipeline
true when the requested pipeline does not include unbounded functions
const OpGraphRef fcdg
The control dependence graph with feedback.
const OpGraphsCollectionRef op_graphs_collection
Global graph storing CFG, DFG, FCFG, FDFG, SDG, FSDG, CDG. The nodes of this graph are operations...
Control flow graph with feedback.
bool dereference_unknown_address
the function dereference a pointer initialized with constant address.
x
Return the smallest n such that 2^n >= _x.
absl::node_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapStable
loops computation analysis step
const CustomOrderedSet< unsigned int > & get_state_variables()
get_state_variables
Class used to describe a particular graph with operations as nodes.
Struct representing memory information.
op_vertex_order_by_map(const std::map< vertex, unsigned int > &ref_, const graph *)
Graph.
const BBGraphRef pdt
The post-dominator tree of the CFG on basic blocks.
const BasicBlocksGraphConstructorRef bbgc
reference to the basic block graph constructor
System dependence + anti-dependence graph + output dependence graph.
bool has_packed_vars() const
System dependence + anti-dependence + output dependence graph + flow graph with feedback.
This structure defines graphs where nodes are operations.
MemoryAllocation_Policy
The allocation memory polycy.
bool is_pipeline_enabled() const
bool has_globals
when true at least one global variable is used
const OpGraphRef fflsaodg
The system dependence, antidependence, output dependence and flow graph with feedback;.
CustomOrderedSet< unsigned int > parm_decl_stored
this set represents the formal parameters that has to be stored into the formal parameter from the ac...
bool is_a_state_variable(unsigned int node_id) const
return true if a variable is a state variable or not
This structure defines graphs where nodes are basic_blocks.
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...