at.dms.kjc.backendSupport
Class EmitCode

java.lang.Object
  extended by at.dms.kjc.backendSupport.EmitCode
Direct Known Subclasses:
EmitCellCode, EmitStandaloneCode

public class EmitCode
extends Object

Takes a ComputeNode collection, a collection of Channel's, and a mapping from Channel x end -> ComputeNode and emits code for the ComputeNode. Inner class CodeGen is the visitor that emits the code for a JPhylum.

Author:
dimock

Nested Class Summary
protected  class EmitCode.CodeGen
          Class to actually emit code.
 
Field Summary
protected static String ARRAY_COPY
           
protected  BackEndFactory backendbits
           
protected  EmitCode.CodeGen codegen
           
 
Constructor Summary
EmitCode(BackEndFactory backendbits)
          Constructor.
 
Method Summary
 void emitCodeForComputeNode(ComputeNode n, CodegenPrintWriter p)
           
 void emitCodeForComputeNode(ComputeNode n, CodegenPrintWriter p, EmitCode.CodeGen codegen)
          Given a ComputeNode and a CodegenPrintWrite, print all code for the ComputeNode.
 void emitCodeForComputeStore(SIRCodeUnit fieldsAndMethods, ComputeNode n, CodegenPrintWriter p, EmitCode.CodeGen codegen)
           
 void generateCHeader(CodegenPrintWriter p)
          Standard code for front of a C file here.
 void generateMain(CodegenPrintWriter p)
          Generate a "main" function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARRAY_COPY

protected static final String ARRAY_COPY
See Also:
Constant Field Values

backendbits

protected BackEndFactory backendbits

codegen

protected EmitCode.CodeGen codegen
Constructor Detail

EmitCode

public EmitCode(BackEndFactory backendbits)
Constructor.

Parameters:
backendbits - indicates BackEndFactory containing all useful info.
Method Detail

emitCodeForComputeNode

public void emitCodeForComputeNode(ComputeNode n,
                                   CodegenPrintWriter p)

emitCodeForComputeNode

public void emitCodeForComputeNode(ComputeNode n,
                                   CodegenPrintWriter p,
                                   EmitCode.CodeGen codegen)
Given a ComputeNode and a CodegenPrintWrite, print all code for the ComputeNode. Channel information relevant to the ComputeNode is printed based on data in the BackEndFactory passed when this class was instantiated.

Parameters:
n - The ComputeNode to emit code for.
p - The CodegenPrintWriter (left open on return).

emitCodeForComputeStore

public void emitCodeForComputeStore(SIRCodeUnit fieldsAndMethods,
                                    ComputeNode n,
                                    CodegenPrintWriter p,
                                    EmitCode.CodeGen codegen)

generateCHeader

public void generateCHeader(CodegenPrintWriter p)
Standard code for front of a C file here. Override!


generateMain

public void generateMain(CodegenPrintWriter p)
Generate a "main" function. Override!