coins.casttohir
クラス ToHirC

java.lang.Object
  |
  +--coins.casttohir.ToHirC
すべての実装インタフェース:
TokenId, TypeId, Visitor

public final class ToHirC
extends java.lang.Object
implements Visitor, TypeId, TokenId

Convert ASTree(abstruct syntax tree) to HIR-C.


フィールドの概要
(パッケージプライベート) static byte[] astPrototype
           
(パッケージプライベート) static int lListNum
           
 
インタフェース coins.ast.TypeId から継承したフィールド
ARRAY_T, CHAR_T, CONST_T, DOUBLE_T, ELLIPSIS_T, ENUM_BEGIN, ENUM_END, FLOAT_T, FUNCTION_T, INT_T, LONG_DOUBLE_T, LONG_LONG_T, LONG_T, NO_DIMENSION_T, OFFSET_T, POINTER_T, RESTRICT_T, RETURN_T, S_AUTO, S_EXTERN, S_INLINE, S_NONE, S_REGISTER, S_STATIC, SHORT_T, SIGNED_T, SIZE_T, STRUCT_BEGIN, STRUCT_END, UNION_BEGIN, UNION_END, UNSIGNED_T, VOID_T, VOLATILE_T
 
インタフェース coins.ast.TokenId から継承したフィールド
AND_E, ANDAND, ARROW, ASM, AUTO, BAD_TOKEN, BREAK, CASE, CAST_OP, CHAR, CHAR_CONST, COND_OP, CONST, CONTINUE, DEFAULT, DIV_E, DO, DOUBLE, DOUBLE_CONST, ELLIPSIS, ELSE, ENUM, EOF, EQ, EXOR_E, EXTERN, FLOAT, FLOAT_CONST, FOR, FUNCALL, GE, GOTO, IDENTIFIER, IF, IGNORE, INDEX_OP, INLINE, INT, INT_CONST, LE, LONG, LONG_CONST, LONG_DOUBLE_CONST, LONGLONG_CONST, LSHIFT, LSHIFT_E, MINUS_E, MINUSMINUS, MOD_E, MUL_E, MUTABLE, NEQ, OR_E, OROR, PLUS_E, PLUSPLUS, PRAGMA, REGISTER, RESTRICT, RETURN, RSHIFT, RSHIFT_E, SHORT, SIGNED, SIZEOF, SKIP_GCC_ASM, SKIP_GCC_ATTRIBUTE, STATIC, STRING_L, STRING_WL, STRUCT, SWITCH, TYPEDEF, TYPEDEF_NAME, UINT_CONST, ULONG_CONST, ULONGLONG_CONST, UNION, UNSIGNED, VOID, VOLATILE, WHILE
 
コンストラクタの概要
ToHirC(ToHir tohir)
          Constructor.
 
