at.dms.kjc.sir.lowering
Class StaticsProp.IterOverAllFieldsAndMethods

java.lang.Object
  extended by at.dms.kjc.sir.lowering.StaticsProp.IterOverAllFieldsAndMethods
Enclosing class:
StaticsProp

public static class StaticsProp.IterOverAllFieldsAndMethods
extends Object

Methods to iterate a EmptyAttributeVisitor over all fields / methods / parameters of a stream, or of a subgraph of the stream graph.

The methods preVisit(SIRStream) and postVisit(SIRStream) are overridable. When iterating the visitor over a subgraph, you can use these methods to get / set information for the visitor per SIRStream.

You can select to visit field definitions, method definitions, and / or parameter definitions. If visiting parameter definitions for push / pop / peek rates,


Constructor Summary
StaticsProp.IterOverAllFieldsAndMethods()
           
 
Method Summary
 void iterOverAllFieldsAndMethods(SIRStream str, boolean doFields, boolean doMethods, boolean doParameters, EmptyAttributeVisitor visitor)
          Visit all field, method, and parameter definitions reachable from a SIRStream (Including substreams).
static void iterOverFieldsAndMethods(SIRStream str, boolean doFields, boolean doMethods, boolean doParameters, EmptyAttributeVisitor visitor)
          Visit all field and method declarations in a SIRStream element (Not including substreams).
protected  void postVisit(SIRStream str)
          Operation to perform after visiting a SIRStream
protected  boolean preVisit(SIRStream str)
          Operation to perform before visiting a SIRstream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticsProp.IterOverAllFieldsAndMethods

public StaticsProp.IterOverAllFieldsAndMethods()
Method Detail

preVisit

protected boolean preVisit(SIRStream str)
Operation to perform before visiting a SIRstream. (for overriding)

Parameters:
str - a SIRStream
Returns:
true if fields, methods, parameters in this SIRStream should be visited. false otherwise.

postVisit

protected void postVisit(SIRStream str)
Operation to perform after visiting a SIRStream

Parameters:
str - a SIRStream

iterOverAllFieldsAndMethods

public void iterOverAllFieldsAndMethods(SIRStream str,
                                        boolean doFields,
                                        boolean doMethods,
                                        boolean doParameters,
                                        EmptyAttributeVisitor visitor)
Visit all field, method, and parameter definitions reachable from a SIRStream (Including substreams). Given a SIRStream (filter, pipeline, splitjoin, ...) for all Iterate over the stream, and for each element use the passed EmptyAttributeVisitor to iterate over all field and method declarations. See iterOverFieldsAndMethods for more details.

Parameters:
str - a SIRStream object -- root of traversal
doFields - == true to visit field declarations
doMethods - == true to visit method declarations
doParameters - == true to visit parameters (push / pop / peek rates, joiner / splitter weights...)
visitor - inheriting from EmptyAttributeVisitor that will be used on field / method / parameter declarations.

iterOverFieldsAndMethods

public static void iterOverFieldsAndMethods(SIRStream str,
                                            boolean doFields,
                                            boolean doMethods,
                                            boolean doParameters,
                                            EmptyAttributeVisitor visitor)
Visit all field and method declarations in a SIRStream element (Not including substreams). Given a SIRStream element, find all field declarations and methods defined in the stream element, and have them accept the passed visitor. It is a Java limitation that a parameterized return type can not be instantiated to void (as opposed to generics in ML or Haskell) so even if you want to use a subclass of KjcVisitor to gather information, you still need to use a subclass of EmptyAttributeVisitor. In fact, you will want a visitor extended for dealing with SIR constructs. This method contains special cases for visitors extending ReplacingVisitor: these visitors automatically replace (destructively update) sub-trees of the AST that acepts them. Here, we update any top-level method declarations / field declarations / parameter values, changed by a ReplacingVisitor. If you are updating parameters, or just inspecting the actual values of parameters, you should call #at.dms.kjc.sir.SIRDynamicRateManager.pushIdentityPolicy() before calling this method (and #at.dms.kjc.sir.SIRDynamicRateManager.popPolicy() after).

Parameters:
str - a SIRStream object (filter, splitjoin, ...)
doFields - == true to visit field declarations
doMethods - == true to visit method declarations
doParameters - == true to visit parameters (push / pop / peek rates, joiner / splitter weights...)
visitor - inheriting from EmptyAttributeVisitor that will be used on field / method / parameter declarations.