|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
print_walker Class Referenceprints each node to an out stream.
More...
|
"at_" methods | |
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_def (defNode *the_def, Order ord) |
virtual void | at_subdecl (subdeclNode *the_subdecl, Order ord) |
virtual void | at_type (typeNode *the_type, 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_expr (exprNode *the_expr, Order ord) |
virtual void | at_index (indexNode *the_index, Order ord) |
virtual void | at_stmt (stmtNode *the_stmt, Order ord) |
virtual void | at_target (targetNode *the_target, Order ord) |
virtual void | at_selection (selectionNode *the_selection, Order ord) |
virtual void | at_loop (loopNode *the_loop, Order ord) |
virtual void | at_jump (jumpNode *the_jump, Order ord) |
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 | |
print_walker (ostream &out, numbering_map *num) | |
virtual void | at_unit (unitNode *the_unit, Order ord) |
virtual void | at_decl (declNode *the_decl, Order ord) |
virtual void | at_proc (procNode *the_proc, 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_suespec (suespecNode *the_suespec, 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_basicblock (basicblockNode *the_bb, Order ord) |
virtual void | at_exprstmt (exprstmtNode *the_exprstmt, Order ord) |
virtual void | at_label (labelNode *the_label, Order ord) |
virtual void | at_case (caseNode *the_case, Order ord) |
virtual void | at_if (ifNode *the_if, Order ord) |
virtual void | at_switch (switchNode *the_switch, 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_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_return (returnNode *the_return, Order ord) |
virtual void | at_attrib (attribNode *the_attrib, Order ord) |
virtual void | at_operand (operandNode *the_oper, Order ord) |
virtual void | at_conditiongoto (conditiongotoNode *the_condgoto, Order ord) |
virtual void | at_threeAddr (threeAddrNode *the_3addr, Order ord) |
virtual void | at_text (textNode *the_text, Order ord) |
Static Public Member Functions | |
void | print (Node *n, ostream &out) |
To display the AST, call this static function:. | |
Private Member Functions | |
void | indent (Node *n) const |
void | in () |
void | out () |
Private Attributes | |
ostream & | _out |
int | _indent |
numbering_map * | _num |
Definition at line 45 of file print_walker.h.
|
Which Nodes in the AST tree should be visited.
|
|
|
Definition at line 60 of file print_walker.cc. |
|
Reimplemented from Walker. Definition at line 203 of file print_walker.cc. References _out, arrayNode::dim(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, arrayNode::size(), and typeNode::type_qualifiers_name(). |
|
Reimplemented from Walker. Definition at line 777 of file print_walker.cc. References _out, in(), indent(), attribNode::name(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 484 of file print_walker.cc. References _out, blockNode::decls(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, and blockNode::stmts(). |
|
Reimplemented from Walker. Definition at line 325 of file print_walker.cc. References _out, in(), indent(), binaryNode::left(), binaryNode::op(), out(), Walker::Postorder, Walker::Preorder, Operator::print(), and binaryNode::right(). |
|
Reimplemented from Walker. Definition at line 463 of file print_walker.cc. References _out, blockNode::decls(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, and blockNode::stmts(). |
|
Reimplemented from Walker. Definition at line 741 of file print_walker.cc. References _out, breakNode::container(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 422 of file print_walker.cc. References _out, callNode::args(), in(), indent(), callNode::name(), out(), Walker::Postorder, Walker::Preorder, and callNode::proc(). |
|
Reimplemented from Walker. Definition at line 558 of file print_walker.cc. References _out, caseNode::container(), caseNode::expr(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, and targetNode::stmt(). |
|
Reimplemented from Walker. Definition at line 364 of file print_walker.cc. References _out, castNode::expr(), in(), indent(), castNode::is_implicit(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 385 of file print_walker.cc. References _out, in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 808 of file print_walker.cc. References _out, in(), indent(), gotoNode::label(), gotoNode::name(), conditiongotoNode::op(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 296 of file print_walker.cc. References _out, in(), indent(), out(), Walker::Postorder, Walker::Preorder, and constNode::text(). |
|
Reimplemented from Walker. Definition at line 725 of file print_walker.cc. References _out, continueNode::container(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 96 of file print_walker.cc. References _out, declNode::decl_location(), declNode::decl_location_name(), id_list, id_list_p, in(), indent(), declNode::name(), out(), Walker::Postorder, Walker::Preorder, declNode::ref_list(), declNode::storage_class(), and declNode::storage_class_name(). |
|
Definition at line 230 of file walker.h. References Walker::at_node(). Referenced by Walker::at_decl(), and Walker::at_proc(). |
|
Reimplemented from Walker. Definition at line 660 of file print_walker.cc. References _out, loopNode::body(), loopNode::cond(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented in enum_value_walker. Definition at line 269 of file walker.h. References Walker::at_sue(). Referenced by enumNode::walk(). |
|
Reimplemented in NodeLocator, and remove_stale_type_walker. Definition at line 275 of file walker.h. References Walker::at_node(). Referenced by Walker::at_binary(), Walker::at_call(), Walker::at_cast(), Walker::at_comma(), Walker::at_index(), Walker::at_initializer(), Walker::at_operand(), Walker::at_ternary(), Walker::at_unary(), and metaexprNode::walk(). |
|
Reimplemented from Walker. Definition at line 505 of file print_walker.cc. References _out, exprstmtNode::expr(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 681 of file print_walker.cc. References _out, loopNode::body(), loopNode::cond(), in(), indent(), forNode::init(), forNode::next(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 221 of file print_walker.cc. References _out, in(), indent(), out(), Walker::Postorder, Walker::Preorder, and typeNode::type_qualifiers_name(). |
|
Reimplemented from Walker. Definition at line 708 of file print_walker.cc. References _out, in(), indent(), gotoNode::label(), gotoNode::name(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 309 of file print_walker.cc. References _out, idNode::decl(), in(), indent(), idNode::name(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 582 of file print_walker.cc. References _out, selectionNode::expr(), ifNode::false_br(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, and ifNode::true_br(). |
|
Definition at line 278 of file walker.h. References Walker::at_expr(). Referenced by Walker::at_const(), and Walker::at_id(). |
|
Reimplemented from Walker. Definition at line 445 of file print_walker.cc. References _out, initializerNode::exprs(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Definition at line 350 of file walker.h. References Walker::at_stmt(). Referenced by Walker::at_break(), Walker::at_continue(), Walker::at_goto(), and Walker::at_return(). |
|
Reimplemented from Walker. Definition at line 523 of file print_walker.cc. References _out, goto_list, goto_list_p, in(), indent(), labelNode::name(), out(), Walker::Postorder, Walker::Preorder, labelNode::references(), and targetNode::stmt(). |
|
Reimplemented in semcheck_walker, set_container_walker, TreeChecker, and init_flowproblem_walker. Definition at line 338 of file walker.h. References Walker::at_stmt(). Referenced by Walker::at_do(), Walker::at_for(), and Walker::at_while(). |
|
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(). |
|
Reimplemented from Walker. Definition at line 790 of file print_walker.cc. References _out, operandNode::addr(), in(), indent(), operandNode::index(), out(), Walker::Postorder, Walker::Preorder, and operandNode::star(). |
|
Reimplemented from Walker. Definition at line 150 of file print_walker.cc. References _out, primNode::basic(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, basic_type::to_string(), and typeNode::type_qualifiers_name(). |
|
Reimplemented from Walker. Definition at line 129 of file print_walker.cc. References _out, procNode::body(), procNode::decl(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 190 of file print_walker.cc. References _out, in(), indent(), out(), Walker::Postorder, Walker::Preorder, and typeNode::type_qualifiers_name(). |
|
Reimplemented from Walker. Definition at line 757 of file print_walker.cc. References _out, returnNode::expr(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, and returnNode::proc(). |
|
Reimplemented in semcheck_walker. Definition at line 329 of file walker.h. References Walker::at_stmt(). Referenced by Walker::at_if(), and Walker::at_switch(). |
|
Reimplemented in NodeLocator, W, init_flowproblem_walker, and LivenessWalker. Definition at line 308 of file walker.h. References Walker::at_node(). Referenced by Walker::at_attrib(), Walker::at_block(), Walker::at_exprstmt(), Walker::at_jump(), Walker::at_loop(), Walker::at_selection(), Walker::at_target(), Walker::at_threeAddr(), and metastmtNode::walk(). |
|
Definition at line 263 of file walker.h. References Walker::at_sue(). Referenced by structNode::walk(). |
|
Definition at line 236 of file walker.h. References Walker::at_decl(). Referenced by subdeclNode::walk(). |
|
Reimplemented from Walker. Definition at line 234 of file print_walker.cc. References _out, Enum, in(), indent(), suespecNode::name(), out(), Walker::Postorder, Walker::Preorder, sueNode::spec(), Struct, Node::typ(), and Union. |
|
Reimplemented from Walker. Definition at line 269 of file print_walker.cc. References _out, suespecNode::align(), suespecNode::complete(), in(), indent(), suespecNode::name(), out(), Walker::Postorder, Walker::Preorder, suespecNode::size(), typeNode::type_qualifiers_name(), and suespecNode::visited(). |
|
Reimplemented from Walker. Definition at line 606 of file print_walker.cc. References _out, switchNode::cases(), selectionNode::expr(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, selectionNode::stmt(), target_list, and target_list_p. |
|
Reimplemented in init_flowproblem_walker. Definition at line 320 of file walker.h. References Walker::at_stmt(). Referenced by Walker::at_case(), and Walker::at_label(). |
|
Reimplemented from Walker. Definition at line 167 of file print_walker.cc. References _out, tdefNode::def(), in(), indent(), tdefNode::name(), out(), Walker::Postorder, Walker::Preorder, and typeNode::type_qualifiers_name(). |
|
Reimplemented from Walker. Definition at line 398 of file print_walker.cc. References _out, ternaryNode::cond(), ternaryNode::false_br(), in(), indent(), out(), Walker::Postorder, Walker::Preorder, and ternaryNode::true_br(). |
|
Reimplemented from Walker. Definition at line 841 of file print_walker.cc. References _out, in(), indent(), out(), Walker::Postorder, Walker::Preorder, and textNode::text(). |
|
Reimplemented from Walker. Definition at line 825 of file print_walker.cc. References _out, in(), indent(), threeAddrNode::op(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented in W, and TreeChecker. Definition at line 242 of file walker.h. References Walker::at_node(). Referenced by Walker::at_array(), Walker::at_func(), Walker::at_prim(), Walker::at_ptr(), Walker::at_sue(), Walker::at_suespec(), and Walker::at_tdef(). |
|
Reimplemented from Walker. Definition at line 346 of file print_walker.cc. References _out, unaryNode::expr(), in(), indent(), unaryNode::op(), out(), Walker::Postorder, Walker::Preorder, and Operator::print(). |
|
Definition at line 266 of file walker.h. References Walker::at_sue(). Referenced by unionNode::walk(). |
|
Reimplemented from Walker. Definition at line 83 of file print_walker.cc. References _out, in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
Reimplemented from Walker. Definition at line 639 of file print_walker.cc. References _out, loopNode::body(), loopNode::cond(), in(), indent(), out(), Walker::Postorder, and Walker::Preorder. |
|
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. Referenced by whileNode::walk(), unitNode::walk(), unionNode::walk(), unaryNode::walk(), threeAddrNode::walk(), ternaryNode::walk(), switchNode::walk(), suespecNode::walk(), subdeclNode::walk(), structNode::walk(), returnNode::walk(), ptrNode::walk(), procNode::walk(), operandNode::walk(), metastmtNode::walk(), metaexprNode::walk(), labelNode::walk(), initializerNode::walk(), ifNode::walk(), idNode::walk(), funcNode::walk(), forNode::walk(), exprstmtNode::walk(), enumNode::walk(), doNode::walk(), declNode::walk(), constNode::walk(), conditiongotoNode::walk(), commaNode::walk(), castNode::walk(), caseNode::walk(), callNode::walk(), blockNode::walk(), binaryNode::walk(), basicblockNode::walk(), attribNode::walk(), arrayNode::walk(), and Walker::Walker(). |
|
Definition at line 61 of file print_walker.h. Referenced by at_array(), at_attrib(), at_basicblock(), at_binary(), at_block(), at_break(), at_call(), at_case(), at_cast(), at_comma(), at_conditiongoto(), at_const(), at_continue(), at_decl(), at_do(), at_exprstmt(), at_for(), at_func(), at_goto(), at_id(), at_if(), at_initializer(), at_label(), at_operand(), at_prim(), at_proc(), at_ptr(), at_return(), at_sue(), at_suespec(), at_switch(), at_tdef(), at_ternary(), at_text(), at_threeAddr(), at_unary(), at_unit(), and at_while(). |
|
Definition at line 67 of file print_walker.cc. References _out. Referenced by at_array(), at_attrib(), at_basicblock(), at_binary(), at_block(), at_break(), at_call(), at_case(), at_cast(), at_comma(), at_conditiongoto(), at_const(), at_continue(), at_decl(), at_do(), at_exprstmt(), at_for(), at_func(), at_goto(), at_id(), at_if(), at_initializer(), at_label(), at_operand(), at_prim(), at_proc(), at_ptr(), at_return(), at_sue(), at_suespec(), at_switch(), at_tdef(), at_ternary(), at_text(), at_threeAddr(), at_unary(), at_unit(), and at_while(). |
|
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. Referenced by df_number_walker::at_node(), whileNode::walk(), unitNode::walk(), unionNode::walk(), unaryNode::walk(), threeAddrNode::walk(), textNode::walk(), ternaryNode::walk(), tdefNode::walk(), switchNode::walk(), suespecNode::walk(), subdeclNode::walk(), structNode::walk(), returnNode::walk(), ptrNode::walk(), procNode::walk(), primNode::walk(), operandNode::walk(), metastmtNode::walk(), metaexprNode::walk(), labelNode::walk(), initializerNode::walk(), ifNode::walk(), idNode::walk(), gotoNode::walk(), funcNode::walk(), forNode::walk(), exprstmtNode::walk(), enumNode::walk(), doNode::walk(), declNode::walk(), continueNode::walk(), constNode::walk(), conditiongotoNode::walk(), commaNode::walk(), castNode::walk(), caseNode::walk(), callNode::walk(), breakNode::walk(), blockNode::walk(), binaryNode::walk(), basicblockNode::walk(), attribNode::walk(), and arrayNode::walk(). |
|
Definition at line 62 of file print_walker.h. Referenced by at_array(), at_attrib(), at_basicblock(), at_binary(), at_block(), at_break(), at_call(), at_case(), at_cast(), at_comma(), at_conditiongoto(), at_const(), at_continue(), at_decl(), at_do(), at_exprstmt(), at_for(), at_func(), at_goto(), at_id(), at_if(), at_initializer(), at_label(), at_operand(), at_prim(), at_proc(), at_ptr(), at_return(), at_sue(), at_suespec(), at_switch(), at_tdef(), at_ternary(), at_text(), at_threeAddr(), at_unary(), at_unit(), and at_while(). |
|
To display the AST, call this static function:.
Definition at line 46 of file print_walker.cc. References df_number_walker::number(), numbering_map, and Node::walk(). Referenced by TreeChecker::checkTree(), and print_ast_phase::run(). |
|
Definition at line 56 of file print_walker.h. |
|
Definition at line 57 of file print_walker.h. |
|
Definition at line 55 of file print_walker.h. Referenced by at_array(), at_attrib(), at_basicblock(), at_binary(), at_block(), at_break(), at_call(), at_case(), at_cast(), at_comma(), at_conditiongoto(), at_const(), at_continue(), at_decl(), at_do(), at_exprstmt(), at_for(), at_func(), at_goto(), at_id(), at_if(), at_initializer(), at_label(), at_operand(), at_prim(), at_proc(), at_ptr(), at_return(), at_sue(), at_suespec(), at_switch(), at_tdef(), at_ternary(), at_text(), at_threeAddr(), at_unary(), at_unit(), at_while(), and indent(). |
Generated on August 27, 2003
Back to the C-Breeze home page