メソッドの概要
 void astToHirC(java.io.InputStream stream)
          Create ASTree by ast.Parser.read(), and visit ASTree to create corresponding HIR-C.
 void atAddressExpr(AddressExpr ast)
          Create reference expression.
 void atArithBinaryExpr(ArithBinaryExpr ast)
          Create arithmetic binary expression.
 void atArithUnaryExpr(ArithUnaryExpr ast)
          Create arithmetic unary expression.
 void atArrayExpr(ArrayExpr ast)
          Create array subscript expression.
 void atArrayInitializer(ArrayInitializer ast)
          At array initializer.
 void atAsmExpr(AsmExpr ast)
           
 void atAssignExpr(AssignExpr ast)
          Create assign expression.
 void atASTList(ASTList ast)
          At AST list.
 void atBreakStmnt(BreakStmnt ast)
          Create break statement.
 void atCallExpr(CallExpr ast)
          Create function call expression.
 void atCaseLabel(CaseLabel ast)
          Create case statement.
 void atCastExpr(CastExpr ast)
          Create cast expression.
 void atCommaExpr(CommaExpr ast)
          Create comma expression.
 void atCompoundStmnt(CompoundStmnt ast)
          At compound statement.
 void atConditionalExpr(ConditionalExpr ast)
          Create conditional expression.
 void atConstantExpr(ConstantExpr ast)
          Create constant expression.
 void atContinueStmnt(ContinueStmnt ast)
          Create continue statement.
 void atDeclarator(Declarator ast)
          Create symbol and add into symbol table. (= typedef, function prototype, variable declaration)
 void atDeclaratorList(DeclaratorList ast)
          At declaration list.
 void atDefaultLabel(DefaultLabel ast)
          Create default statement.
 void atDereferenceExpr(DereferenceExpr ast)
          Create dereference expression.
 void atDoStmnt(DoStmnt ast)
          Create do-while statement.
 void atEnum(Enum ast)
          Create EnumType and add symTableCurrent.
 void atExpressionStmnt(ExpressionStmnt ast)
          Create expression statement.
 void atForStmnt(ForStmnt ast)
          Create for statement.
 void atFunction(Function ast)
          Create function, and add programRoot.
 void atGotoStmnt(GotoStmnt ast)
          Create goto statement.
 void atIfStmnt(IfStmnt ast)
          Create if statement.
 void atMemberExpr(MemberExpr ast)
          Create member-access expression.
 void atNamedLabel(NamedLabel ast)
          Create label statement.
 void atNullStmnt(NullStmnt ast)
          Create null statement.
 void atPair(Pair ast)
          At Pair.
 void atPointerBinaryExpr(PointerBinaryExpr ast)
          Create pointer binary expression.
 void atPostfixExpr(PostfixExpr ast)
          Create postfix expression.
 void atPragma(Pragma ast)
          atPragma changes Pragma to InfStmt whose inf-body is the String specified in the pragma statement.
 void atPrefixExpr(PrefixExpr ast)
          Create prefix expression.
 void atReturnStmnt(ReturnStmnt ast)
          Create return statement.
 void atSizeofExpr(SizeofExpr ast)
          Create sizeof expression.
 void atStringLiteral(StringLiteral ast)
          Create string literal expression.
 void atStruct(Struct ast)
          Create StructType and add to symTableCurrent.
 StructType atStructDeclarator(Struct ast)
           
 void atSwitchStmnt(SwitchStmnt ast)
          Create switch statement.
 void atUnion(Union ast)
          Create UnionType and add symTableCurrent.
 UnionType atUnionDeclarator(Union ast)
          Create UnionType and add symTableCurrent.
 void atVariableExpr(VariableExpr ast)
          Create variable expression.
 void atWhileStmnt(WhileStmnt ast)
          Create while statement.
protected  void message(int level, java.lang.String mes)
          Output debug message.
 Exp pPromotion(Exp e)
          Pointer promotion (selfish naming).
 HIR visit(ASTree ast)
          Visit ASTree.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

astPrototype

static final byte[] astPrototype

lListNum

static int lListNum
コンストラクタの詳細

ToHirC

public ToHirC(ToHir tohir)
Constructor.

パラメータ:
tohir - Offers cooperation with the object of other packages.
メソッドの詳細

message

protected void message(int level,
                       java.lang.String mes)
Output debug message.

パラメータ:
level - Debug level.
mes - Debug message.

astToHirC

public void astToHirC(java.io.InputStream stream)
               throws java.io.IOException,
                      FatalError
Create ASTree by ast.Parser.read(), and visit ASTree to create corresponding HIR-C.

パラメータ:
stream - Input stream.
java.io.IOException
FatalError

visit

public HIR visit(ASTree ast)
Visit ASTree.


atASTList

public void atASTList(ASTList ast)
At AST list. Declarator list is processed at upper level. Must not reach here.

定義:
インタフェース Visitor 内の atASTList
パラメータ:
ast - ASTList

atPragma

public void atPragma(Pragma ast)
atPragma changes Pragma to InfStmt whose inf-body is the String specified in the pragma statement. A pragma statement may take the form of #pragma kindName pragmaBody where kindName is a String and pragmaBody is a sequence of String composed of Sym and list (sequence of Syms and lists enclosed in parenthesis. The resultant InfStmt is tentatively composed by attaching information by addInf(kindName, pragmaBody). It will be transformed into final form by atInfStmt of coins.casttohir.HirVisit. The reason to take tentative form in ToHirC is symbols appearing in pragmaBody may not yet be defined (registered) in SymTable.

定義:
インタフェース Visitor 内の atPragma
パラメータ:
ast - Pragma character string contained in the pragma statement.

atAsmExpr

public void atAsmExpr(AsmExpr ast)
定義:
インタフェース Visitor 内の atAsmExpr

atCompoundStmnt

public void atCompoundStmnt(CompoundStmnt ast)
At compound statement.

