forge.transform
Class AbstractTransformer.TransformVisitor

java.lang.Object
  extended by forge.transform.AbstractTransformer.TransformVisitor
All Implemented Interfaces:
CFGVisitor
Enclosing class:
AbstractTransformer

protected abstract static class AbstractTransformer.TransformVisitor
extends java.lang.Object
implements CFGVisitor

A TransformVisitor


Constructor Summary
protected AbstractTransformer.TransformVisitor(AbstractTransformer transformer, ForgeCFG source)
          Constructs a TransformVisitor belonging to the given transformer,
protected AbstractTransformer.TransformVisitor(AbstractTransformer transformer, ForgeCFG source, ForgeCFG.Impl target)
           
 
Method Summary
 CFGStmt apply(CFGStmt stmt)
           
protected  AssignStmt copy(AssignStmt stmt)
           
protected  BranchStmt copy(BranchStmt stmt)
           
protected  CallStmt copy(CallStmt stmt)
           
protected  CreateStmt copy(CreateStmt stmt)
           
protected  SpecStmt copy(SpecStmt stmt)
           
protected  void replace(CFGStmt source, CFGStmt target)
          Sets the result of applying the visitor to the given source.
protected  InstanceDomain replaceDom(InstanceDomain dom)
           
protected  ForgeExpression replaceExpr(ForgeExpression expr)
          Called during the copy methods on any expression that appears.
protected  java.util.List<ForgeExpression> replaceExprs(java.util.List<ForgeExpression> exprs)
           
protected  ForgeVariable replaceVar(ForgeVariable var)
           
protected  edu.mit.csail.sdg.util.collections.UniqueList<ForgeVariable> replaceVars(java.util.Collection<ForgeVariable> vars)
           
 ForgeCFG source()
           
 ForgeCFG.Impl target()
           
protected  UpdateStmt transform(AssignStmt stmt)
          Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.
protected  CFGStmt transform(BranchStmt stmt)
          Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.
protected  CFGStmt transform(CallStmt stmt)
          Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.
protected  UpdateStmt transform(CreateStmt stmt)
          Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.
protected  CFGStmt transform(ExitStmt stmt)
          Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.
protected  UpdateStmt transform(SpecStmt stmt)
          Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.
 void visit(AssignStmt stmt)
          Visits an AssignStmt in the CFG.
 void visit(BranchStmt stmt)
          Visits a BranchStmt in the CFG.
 void visit(CallStmt stmt)
          Visits a CallStmt in the CFG.
 void visit(CreateStmt stmt)
          Visits a CreateStmt in the CFG.
 void visit(ExitStmt stmt)
          Visits a ExitStmt in the CFG.
 void visit(SpecStmt stmt)
          Visits a SpecStmt in the CFG.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransformer.TransformVisitor

protected AbstractTransformer.TransformVisitor(AbstractTransformer transformer,
                                               ForgeCFG source)
Constructs a TransformVisitor belonging to the given transformer,


AbstractTransformer.TransformVisitor

protected AbstractTransformer.TransformVisitor(AbstractTransformer transformer,
                                               ForgeCFG source,
                                               ForgeCFG.Impl target)
Method Detail

source

public final ForgeCFG source()

target

public final ForgeCFG.Impl target()

apply

public final CFGStmt apply(CFGStmt stmt)

replace

protected final void replace(CFGStmt source,
                             CFGStmt target)
Sets the result of applying the visitor to the given source.


transform

protected UpdateStmt transform(AssignStmt stmt)
Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.

This implementation copies the stmt, replaces the stmt for the copy, applies the visitor to the next stmt, sets the next stmt of the copy to the result of that application, and returns the copy.


transform

protected UpdateStmt transform(CreateStmt stmt)
Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.

This implementation copies the stmt, replaces the stmt for the copy, applies the visitor to the next stmt, sets the next stmt of the copy to the result of that application, and returns the copy.


transform

protected UpdateStmt transform(SpecStmt stmt)
Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.

This implementation copies the stmt, replaces the stmt for the copy, applies the visitor to the next stmt, sets the next stmt of the copy to the result of that application, and returns the copy.


transform

protected CFGStmt transform(CallStmt stmt)
Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.

This implementation copies the stmt, replaces the stmt for the copy, applies the visitor to the next stmt, sets the next stmt of the copy to the result of that application, and returns the copy.


transform

protected CFGStmt transform(BranchStmt stmt)
Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.

This implementation copies the stmt, replaces the stmt for the copy, applies the visitor to the then stmt, sets the then branch of the copy to the result of that application, applies the visitor to the else stmt, sets the else branch to the result of that application.


transform

protected CFGStmt transform(ExitStmt stmt)
Transforms the statement to a new statement or null, but must also call replace to set the result of an application to this statement.

This implementation replaces the stmt for the exit stmt of the target cfg and returns the target's exit.


replaceExpr

protected ForgeExpression replaceExpr(ForgeExpression expr)
Called during the copy methods on any expression that appears. Given a ForgeVariable, must return a ForgeVariable and given an InstanceDomain, must return an InstanceDomain.


copy

protected final AssignStmt copy(AssignStmt stmt)

copy

protected final CallStmt copy(CallStmt stmt)

copy

protected final CreateStmt copy(CreateStmt stmt)

copy

protected final BranchStmt copy(BranchStmt stmt)

copy

protected final SpecStmt copy(SpecStmt stmt)

replaceVar

protected final ForgeVariable replaceVar(ForgeVariable var)

replaceDom

protected final InstanceDomain replaceDom(InstanceDomain dom)

replaceExprs

protected final java.util.List<ForgeExpression> replaceExprs(java.util.List<ForgeExpression> exprs)

replaceVars

protected final edu.mit.csail.sdg.util.collections.UniqueList<ForgeVariable> replaceVars(java.util.Collection<ForgeVariable> vars)

visit

public final void visit(AssignStmt stmt)
Description copied from interface: CFGVisitor
Visits an AssignStmt in the CFG.

Specified by:
visit in interface CFGVisitor

visit

public final void visit(BranchStmt stmt)
Description copied from interface: CFGVisitor
Visits a BranchStmt in the CFG.

Specified by:
visit in interface CFGVisitor

visit

public final void visit(CallStmt stmt)
Description copied from interface: CFGVisitor
Visits a CallStmt in the CFG.

Specified by:
visit in interface CFGVisitor

visit

public final void visit(CreateStmt stmt)
Description copied from interface: CFGVisitor
Visits a CreateStmt in the CFG.

Specified by:
visit in interface CFGVisitor

visit

public final void visit(ExitStmt stmt)
Description copied from interface: CFGVisitor
Visits a ExitStmt in the CFG.

Specified by:
visit in interface CFGVisitor

visit

public final void visit(SpecStmt stmt)
Description copied from interface: CFGVisitor
Visits a SpecStmt in the CFG.

Specified by:
visit in interface CFGVisitor