ic.dfa
Class ReachableAnalysisWithVisitor

java.lang.Object
  extended by ic.dfa.DataFlowAnalysis<Boolean>
      extended by ic.dfa.ReachableAnalysisWithVisitor

public class ReachableAnalysisWithVisitor
extends DataFlowAnalysis<Boolean>

Same as ReachableAnalysis, but illustrates how to leverage the TAC visitor pattern (if you have one) to implement the transfer functions in a relatively elegant way.


Field Summary
 
Fields inherited from class ic.dfa.DataFlowAnalysis
cfg, in, out
 
Constructor Summary
ReachableAnalysisWithVisitor(ControlFlowGraph cfg)
           
 
Method Summary
 Boolean boundary()
          Initial value for out[enter] or in[exit], depending on direction.
 boolean equals(Boolean t1, Boolean t2)
          Return true if t1 and t2 are equivalent.
 boolean isForward()
          Return true iff the analysis is a forward analysis.
 Boolean meet(Boolean t1, Boolean t2)
          Return the meet of t1 and t2 in the lattice.
 Boolean top()
          Top value in the lattice of T elements.
 Boolean transfer(TInstr instr, Boolean t)
          Return the result of applying the transfer function for instr to t.
 Boolean visit(TBinary x, Boolean t)
           
 Boolean visit(TCopy x, Boolean t)
           
 
Methods inherited from class ic.dfa.DataFlowAnalysis
in, out, solve, solveBackward, solveForward, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReachableAnalysisWithVisitor

public ReachableAnalysisWithVisitor(ControlFlowGraph cfg)
Method Detail

boundary

public Boolean boundary()
Description copied from class: DataFlowAnalysis
Initial value for out[enter] or in[exit], depending on direction.

Specified by:
boundary in class DataFlowAnalysis<Boolean>

top

public Boolean top()
Description copied from class: DataFlowAnalysis
Top value in the lattice of T elements.

Specified by:
top in class DataFlowAnalysis<Boolean>

equals

public boolean equals(Boolean t1,
                      Boolean t2)
Description copied from class: DataFlowAnalysis
Return true if t1 and t2 are equivalent.

Specified by:
equals in class DataFlowAnalysis<Boolean>

isForward

public boolean isForward()
Description copied from class: DataFlowAnalysis
Return true iff the analysis is a forward analysis.

Specified by:
isForward in class DataFlowAnalysis<Boolean>

meet

public Boolean meet(Boolean t1,
                    Boolean t2)
Description copied from class: DataFlowAnalysis
Return the meet of t1 and t2 in the lattice.

Specified by:
meet in class DataFlowAnalysis<Boolean>

transfer

public Boolean transfer(TInstr instr,
                        Boolean t)
Description copied from class: DataFlowAnalysis
Return the result of applying the transfer function for instr to t.

Specified by:
transfer in class DataFlowAnalysis<Boolean>

visit

public Boolean visit(TBinary x,
                     Boolean t)

visit

public Boolean visit(TCopy x,
                     Boolean t)