at.dms.kjc.cluster
Class TapeDynrate

java.lang.Object
  extended by at.dms.kjc.cluster.TapeBase
      extended by at.dms.kjc.cluster.TapeDynrate
All Implemented Interfaces:
Tape

public class TapeDynrate
extends TapeBase
implements Tape

Dynamic-rate tapes linking nodes. The tape is only one part of the story: the tape creates push, pop, etc routines but to pass arrays over tapes we need to change some types so the calls to push, pop, ets mat need to be wrapped in a cast or in a memcpy(). The translation functionality should be part of the tape class, but (alas) is actually in the code emitters FlatIRToCluster and ClusterCode.

Author:
janiss refactored to unrecognizability by dimock

Field Summary
 
Fields inherited from class at.dms.kjc.cluster.TapeBase
dst, peek_name, pop_name, push_name, src, type, typeString
 
Constructor Summary
TapeDynrate(int source, int dest, CType type)
           
 
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.
 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 getTypeCastName()
          returns the type to cast to, which is only relevant for arrays.
 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 popNStmt(int N)
          prefix to pop N items discarding them.
 String pushbackCleanup()
           
 String pushbackInit(int NumberToPush)
           
 String pushbackPrefix()
           
 String pushbackSuffix()
           
 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, popManyItems, pushManyItems
 
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, popManyItems, pushManyItems
 

Constructor Detail

TapeDynrate

public TapeDynrate(int source,
                   int dest,
                   CType type)
Method Detail

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

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

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 NumberToPush)
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:

getTypeCastName

public String getTypeCastName()
returns the type to cast to, which is only relevant for arrays.

Returns: