at.dms.kjc.common
Class RawSimulatorPrint

java.lang.Object
  extended by at.dms.kjc.common.RawSimulatorPrint

public class RawSimulatorPrint
extends Object

This class gathers common code for printing on the raw simulator, including C code defines and SIRPrintStatement code generation. It is used by the old RawBackend, SpaceDynamic, and SpaceTime.

Author:
mgordon

Field Summary
static String STREAMIT_PRINT_FLOAT
           
static String STREAMIT_PRINT_INT
           
 
Constructor Summary
RawSimulatorPrint()
           
 
Method Summary
static String bCMagicHandler()
          Return the bC code that will define the magic print handler and register the handler.
static String getHeader()
          Return the header (c #define statements) that defines the print macros for integers and floats.
static void visitPrintStatement(SIRPrintStatement self, JExpression exp, CodegenPrintWriter p, ToC toC)
          Generate code for an SIRPrintstatement when we are targeting the raw simulator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAMIT_PRINT_INT

public static String STREAMIT_PRINT_INT

STREAMIT_PRINT_FLOAT

public static String STREAMIT_PRINT_FLOAT
Constructor Detail

RawSimulatorPrint

public RawSimulatorPrint()
Method Detail

getHeader

public static String getHeader()
Return the header (c #define statements) that defines the print macros for integers and floats.

Returns:
the header that defines the print macros for integers and floats.

bCMagicHandler

public static String bCMagicHandler()
Return the bC code that will define the magic print handler and register the handler.

Returns:
the bC code that will define the magic print handler and register the handler.

visitPrintStatement

public static void visitPrintStatement(SIRPrintStatement self,
                                       JExpression exp,
                                       CodegenPrintWriter p,
                                       ToC toC)
Generate code for an SIRPrintstatement when we are targeting the raw simulator. We use two magic instructions, one to print int types and one to print floats, to pass the value we would like to print to the simulator runtime so it can display it. We convert each print statement into a call of a macro defined to call the appropriate magic instruction.

Parameters:
self - The print statement
exp - The expression to print
p - The CodeGenPrinter to append the code to.
toC - The parent visiter used to visit the exp.