#include <loops.h>
Public Types | |
enum | EdgeKind { TreeEdge, BackEdge, ForwardEdge, CrossEdge } |
Public Methods | |
loopTree (procNode *procedure) | |
Create a loop tree. More... | |
~loopTree () | |
Delete a loop tree. More... | |
procNode * | procedure () const |
Procedure. More... | |
loopTreeNode * | topLoop () const |
Top loop object. More... | |
loopTreeNode * | whichLoop (basicblockNode *block) |
Which loop. More... | |
loopTreeNode * | loopAncestor (loopTreeNode *loop) |
Find a loop ancestor. More... | |
EdgeKind | classifyEdge (basicblockNode *source, basicblockNode *target) |
Edge classification. More... | |
void | report () |
Report. More... | |
Private Methods | |
void | findLoop (basicblockNode *candidate, basicblock_set_map &generators_map) |
Decide if a block is a loop header. More... | |
void | findBody (basicblockNode *head, basicblock_set &generators, loopTreeNode::LoopKind kind) |
Determine the body of a loop. More... | |
basicblockNode * | commonDominator (basicblockNode *first, basicblockNode *second) |
Find a common dominator for two blocks. More... | |
void | classifyEdges (basicblock_list &post_order) |
Classify edges. More... | |
void | depthFirstSearch (basicblockNode *cur, basicblock_list &post_order, int &pre_order_number, int &post_order_number) |
Depth-first search. More... | |
void | setDepths (loopTreeNode *cur, int depth) |
Set the depth on each loop nest. More... | |
void | report (loopTreeNode *cur, int level) |
Report (tree recursion). More... | |
Private Attributes | |
procNode * | _procedure |
The procedure. More... | |
loopTreeNode * | _top |
The loop tree. More... | |
loop_list | _loops |
A list of the loops. More... | |
blockloop_map | _containedIn |
Mapping from basic blocks to loops. More... | |
edge_map | _backEdges |
List of back edges. More... | |
edge_map | _forwardEdges |
List of forward edges. More... | |
edge_map | _crossEdges |
List of cross edges. More... | |
basicblock_int_map | _preOrder |
Depth-first pre-order of the nodes. More... | |
basicblock_int_map | _rpostOrder |
Depth-first reverse-post-order of the nodes. More... |
|
|
|
Create a loop tree.
|
|
Delete a loop tree. This destructor is reponsible for deleting all of the loop tree nodes as well. |
|
Edge classification. Given a particular source and target in the control-flow graph, indicate which kind of edge it is: tree, forward, backward, or cross. |
|
Classify edges. Perform a depth-first search of the control-flow graph, building pre-order and reverse-post-order orderings of the nodes, as well as classifying th edges. Also, return a list with the post-order traversal. |
|
Find a common dominator for two blocks.
|
|
Depth-first search.
|
|
Determine the body of a loop.
|
|
Decide if a block is a loop header.
|
|
Find a loop ancestor.
|
|
Procedure.
|
|
Report (tree recursion).
|
|
Report.
|
|
Set the depth on each loop nest.
|
|
Top loop object. Note that this is not really a loop; it's just used as the root of the tree |
|
Which loop. Determine which loop a particular basic block belongs to. |
|
List of back edges. Back edges are stored according to the *target* of the back-edge, not the source. This is because the algorithm needs to easily find all the back-edges that impinge on a candidate node. |
|
Mapping from basic blocks to loops.
|
|
List of cross edges. Stored according to the source of the edge |
|
List of forward edges. Stored according to the source of the edge |
|
A list of the loops.
|
|
Depth-first pre-order of the nodes.
|
|
The procedure.
|
|
Depth-first reverse-post-order of the nodes.
|
|
The loop tree.
|