C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ExpressionDismantle Class Reference

#include <dismantle.h>

Inheritance diagram for ExpressionDismantle:

Changer List of all members.

Public Types

enum  Order { Preorder, Postorder, Both }
enum  Depth { Subtree, NodeOnly }

Public Member Functions

 ExpressionDismantle (void)
virtual Nodeat_exprstmt (exprstmtNode *, Order)
virtual Nodeat_type (typeNode *, Order)
virtual Nodeat_binary (binaryNode *, Order)
virtual Nodeat_unary (unaryNode *, Order)
virtual Nodeat_call (callNode *, Order)
virtual Nodeat_comma (commaNode *, Order)
virtual Nodeat_cast (castNode *, Order)
Accessors
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.

bool delete_old () const
 Return whether this Changer deletes Nodes which are removed from the AST by "at_" methods.

"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 Nodeat_node (Node *the_node, Order ord)
virtual Nodeat_unit (unitNode *the_unit, Order ord)
virtual Nodeat_def (defNode *the_def, Order ord)
virtual Nodeat_decl (declNode *the_decl, Order ord)
virtual Nodeat_subdecl (subdeclNode *the_subdecl, Order ord)
virtual Nodeat_proc (procNode *the_proc, Order ord)
virtual Nodeat_prim (primNode *the_prim, Order ord)
virtual Nodeat_tdef (tdefNode *the_tdef, Order ord)
virtual Nodeat_ptr (ptrNode *the_ptr, Order ord)
virtual Nodeat_array (arrayNode *the_array, Order ord)
virtual Nodeat_func (funcNode *the_func, Order ord)
virtual Nodeat_sue (sueNode *the_sue, Order ord)
virtual Nodeat_struct (structNode *the_struct, Order ord)
virtual Nodeat_union (unionNode *the_union, Order ord)
virtual Nodeat_enum (enumNode *the_enum, Order ord)
virtual Nodeat_suespec (suespecNode *the_suespec, Order ord)
virtual Nodeat_expr (exprNode *the_expr, Order ord)
virtual Nodeat_index (indexNode *the_index, Order ord)
virtual Nodeat_const (constNode *the_const, Order ord)
virtual Nodeat_id (idNode *the_id, Order ord)
virtual Nodeat_ternary (ternaryNode *the_ternary, Order ord)
virtual Nodeat_initializer (initializerNode *the_initializer, Order ord)
virtual Nodeat_stmt (stmtNode *the_stmt, Order ord)
virtual Nodeat_block (blockNode *the_block, Order ord)
virtual Nodeat_basicblock (basicblockNode *the_basicblock, Order ord)
virtual Nodeat_target (targetNode *the_target, Order ord)
virtual Nodeat_label (labelNode *the_label, Order ord)
virtual Nodeat_case (caseNode *the_case, Order ord)
virtual Nodeat_selection (selectionNode *the_selection, Order ord)
virtual Nodeat_if (ifNode *the_if, Order ord)
virtual Nodeat_switch (switchNode *the_switch, Order ord)
virtual Nodeat_loop (loopNode *the_loop, Order ord)
virtual Nodeat_while (whileNode *the_while, Order ord)
virtual Nodeat_do (doNode *the_do, Order ord)
virtual Nodeat_for (forNode *the_for, Order ord)
virtual Nodeat_jump (jumpNode *the_jump, Order ord)
virtual Nodeat_goto (gotoNode *the_goto, Order ord)
virtual Nodeat_continue (continueNode *the_continue, Order ord)
virtual Nodeat_break (breakNode *the_break, Order ord)
virtual Nodeat_return (returnNode *the_return, Order ord)
virtual Nodeat_attrib (attribNode *the_attrib, Order ord)
virtual Nodeat_operand (operandNode *the_oper, Order ord)
virtual Nodeat_conditiongoto (conditiongotoNode *the_condgoto, Order ord)
virtual Nodeat_threeAddr (threeAddrNode *the_3addr, Order ord)
virtual Nodeat_text (textNode *the_text, Order ord)

Static Public Member Functions

void init ()

Private Attributes

blockNode_new_block
int _in_type

Static Private Attributes

op_id_map _op_assign_map
op_id_set _op_post

Member Enumeration Documentation

enum Changer::Depth [inherited]
 

Enumeration values:
Subtree 
NodeOnly 

Definition at line 148 of file changer.h.

enum Changer::Order [inherited]
 

Enumeration values:
Preorder 
Postorder 
Both 

