Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

Walker Class Reference

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

#include <iokernel/walker.h>

Class diagram for Walker:

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

List of all members.


Public Members

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

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
SuifEnv* get_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:


Member Function Documentation

Walker::Walker (SuifEnv * the_env)

virtual Walker::~Walker () [virtual]

In case subclasses want to delete something.

virtual ApplyStatus Walker::operator() (Address address, const MetaClass * _meta) [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.

virtual bool Walker::is_walkable (Address address, bool is_owned, const MetaClass * _meta) [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 ReplacingWalker, and AllWalker.

virtual bool Walker::is_visitable (Address address, const MetaClass * _meta) const [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, and SelectiveWalker.

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.

bool Walker::get_is_pre_order () const

Get the order of walking.

Returns:
true iff the order is pre-order.

void Walker::set_address (Address new_address)

Address Walker::get_address () const

SuifEnv * Walker::get_env () const

void Walker::set_parent (Address addr)

Address Walker::get_parent () const

virtual bool Walker::get_makes_changes () const [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.

virtual bool Walker::is_changed (Address addr) const [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.


The documentation for this class was generated from the following files:
Generated at Wed Apr 25 17:35:10 2001 for NCI SUIF by doxygen  written by Dimitri van Heesch, © 1997-1999