coins.casttohir
Class ToHirCOpt2

java.lang.Object
  extended bycoins.casttohir.ToHirVisit
      extended bycoins.casttohir.ToHirCOpt
          extended bycoins.casttohir.ToHirCOpt2

public class ToHirCOpt2
extends ToHirCOpt

Do HIR-C optimization for arithmetic expression and conditional expression. Optimization level is controlled by compile option. ToHirCOpt2 does kind 4 through kind 8 optimizations described in ToHirCOpt.


Field Summary
protected  SideEffectCutter cutter
           
protected  ToHirCOpt2 toOpt
           
 
Fields inherited from class coins.casttohir.ToHirCOpt
buffer, fDbgLevel, hir, inverter, nowBlock, sym, toCast, toHir
 
Constructor Summary
ToHirCOpt2(ToHir tohir)
          Constructor.
 
Method Summary
protected  Exp atAdd(Exp e)
          At add expression node.
protected  Exp atAnd(Exp e)
          At and expression node.
protected  Exp atARShift(Exp e)
          At arithmetic R-shift expression node.
protected  Exp atCmpEq(Exp e)
          At EQ expression node.
protected  Exp atCmpGe(Exp e)
          At GE expression node.
protected  Exp atCmpGt(Exp e)
          At GT expression node.
protected  Exp atCmpLe(Exp e)
          At LE expression node.
protected  Exp atCmpLt(Exp e)
          At LT expression node.
protected  Exp atCmpNe(Exp e)
          At NE expression node.
protected  Exp atDiv(Exp e)
          At mul expression node.
protected  Exp atLgAnd(Exp e)
          At logical-and expression node.
protected  Exp atLgOr(Exp e)
          At logical-or expression node.
protected  Exp atLShift(Exp e)
          At L-shift expression node.
protected  Exp atMod(Exp e)
          At mod expression node.
protected  Exp atMul(Exp e)
          At mul expression node.
protected  Exp atOffset(Exp e)
          At offset(difference of address) expression node.
protected  Exp atOr(Exp e)
          At and expression node.
protected  Exp atRShift(Exp e)
          At logical R-shift expression node.
protected  Exp atSelect(Exp e)
          At selection expression node.
protected  Exp atSub(Exp e)
          At sub expression node.
protected  Exp atXor(Exp e)
          At xor expression node.
protected  void message(int level, java.lang.String mes)
          Output debug message.
protected  ToHirCOpt2 sureChild()
          Make sure child of this object.
 
Methods inherited from class coins.casttohir.ToHirCOpt
atAddAssign, atAddr, atAndAssign, atArrow, atAssign, atAssignStmt, atBlock, atCall, atComma, atConst, atContents, atConv, atDecay, atDivAssign, atElem, atEqZero, atExpList, atExpRepeat, atExpStmt, atFor, atIf, atIndex, atInfStmt, atJump, atLabeledStmt, atLShiftAssign, atModAssign, atMulAssign, atNeg, atNot, atOrAssign, atPost, atPre, atQual, atReturn, atRShiftAssign, atSetDataStmt, atSubAssign, atSubp, atSubpDefinition, atSubs, atSwitch, atUndecay, atUntil, atVar, atWhile, atXorAssign, inInitBlock, processPragmaItem, visitExp, visitProgram, visitProgram, visitStmt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toOpt

protected ToHirCOpt2 toOpt

cutter

protected final SideEffectCutter cutter
Constructor Detail

ToHirCOpt2

public ToHirCOpt2(ToHir tohir)
Constructor.

Parameters:
tohir - Offers cooperation with the object of other packages.
Method Detail

sureChild

protected ToHirCOpt2 sureChild()
Make sure child of this object.

Returns:
Child of this object.

message

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

Overrides:
message in class ToHirCOpt
Parameters:
level - Debug level.
mes - Debug message.

atAdd

protected Exp atAdd(Exp e)
At add expression node.

Overrides:
atAdd in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atSub

protected Exp atSub(Exp e)
At sub expression node.

Overrides:
atSub in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atMul

protected Exp atMul(Exp e)
At mul expression node.

Overrides:
atMul in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atDiv

protected Exp atDiv(Exp e)
At mul expression node.

Overrides:
atDiv in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atMod

protected Exp atMod(Exp e)
At mod expression node.

Overrides:
atMod in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atAnd

protected Exp atAnd(Exp e)
At and expression node.

Overrides:
atAnd in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atOr

protected Exp atOr(Exp e)
At and expression node.

Overrides:
atOr in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atXor

protected Exp atXor(Exp e)
At xor expression node.

Overrides:
atXor in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atCmpEq

protected Exp atCmpEq(Exp e)
At EQ expression node.

Overrides:
atCmpEq in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atCmpNe

protected Exp atCmpNe(Exp e)
At NE expression node.

Overrides:
atCmpNe in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atCmpGt

protected Exp atCmpGt(Exp e)
At GT expression node.

Overrides:
atCmpGt in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atCmpGe

protected Exp atCmpGe(Exp e)
At GE expression node.

Overrides:
atCmpGe in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atCmpLt

protected Exp atCmpLt(Exp e)
At LT expression node.

Overrides:
atCmpLt in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atCmpLe

protected Exp atCmpLe(Exp e)
At LE expression node.

Overrides:
atCmpLe in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atLShift

protected Exp atLShift(Exp e)
At L-shift expression node.

Overrides:
atLShift in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atARShift

protected Exp atARShift(Exp e)
At arithmetic R-shift expression node.

Overrides:
atARShift in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atRShift

protected Exp atRShift(Exp e)
At logical R-shift expression node.

Overrides:
atRShift in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atOffset

protected Exp atOffset(Exp e)
At offset(difference of address) expression node.

Overrides:
atOffset in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atLgAnd

protected Exp atLgAnd(Exp e)
At logical-and expression node.

Overrides:
atLgAnd in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atLgOr

protected Exp atLgOr(Exp e)
At logical-or expression node.

Overrides:
atLgOr in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp

atSelect

protected Exp atSelect(Exp e)
At selection expression node.

Overrides:
atSelect in class ToHirVisit
Parameters:
e - Exp
Returns:
Exp