at.dms.kjc.sir
Class SIRStructure

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

public class SIRStructure
extends SIRStream

This class represents a data structure that may be passed between streams on tapes. It is implemented as an SIRStream for simplicity; a better design would have a parent class of SIRStream which was "SIR object with fields", and derive from that.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class at.dms.kjc.sir.SIRStream
fields, ident, init, methods, work
 
Constructor Summary
SIRStructure()
           
SIRStructure(SIRContainer parent, String ident, JFieldDeclaration[] fields)
           
SIRStructure(SIRContainer parent, String ident, JFieldDeclaration[] fields, boolean isUnion)
           
 
Method Summary
 Object accept(AttributeStreamVisitor v)
           
 void addMethod(JMethodDeclaration method)
          adds method to this, if is not already registered as a method of this.
 void addMethods(JMethodDeclaration[] m)
          Adds to the methods of this.
 Object deepClone()
          Returns a deep clone of this object.
protected  void deepCloneInto(SIRStructure other)
          Clones all fields of this into
 CType getInputType()
          Returns the input type 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.
 LIRStreamType getStreamType()
          Returns the type of this stream.
 boolean isCUnion()
          Should code generation crate a struct or a C union type?
 boolean needsInit()
          Returns whether or not this class needs a call to an init function to be generated.
 boolean needsWork()
          Returns whether or not this class needs a call to a work function to be generated.
 void setInit(JMethodDeclaration newInit)
          sets the init function
 void setInitWithoutReplacement(JMethodDeclaration newInit)
          sets the init function WITHOUT eliminating the old one in the methods array.
 void setMethods(JMethodDeclaration[] m)
          Install methods as the new methods array.
 void setWork(JMethodDeclaration newWork)
          Sets the work function.
 
Methods inherited from class at.dms.kjc.sir.SIRStream
addField, addField, addFields, addFields, addReplacementMethod, deepCloneInto, getFields, getIdent, getInit, getMethods, getParams, getStreamWithNumber, getTypeNameInC, getWork, hasMethod, insideFeedbackLoop, makeEmptyInit, makeEmptyInitWork, makeEmptyWork, setFields, setIdent, toString
 
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
 

Constructor Detail

SIRStructure

public SIRStructure(SIRContainer parent,
                    String ident,
                    JFieldDeclaration[] fields,
                    boolean isUnion)
Parameters:
parent -
ident -
fields -
isUnion -

SIRStructure

public SIRStructure(SIRContainer parent,
                    String ident,
                    JFieldDeclaration[] fields)
Parameters:
parent -
ident -
fields -

SIRStructure

public SIRStructure()
Method Detail

isCUnion

public boolean isCUnion()
Should code generation crate a struct or a C union type?

Returns:
true if code generation should make a union type.

addMethod

public void addMethod(JMethodDeclaration method)
Description copied from class: SIRStream
adds method to this, if is not already registered as a method of this. Requires that is non-null.

Specified by:
addMethod in interface SIRCodeUnit
Overrides:
addMethod in class SIRStream
Parameters:
method - The method to add.

addMethods

public void addMethods(JMethodDeclaration[] m)
Description copied from class: SIRStream
Adds to the methods of this. Does not check for duplicates.

Specified by:
addMethods in interface SIRCodeUnit
Overrides:
addMethods in class SIRStream
Parameters:
m - The methods to attempt to add to the end of the methods.

setMethods

public void setMethods(JMethodDeclaration[] m)
Description copied from interface: SIRCodeUnit
Install methods as the new methods array. Disregarding the old methods array.

Specified by:
setMethods in interface SIRCodeUnit
Overrides:
setMethods in class SIRStream
Parameters:
m - The new methods to install.

setWork

public void setWork(JMethodDeclaration newWork)
Description copied from class: SIRStream
Sets the work function.

Overrides:
setWork in class SIRStream

setInit

public void setInit(JMethodDeclaration newInit)
Description copied from class: SIRStream
sets the init function

Overrides:
setInit in class SIRStream

setInitWithoutReplacement

public void setInitWithoutReplacement(JMethodDeclaration newInit)
Description copied from class: SIRStream
sets the init function WITHOUT eliminating the old one in the methods array. Usually you want to use the plain setInit unless you're fusing.

Overrides:
setInitWithoutReplacement 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

getOutputType

public CType getOutputType()
Description copied from class: SIRStream
Returns the output type of this.

Specified by:
getOutputType in class SIRStream

getStreamType

public LIRStreamType getStreamType()
Description copied from class: SIRStream
Returns the type of this stream.

Specified by:
getStreamType in class SIRStream

getInputType

public CType getInputType()
Description copied from class: SIRStream
Returns the input type of this.

Specified by:
getInputType in class SIRStream

needsInit

public boolean needsInit()
Description copied from class: SIRStream
Returns whether or not this class needs a call to an init function to be generated. Special library functions like FileReader's and FileWriter's do not need an init call.

Overrides:
needsInit in class SIRStream

needsWork

public boolean needsWork()
Description copied from class: SIRStream
Returns whether or not this class needs a call to a work function to be generated. Special library functions like FileReader's and FileWriter's do not need a work call at the level of the Kopi IR (it is generated in C).

Overrides:
needsWork in class SIRStream

accept

public Object accept(AttributeStreamVisitor v)
Specified by:
accept in class SIROperator

deepClone

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

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

deepCloneInto

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