at.dms.kjc.cluster
Class TapeCluster

java.lang.Object
  extended by at.dms.kjc.cluster.TapeBase
      extended by at.dms.kjc.cluster.TapeCluster
All Implemented Interfaces:
Tape
Direct Known Subclasses:
TapeClusterFused

public class TapeCluster
extends TapeBase
implements Tape

Janis' code for cluster edges pulled out

Author:
dimock

Field Summary
protected  String consumer_name
           
protected  String pop_buffer
          name of pop buffer
protected  String pop_index
          a variable name for a tape offset (downstream)
protected  String producer_name
           
protected  String push_buffer
          name of push buffer
protected  String push_index
          a variable name for a tape offset (upstream)
protected  String tapeName
           
 
Fields inherited from class at.dms.kjc.cluster.TapeBase
dst, peek_name, pop_name, push_name, src, type, typeString
 
Method Summary
 String assignPeekToVar(String varName, String offset)
          Assign the result of peeking.
 String assignPopToVar(String varName)
          Statement, but no ";" to pop an item into a variable.
protected  void createPushRoutineBody(StringBuffer s, String dataName)
           
 String dataDeclaration()
          Data declaration: in .c file if needed else noop.
 String dataDeclarationH()
          Data declaration: in .h file if needed else noop.
 String downstreamCleanup()
          Any cleanup needed before exit for downstream end of tape.
 String downstreamDeclaration()
          Data declaration: for code doing downstream processing.
 String downstreamDeclarationExtern()
          Data declaration: following "extern" if needed else noop.
 String getConsumerName()
          Consumer name for init code in ClusterCodeGeneration.
 String getProducerName()
          Consumer name for init code in ClusterCodeGeneration.
 String peekPrefix()
          prefix to peek expression
 String peekSuffix()
          suffix to peek expression
 String popExpr()
          expression to pop an item: to end of statement.
 String popExprCleanup()
          if expression to pop an item requires statements to clean up then this is cleanup.
 String popExprNoCleanup()
          expression to pop an item, really an expression.
 String popManyItems(String destBuffer, int destOffset, int numItems)
           
 String popNStmt(int N)
          prefix to pop N items discarding them.
 String pushbackCleanup()
           
 String pushbackInit(int numberToPushBack)
           
 String pushbackPrefix()
           
 String pushbackSuffix()
           
 String pushManyItems(String sourceBuffer, int sourceOffset, int numItems)
           
 String pushPrefix()
          prefix before data expression to push.
 String pushSuffix()
          suffix after data expression to push.
 String topOfWorkIteration()
          Code used at top of work iteration.
 String upstreamCleanup()
          Any cleanup needed before exit for upstream end of tape.
 String upstreamDeclaration()
          Data declaration: for code doing upstream processing.
 String upstreamDeclarationExtern()
          Data declaration: following "extern" if needed else noop.
 
Methods inherited from class at.dms.kjc.cluster.TapeBase
getDest, getPeekName, getPopName, getPushName, getSource, getType, newTape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface at.dms.kjc.cluster.Tape
getDest, getPeekName, getPopName, getPushName, getSource, getType
 

Field Detail

pop_buffer

protected final String pop_buffer
name of pop buffer


push_buffer

protected final String push_buffer
name of push buffer


pop_index

protected final String pop_index
a variable name for a tape offset (downstream)


push_index

protected final String push_index
a variable name for a tape offset (upstream)


producer_name

protected final String producer_name

consumer_name

protected final String consumer_name

tapeName

protected String tapeName
Method Detail

getConsumerName

public String getConsumerName()
Consumer name for init code in ClusterCodeGeneration. Do not use elsewhere.


getProducerName

public String getProducerName()
Consumer name for init code in ClusterCodeGeneration. Do not use elsewhere.


dataDeclarationH

public String dataDeclarationH()
Description copied from interface: Tape
Data declaration: in .h file if needed else noop.

Specified by:
dataDeclarationH in interface Tape
Specified by:
dataDeclarationH in class TapeBase
Returns:
TODO

dataDeclaration

public String dataDeclaration()
Description copied from interface: Tape
Data declaration: in .c file if needed else noop.

Specified by:
dataDeclaration in interface Tape
Specified by:
dataDeclaration in class TapeBase
Returns:
TODO

downstreamDeclarationExtern

public String downstreamDeclarationExtern()
Description copied from interface: Tape
Data declaration: following "extern" if needed else noop. For downstream end of tape.

Specified by:
downstreamDeclarationExtern in interface Tape
Specified by:
downstreamDeclarationExtern in class TapeBase
Returns:
TODO

downstreamDeclaration

public String downstreamDeclaration()
Description copied from interface: Tape
Data declaration: for code doing downstream processing.

Specified by:
downstreamDeclaration in interface Tape
Specified by:
downstreamDeclaration in class TapeBase
Returns:
TODO

pushManyItems

public String pushManyItems(String sourceBuffer,
                            int sourceOffset,
                            int numItems)
Specified by:
pushManyItems in interface Tape
Overrides:
pushManyItems in class TapeBase

popManyItems

public String popManyItems(String destBuffer,
                           int destOffset,
                           int numItems)
Specified by:
popManyItems in interface Tape
Overrides:
popManyItems in class TapeBase

upstreamDeclarationExtern

public String upstreamDeclarationExtern()
Description copied from interface: Tape
Data declaration: following "extern" if needed else noop. For upstream end of tape.

Specified by:
upstreamDeclarationExtern in interface Tape
Specified by:
upstreamDeclarationExtern in class TapeBase
Returns:
TODO

upstreamDeclaration

public String upstreamDeclaration()
Description copied from interface: Tape
Data declaration: for code doing upstream processing.

Specified by:
upstreamDeclaration in interface Tape
Specified by:
upstreamDeclaration in class TapeBase
Returns:
TODO

createPushRoutineBody

protected void createPushRoutineBody(StringBuffer s,
                                     String dataName)

topOfWorkIteration

public String topOfWorkIteration()
Description copied from interface: Tape
Code used at top of work iteration.
For instance: resetting pointers in a buffer.

Specified by:
topOfWorkIteration in interface Tape
Specified by:
topOfWorkIteration in class TapeBase
Returns:
TODO

upstreamCleanup

public String upstreamCleanup()
Description copied from interface: Tape
Any cleanup needed before exit for upstream end of tape.

Specified by:
upstreamCleanup in interface Tape
Specified by:
upstreamCleanup in class TapeBase
Returns:
TODO

downstreamCleanup

public String downstreamCleanup()
Description copied from interface: Tape
Any cleanup needed before exit for downstream end of tape.

Specified by:
downstreamCleanup in interface Tape
Specified by:
downstreamCleanup in class TapeBase
Returns:
TODO

pushPrefix

public String pushPrefix()
Description copied from interface: Tape
prefix before data expression to push.

Specified by:
pushPrefix in interface Tape
Specified by:
pushPrefix in class TapeBase
Returns:
TODO

pushSuffix

public String pushSuffix()
Description copied from interface: Tape
suffix after data expression to push.

Specified by:
pushSuffix in interface Tape
Specified by:
pushSuffix in class TapeBase
Returns:
TODO

popExpr

public String popExpr()
Description copied from interface: Tape
expression to pop an item: to end of statement.

Specified by:
popExpr in interface Tape
Specified by:
popExpr in class TapeBase
Returns:
TODO

popExprNoCleanup

public String popExprNoCleanup()
Description copied from interface: Tape
expression to pop an item, really an expression.

Specified by:
popExprNoCleanup in interface Tape
Specified by:
popExprNoCleanup in class TapeBase

popExprCleanup

public String popExprCleanup()
Description copied from interface: Tape
if expression to pop an item requires statements to clean up then this is cleanup.

Specified by:
popExprCleanup in interface Tape
Specified by:
popExprCleanup in class TapeBase

popNStmt

public String popNStmt(int N)
Description copied from interface: Tape
prefix to pop N items discarding them.

Specified by:
popNStmt in interface Tape
Specified by:
popNStmt in class TapeBase
Returns:
TODO

peekPrefix

public String peekPrefix()
Description copied from interface: Tape
prefix to peek expression

Specified by:
peekPrefix in interface Tape
Specified by:
peekPrefix in class TapeBase
Returns:
TODO

peekSuffix

public String peekSuffix()
Description copied from interface: Tape
suffix to peek expression

Specified by:
peekSuffix in interface Tape
Specified by:
peekSuffix in class TapeBase
Returns:
TODO

pushbackInit

public String pushbackInit(int numberToPushBack)
Specified by:
pushbackInit in interface Tape
Specified by:
pushbackInit in class TapeBase

pushbackPrefix

public String pushbackPrefix()
Specified by:
pushbackPrefix in interface Tape
Specified by:
pushbackPrefix in class TapeBase

pushbackSuffix

public String pushbackSuffix()
Specified by:
pushbackSuffix in interface Tape
Specified by:
pushbackSuffix in class TapeBase

pushbackCleanup

public String pushbackCleanup()
Specified by:
pushbackCleanup in interface Tape
Specified by:
pushbackCleanup in class TapeBase

assignPopToVar

public String assignPopToVar(String varName)
Description copied from interface: Tape
Statement, but no ";" to pop an item into a variable. Useful since C can not handle arrays over tapes by simple assignment.

Specified by:
assignPopToVar in interface Tape
Specified by:
assignPopToVar in class TapeBase

assignPeekToVar

public String assignPeekToVar(String varName,
                              String offset)
Description copied from interface: Tape
Assign the result of peeking. Must deal with peeking an array.

Specified by:
assignPeekToVar in interface Tape
Specified by:
assignPeekToVar in class TapeBase
Returns: