|
||||||||||
| 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 KjcVisitorvisitFieldDeclaration in class KjcEmptyVisitor
public void visitIfStatement(JIfStatement self,
JExpression cond,
JStatement thenClause,
JStatement elseClause)
visitIfStatement in interface KjcVisitorvisitIfStatement in class KjcEmptyVisitor
public void visitThisExpression(JThisExpression self,
JExpression prefix)
visitThisExpression in interface KjcVisitorvisitThisExpression in class KjcEmptyVisitorpublic void visitSuperExpression(JSuperExpression self)
visitSuperExpression in interface KjcVisitorvisitSuperExpression in class KjcEmptyVisitor
public void visitRelationalExpression(JRelationalExpression self,
int oper,
JExpression left,
JExpression right)
visitRelationalExpression in interface KjcVisitorvisitRelationalExpression 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 KjcVisitorvisitNameExpression in class KjcEmptyVisitor
public void visitBinaryExpression(JBinaryExpression self,
String oper,
JExpression left,
JExpression right)
visitBinaryExpression in interface KjcVisitorvisitBinaryExpression in class KjcEmptyVisitor
public void visitFieldExpression(JFieldAccessExpression self,
JExpression left,
String ident)
visitFieldExpression in interface KjcVisitorvisitFieldExpression in class KjcEmptyVisitor
public void visitBitwiseExpression(JBitwiseExpression self,
int oper,
JExpression left,
JExpression right)
visitBitwiseExpression in interface KjcVisitorvisitBitwiseExpression in class KjcEmptyVisitor
public void visitArrayLengthExpression(JArrayLengthExpression self,
JExpression prefix)
visitArrayLengthExpression in interface KjcVisitorvisitArrayLengthExpression in class KjcEmptyVisitor
public void visitArrayAccessExpression(JArrayAccessExpression self,
JExpression prefix,
JExpression accessor)
visitArrayAccessExpression in interface KjcVisitorvisitArrayAccessExpression in class KjcEmptyVisitorpublic void visitCreatePortalExpression(SIRCreatePortal self)
visitCreatePortalExpression in interface SLIRVisitorvisitCreatePortalExpression in class SLIREmptyVisitor
public void visitInitStatement(SIRInitStatement self,
SIRStream stream)
SLIREmptyVisitor
visitInitStatement in interface SLIRVisitorvisitInitStatement in class SLIREmptyVisitorpublic void visitInterfaceTable(SIRInterfaceTable self)
SLIREmptyVisitor
visitInterfaceTable in interface SLIRVisitorvisitInterfaceTable in class SLIREmptyVisitorpublic void visitLatency(SIRLatency self)
SLIREmptyVisitor
visitLatency in interface SLIRVisitorvisitLatency in class SLIREmptyVisitorpublic void visitLatencyMax(SIRLatencyMax self)
SLIREmptyVisitor
visitLatencyMax in interface SLIRVisitorvisitLatencyMax in class SLIREmptyVisitorpublic void visitLatencyRange(SIRLatencyRange self)
SLIREmptyVisitor
visitLatencyRange in interface SLIRVisitorvisitLatencyRange in class SLIREmptyVisitorpublic void visitLatencySet(SIRLatencySet self)
SLIREmptyVisitor
visitLatencySet in interface SLIRVisitorvisitLatencySet in class SLIREmptyVisitor
public void visitMessageStatement(SIRMessageStatement self,
JExpression portal,
String iname,
String ident,
JExpression[] params,
SIRLatency latency)
SLIREmptyVisitor
visitMessageStatement in interface SLIRVisitorvisitMessageStatement in class SLIREmptyVisitorpublic JExpression passParentheses(JExpression exp)
public void visitSwitchLabel(JSwitchLabel self,
JExpression expr)
visitSwitchLabel in interface KjcVisitorvisitSwitchLabel in class KjcEmptyVisitor
public void visitSwitchGroup(JSwitchGroup self,
JSwitchLabel[] labels,
JStatement[] stmts)
visitSwitchGroup in interface KjcVisitorvisitSwitchGroup in class KjcEmptyVisitorpublic void visitBooleanLiteral(boolean value)
visitBooleanLiteral in interface KjcVisitorvisitBooleanLiteral in class KjcEmptyVisitorpublic void visitByteLiteral(byte value)
visitByteLiteral in interface KjcVisitorvisitByteLiteral in class KjcEmptyVisitorpublic void visitCharLiteral(char value)
visitCharLiteral in interface KjcVisitorvisitCharLiteral in class KjcEmptyVisitorpublic void visitDoubleLiteral(double value)
visitDoubleLiteral in interface KjcVisitorvisitDoubleLiteral in class KjcEmptyVisitorpublic void visitFloatLiteral(float value)
visitFloatLiteral in interface KjcVisitorvisitFloatLiteral in class KjcEmptyVisitorpublic void visitIntLiteral(int value)
visitIntLiteral in interface KjcVisitorvisitIntLiteral in class KjcEmptyVisitorpublic void visitLongLiteral(long value)
visitLongLiteral in interface KjcVisitorvisitLongLiteral in class KjcEmptyVisitorpublic void visitShortLiteral(short value)
visitShortLiteral in interface KjcVisitorvisitShortLiteral in class KjcEmptyVisitorpublic void visitStringLiteral(String value)
visitStringLiteral in interface KjcVisitorvisitStringLiteral in class KjcEmptyVisitorpublic void visitNullLiteral()
visitNullLiteral in interface KjcVisitorvisitNullLiteral in class KjcEmptyVisitor
public void visitFormalParameters(JFormalParameter self,
boolean isFinal,
CType type,
String ident)
visitFormalParameters in interface KjcVisitorvisitFormalParameters in class KjcEmptyVisitor
public void visitArgs(JExpression[] args,
int base)
public void visitConstructorCall(JConstructorCall self,
boolean functorIsThis,
JExpression[] params)
visitConstructorCall in interface KjcVisitorvisitConstructorCall in class KjcEmptyVisitor
public void visitArrayInitializer(JArrayInitializer self,
JExpression[] elems)
visitArrayInitializer in interface KjcVisitorvisitArrayInitializer in class KjcEmptyVisitorpublic 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 | |||||||||