coins.mdf
Class TreatIf

java.lang.Object
  extended bycoins.mdf.TreatNode
      extended bycoins.mdf.TreatIf

class TreatIf
extends TreatNode

This class treats `IF statement'. In MDF module, the `IF statement' is a kind of special statement because it include the flow information.


Field Summary
protected  MdfEnvironment env
           
protected  MacroFlowGraph mfg
           
protected  Stmt root
           
protected  SymTable symTab
           
protected  java.util.LinkedList visited
           
 
Constructor Summary
(package private) TreatIf(MdfEnvironment e, MacroFlowGraph g, IfStmt stmt, java.util.LinkedList list, MdfConditions c)
          Constructor:
 
Method Summary
protected  boolean isChange(MacroTask mt, Label label)
          Get whether the specified macro task has the specified label.
protected  BlockStmt makeJumpBlk(Label label)
          Make a new block structure which include a new JUMP statement.
(package private)  void replace(MacroTask mt, Label label)
          Replace the `then part' and `else part' of the current IF statement.
protected  void replaceReturn(Label label, DeclareLocalVariables decLocal)
          Replace the return statement into the jump statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected MdfEnvironment env

symTab

protected SymTable symTab

mfg

protected MacroFlowGraph mfg

visited

protected java.util.LinkedList visited

root

protected Stmt root
Constructor Detail

TreatIf

TreatIf(MdfEnvironment e,
        MacroFlowGraph g,
        IfStmt stmt,
        java.util.LinkedList list,
        MdfConditions c)
Constructor:

Parameters:
e - The environment of the MDF module
g - The current macro flow graph
stmt - The current IF statement
list - The list of the labels which the MDF module is already treated
c - The current conditions
Method Detail

replace

void replace(MacroTask mt,
             Label label)
Replace the `then part' and `else part' of the current IF statement.

Parameters:
mt - The current macro task
label - The target label

replaceReturn

protected void replaceReturn(Label label,
                             DeclareLocalVariables decLocal)
Replace the return statement into the jump statement.

Parameters:
label - The label of the final return statement
decLocal - The declaration of the local variables

makeJumpBlk

protected BlockStmt makeJumpBlk(Label label)
Make a new block structure which include a new JUMP statement.

Parameters:
label - The target label
Returns:
A new block structure

isChange

protected boolean isChange(MacroTask mt,
                           Label label)
Get whether the specified macro task has the specified label.

Parameters:
mt - The target macro task
label - The target label
Returns:
True if the specified macro task has the specified label