PandA-2024.02
|
#include <loop.hpp>
Public Member Functions | |
Loop (const BBGraphRef g) | |
Constructor for empty loop (used for irreducible) More... | |
Loop (const BBGraphRef _bb_graph, vertex _header_block) | |
Constructor for reducible loop. More... | |
unsigned int | GetId () const |
returns the loop id More... | |
bool | is_innermost () const |
tells if the loop is innermost More... | |
bool | IsReducible () const |
tells if the loop is reducible More... | |
vertex | GetHeader () const |
returns loop header More... | |
CustomOrderedSet< vertex > | get_entries () const |
return the alternative entries of a loop More... | |
void | add_entry (vertex v) |
add an entry of the loop More... | |
const LoopRef | Parent () const |
returns the parent loop More... | |
void | add_block (vertex block) |
adds a block to this loop More... | |
size_t | num_blocks () const |
returns the number of basic blocks belonging to this loop More... | |
const CustomUnorderedSet< vertex > & | get_blocks () const |
returns the blocks More... | |
size_t | num_exits () const |
std::list< vertex >::const_iterator | exit_block_iter_begin () const |
std::list< vertex >::const_iterator | exit_block_iter_end () const |
size_t | num_landing_pads () const |
const CustomUnorderedSet< vertex > | GetLandingPadBlocks () const |
Return the landing pads of the loops. More... | |
vertex | primary_landing_pad () const |
void | SetParent (LoopRef parent) |
Sets parent for this loop. More... | |
void | AddChild (LoopRef child) |
Adds a child loop. More... | |
const CustomOrderedSet< LoopConstRef > & | GetChildren () const |
Returns the children of this loop in the loop forest. More... | |
void | get_recursively_bb (CustomUnorderedSet< vertex > &ret) const |
Returns the basic blocks which belong to this loop and to loop nested in this loop. More... | |
OpVertexSet | GetRecursivelyOps (const OpGraphConstRef op_graph) const |
Returns the operation which belongs to this loop or to a nested loop. More... | |
const std::map< vertex, CustomUnorderedSet< vertex > > & | get_exit_landing_association () const |
Returns the map exit_landing_association. More... | |
void | add_sp_back_edge (vertex vs, vertex vd) |
add a spanning tree back edge More... | |
bool | is_sp_back_edge (vertex vs, vertex vd) const |
check if a pair of vertex is a spanning tree back edge for the loop More... | |
CustomOrderedSet< std::pair< vertex, vertex > > | get_sp_back_edges () const |
return the list of spanning tree back edges More... | |
Data Fields | |
unsigned int | depth |
Nesting depth of this loop. More... | |
int | loop_type |
loop type More... | |
long long | footprint_size |
loop memory footprint More... | |
long long | instruction_size |
loop instruction footprint More... | |
vertex | body_start |
body start basic block (at the moment defined only for SIMPLE_LOOP & WHILE_LOOP) More... | |
unsigned int | main_iv |
the main induction variable of countable loop; More... | |
tree_nodeRef | init |
value of the initialization of the induction variable More... | |
unsigned int | init_gimple_id |
The index of the gimple tree node containing the initialization of the induction variable; right operand can be different from initialization_tree_node_id because of assignments chain. More... | |
unsigned int | inc_id |
The node id containing the increment statement. More... | |
integer_cst_t | increment |
Increment of induction variable. More... | |
tree_nodeRef | increment_tn |
Increment of induction variable. More... | |
integer_cst_t | lower_bound |
Initial value of induction variable defined when loop_type is COUNTABLE_LOOP. More... | |
integer_cst_t | upper_bound |
Final value of induction variable defined when loop_type is COUNTABLE_LOOP. More... | |
tree_nodeRef | upper_bound_tn |
Final value of induction variable. More... | |
bool | close_interval |
flag for induction variable close interval defined when loop_type is COUNTABLE_LOOP More... | |
Private Member Functions | |
void | ComputeLandingPadExits () |
compute landing pad exits More... | |
Private Attributes | |
const BBGraphRef | g |
The basic block control flow graph. More... | |
bool | is_innermost_loop |
tells if there aren't loop nested in this More... | |
refcount< Loop > | parent_loop |
Parent loop. More... | |
CustomOrderedSet< LoopConstRef > | children |
Child loops. More... | |
CustomUnorderedSet< vertex > | blocks |
Blocks which belong to this loop. More... | |
std::list< vertex > | exits |
exit blocks for this loop More... | |
CustomUnorderedSet< vertex > | landing_pads |
landing_pads for this loop More... | |
vertex | primary_landing_pad_block |
??? More... | |
vertex | header_block |
the header of the loop More... | |
CustomOrderedSet< vertex > | alternative_entries |
in case the loop is irreducible the loop has multiple entries while for reducible loops the entry is just one More... | |
unsigned int | loop_id |
the id of the loop More... | |
std::map< vertex, CustomUnorderedSet< vertex > > | exit_landing_association |
Map storing the association between an exit basic block and the corresponding landing pads. More... | |
CustomOrderedSet< std::pair< vertex, vertex > > | sp_back_edges |
set of vertex pairs describing a spanning tree back edge for the loop More... | |
Static Private Attributes | |
static unsigned int | curr_unused_irreducible_id = std::numeric_limits<unsigned int>::max() |
used to label irreducible loops More... | |
Friends | |
class | Loops |
Friend definition of loop. More... | |
class | add_loop_nop |
Definition of friend class add_loop_nop. More... | |
|
explicit |
Loop::Loop | ( | const BBGraphRef | _bb_graph, |
vertex | _header_block | ||
) |
Constructor for reducible loop.
g | is the basic block control flow graph |
header | is the header basic block |
Definition at line 95 of file loop.cpp.
References add_block(), alternative_entries, BBGraph::CGetBBNodeInfo(), g, and loop_id.
void Loop::add_block | ( | vertex | block | ) |
adds a block to this loop
block | is the basic block to be added |
Definition at line 282 of file loop.cpp.
References blocks.
Referenced by add_entry(), Loops::DetectReducibleLoop(), Loop(), and Loops::tarjan_scc().
|
inline |
add an entry of the loop
Definition at line 298 of file loop.hpp.
References add_block(), AddChild(), exit_block_iter_begin(), exit_block_iter_end(), get_blocks(), get_exit_landing_association(), get_recursively_bb(), GetChildren(), GetLandingPadBlocks(), GetRecursivelyOps(), num_blocks(), num_exits(), num_landing_pads(), Parent(), primary_landing_pad(), and SetParent().
void Loop::AddChild | ( | LoopRef | child | ) |
Adds a child loop.
child | is the child loop |
Definition at line 287 of file loop.cpp.
References children.
Referenced by add_entry(), Loops::DetectReducibleLoop(), and Loops::tarjan_scc().
|
private |
compute landing pad exits
Definition at line 249 of file loop.cpp.
References exit_landing_association, exits, g, get_recursively_bb(), landing_pads, and lenet_tvm::target.
std::list< vertex >::const_iterator Loop::exit_block_iter_begin | ( | ) | const |
Definition at line 166 of file loop.cpp.
References exits.
Referenced by add_entry(), and Vectorize::DuplicateIncrement().
std::list< vertex >::const_iterator Loop::exit_block_iter_end | ( | ) | const |
Definition at line 171 of file loop.cpp.
References exits.
Referenced by add_entry().
const CustomUnorderedSet< vertex > & Loop::get_blocks | ( | ) | const |
returns the blocks
Definition at line 156 of file loop.cpp.
References blocks.
Referenced by add_entry().
|
inline |
return the alternative entries of a loop
Definition at line 292 of file loop.hpp.
References alternative_entries.
const std::map< vertex, CustomUnorderedSet< vertex > > & Loop::get_exit_landing_association | ( | ) | const |
Returns the map exit_landing_association.
Definition at line 317 of file loop.cpp.
References exit_landing_association.
Referenced by add_entry().
void Loop::get_recursively_bb | ( | CustomUnorderedSet< vertex > & | ret | ) | const |
Returns the basic blocks which belong to this loop and to loop nested in this loop.
ret | is the returned set of basic block of this loop and of its children |
Definition at line 292 of file loop.cpp.
References blocks, and children.
Referenced by add_entry(), ComputeLandingPadExits(), and GetRecursivelyOps().
|
inline |
return the list of spanning tree back edges
Definition at line 397 of file loop.hpp.
References sp_back_edges.
const CustomOrderedSet< LoopConstRef > & Loop::GetChildren | ( | ) | const |
Returns the children of this loop in the loop forest.
Definition at line 322 of file loop.cpp.
References children.
Referenced by add_entry().
vertex Loop::GetHeader | ( | ) | const |
returns loop header
Definition at line 136 of file loop.cpp.
References header_block.
Referenced by Vectorize::DuplicateIncrement().
unsigned int Loop::GetId | ( | ) | const |
returns the loop id
Definition at line 131 of file loop.cpp.
References loop_id.
Referenced by Loops::tarjan_scc().
const CustomUnorderedSet< vertex > Loop::GetLandingPadBlocks | ( | ) | const |
Return the landing pads of the loops.
the | basic block landing pads of the loop |
Definition at line 181 of file loop.cpp.
References landing_pads.
Referenced by add_entry().
OpVertexSet Loop::GetRecursivelyOps | ( | const OpGraphConstRef | op_graph | ) | const |
Returns the operation which belongs to this loop or to a nested loop.
op_graph | is the operation graph |
Definition at line 302 of file loop.cpp.
References BBGraph::CGetBBNodeInfo(), g, get_recursively_bb(), and THROW_ASSERT.
Referenced by add_entry().
bool Loop::is_innermost | ( | ) | const |
bool Loop::IsReducible | ( | ) | const |
tells if the loop is reducible
Definition at line 146 of file loop.cpp.
References header_block, and NULL_VERTEX.
Referenced by Vectorize::DuplicateIncrement().
size_t Loop::num_blocks | ( | ) | const |
returns the number of basic blocks belonging to this loop
Definition at line 151 of file loop.cpp.
References blocks.
Referenced by add_entry().
size_t Loop::num_exits | ( | ) | const |
Definition at line 161 of file loop.cpp.
References exits.
Referenced by add_entry(), and Vectorize::DuplicateIncrement().
size_t Loop::num_landing_pads | ( | ) | const |
Definition at line 176 of file loop.cpp.
References landing_pads.
Referenced by add_entry().
const LoopRef Loop::Parent | ( | ) | const |
returns the parent loop
Definition at line 239 of file loop.cpp.
References parent_loop.
Referenced by add_entry(), and Loops::DetectReducibleLoop().
vertex Loop::primary_landing_pad | ( | ) | const |
Definition at line 186 of file loop.cpp.
References g, landing_pads, NULL_VERTEX, and lenet_tvm::target.
Referenced by add_entry().
void Loop::SetParent | ( | LoopRef | parent | ) |
Sets parent for this loop.
parent | is the parent loop |
Definition at line 244 of file loop.cpp.
References refcount< T >::get(), and parent_loop.
Referenced by add_entry(), and Loops::DetectReducibleLoop().
|
friend |
|
private |
in case the loop is irreducible the loop has multiple entries while for reducible loops the entry is just one
Definition at line 190 of file loop.hpp.
Referenced by get_entries(), and Loop().
|
private |
Blocks which belong to this loop.
Definition at line 175 of file loop.hpp.
Referenced by add_block(), Loops::BuildZeroLoop(), get_blocks(), get_recursively_bb(), and num_blocks().
vertex Loop::body_start |
|
private |
Child loops.
Definition at line 172 of file loop.hpp.
Referenced by AddChild(), Loops::BuildZeroLoop(), get_recursively_bb(), GetChildren(), and is_innermost().
bool Loop::close_interval |
|
staticprivate |
unsigned int Loop::depth |
Nesting depth of this loop.
Definition at line 206 of file loop.hpp.
Referenced by Loops::computeDepth().
|
private |
Map storing the association between an exit basic block and the corresponding landing pads.
Definition at line 196 of file loop.hpp.
Referenced by ComputeLandingPadExits(), and get_exit_landing_association().
|
private |
exit blocks for this loop
Definition at line 178 of file loop.hpp.
Referenced by ComputeLandingPadExits(), exit_block_iter_begin(), exit_block_iter_end(), and num_exits().
|
private |
The basic block control flow graph.
Definition at line 163 of file loop.hpp.
Referenced by ComputeLandingPadExits(), GetRecursivelyOps(), Loop(), and primary_landing_pad().
|
private |
the header of the loop
Definition at line 187 of file loop.hpp.
Referenced by GetHeader(), and IsReducible().
unsigned int Loop::inc_id |
integer_cst_t Loop::increment |
tree_nodeRef Loop::increment_tn |
tree_nodeRef Loop::init |
unsigned int Loop::init_gimple_id |
long long Loop::instruction_size |
|
private |
tells if there aren't loop nested in this
Definition at line 166 of file loop.hpp.
Referenced by Loops::BuildZeroLoop().
|
private |
landing_pads for this loop
Definition at line 181 of file loop.hpp.
Referenced by ComputeLandingPadExits(), GetLandingPadBlocks(), num_landing_pads(), and primary_landing_pad().
|
private |
integer_cst_t Loop::lower_bound |
unsigned int Loop::main_iv |
|
private |
set of vertex pairs describing a spanning tree back edge for the loop
Definition at line 202 of file loop.hpp.
Referenced by get_sp_back_edges().
integer_cst_t Loop::upper_bound |
tree_nodeRef Loop::upper_bound_tn |