Definition at line 147 of file changer.h.

Referenced by whileNode::change(), unitNode::change(), unionNode::change(), unaryNode::change(), threeAddrNode::change(), textNode::change(), ternaryNode::change(), tdefNode::change(), switchNode::change(), suespecNode::change(), subdeclNode::change(), structNode::change(), returnNode::change(), ptrNode::change(), procNode::change(), primNode::change(), operandNode::change(), metastmtNode::change(), metaexprNode::change(), labelNode::change(), initializerNode::change(), ifNode::change(), idNode::change(), gotoNode::change(), funcNode::change(), forNode::change(), exprstmtNode::change(), enumNode::change(), doNode::change(), declNode::change(), continueNode::change(), constNode::change(), conditiongotoNode::change(), commaNode::change(), castNode::change(), caseNode::change(), callNode::change(), breakNode::change(), blockNode::change(), binaryNode::change(), basicblockNode::change(), attribNode::change(), and arrayNode::change().


Constructor & Destructor Documentation

ExpressionDismantle::ExpressionDismantle void   
 

Definition at line 94 of file dismantle-expr.cc.


Member Function Documentation

virtual Node* Changer::at_array arrayNode   the_array,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger.

Definition at line 253 of file changer.h.

References Changer::at_type().

Referenced by arrayNode::change().

virtual Node* Changer::at_attrib attribNode   the_attrib,
Order    ord
[inline, virtual, inherited]
 

Definition at line 364 of file changer.h.

References Changer::at_stmt().

Referenced by attribNode::change().

virtual Node* Changer::at_basicblock basicblockNode   the_basicblock,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in constantFoldingChanger.

Definition at line 313 of file changer.h.

References Changer::at_block().

Referenced by basicblockNode::change().

Node * ExpressionDismantle::at_binary binaryNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 135 of file dismantle-expr.cc.

References _in_type, _new_block, operandNode::addr(), Operator::ANDassign, ref_clone_changer::clone(), Const, Node::coord(), blockNode::decls(), Operator::DIVassign, Operator::EQ, Operator::ERassign, Operator::GE, Id, Operator::id(), Operator::Index, operandNode::index(), Operator::LE, binaryNode::left(), Operator::LS, Operator::LSassign, Operator::MINUSassign, Operator::MODassign, Operator::MULTassign, Operator::NE, DismantleUtil::new_temp_decl(), binaryNode::op(), Operand, Operator::ORassign, exprNode::output(), Operator::PLUSassign, Changer::Postorder, binaryNode::right(), Operator::RS, Operator::RSassign, blockNode::stmts(), Node::typ(), operandNode::type(), and exprNode::type().

virtual Node* Changer::at_block blockNode   the_block,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in StaticToGlobalDismantle, and InitializerDismantle.

Definition at line 310 of file changer.h.

References Changer::at_stmt().

Referenced by Changer::at_basicblock(), and blockNode::change().

virtual Node* Changer::at_break breakNode   the_break,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in BreakContinueChanger.

Definition at line 358 of file changer.h.

References Changer::at_jump().

Referenced by breakNode::change().

Node * ExpressionDismantle::at_call callNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 531 of file dismantle-expr.cc.

References _in_type, _new_block, callNode::args(), Const, Node::coord(), blockNode::decls(), expr_list_p, Id, typeNode::is_void(), callNode::name(), DismantleUtil::new_temp_decl(), Operand, operand_list, Changer::Postorder, blockNode::stmts(), Node::typ(), and exprNode::type().

virtual Node* Changer::at_case caseNode   the_case,
Order    ord
[inline, virtual, inherited]
 

Definition at line 325 of file changer.h.

References Changer::at_target().

Referenced by caseNode::change().

Node * ExpressionDismantle::at_cast castNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 591 of file dismantle-expr.cc.

References _in_type, _new_block, Const, castNode::expr(), Id, typeNode::is_void(), Operand, Changer::Postorder, ThreeAddr, Node::typ(), and exprNode::type().

Node * ExpressionDismantle::at_comma commaNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 578 of file dismantle-expr.cc.

References Const, commaNode::exprs(), Id, Operand, Changer::Postorder, and Node::typ().

virtual Node* Changer::at_conditiongoto conditiongotoNode   the_condgoto,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in constantPropChanger, constantFoldingChanger, and constantsChanger.

Definition at line 370 of file changer.h.

References Changer::at_goto().

Referenced by conditiongotoNode::change().