定義:
インタフェース Visitor 内の atCompoundStmnt
パラメータ:
ast - ASTList

atStruct

public void atStruct(Struct ast)
Create StructType and add to symTableCurrent.

定義:
インタフェース Visitor 内の atStruct
パラメータ:
ast - Struct

atStructDeclarator

public StructType atStructDeclarator(Struct ast)

atUnion

public void atUnion(Union ast)
Create UnionType and add symTableCurrent.

定義:
インタフェース Visitor 内の atUnion
パラメータ:
ast - Union

atUnionDeclarator

public UnionType atUnionDeclarator(Union ast)
Create UnionType and add symTableCurrent.

パラメータ:
ast - Union

atEnum

public void atEnum(Enum ast)
Create EnumType and add symTableCurrent.

定義:
インタフェース Visitor 内の atEnum
パラメータ:
ast - Enum

atDeclarator

public void atDeclarator(Declarator ast)
Create symbol and add into symbol table. (= typedef, function prototype, variable declaration)

定義:
インタフェース Visitor 内の atDeclarator
パラメータ:
ast - Declarator

atDeclaratorList

public void atDeclaratorList(DeclaratorList ast)
At declaration list. Declarator list is processed at upper level. Must not reach here.

定義:
インタフェース Visitor 内の atDeclaratorList
パラメータ:
ast - DeclaratorList

atArrayInitializer

public void atArrayInitializer(ArrayInitializer ast)
At array initializer. Array initializer is processed at upper level. Must not reach here.

定義:
インタフェース Visitor 内の atArrayInitializer
パラメータ:
ast - ArrayInitializer

atFunction

public void atFunction(Function ast)
Create function, and add programRoot.

定義:
インタフェース Visitor 内の atFunction
パラメータ:
ast - Function

atPair

public void atPair(Pair ast)
At Pair. Pair is processed at upper level. Must not reach here.

定義:
インタフェース Visitor 内の atPair
パラメータ:
ast - Pair

atAddressExpr

public void atAddressExpr(AddressExpr ast)
Create reference expression.

定義:
インタフェース Visitor 内の atAddressExpr
パラメータ:
ast - AddressExpr

atArithBinaryExpr

public void atArithBinaryExpr(ArithBinaryExpr ast)
Create arithmetic binary expression.

定義:
インタフェース Visitor 内の atArithBinaryExpr
パラメータ:
ast - ArithBinaryExpr

atArithUnaryExpr

public void atArithUnaryExpr(ArithUnaryExpr ast)
Create arithmetic unary expression.

定義:
インタフェース Visitor 内の atArithUnaryExpr
パラメータ:
ast - ArithUnaryExpr

atArrayExpr

public void atArrayExpr(ArrayExpr ast)
Create array subscript expression.

定義:
インタフェース Visitor 内の atArrayExpr
パラメータ:
ast - ArrayExpr

atAssignExpr

public void atAssignExpr(AssignExpr ast)
Create assign expression.

定義:
インタフェース Visitor 内の atAssignExpr
パラメータ:
ast - AssignExpr

atCallExpr

public void atCallExpr(CallExpr ast)
Create function call expression.

定義:
インタフェース Visitor 内の atCallExpr
パラメータ:
ast - CallExpr

atCastExpr

public void atCastExpr(CastExpr ast)
Create cast expression.

定義:
インタフェース Visitor 内の atCastExpr
パラメータ:
ast - CastExpr

atSizeofExpr

public void atSizeofExpr(SizeofExpr ast)
Create sizeof expression.

定義:
インタフェース Visitor 内の atSizeofExpr
パラメータ:
ast - SizeofExpr

atCommaExpr

public void atCommaExpr(CommaExpr ast)
Create comma expression.

定義:
インタフェース Visitor 内の atCommaExpr
パラメータ:
ast - CommaExpr

atConditionalExpr

public void atConditionalExpr(ConditionalExpr ast)
Create conditional expression.

定義:
インタフェース Visitor 内の atConditionalExpr
パラメータ:
ast - ConditionalExpr

atConstantExpr

public void atConstantExpr(ConstantExpr ast)
Create constant expression.

定義:
インタフェース Visitor 内の atConstantExpr
パラメータ:
ast - ConstantExpr

atDereferenceExpr

public void atDereferenceExpr(DereferenceExpr ast)
Create dereference expression.

