|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.KjcEmptyVisitor
at.dms.kjc.SLIREmptyVisitor
at.dms.kjc.common.ToCCommon
at.dms.kjc.common.ToC
public class ToC
This class converts the Stream IR (which references the Kopi Java IR) to C code and dumps it to a file, str.c.
Field Summary | |
---|---|
protected boolean |
isInit
true if we are currently visiting the init function |
protected JMethodDeclaration |
method
the current function we are visiting |
Fields inherited from class at.dms.kjc.common.ToCCommon |
---|
alternatePrintsForTiming, hasBoolType, lastLeft, p, printPostfixMap, printPrefixMap |
Fields inherited from interface at.dms.kjc.Constants |
---|
CMP_VERSION, JAV_CLASS, JAV_CLONE, JAV_CLONEABLE, JAV_CONSTRUCTOR, JAV_ERROR, JAV_EXCEPTION, JAV_INIT, JAV_LENGTH, JAV_NAME_SEPARATOR, JAV_OBJECT, JAV_OUTER_THIS, JAV_RUNTIME, JAV_RUNTIME_EXCEPTION, JAV_STATIC_INIT, JAV_STRING, JAV_STRINGBUFFER, JAV_THIS, JAV_THROWABLE, OPE_BAND, OPE_BNOT, OPE_BOR, OPE_BSR, OPE_BXOR, OPE_EQ, OPE_GE, OPE_GT, OPE_LE, OPE_LNOT, OPE_LT, OPE_MINUS, OPE_NE, OPE_PERCENT, OPE_PLUS, OPE_POSTDEC, OPE_POSTINC, OPE_PREDEC, OPE_PREINC, OPE_SIMPLE, OPE_SL, OPE_SLASH, OPE_SR, OPE_STAR, TID_ARRAY, TID_BIT, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_SHORT, TID_VECTOR, TID_VOID, VECTOR_EMPTY |
Constructor Summary | |
---|---|
ToC()
|
|
ToC(CodegenPrintWriter p)
|
Method Summary | |
---|---|
void |
clear()
clear the internal String that represents the code generated so far |
protected void |
declareInitializedArray(CType type,
String ident,
JExpression expr)
Prints initialization for an array with static initializer, e.g., "int A[2] = {1,2};" To promote code reuse with other backends, inputs a visitor to do the recursive call. |
boolean |
isDeclOnly()
|
JExpression |
passParentheses(JExpression exp)
|
void |
setDeclOnly(boolean declOnly)
|
void |
visitArgs(JExpression[] args,
int base)
prints an array length expression |
void |
visitArrayAccessExpression(JArrayAccessExpression self,
JExpression prefix,
JExpression accessor)
prints an array access expression |
void |
visitArrayInitializer(JArrayInitializer self,
JExpression[] elems)
prints an array initializer expression |
void |
visitArrayLengthExpression(JArrayLengthExpression self,
JExpression prefix)
prints an array length expression |
void |
visitBinaryExpression(JBinaryExpression self,
String oper,
JExpression left,
JExpression right)
prints an binary expression |
void |
visitBitwiseExpression(JBitwiseExpression self,
int oper,
JExpression left,
JExpression right)
prints a bitwise expression |
void |
visitBooleanLiteral(boolean value)
prints a boolean literal |
void |
visitByteLiteral(byte value)
prints a byte literal |
void |
visitCharLiteral(char value)
prints a character literal |
void |
visitConstructorCall(JConstructorCall self,
boolean functorIsThis,
JExpression[] params)
prints an array length expression |
void |
visitCreatePortalExpression(SIRCreatePortal self)
|
void |
visitDoubleLiteral(double value)
prints a double literal |
void |
visitFieldDeclaration(JFieldDeclaration self,
int modifiers,
CType type,
String ident,
JExpression expr)
prints a field declaration |
void |
visitFieldExpression(JFieldAccessExpression self,
JExpression left,
String ident)
prints a field expression |
void |
visitFloatLiteral(float value)
prints a float literal |
void |
visitFormalParameters(JFormalParameter self,
boolean isFinal,
CType type,
String ident)
prints an array length expression |
void |
visitIfStatement(JIfStatement self,
JExpression cond,
JStatement thenClause,
JStatement elseClause)
prints a if statement |
void |
visitInitStatement(SIRInitStatement self,
SIRStream stream)
Visits an init statement. |
void |
visitInterfaceTable(SIRInterfaceTable self)
Visits an interface table. |
void |
visitIntLiteral(int value)
prints a int literal |
void |
visitLatency(SIRLatency self)
Visits a latency. |
void |
visitLatencyMax(SIRLatencyMax self)
Visits a max latency. |
void |
visitLatencyRange(SIRLatencyRange self)
Visits a latency range. |
void |
visitLatencySet(SIRLatencySet self)
Visits a latency set. |
void |
visitLongLiteral(long value)
prints a long literal |
void |
visitMessageStatement(SIRMessageStatement self,
JExpression portal,
String iname,
String ident,
JExpression[] params,
SIRLatency latency)
Visits a message statement. |
void |
visitNameExpression(JNameExpression self,
JExpression prefix,
String ident)
prints a name expression There should be no surviving JNameExpression's from the front end. |
void |
visitNullLiteral()
prints a null literal |
void |
visitRelationalExpression(JRelationalExpression self,
int oper,
JExpression left,
JExpression right)
prints a relational expression |
void |
visitShortLiteral(short value)
prints a short literal |
void |
visitStringLiteral(String value)
prints a string literal |
void |
visitSuperExpression(JSuperExpression self)
prints a super expression |
void |
visitSwitchGroup(JSwitchGroup self,
JSwitchLabel[] labels,
JStatement[] stmts)
prints an array length expression |
void |
visitSwitchLabel(JSwitchLabel self,
JExpression expr)
prints an array length expression |
void |
visitThisExpression(JThisExpression self,
JExpression prefix)
prints a this expression |
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.common.CodeGenerator |
---|
getPrinter |
Field Detail |
---|
protected boolean isInit
protected JMethodDeclaration method
Constructor Detail |
---|
public ToC()
public ToC(CodegenPrintWriter p)
Method Detail |
---|
protected void declareInitializedArray(CType type, String ident, JExpression expr)
public void visitFieldDeclaration(JFieldDeclaration self, int modifiers, CType type, String ident, JExpression expr)
visitFieldDeclaration
in interface KjcVisitor
visitFieldDeclaration
in class KjcEmptyVisitor
public void visitIfStatement(JIfStatement self, JExpression cond, JStatement thenClause, JStatement elseClause)
visitIfStatement
in interface KjcVisitor
visitIfStatement
in class KjcEmptyVisitor
public void visitThisExpression(JThisExpression self, JExpression prefix)
visitThisExpression
in interface KjcVisitor
visitThisExpression
in class KjcEmptyVisitor
public void visitSuperExpression(JSuperExpression self)
visitSuperExpression
in interface KjcVisitor
visitSuperExpression
in class KjcEmptyVisitor
public void visitRelationalExpression(JRelationalExpression self, int oper, JExpression left, JExpression right)
visitRelationalExpression
in interface KjcVisitor
visitRelationalExpression
in class KjcEmptyVisitor
public void visitNameExpression(JNameExpression self, JExpression prefix, String ident)
(1) Name with no prefix -- used to print an untyped string: such as a symbolic constant 'PI'. (2) Name with a prefix: The uniprocessor backend co-opted this to print 'prefix->string' TODO: It seems that they should have used a BinaryExpression
visitNameExpression
in interface KjcVisitor
visitNameExpression
in class KjcEmptyVisitor
public void visitBinaryExpression(JBinaryExpression self, String oper, JExpression left, JExpression right)
visitBinaryExpression
in interface KjcVisitor
visitBinaryExpression
in class KjcEmptyVisitor
public void visitFieldExpression(JFieldAccessExpression self, JExpression left, String ident)
visitFieldExpression
in interface KjcVisitor
visitFieldExpression
in class KjcEmptyVisitor
public void visitBitwiseExpression(JBitwiseExpression self, int oper, JExpression left, JExpression right)
visitBitwiseExpression
in interface KjcVisitor
visitBitwiseExpression
in class KjcEmptyVisitor
public void visitArrayLengthExpression(JArrayLengthExpression self, JExpression prefix)
visitArrayLengthExpression
in interface KjcVisitor
visitArrayLengthExpression
in class KjcEmptyVisitor
public void visitArrayAccessExpression(JArrayAccessExpression self, JExpression prefix, JExpression accessor)
visitArrayAccessExpression
in interface KjcVisitor
visitArrayAccessExpression
in class KjcEmptyVisitor
public void visitCreatePortalExpression(SIRCreatePortal self)
visitCreatePortalExpression
in interface SLIRVisitor
visitCreatePortalExpression
in class SLIREmptyVisitor
public void visitInitStatement(SIRInitStatement self, SIRStream stream)
SLIREmptyVisitor
visitInitStatement
in interface SLIRVisitor
visitInitStatement
in class SLIREmptyVisitor
public void visitInterfaceTable(SIRInterfaceTable self)
SLIREmptyVisitor
visitInterfaceTable
in interface SLIRVisitor
visitInterfaceTable
in class SLIREmptyVisitor
public void visitLatency(SIRLatency self)
SLIREmptyVisitor
visitLatency
in interface SLIRVisitor
visitLatency
in class SLIREmptyVisitor
public void visitLatencyMax(SIRLatencyMax self)
SLIREmptyVisitor
visitLatencyMax
in interface SLIRVisitor
visitLatencyMax
in class SLIREmptyVisitor
public void visitLatencyRange(SIRLatencyRange self)
SLIREmptyVisitor
visitLatencyRange
in interface SLIRVisitor
visitLatencyRange
in class SLIREmptyVisitor
public void visitLatencySet(SIRLatencySet self)
SLIREmptyVisitor
visitLatencySet
in interface SLIRVisitor
visitLatencySet
in class SLIREmptyVisitor
public void visitMessageStatement(SIRMessageStatement self, JExpression portal, String iname, String ident, JExpression[] params, SIRLatency latency)
SLIREmptyVisitor
visitMessageStatement
in interface SLIRVisitor
visitMessageStatement
in class SLIREmptyVisitor
public JExpression passParentheses(JExpression exp)
public void visitSwitchLabel(JSwitchLabel self, JExpression expr)
visitSwitchLabel
in interface KjcVisitor
visitSwitchLabel
in class KjcEmptyVisitor
public void visitSwitchGroup(JSwitchGroup self, JSwitchLabel[] labels, JStatement[] stmts)
visitSwitchGroup
in interface KjcVisitor
visitSwitchGroup
in class KjcEmptyVisitor
public void visitBooleanLiteral(boolean value)
visitBooleanLiteral
in interface KjcVisitor
visitBooleanLiteral
in class KjcEmptyVisitor
public void visitByteLiteral(byte value)
visitByteLiteral
in interface KjcVisitor
visitByteLiteral
in class KjcEmptyVisitor
public void visitCharLiteral(char value)
visitCharLiteral
in interface KjcVisitor
visitCharLiteral
in class KjcEmptyVisitor
public void visitDoubleLiteral(double value)
visitDoubleLiteral
in interface KjcVisitor
visitDoubleLiteral
in class KjcEmptyVisitor
public void visitFloatLiteral(float value)
visitFloatLiteral
in interface KjcVisitor
visitFloatLiteral
in class KjcEmptyVisitor
public void visitIntLiteral(int value)
visitIntLiteral
in interface KjcVisitor
visitIntLiteral
in class KjcEmptyVisitor
public void visitLongLiteral(long value)
visitLongLiteral
in interface KjcVisitor
visitLongLiteral
in class KjcEmptyVisitor
public void visitShortLiteral(short value)
visitShortLiteral
in interface KjcVisitor
visitShortLiteral
in class KjcEmptyVisitor
public void visitStringLiteral(String value)
visitStringLiteral
in interface KjcVisitor
visitStringLiteral
in class KjcEmptyVisitor
public void visitNullLiteral()
visitNullLiteral
in interface KjcVisitor
visitNullLiteral
in class KjcEmptyVisitor
public void visitFormalParameters(JFormalParameter self, boolean isFinal, CType type, String ident)
visitFormalParameters
in interface KjcVisitor
visitFormalParameters
in class KjcEmptyVisitor
public void visitArgs(JExpression[] args, int base)
public void visitConstructorCall(JConstructorCall self, boolean functorIsThis, JExpression[] params)
visitConstructorCall
in interface KjcVisitor
visitConstructorCall
in class KjcEmptyVisitor
public void visitArrayInitializer(JArrayInitializer self, JExpression[] elems)
visitArrayInitializer
in interface KjcVisitor
visitArrayInitializer
in class KjcEmptyVisitor
public void clear()
public void setDeclOnly(boolean declOnly)
declOnly
- The declOnly to set.public boolean isDeclOnly()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |