Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Walker Class Reference

This is the base class for all Walkers. More...

#include <iokernel/walker.h>

Inheritance diagram for Walker:

SuifWalker AllWalker GroupWalker SelectiveWalker stopping_suif_visitor Collector SuifCounter constant_folder_walker RemoveIfAndLoopWalker ReplacingWalker binary_expression_walker CollectWalker CollisionAvoider CountCallsWalker CountIndirectCalls_Walker FindCalleesWalker formater NonConstBoundArrayTypeWalker NonConstDimExpressionWalker Padding ProcedureWalker SymbolNamer TestWalker type_checker_walker Unowned collect_annotations_visitor find_file_suif_visitor find_instruction_visitor find_line_annote_suif_visitor find_tag_visitor line_suif_visitor List of all members.

Public Types

enum  ApplyStatus {
  Continue,
  Stop,
  Abort,
  Truncate,
  Replaced
}
 Status codes that can be returned by the operator(). More...


Public Methods

 Walker (SuifEnv *the_env)
virtual ~Walker ()
 In case subclasses want to delete something.

virtual ApplyStatus operator() (Address address, const MetaClass *_meta) = 0
 Called by the walker to perform action on the data in address. More...

virtual bool is_walkable (Address address, bool is_owned, const MetaClass *_meta)
 Determine if the tree rooted at the address should be walked Default implementation returns true iff is_owned is true. More...

virtual bool is_visitable (Address address, const MetaClass *_meta) const
 Determine if operator() should be called on the data in address. More...

void set_post_order ()
 Set the order of walking to post_order. More...

void set_pre_order ()
 Set the order of walking to pre_order, which is the default.

bool get_is_pre_order () const
 Get the order of walking. More...

void set_address (Address new_address)
Address get_address () const
SuifEnvget_env () const
void set_parent (Address addr)
Address get_parent () const
virtual bool get_makes_changes () const
 It is possible for nodes to be replaced during a walk. More...

virtual bool is_changed (Address addr) const
 Should the node be ignored because it has been deleted or changed? This exists so that we do not need to try to develop the real meta class for a deleted object. More...


Detailed Description

This is the base class for all Walkers.

This class is abstract. Generally, you will want to derive from SuifWalker found in suifkernel/suif_walker.h. The normal use of walkers is described in that file.

See also:
suif_walker.h


Member Enumeration Documentation

enum Walker::ApplyStatus

Status codes that can be returned by the operator().

The internal status should not be modified by the operator code.

Enumeration values:
Continue   Continue iteration.
Stop   Stop iteration, normal termination.
Abort   Stop with error condition.
Truncate   Do not walk sub-objects of this object (pre-order only).
Replaced   Object has been replaced with a new object.

You must set the address of the new object by calling set_address before returning.


Constructor & Destructor Documentation

Walker::Walker ( SuifEnv * the_env)

Walker::~Walker () [inline, virtual]

In case subclasses want to delete something.


Member Function Documentation

Address Walker::get_address () const

SuifEnv * Walker::get_env () const

bool Walker::get_is_pre_order () const

Get the order of walking.

Returns:
true iff the order is pre-order.

bool Walker::get_makes_changes () const [inline, virtual]

It is possible for nodes to be replaced during a walk.

This is important when walking lists, as the contents of the list can change while the list is being walked.

So, if changes can occur, we must copy the list before walking it. get_makes_changes returns true if a walker changes the tree.

Reimplemented in ReplacingWalker.

Address Walker::get_parent () const

bool Walker::is_changed ( Address addr) const [inline, virtual]

Should the node be ignored because it has been deleted or changed? This exists so that we do not need to try to develop the real meta class for a deleted object.

Doing that will cause a seg fault

Reimplemented in ReplacingWalker.

bool Walker::is_visitable ( Address address,
const MetaClass * _meta) const [inline, virtual]

Determine if operator() should be called on the data in address.

Default implementation always true.

Parameters:
address   points to the data.
_meta   the meta class of the data pointed to by address.

Reimplemented in SuifWalker.

bool Walker::is_walkable ( Address address,
bool is_owned,
const MetaClass * _meta) [inline, virtual]

Determine if the tree rooted at the address should be walked Default implementation returns true iff is_owned is true.

You can, for example, return false if you know that a node of interest cannot be contained inside a given node.

Notice the difference to is_visitable. The latter determines if the function operator should be called on a given node. This function controls walking of an entire subtree.

Parameters:
address   (a pointer to) a pointer.
is_owned   true if the pointer pointed to by address is owned by this object.
_meta   the meta class of the pointer in address. This meta class will be a subclass of PointerMetaClass.

Reimplemented in AllWalker, and ReplacingWalker.

ApplyStatus Walker::operator() ( Address address,
const MetaClass * _meta) [inline, pure virtual]

Called by the walker to perform action on the data in address.

Subclass must overwrite this method.

Parameters:
address   address of the data to be applied on.
_meta   meta class of the data in address.

Reimplemented in SuifWalker.

void Walker::set_address ( Address new_address)

void Walker::set_parent ( Address addr)

void Walker::set_post_order ()

Set the order of walking to post_order.

Default is pre_order.

void Walker::set_pre_order ()

Set the order of walking to pre_order, which is the default.


The documentation for this class was generated from the following files:
Generated at Mon Jul 31 13:45:00 2000 for NCI SUIF by doxygen 1.1.2 written by Dimitri van Heesch, © 1997-2000