virtual Node* Changer::at_const constNode   the_const,
Order    ord
[inline, virtual, inherited]
 

Definition at line 280 of file changer.h.

References Changer::at_index().

Referenced by constNode::change().

virtual Node* Changer::at_continue continueNode   the_continue,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in BreakContinueChanger.

Definition at line 355 of file changer.h.

References Changer::at_jump().

Referenced by continueNode::change().

virtual Node* Changer::at_decl declNode   the_decl,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger, StaticToGlobalDismantle, InitializerDismantle, FlattenDismantle, ref_clone_changer, and TreeFixer.

Definition at line 232 of file changer.h.

References Changer::at_def().

Referenced by Changer::at_subdecl(), and declNode::change().

virtual Node* Changer::at_def defNode   the_def,
Order    ord
[inline, virtual, inherited]
 

Definition at line 229 of file changer.h.

References Changer::at_node().

Referenced by Changer::at_decl(), and Changer::at_proc().

virtual Node* Changer::at_do doNode   the_do,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in LoopDismantle.

Definition at line 343 of file changer.h.

References Changer::at_loop().

Referenced by doNode::change().

virtual Node* Changer::at_enum enumNode   the_enum,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger.

Definition at line 268 of file changer.h.

References Changer::at_sue().

Referenced by enumNode::change().

virtual Node* Changer::at_expr exprNode   the_expr,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in ipConstantsChanger.

Definition at line 274 of file changer.h.

References Changer::at_node().

Referenced by Changer::at_binary(), Changer::at_call(), Changer::at_cast(), Changer::at_comma(), Changer::at_index(), Changer::at_initializer(), Changer::at_operand(), Changer::at_ternary(), Changer::at_unary(), and metaexprNode::change().

Node * ExpressionDismantle::at_exprstmt exprstmtNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 100 of file dismantle-expr.cc.

References _new_block, blockNode::change(), exprstmtNode::change(), Node::coord(), exprstmtNode::expr(), and Changer::Preorder.

virtual Node* Changer::at_for forNode   the_for,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in LoopDismantle.

Definition at line 346 of file changer.h.

References Changer::at_loop().

Referenced by forNode::change().

virtual Node* Changer::at_func funcNode   the_func,
Order    ord
[inline, virtual, inherited]
 

Definition at line 256 of file changer.h.

References Changer::at_type().

Referenced by funcNode::change().

virtual Node* Changer::at_goto gotoNode   the_goto,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in FlattenDismantle.

Definition at line 352 of file changer.h.

References Changer::at_jump().

Referenced by Changer::at_conditiongoto(), and gotoNode::change().

virtual Node* Changer::at_id idNode   the_id,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in UnusedDeclarationCleanupChanger, and constantsChanger.

Definition at line 283 of file changer.h.

References Changer::at_index().

Referenced by idNode::change().

virtual Node* Changer::at_if ifNode   the_if,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in SelectionDismantle, and CFS_Changer.

Definition at line 331 of file changer.h.

References Changer::at_selection().

Referenced by ifNode::change().

virtual Node* Changer::at_index indexNode   the_index,
Order    ord
[inline, virtual, inherited]
 

Definition at line 277 of file changer.h.

References Changer::at_expr().

Referenced by Changer::at_const(), and Changer::at_id().

virtual Node* Changer::at_initializer initializerNode   the_initializer,
Order    ord
[inline, virtual, inherited]
 

Definition at line 304 of file changer.h.

References Changer::at_expr().

Referenced by initializerNode::change().

virtual Node* Changer::at_jump jumpNode   the_jump,
Order    ord
[inline, virtual, inherited]
 

Definition at line 349 of file changer.h.

References Changer::at_stmt().

Referenced by Changer::at_break(), Changer::at_continue(), Changer::at_goto(), and Changer::at_return().

virtual Node* Changer::at_label labelNode   the_label,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in LabelDismantle, FlattenDismantle, and ref_clone_changer.

Definition at line 322 of file changer.h.

References Changer::at_target().

Referenced by labelNode::change().

virtual Node* Changer::at_loop loopNode   the_loop,
Order    ord
[inline, virtual, inherited]
 

Definition at line 337 of file changer.h.

References Changer::at_stmt().

Referenced by Changer::at_do(), Changer::at_for(), and Changer::at_while().

virtual Node* Changer::at_node Node   the_node,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in ref_clone_changer.

Definition at line 223 of file changer.h.