定義:
インタフェース Visitor 内の atDereferenceExpr
パラメータ:
ast - DereferenceExpr

atMemberExpr

public void atMemberExpr(MemberExpr ast)
Create member-access expression.

定義:
インタフェース Visitor 内の atMemberExpr
パラメータ:
ast - MemberExpr

atPointerBinaryExpr

public void atPointerBinaryExpr(PointerBinaryExpr ast)
Create pointer binary expression.

定義:
インタフェース Visitor 内の atPointerBinaryExpr
パラメータ:
ast - PointerBinaryExpr

atPostfixExpr

public void atPostfixExpr(PostfixExpr ast)
Create postfix expression.

定義:
インタフェース Visitor 内の atPostfixExpr
パラメータ:
ast - PostfixExpr

atPrefixExpr

public void atPrefixExpr(PrefixExpr ast)
Create prefix expression.

定義:
インタフェース Visitor 内の atPrefixExpr
パラメータ:
ast - PrefixExpr

atStringLiteral

public void atStringLiteral(StringLiteral ast)
Create string literal expression.

定義:
インタフェース Visitor 内の atStringLiteral
パラメータ:
ast - StringLiteral

atVariableExpr

public void atVariableExpr(VariableExpr ast)
Create variable expression.

定義:
インタフェース Visitor 内の atVariableExpr
パラメータ:
ast - VariableExpr

atBreakStmnt

public void atBreakStmnt(BreakStmnt ast)
Create break statement.

定義:
インタフェース Visitor 内の atBreakStmnt

atCaseLabel

public void atCaseLabel(CaseLabel ast)
Create case statement.

定義:
インタフェース Visitor 内の atCaseLabel
パラメータ:
ast - CaseLabel

atContinueStmnt

public void atContinueStmnt(ContinueStmnt ast)
Create continue statement.

定義:
インタフェース Visitor 内の atContinueStmnt
パラメータ:
ast - ContinueStmnt

atDefaultLabel

public void atDefaultLabel(DefaultLabel ast)
Create default statement.

定義:
インタフェース Visitor 内の atDefaultLabel
パラメータ:
ast - DefaultLabel

atDoStmnt

public void atDoStmnt(DoStmnt ast)
Create do-while statement.

定義:
インタフェース Visitor 内の atDoStmnt
パラメータ:
ast - DoStmnt

atExpressionStmnt

public void atExpressionStmnt(ExpressionStmnt ast)
Create expression statement.

定義:
インタフェース Visitor 内の atExpressionStmnt
パラメータ:
ast - ExpressionStmnt

atForStmnt

public void atForStmnt(ForStmnt ast)
Create for statement.

定義:
インタフェース Visitor 内の atForStmnt
パラメータ:
ast - ForStmnt

atGotoStmnt

public void atGotoStmnt(GotoStmnt ast)
Create goto statement.

定義:
インタフェース Visitor 内の atGotoStmnt
パラメータ:
ast - GotoStmnt

atIfStmnt

public void atIfStmnt(IfStmnt ast)
Create if statement.

定義:
インタフェース Visitor 内の atIfStmnt
パラメータ:
ast - IfStmnt

atNamedLabel

public void atNamedLabel(NamedLabel ast)
Create label statement.

定義:
インタフェース Visitor 内の atNamedLabel
パラメータ:
ast - NamedLabel

atNullStmnt

public void atNullStmnt(NullStmnt ast)
Create null statement.

定義:
インタフェース Visitor 内の atNullStmnt
パラメータ:
ast - NullStmnt

atReturnStmnt

public void atReturnStmnt(ReturnStmnt ast)
Create return statement.

定義:
インタフェース Visitor 内の atReturnStmnt
パラメータ:
ast - ReturnStmnt

atSwitchStmnt

public void atSwitchStmnt(SwitchStmnt ast)
Create switch statement.

定義:
インタフェース Visitor 内の atSwitchStmnt
パラメータ:
ast - SwitchStmnt

atWhileStmnt

public void atWhileStmnt(WhileStmnt ast)
Create while statement.

定義:
インタフェース Visitor 内の atWhileStmnt
パラメータ:
ast - WhileStmnt

pPromotion

public Exp pPromotion(Exp e)
Pointer promotion (selfish naming). Convert expression has VectorType/SubpType to PointerType.

パラメータ:
e - Expression which has VectorType/SubpType.
戻り値:
Expression which has PointerType.