LivenessWalker Class ReferenceDetermines global(intraprocedural) liveness on a procedure.
More...
#include <live.h>
Inheritance diagram for LivenessWalker:
List of all members.
|
Public Types |
enum | Order { Preorder,
Postorder,
Both
} |
| The order in which AST Nodes should be visited. More...
|
enum | Depth { Subtree,
NodeOnly
} |
| Which Nodes in the AST tree should be visited. More...
|
Public Member Functions |
| LivenessWalker () |
virtual void | at_proc (procNode *, Order) |
virtual void | at_basicblock (basicblockNode *, Order) |
virtual void | at_threeAddr (threeAddrNode *, Order) |
virtual void | at_return (returnNode *, Order) |
virtual void | at_conditiongoto (conditiongotoNode *, Order) |
virtual void | at_stmt (stmtNode *, Order) |
decl_set * | defs (stmtNode *) |
| Returns the def set for the statement.
|
decl_set * | uses (stmtNode *) |
| Returns the use set for the statment.
|
decl_set * | live_in (stmtNode *) |
| Returns the set of variables live into the statement.
|
decl_set * | live_out (stmtNode *) |
| Returns the set of variables live out of the statement.
|
|
Methods to get and set fields in the class.
|
Order | order () const |
| Return the order in which Nodes of an AST should be visited.
|
Depth | depth () const |
| Return which Nodes of an AST should be visited.
|
|
These methods define the functions that should be performed when different classes of Nodes are encountered in the AST. The most specific "at_" method that matches a given Node's class will be called.
|
virtual void | at_node (Node *the_node, Order ord) |
virtual void | at_unit (unitNode *the_unit, Order ord) |
virtual void | at_def (defNode *the_def, Order ord) |
virtual void | at_decl (declNode *the_decl, Order ord) |
virtual void | at_subdecl (subdeclNode *the_subdecl, Order ord) |
virtual void | at_type (typeNode *the_type, Order ord) |
virtual void | at_prim (primNode *the_prim, Order ord) |
virtual void | at_tdef (tdefNode *the_tdef, Order ord) |
virtual void | at_ptr (ptrNode *the_ptr, Order ord) |
virtual void | at_array (arrayNode *the_array, Order ord) |
virtual void | at_func (funcNode *the_func, Order ord) |
virtual void | at_sue (sueNode *the_sue, Order ord) |
virtual void | at_struct (structNode *the_struct, Order ord) |
virtual void | at_union (unionNode *the_union, Order ord) |
virtual void | at_enum (enumNode *the_enum, Order ord) |
virtual void | at_suespec (suespecNode *the_suespec, Order ord) |
virtual void | at_expr (exprNode *the_expr, Order ord) |
virtual void | at_index (indexNode *the_index, Order ord) |
virtual void | at_const (constNode *the_const, Order ord) |
virtual void | at_id (idNode *the_id, Order ord) |
virtual void | at_binary (binaryNode *the_binary, Order ord) |
virtual void | at_unary (unaryNode *the_unary, Order ord) |
virtual void | at_cast (castNode *the_cast, Order ord) |
virtual void | at_comma (commaNode *the_comma, Order ord) |
virtual void | at_ternary (ternaryNode *the_ternary, Order ord) |
virtual void | at_call (callNode *the_call, Order ord) |
virtual void | at_initializer (initializerNode *the_initializer, Order ord) |
virtual void | at_block (blockNode *the_block, Order ord) |
virtual void | at_exprstmt (exprstmtNode *the_exprstmt, Order ord) |
virtual void | at_target (targetNode *the_target, Order ord) |
virtual void | at_label (labelNode *the_label, Order ord) |
virtual void | at_case (caseNode *the_case, Order ord) |
virtual void | at_selection (selectionNode *the_selection, Order ord) |
virtual void | at_if (ifNode *the_if, Order ord) |
virtual void | at_switch (switchNode *the_switch, Order ord) |
virtual void | at_loop (loopNode *the_loop, Order ord) |
virtual void | at_while (whileNode *the_while, Order ord) |
virtual void | at_do (doNode *the_do, Order ord) |
virtual void | at_for (forNode *the_for, Order ord) |
virtual void | at_jump (jumpNode *the_jump, Order ord) |
virtual void | at_goto (gotoNode *the_goto, Order ord) |
virtual void | at_continue (continueNode *the_continue, Order ord) |
virtual void | at_break (breakNode *the_break, Order ord) |
virtual void | at_attrib (attribNode *the_attrib, Order ord) |
virtual void | at_operand (operandNode *the_oper, Order ord) |
virtual void | at_text (textNode *the_text, Order ord) |
Static Public Member Functions |
static LivenessWalker * | walk (procNode *) |
Private Member Functions |
void | defUseOperand (threeAddrNode *, operandNode *, bool, bool) |
decl_set * | bits2decls (Bits *) |
Private Attributes |
int | _num_decls |
map< declNode *, int > | _decl2num |
vector< declNode * > | _num2decl |
map< stmtNode *, Bits * > | _live_in |
map< stmtNode *, Bits * > | _live_out |
map< stmtNode *, Bits * > | _def |
map< stmtNode *, Bits * > | _use |
Detailed Description
Determines global(intraprocedural) liveness on a procedure.
This Walker performs intraprocedureal liveness analysis. The current analysis is VERY conservative. The input to LivenessWalker::walk() must be a CFG. The analysis is performed at the level of a variable declaration. Therefore, liveness is generated for a struct or array whenever any element or field is used; liveness is not currently determined on a per-element or per-field basis.
The liveness information is available for every stmtNode (namely, threeAddrNode, conditiongotoNode and returnNode) and for every basicblockNode.
Additionally, this Walker does not perform any pointer analysis.
Definition at line 68 of file live.h.
Member Enumeration Documentation
|
Which Nodes in the AST tree should be visited.
- Enumeration values:
-
Subtree |
The entire AST should be traversed. |
NodeOnly |
Only the root Node should be visited. |
Definition at line 155 of file walker.h. |
|
The order in which AST Nodes should be visited.
- Enumeration values:
-
Preorder |
Nodes should be visited before their children. |
Postorder |
Nodes should be visited after their children. |
Both |
Nodes should be visited both before and after their children. |
Definition at line 147 of file walker.h. |
Constructor & Destructor Documentation
LivenessWalker::LivenessWalker |
( |
|
) |
|
|
Member Function Documentation
virtual void Walker::at_array |
( |
arrayNode * |
the_array, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_attrib |
( |
attribNode * |
the_attrib, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_binary |
( |
binaryNode * |
the_binary, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_block |
( |
blockNode * |
the_block, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_break |
( |
breakNode * |
the_break, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_call |
( |
callNode * |
the_call, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_case |
( |
caseNode * |
the_case, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_cast |
( |
castNode * |
the_cast, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_comma |
( |
commaNode * |
the_comma, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_const |
( |
constNode * |
the_const, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_continue |
( |
continueNode * |
the_continue, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_decl |
( |
declNode * |
the_decl, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_def |
( |
defNode * |
the_def, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_do |
( |
doNode * |
the_do, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_enum |
( |
enumNode * |
the_enum, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_expr |
( |
exprNode * |
the_expr, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_exprstmt |
( |
exprstmtNode * |
the_exprstmt, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_for |
( |
forNode * |
the_for, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_func |
( |
funcNode * |
the_func, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_goto |
( |
gotoNode * |
the_goto, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_id |
( |
idNode * |
the_id, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_if |
( |
ifNode * |
the_if, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_index |
( |
indexNode * |
the_index, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_initializer |
( |
initializerNode * |
the_initializer, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_jump |
( |
jumpNode * |
the_jump, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_label |
( |
labelNode * |
the_label, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_loop |
( |
loopNode * |
the_loop, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_node |
( |
Node * |
the_node, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
|
Reimplemented in gcWalker, goto_label_walker, set_container_walker, sue_complete_walker, TreeChecker, and df_number_walker.
Definition at line 223 of file walker.h.
Referenced by Walker::at_def(), Walker::at_expr(), Walker::at_stmt(), Walker::at_text(), Walker::at_type(), and Walker::at_unit(). |
virtual void Walker::at_operand |
( |
operandNode * |
the_oper, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_prim |
( |
primNode * |
the_prim, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void LivenessWalker::at_proc |
( |
procNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_ptr |
( |
ptrNode * |
the_ptr, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_selection |
( |
selectionNode * |
the_selection, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void LivenessWalker::at_stmt |
( |
stmtNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_struct |
( |
structNode * |
the_struct, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_subdecl |
( |
subdeclNode * |
the_subdecl, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_sue |
( |
sueNode * |
the_sue, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_suespec |
( |
suespecNode * |
the_suespec, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_switch |
( |
switchNode * |
the_switch, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_target |
( |
targetNode * |
the_target, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_tdef |
( |
tdefNode * |
the_tdef, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_ternary |
( |
ternaryNode * |
the_ternary, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_text |
( |
textNode * |
the_text, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_type |
( |
typeNode * |
the_type, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_unary |
( |
unaryNode * |
the_unary, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_union |
( |
unionNode * |
the_union, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_unit |
( |
unitNode * |
the_unit, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_while |
( |
whileNode * |
the_while, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
|
Returns the def set for the statement.
|
Depth Walker::depth |
( |
|
) |
const [inline, inherited] |
|
|
Return which Nodes of an AST should be visited.
A value of SubTree specifies that the entire AST should be traversed. A value of NodeOnly specifies that only the root Node in the AST should be visited.
Definition at line 211 of file walker.h.
References Walker::_depth. |
|
Returns the set of variables live into the statement.
|
|
Returns the set of variables live out of the statement.
|
Order Walker::order |
( |
|
) |
const [inline, inherited] |
|
|
Return the order in which Nodes of an AST should be visited.
Nodes can be visited before their children (Preorder), after their children (Postorder), or both (Both).
Definition at line 203 of file walker.h.
References Walker::_order.
Referenced by df_number_walker::at_node(). |
|
Returns the use set for the statment.
|
Member Data Documentation
The documentation for this class was generated from the following file:
|