at.dms.kjc.sir
Class SIRFeedbackLoop

java.lang.Object
  extended by at.dms.kjc.sir.SIROperator
      extended by at.dms.kjc.sir.SIRStream
          extended by at.dms.kjc.sir.SIRContainer
              extended by at.dms.kjc.sir.SIRFeedbackLoop
All Implemented Interfaces:
DeepCloneable, Finalizable, SIRCodeUnit, Serializable, Cloneable

public class SIRFeedbackLoop
extends SIRContainer
implements Cloneable

This represents a feedback loop construct.

See Also:
Serialized Form

Field Summary
static int BODY
          These constants are used for addressing the children of a feedback loop.
static int LOOP
           
 
Fields inherited from class at.dms.kjc.sir.SIRStream
fields, ident, init, methods, work
 
Constructor Summary
SIRFeedbackLoop()
          Construct a new SIRPipeline null fields, parent, and methods
SIRFeedbackLoop(SIRContainer parent, String ident)
          Construct a new SIRPipeline with empty fields and methods.
SIRFeedbackLoop(SIRContainer parent, String ident, JFieldDeclaration[] fields, JMethodDeclaration[] methods)
          Construct a new SIRPipeline with the given fields and methods.
 
Method Summary
 Object accept(AttributeStreamVisitor v)
          Accepts attribute visitor at this node.
 boolean contains(SIROperator str)
          Whether or not is an immediate child of this.
 Object deepClone()
          Returns a deep clone of this object.
protected  void deepCloneInto(SIRFeedbackLoop other)
          Clones all fields of this into
 SIRStream getBody()
          Returns body of this.
 String getChildName(SIROperator str)
          Returns the relative name by which this object refers to child , or null if is not a child of this.
 List<SIROperator> getChildren()
          Returns a list of the children of this.
 JExpression getDelay()
          get the delay of the feedback loop
 int getDelayInt()
          Retrieve the delay of this as an int (requires that constants have been propagated).
 JMethodDeclaration getInitPath()
          Returns the path-initialization function of this.
 CType getInputType()
          Returns the input type of this.
 SIRJoiner getJoiner()
          Returns joiner of this.
 SIRStream getLoop()
          Returns loop of this.
 CType getOutputType()
          Returns the output type of this.
 int getPopForSchedule(HashMap[] counts)
          Same as getPushForSchedule, but with pop instead of push.
 int getPushForSchedule(HashMap[] counts)
          Returns the number of items pushed out of this stream in one execution of the steady-state, given the steady-state execution counts specified by (as in SIRScheduler.) Requires that contains a firing for each *filter* that contained in the hierarchy of this (does not depend on splitters / joiners.) The intent of this method is that can be calculated once for a stream graph, then the splitjoins & pipelines of the graph can be refactored, and one can still call this to get the push count of new constructs without re-invoking the scheduler.
 SIRSplitter getSplitter()
          Returns splitter of this.
 LIRStreamType getStreamType()
          Returns the type of this stream.
 SIROperator getSuccessor(SIRStream child)
          Overrides SIRStream.getSuccessor.
 List<SIROperator[]> getTapePairs()
          Returns a list of tuples (two-element arrays) of SIROperators, representing a tape from the first element of each tuple to the second.
 void reclaimChildren()
          Resets all children of this to have this as their parent, and calls reclaimChildren on all children that are containers.
 void replace(SIRStream oldStr, SIRStream newStr)
          See documentation in SIRContainer.
 void rescale()
           
 void setBody(SIRStream body)
          Set the Body of the feedback loop, and the parent of to this.
 void setDelay(JExpression delay)
          Set the delay of the feedback loop
 void setInitPath(JMethodDeclaration newInitPath)
          Set the Init Path method of the feedback loop
 void setJoiner(SIRJoiner joiner)
          Set the Joiner of the feedback loop, and sets the parent of to be this.
 void setLoop(SIRStream loop)
          Set the Body of the feedback loop
 void setSplitter(SIRSplitter splitter)
          Set the Splitter of the feedback loop, and sets the parent of to be this.
 String toString()
           
 
Methods inherited from class at.dms.kjc.sir.SIRContainer
add, add, add, add, clear, deepCloneInto, destroy, get, getParams, getParams, indexOf, makeWrapper, myChildren, myParams, remove, remove, set, setParams, size
 
Methods inherited from class at.dms.kjc.sir.SIRStream
addField, addField, addFields, addFields, addMethod, addMethods, addReplacementMethod, deepCloneInto, getFields, getIdent, getInit, getMethods, getStreamWithNumber, getTypeNameInC, getWork, hasMethod, insideFeedbackLoop, makeEmptyInit, makeEmptyInitWork, makeEmptyWork, needsInit, needsWork, setFields, setIdent, setInit, setInitWithoutReplacement, setMethods, setWork
 
Methods inherited from class at.dms.kjc.sir.SIROperator
assertMutable, deepCloneInto, getAncestors, getName, getNumber, getParent, getParents, getParentStructureAccess, getRelativeName, getShortIdent, hashCode, readResolve, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BODY

