edu.cmu.cs.crystal.simple
Class AbstractingTransferFunction<LE>

java.lang.Object
  extended by edu.cmu.cs.crystal.simple.AbstractingTransferFunction<LE>
Type Parameters:
LE - the lattice being used in this analysis.
All Implemented Interfaces:
IFlowAnalysisDefinition<LE>, ITACTransferFunction<LE>
Direct Known Subclasses:
LiveVariableTransferFunction

public abstract class AbstractingTransferFunction<LE>
extends Object
implements ITACTransferFunction<LE>

This class implements additional transfer functions that abstract or group other transfer functions according to the instruction hierarchy. This is convenient for analyses that want to treat many different but related instructions in the same way. For example, if you want to have the same transfer function for MethodCallInstruction, ConstructorCallInstruction, and NewObjectInstruction, you can override TACInvocation.

Author:
Jonathan Aldrich

Constructor Summary
AbstractingTransferFunction()
           
 
Method Summary
 ITACAnalysisContext getAnalysisContext()
           
 AnalysisDirection getAnalysisDirection()
          Informs Crystal in which direction to perform the analysis.
 void setAnalysisContext(ITACAnalysisContext analysisContext)
          This method is used to pass a variable query interface to the transfer function.
 LE transfer(ArrayInitInstruction instr, LE value)
           
 LE transfer(AssignmentInstruction instr, LE value)
           
 LE transfer(BinaryOperation binop, LE value)
           
 LE transfer(CastInstruction instr, LE value)
           
 LE transfer(ConstructorCallInstruction instr, LE value)
           
 LE transfer(CopyInstruction instr, LE value)
           
 LE transfer(DotClassInstruction instr, LE value)
           
 LE transfer(EnhancedForConditionInstruction instr, LE value)
           
 LE transfer(InstanceofInstruction instr, LE value)
           
 LE transfer(InvocationInstruction instr, LE value)
           
 LE transfer(LoadArrayInstruction instr, LE value)
           
 LE transfer(LoadFieldInstruction instr, LE value)
           
 LE transfer(LoadLiteralInstruction instr, LE value)
           
 LE transfer(MethodCallInstruction instr, LE value)
           
 LE transfer(NewArrayInstruction instr, LE value)
           
 LE transfer(NewObjectInstruction instr, LE value)
           
 LE transfer(OneOperandInstruction instr, LE value)
           
 LE transfer(ReturnInstruction instr, LE value)
           
 LE transfer(SourceVariableDeclaration instr, LE value)
           
 LE transfer(SourceVariableReadInstruction instr, LE value)
           
 LE transfer(StoreArrayInstruction instr, LE value)
           
 LE transfer(StoreFieldInstruction instr, LE value)
           
 LE transfer(StoreInstruction instr, LE value)
           
 LE transfer(TACInstruction instr, LE value)
           
 LE transfer(UnaryOperation unop, LE value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.cmu.cs.crystal.flow.IFlowAnalysisDefinition
createEntryValue, getLatticeOperations
 

Constructor Detail

AbstractingTransferFunction

public AbstractingTransferFunction()
Method Detail

getAnalysisDirection

public AnalysisDirection getAnalysisDirection()
Description copied from interface: IFlowAnalysisDefinition
Informs Crystal in which direction to perform the analysis.

Specified by:
getAnalysisDirection in interface IFlowAnalysisDefinition<LE>
Returns:
the direction of the analysis; never null.

getAnalysisContext

public ITACAnalysisContext getAnalysisContext()

setAnalysisContext

public void setAnalysisContext(ITACAnalysisContext analysisContext)
Description copied from interface: ITACTransferFunction
This method is used to pass a variable query interface to the transfer function. Transfer functions can, but do not have to, store the passed object in one of their fields for future use. The provided object can be used to find Variable objects for AST nodes. Note that the entire context should be stored, and not individual variables like ThisVariable. This is because this method will be called in a state where the context is not yet ready for calls to methods like getThisVariable().

Specified by:
setAnalysisContext in interface ITACTransferFunction<LE>
Parameters:
analysisContext - Interface to query for variables given AST nodes.

transfer

public LE transfer(TACInstruction instr,
                   LE value)

transfer

public LE transfer(AssignmentInstruction instr,
                   LE value)

transfer

public LE transfer(InvocationInstruction instr,
                   LE value)

transfer

public LE transfer(OneOperandInstruction instr,
                   LE value)

transfer

public LE transfer(StoreInstruction instr,
                   LE value)

transfer

public LE transfer(ArrayInitInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(BinaryOperation binop,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(CastInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(DotClassInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(ConstructorCallInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(CopyInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(EnhancedForConditionInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(InstanceofInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(LoadLiteralInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(LoadArrayInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(LoadFieldInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(MethodCallInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(NewArrayInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(NewObjectInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(ReturnInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(StoreArrayInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(StoreFieldInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(SourceVariableDeclaration instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(SourceVariableReadInstruction instr,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>

transfer

public LE transfer(UnaryOperation unop,
                   LE value)
Specified by:
transfer in interface ITACTransferFunction<LE>