coins.casttohir
クラス SideEffectBuffer

java.lang.Object
  |
  +--coins.casttohir.SideEffectBuffer

public class SideEffectBuffer
extends java.lang.Object

SideEffectBuffer Hold side effect statements and process them (move, insert, etc.).
Side effect statement: statement that leave side effect (assign statement, call statement, etc.).
Sequence point: program point where side effect should be completed at the latest.
Swept out statement: statement moved forward or backward to perform side effect at proper point as defined by the grammar.
Sweep out backward: move a side effect statement in front of the current statement.
Sweep out forward: move a side effect statement to some position succeeding the current statement.


コンストラクタの概要
(パッケージプライベート) SideEffectBuffer(ToHir tohir)
          SideEffectBuffer Constructor.
 
メソッドの概要
(パッケージプライベート)  void add(SideEffectBuffer child)
          add Connect the statement lists of the child with the statement lists of this SideEffectBuffer, and clear the statement lists of the child.
(パッケージプライベート)  SideEffectBuffer addNext(HIR s)
          addNext Add statement to the list of statements to be swept forward.
(パッケージプライベート)  void addNext(SideEffectBuffer child)
          addNext Connect the statement lists of the child with the nextList of this SideEffectBuffer, and clear the statement lists of the child.
(パッケージプライベート)  SideEffectBuffer addPrev(HIR s)
          addPrev Add statement to the list of statements to be swept backward.
(パッケージプライベート)  void addPrev(SideEffectBuffer child)
          addPrev Connect the statement lists of the child with the prevList of this SideEffectBuffer, and clear the statement lists of the child.
(パッケージプライベート)  void addToBlockFirst(Stmt s, boolean reserve)
          addToBlockLast Add swept forward statements (in nextList) as the last statement of the block which is either parameter s or a block generated to surround s.
(パッケージプライベート)  void addToBlockLast(Stmt s, boolean reserve)
          addToBlockLast Add swept backward statements (in prevList) as the last statement of the block which is either parameter s or a block generated to surround s.
(パッケージプライベート)  void addToStmtNext(Stmt s, boolean reserve)
          addToStmtNext Insert the statements swept forward (nextList elements) at the position next to the statement s.
(パッケージプライベート)  void addToStmtPrev(Stmt s, boolean reserve)
          addToStmtPrev Insert the statements swept backward (prevList elements) in front of the statement s.
(パッケージプライベート)  BlockStmt getBlockStmt(Stmt s)
          getBlockStmt From parameter s, make a block statement in which swept out statements can be inserted.
(パッケージプライベート)  boolean isEmpty()
          isEmpty
(パッケージプライベート)  boolean isEmptyNext()
          isEmptyNext
(パッケージプライベート)  boolean isEmptyPrev()
          isEmptyPrev
(パッケージプライベート)  void moveNextToPrev()
          moveNextToPrev Move the swept forward statements to the list of swept backward statements by moving statements in nextList to prevList.
(パッケージプライベート)  Exp toExp(Exp e)
          toExp Change the list of swept backward expressions to an expression by successively changing expressions in prevList to comma expression and appending parameter e as value expression of the comma expression.
(パッケージプライベート)  Stmt toStmt()
          toStmt Change the swept out statement list to a statement.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

SideEffectBuffer

SideEffectBuffer(ToHir tohir)
SideEffectBuffer Constructor.

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

isEmpty

boolean isEmpty()
isEmpty

戻り値:
True if there is no statements swept out.

isEmptyPrev

boolean isEmptyPrev()
isEmptyPrev

戻り値:
True if there is no statement swept backward.

isEmptyNext

boolean isEmptyNext()
isEmptyNext

戻り値:
True if there is no statement swept forward.

addPrev

SideEffectBuffer addPrev(HIR s)
addPrev Add statement to the list of statements to be swept backward.

パラメータ:
s - Added statement.
戻り値:
This SideEffectBuffer.

addNext

SideEffectBuffer addNext(HIR s)
addNext Add statement to the list of statements to be swept forward.

パラメータ:
s - Added statement.
戻り値:
This SideEffectBuffer.

add

void add(SideEffectBuffer child)
add Connect the statement lists of the child with the statement lists of this SideEffectBuffer, and clear the statement lists of the child.

パラメータ:
child - The child SideEffectBuffer.

addPrev

void addPrev(SideEffectBuffer child)
addPrev Connect the statement lists of the child with the prevList of this SideEffectBuffer, and clear the statement lists of the child.

パラメータ:
child - The child SideEffectBuffer.

addNext

void addNext(SideEffectBuffer child)
addNext Connect the statement lists of the child with the nextList of this SideEffectBuffer, and clear the statement lists of the child.

パラメータ:
child - The child SideEffectBuffer.

moveNextToPrev

void moveNextToPrev()
moveNextToPrev Move the swept forward statements to the list of swept backward statements by moving statements in nextList to prevList.


toStmt

Stmt toStmt()
toStmt Change the swept out statement list to a statement. If there is only one statement swept out, then return it. If there are multiple statements, the make a block statement where statements in prevList are arranged first and then statements in nextList are arranged next.

戻り値:
The resultant statement.

toExp

Exp toExp(Exp e)
toExp Change the list of swept backward expressions to an expression by successively changing expressions in prevList to comma expression and appending parameter e as value expression of the comma expression.

パラメータ:
e - The second operand of the most outside comma expression.
戻り値:
The resultant expression.

addToStmtPrev

final void addToStmtPrev(Stmt s,
                         boolean reserve)
addToStmtPrev Insert the statements swept backward (prevList elements) in front of the statement s. If a prevList element is an expression, then change it to ExpStmt and insert it.

パラメータ:
s - Statement showing the position of insertion.
reserve - True if the inserted statements are to be left.

addToStmtNext

final void addToStmtNext(Stmt s,
                         boolean reserve)
addToStmtNext Insert the statements swept forward (nextList elements) at the position next to the statement s. If a nextList element is an expression, then change it to ExpStmt and insert it.

パラメータ:
s - Statement showing the position of insertion.
reserve - True if the inserted statements are to be left.

addToBlockLast

final void addToBlockLast(Stmt s,
                          boolean reserve)
addToBlockLast Add swept backward statements (in prevList) as the last statement of the block which is either parameter s or a block generated to surround s.

パラメータ:
s - Statement showing the candidate of insertion.
reserve - True if the inserted statements are to be left.

addToBlockFirst

final void addToBlockFirst(Stmt s,
                           boolean reserve)
addToBlockLast Add swept forward statements (in nextList) as the last statement of the block which is either parameter s or a block generated to surround s.

パラメータ:
s - Statement showing the candidate of insertion.
reserve - True if the inserted statements are to be left.

getBlockStmt

BlockStmt getBlockStmt(Stmt s)
getBlockStmt From parameter s, make a block statement in which swept out statements can be inserted.
 0)  (BlockStmt )      =>  (BlockStmt )  --> return

 1)  (LabeledStmt          (LabeledStmt
       (BlockStmt      =>    (BlockStmt  --> return

 2)  (LabeledStmt          (LabeledStmt
       (xxxStmt ))     =>    (BlockStmt  --> return
                               (xxxStmt )))

 3)  (xxxStmt )        =>  (BlockStmt  --> return
                             (xxxStmt ))
 

パラメータ:
s - Statement showing the candidate of insertion point.
戻り値:
Resultant block statement.