Referenced by Changer::at_def(), Changer::at_expr(), Changer::at_stmt(), Changer::at_text(), Changer::at_type(), and Changer::at_unit().

virtual Node* Changer::at_operand operandNode   the_oper,
Order    ord
[inline, virtual, inherited]
 

Definition at line 367 of file changer.h.

References Changer::at_expr().

Referenced by operandNode::change().

virtual Node* Changer::at_prim primNode   the_prim,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger.

Definition at line 244 of file changer.h.

References Changer::at_type().

Referenced by primNode::change().

virtual Node* Changer::at_proc procNode   the_proc,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in Dismantle, StaticToGlobalDismantle, ControlDismantle, ReturnDismantle, FlattenDismantle, function_inline, cfg_changer, copyPropChanger, deadCodeEliminationChanger, UnusedDeclarationCleanupChanger, LocalCopyPropChanger, CFS_Changer, and Optimizer.

Definition at line 238 of file changer.h.

References Changer::at_def().

Referenced by procNode::change().

virtual Node* Changer::at_ptr ptrNode   the_ptr,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger.

Definition at line 250 of file changer.h.

References Changer::at_type().

Referenced by ptrNode::change().

virtual Node* Changer::at_return returnNode   the_return,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in SelectionDismantle, ReturnDismantle, FlattenDismantle, and constantPropChanger.

Definition at line 361 of file changer.h.

References Changer::at_jump().

Referenced by returnNode::change().

virtual Node* Changer::at_selection selectionNode   the_selection,
Order    ord
[inline, virtual, inherited]
 

Definition at line 328 of file changer.h.

References Changer::at_stmt().

Referenced by Changer::at_if(), and Changer::at_switch().

virtual Node* Changer::at_stmt stmtNode   the_stmt,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in TernaryDismantle, and SelectionDismantle.

Definition at line 307 of file changer.h.

References Changer::at_node().

Referenced by Changer::at_attrib(), Changer::at_block(), Changer::at_exprstmt(), Changer::at_jump(), Changer::at_loop(), Changer::at_selection(), Changer::at_target(), Changer::at_threeAddr(), and metastmtNode::change().

virtual Node* Changer::at_struct structNode   the_struct,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger.

Definition at line 262 of file changer.h.

References Changer::at_sue().

Referenced by structNode::change().

virtual Node* Changer::at_subdecl subdeclNode   the_subdecl,
Order    ord
[inline, virtual, inherited]
 

Definition at line 235 of file changer.h.

References Changer::at_decl().

Referenced by subdeclNode::change().

virtual Node* Changer::at_sue sueNode   the_sue,
Order    ord
[inline, virtual, inherited]
 

Definition at line 259 of file changer.h.

References Changer::at_type().

Referenced by Changer::at_enum(), Changer::at_struct(), and Changer::at_union().

virtual Node* Changer::at_suespec suespecNode   the_suespec,
Order    ord
[inline, virtual, inherited]
 

Definition at line 271 of file changer.h.

References Changer::at_type().

Referenced by suespecNode::change().

virtual Node* Changer::at_switch switchNode   the_switch,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in SelectionDismantle, and ref_clone_changer.

Definition at line 334 of file changer.h.

References Changer::at_selection().

Referenced by switchNode::change().

virtual Node* Changer::at_target targetNode   the_target,
Order    ord
[inline, virtual, inherited]
 

Definition at line 319 of file changer.h.

References Changer::at_stmt().

Referenced by Changer::at_case(), and Changer::at_label().

virtual Node* Changer::at_tdef tdefNode   the_tdef,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger, and UpdateTdefChanger.

Definition at line 247 of file changer.h.

References Changer::at_type().

Referenced by tdefNode::change().

virtual Node* Changer::at_ternary ternaryNode   the_ternary,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in TernaryDismantle.

Definition at line 298 of file changer.h.

References Changer::at_expr().

Referenced by ternaryNode::change().

virtual Node* Changer::at_text textNode   the_text,
Order    ord
[inline, virtual, inherited]
 

Definition at line 376 of file changer.h.

References Changer::at_node().

Referenced by textNode::change().

virtual Node* Changer::at_threeAddr threeAddrNode   the_3addr,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in SizeofChanger, FlattenDismantle, function_inline, constantPropChanger, constantFoldingChanger, deadCodeEliminationChanger, constantsChanger, and deadcodeChanger.

Definition at line 373 of file changer.h.

References Changer::at_stmt().