public static final int BODY
These constants are used for addressing the children of a feedback loop.

See Also:
Constant Field Values

LOOP

public static final int LOOP
See Also:
Constant Field Values
Constructor Detail

SIRFeedbackLoop

public SIRFeedbackLoop()
Construct a new SIRPipeline null fields, parent, and methods


SIRFeedbackLoop

public SIRFeedbackLoop(SIRContainer parent,
                       String ident,
                       JFieldDeclaration[] fields,
                       JMethodDeclaration[] methods)
Construct a new SIRPipeline with the given fields and methods.


SIRFeedbackLoop

public SIRFeedbackLoop(SIRContainer parent,
                       String ident)
Construct a new SIRPipeline with empty fields and methods.

Method Detail

getOutputType

public CType getOutputType()
Returns the output type of this.

Specified by:
getOutputType in class SIRStream

getInputType

public CType getInputType()
Returns the input type of this.

Specified by:
getInputType in class SIRStream

getPushForSchedule

public int getPushForSchedule(HashMap[] counts)
Description copied from class: SIRStream
Returns the number of items pushed out of this stream in one execution of the steady-state, given the steady-state execution counts specified by (as in SIRScheduler.) Requires that contains a firing for each *filter* that contained in the hierarchy of this (does not depend on splitters / joiners.) The intent of this method is that can be calculated once for a stream graph, then the splitjoins & pipelines of the graph can be refactored, and one can still call this to get the push count of new constructs without re-invoking the scheduler.

Specified by:
getPushForSchedule in class SIRStream

getPopForSchedule

public int getPopForSchedule(HashMap[] counts)
Description copied from class: SIRStream
Same as getPushForSchedule, but with pop instead of push.

Specified by:
getPopForSchedule in class SIRStream

getStreamType

public LIRStreamType getStreamType()
Returns the type of this stream.

Specified by:
getStreamType in class SIRStream

getChildName

public String getChildName(SIROperator str)
Returns the relative name by which this object refers to child , or null if is not a child of this.


replace

public void replace(SIRStream oldStr,
                    SIRStream newStr)
See documentation in SIRContainer.

Specified by:
replace in class SIRContainer

rescale

public void rescale()

getChildren

public List<SIROperator> getChildren()
Returns a list of the children of this. The children are stream objects that are contained within this.

Overrides:
getChildren in class SIRContainer

reclaimChildren

public void reclaimChildren()
Description copied from class: SIRContainer
Resets all children of this to have this as their parent, and calls reclaimChildren on all children that are containers. This is needed because a stream can have exactly one parent, but sometimes a stream is shuffled around between different parents (e.g. in partitioning).

Overrides:
reclaimChildren in class SIRContainer

getSuccessor

public SIROperator getSuccessor(SIRStream child)
Overrides SIRStream.getSuccessor. The loop stream should have the joiner as its successor. All others are in order set by .

Overrides:
getSuccessor in class SIRContainer

getTapePairs

public List<SIROperator[]> getTapePairs()
Returns a list of tuples (two-element arrays) of SIROperators, representing a tape from the first element of each tuple to the second.

Specified by:
getTapePairs in class SIRContainer

accept

public Object accept(AttributeStreamVisitor v)
Accepts attribute visitor at this node.

Specified by:
accept in class SIROperator

setBody

public void setBody(SIRStream body)
Set the Body of the feedback loop, and the parent of to this.


setLoop

public void setLoop(SIRStream loop)
Set the Body of the feedback loop


setJoiner

public void setJoiner(SIRJoiner joiner)
Set the Joiner of the feedback loop, and sets the parent of to be this.


setSplitter

public void setSplitter(SIRSplitter splitter)
Set the Splitter of the feedback loop, and sets the parent of to be this.


setDelay

public void setDelay(JExpression delay)
Set the delay of the feedback loop


getDelay

public JExpression getDelay()
get the delay of the feedback loop


getDelayInt

public int getDelayInt()
Retrieve the delay of this as an int (requires that constants have been propagated).


contains

public boolean contains(SIROperator str)
Whether or not is an immediate child of this.

Overrides:
contains in class SIRContainer

setInitPath

public void setInitPath(JMethodDeclaration newInitPath)
Set the Init Path method of the feedback loop


getBody

public SIRStream getBody()
Returns body of this.


getLoop

public SIRStream getLoop()
Returns loop of this.


getJoiner

public SIRJoiner getJoiner()
Returns joiner of this.


getSplitter

public SIRSplitter getSplitter()
Returns splitter of this.


getInitPath

public JMethodDeclaration getInitPath()
Returns the path-initialization function of this.


toString

public String toString()
Overrides:
toString in class SIRStream

deepClone

public Object deepClone()
Returns a deep clone of this object.

Specified by:
deepClone in interface DeepCloneable
Overrides:
deepClone in class SIRContainer

deepCloneInto

protected void deepCloneInto(SIRFeedbackLoop other)
Clones all fields of this into
other