Referenced by threeAddrNode::change().

Node * ExpressionDismantle::at_type typeNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 124 of file dismantle-expr.cc.

References _in_type, and Changer::Preorder.

Node * ExpressionDismantle::at_unary unaryNode  ,
Order   
[virtual]
 

Reimplemented from Changer.

Definition at line 345 of file dismantle-expr.cc.

References _in_type, _new_block, _op_post, operandNode::addr(), Operator::ADDRESS, ref_clone_changer::clone(), Const, Node::coord(), blockNode::decls(), exprstmtNode::expr(), unaryNode::expr(), operandNode::fields(), Id, Operator::id(), operandNode::index(), Operator::INDIR, DismantleUtil::new_temp_decl(), unaryNode::op(), Operand, Operator::POSTDEC, Operator::POSTINC, Changer::Postorder, Operator::PREDEC, Operator::PREINC, Changer::Preorder, Operator::SIZEOF, operandNode::star(), blockNode::stmts(), Node::typ(), exprNode::type(), Operator::UMINUS, and Operator::UPLUS.

virtual Node* Changer::at_union unionNode   the_union,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in AllocSizeChanger.

Definition at line 265 of file changer.h.

References Changer::at_sue().

Referenced by unionNode::change().

virtual Node* Changer::at_unit unitNode   the_unit,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in Dismantle, StaticToGlobalDismantle, and Optimizer.

Definition at line 226 of file changer.h.

References Changer::at_node().

Referenced by unitNode::change().

virtual Node* Changer::at_while whileNode   the_while,
Order    ord
[inline, virtual, inherited]
 

Reimplemented in LoopDismantle.

Definition at line 340 of file changer.h.

References Changer::at_loop().

Referenced by whileNode::change().

bool Changer::delete_old   const [inline, inherited]
 

Return whether this Changer deletes Nodes which are removed from the AST by "at_" methods.

Definition at line 209 of file changer.h.

Referenced by subdeclNode::change(), change_list(), and Changer::Changer().

Depth Changer::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 204 of file changer.h.

void ExpressionDismantle::init   [static]
 

Definition at line 70 of file dismantle-expr.cc.

References _op_assign_map, _op_post, Operator::ANDassign, Operator::DIVassign, Operator::ERassign, Operator::LS, Operator::LSassign, Operator::MINUSassign, Operator::MODassign, Operator::MULTassign, Operator::ORassign, Operator::PLUSassign, Operator::POSTDEC, Operator::POSTINC, Operator::PREDEC, Operator::PREINC, Operator::RS, and Operator::RSassign.

Referenced by Dismantle::at_proc().

Order Changer::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 196 of file changer.h.

Referenced by whileNode::change(), unitNode::change(), unionNode::change(), unaryNode::change(), threeAddrNode::change(), textNode::change(), ternaryNode::change(), tdefNode::change(), switchNode::change(), suespecNode::change(), subdeclNode::change(), structNode::change(), returnNode::change(), ptrNode::change(), procNode::change(), primNode::change(), operandNode::change(), metastmtNode::change(), metaexprNode::change(), labelNode::change(), initializerNode::change(), ifNode::change(), idNode::change(), gotoNode::change(), funcNode::change(), forNode::change(), exprstmtNode::change(), enumNode::change(), doNode::change(), declNode::change(), continueNode::change(), constNode::change(), conditiongotoNode::change(), commaNode::change(), castNode::change(), caseNode::change(), callNode::change(), breakNode::change(), blockNode::change(), binaryNode::change(), basicblockNode::change(), attribNode::change(), and arrayNode::change().


Member Data Documentation

int ExpressionDismantle::_in_type [private]
 

Definition at line 252 of file dismantle.h.

Referenced by at_binary(), at_call(), at_cast(), at_type(), and at_unary().

blockNode* ExpressionDismantle::_new_block [private]
 

Definition at line 251 of file dismantle.h.

Referenced by at_binary(), at_call(), at_cast(), at_exprstmt(), and at_unary().

map< unsigned int, unsigned int > ExpressionDismantle::_op_assign_map [static, private]
 

Definition at line 67 of file dismantle-expr.cc.

Referenced by init().

set< unsigned int > ExpressionDismantle::_op_post [static, private]
 

Definition at line 68 of file dismantle-expr.cc.

Referenced by at_unary(), and init().


The documentation for this class was generated from the following files:

Generated on August 27, 2003
Back to the C-Breeze home page