public class

DFA1

extends Object
implements IDFA<InsnType extends IInstruction>
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.cfg.DFA1<InsnType extends com.pnfsoftware.jeb.core.units.code.IInstruction>

Class Overview

Legacy Data Flow Analysis (DFA) object for a CFG. This class calculates all data flow information for the entire CFG. It is fast on small- to large-sized routines, but can be slow and consume large amount of memory for very large routines. The use of the newest DFA2 class is recommended for most cases.

DFA objects can be configured and performed using CFG.doDataFlowAnalysis() methods.

The provided chains are ordered by key (variable) appearance in processing.

See Also

Summary

Nested Classes
class DFA1.BI<InsnType extends IInstruction>  
[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.IDFA
Public Methods
boolean checkNoUse(long addr, int varid)
Long checkSingleDef(long addr, int varid)
Long checkSingleSource(long addr, int varid)
Long checkSingleUse(long addr, int varid)
String formatStats()
BI<InsnType> getBlockInfo(BasicBlock<InsnType> b)
CFG<InsnType> getCfg()
Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.
Map<Integer, Collection<Long>> getDefUseChains(long address)
Retrieve the du-chains for the instruction at the provided address.
Map<Integer, Collection<Long>> getDefUseChains(BasicBlock<InsnType> b, int index)
Collection<Long> getDefUses(long addr, int varid, int stopCount)
Collection<Long> getDefUses(long addr, int varid)
long getExecutionTime()
Collection<Long> getInputMap(int varid)
Map<Integer, Collection<Long>> getInputMap()
Retrieve the du-chain of live registers at the entry block.
Set<Integer> getInputs()
List<Integer> getInstructionAllDefs(long addr)
List<Integer> getInstructionAllUses(long addr)
Collection<Integer> getInstructionDefs(long addr)
Collection<Integer> getInstructionPotentialDefs(long addr)
Collection<Integer> getInstructionPotentialUses(long addr)
Collection<Integer> getInstructionSpoiledDefs(long addr)
Collection<Integer> getInstructionUses(long addr)
Map<Integer, Collection<Long>> getLiveChains(BasicBlock<InsnType> b, int idx)
Collection<Long> getLiveChains(BasicBlock<InsnType> b, int idx, int varid)
Map<Integer, Collection<Long>> getOutputMap()
Retrieve a coalesced ud-chain of reaching registers for all the exit blocks of the CFG.
Map<Integer, Collection<Long>> getOutputMap(BasicBlock<InsnType> b)
Collection<Long> getOutputMap(BasicBlock<InsnType> blk, int varid)
Collection<Long> getOutputMap(int varid)
Collection<Integer> getOutputs(BasicBlock<InsnType> b)
Collection<Integer> getOutputs()
Map<Integer, Collection<Long>> getReachChains(BasicBlock<InsnType> b, int idx)
Collection<Long> getReachChains(BasicBlock<InsnType> b, int idx, int varid)
Map<Integer, Collection<Long>> getReachingVariables(long address)
Retrieve the list of variables reaching the instruction at the provided address.
Map<Integer, Collection<Long>> getUseDefChains(BasicBlock<InsnType> b, int index)
Map<Integer, Collection<Long>> getUseDefChains(long address)
Retrieve the ud-chains for the instruction at the provided address.
Collection<Long> getUseDefs(long addr, int varid, int stopCount)
Collection<Long> getUseDefs(long addr, int varid)
List<Integer> getUseDiscrepancies(long address)
Retrieve the list of use-discrepancies at the provided instruction address.
int getVariableCollectionFlags()
Retrieve the variable collection flags.
IVariableInformationProvider getVariableInformationProvider()
void invalidate()
Invalidate the analysis.
boolean isCleanCopies()
boolean isIntegrateCalculatedInputRegisters()
boolean isNotRedefined(int varid, long addr0, long addr1)
Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction.
boolean isNotRedefined(int varid, BasicBlock<InsnType> b0, int i0, BasicBlock<InsnType> b1, int i1)
Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction.
boolean isSanitizePotentialLists()
boolean isUseDiscrepancy(long addr, int varid)
boolean isValid()
Determine whether the current analysis was performed and is valid.
Boolean isVarReachingFromTo(int varid, BasicBlock<InsnType> b0, int i0, BasicBlock<InsnType> b1, int i1)
Determine if a variable used by the start instruction reaches the final instruction with the same value.
Boolean isVarReachingFromTo(int varid, long addr0, long addr1)
Determine if a variable used by the start instruction reaches the final instruction with the same value.
void notifyInstructionUpdate(long addr)
void perform()
Perform data flow analysis on the CFG.
void removeEntries(BasicBlock<InsnType> b, int index, boolean hardRemoval)
void setCleanCopies(boolean cleanCopies)
void setIntegrateCalculatedInputRegisters(boolean integrateCalculatedInputRegisters)
void setSanitizePotentialLists(boolean sanitizePotentialLists)
void setVariableCollectionFlags(int flags)
Set the variable collection flags.
void setVariableInformationProvider(IVariableInformationProvider varInfoProvider)
String toString()
void verifyDFA()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.units.code.IDFA

Public Methods

public boolean checkNoUse (long addr, int varid)

public Long checkSingleDef (long addr, int varid)

public Long checkSingleSource (long addr, int varid)

public Long checkSingleUse (long addr, int varid)

public String formatStats ()

public BI<InsnType> getBlockInfo (BasicBlock<InsnType> b)

public CFG<InsnType> getCfg ()

Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.

public Map<Integer, Collection<Long>> getDefUseChains (long address)

Retrieve the du-chains for the instruction at the provided address.

Data flow analysis must have been #doDataFlowAnalysis() performed else this method will throw an IllegalStateException.

Parameters
address instruction address; the special address -1 can be used retrieve the routine's input chains (live registers at entry)
Returns
  • a def-use chain: key= input variable id, value= list of addresses for uses

public Map<Integer, Collection<Long>> getDefUseChains (BasicBlock<InsnType> b, int index)

public Collection<Long> getDefUses (long addr, int varid, int stopCount)

public Collection<Long> getDefUses (long addr, int varid)

public long getExecutionTime ()

public Collection<Long> getInputMap (int varid)

public Map<Integer, Collection<Long>> getInputMap ()

Retrieve the du-chain of live registers at the entry block.

Data flow analysis must have been #doDataFlowAnalysis() performed else this method will throw an IllegalStateException.

Returns
  • a def-use chain: key= input variable id, value= list of addresses for uses

public Set<Integer> getInputs ()

public List<Integer> getInstructionAllDefs (long addr)

public List<Integer> getInstructionAllUses (long addr)

public Collection<Integer> getInstructionDefs (long addr)

public Collection<Integer> getInstructionPotentialDefs (long addr)

public Collection<Integer> getInstructionPotentialUses (long addr)

public Collection<Integer> getInstructionSpoiledDefs (long addr)

public Collection<Integer> getInstructionUses (long addr)

public Map<Integer, Collection<Long>> getLiveChains (BasicBlock<InsnType> b, int idx)

public Collection<Long> getLiveChains (BasicBlock<InsnType> b, int idx, int varid)

public Map<Integer, Collection<Long>> getOutputMap ()

Retrieve a coalesced ud-chain of reaching registers for all the exit blocks of the CFG.

Data flow analysis must have been #doDataFlowAnalysis() performed else this method will throw an IllegalStateException.

Returns
  • a use-def chain: key= output variable id, value= list of addresses for definitions

public Map<Integer, Collection<Long>> getOutputMap (BasicBlock<InsnType> b)

public Collection<Long> getOutputMap (BasicBlock<InsnType> blk, int varid)

public Collection<Long> getOutputMap (int varid)

public Collection<Integer> getOutputs (BasicBlock<InsnType> b)

public Collection<Integer> getOutputs ()

public Map<Integer, Collection<Long>> getReachChains (BasicBlock<InsnType> b, int idx)

public Collection<Long> getReachChains (BasicBlock<InsnType> b, int idx, int varid)

public Map<Integer, Collection<Long>> getReachingVariables (long address)

Retrieve the list of variables reaching the instruction at the provided address.

Data flow analysis must have been #doDataFlowAnalysis() performed else this method will throw an IllegalStateException.

Parameters
address exact instruction address; the special address -1 can be used retrieve the routine's input chains (live registers at entry)
Returns
  • a map of var_ids reaching the instruction, whose values are the the lists of addresses where those vars were defined

public Map<Integer, Collection<Long>> getUseDefChains (BasicBlock<InsnType> b, int index)

public Map<Integer, Collection<Long>> getUseDefChains (long address)

Retrieve the ud-chains for the instruction at the provided address.

Data flow analysis must have been #doDataFlowAnalysis() performed else this method will throw an IllegalStateException.

Parameters
address instruction address; the special address -1 can be used retrieve the routine's output chains (reaching registers at all exits)
Returns
  • a use-def chain: key= output variable id, value= list of addresses for definitions

public Collection<Long> getUseDefs (long addr, int varid, int stopCount)

public Collection<Long> getUseDefs (long addr, int varid)

public List<Integer> getUseDiscrepancies (long address)

Retrieve the list of use-discrepancies at the provided instruction address.

Parameters
address instruction address
Returns
  • a list of variables whose usage at the provided location appears to be incorrect (i.e. not all paths to this usage carry a definition of the variable)

public int getVariableCollectionFlags ()

Retrieve the variable collection flags.

Returns

public IVariableInformationProvider getVariableInformationProvider ()

public void invalidate ()

Invalidate the analysis. Clients have the responsibility to invalidate an analysis if the CFG was modified in such a way that data flow should be recalculated.

public boolean isCleanCopies ()

public boolean isIntegrateCalculatedInputRegisters ()

public boolean isNotRedefined (int varid, long addr0, long addr1)

Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction. (Note that this method does not verify that varid actually has definitions reaching the start or final instruction; it is up to the caller to verify that.)

Parameters
varid variable id
addr0 start address, exclusive
addr1 final address, also exclusive
Returns
  • true if the variable was not redefined

public boolean isNotRedefined (int varid, BasicBlock<InsnType> b0, int i0, BasicBlock<InsnType> b1, int i1)

Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction. (Note that this method does not verify that varid actually has definitions reaching the start or final instruction; it is up to the caller to verify that.)

Parameters
varid variable id
b0 start block
i0 final block
b1 index of the start instruction in the start block, exclusive
i1 index of the final instruction in the final block, also exclusive
Returns
  • true if the variable was not redefined

public boolean isSanitizePotentialLists ()

public boolean isUseDiscrepancy (long addr, int varid)

public boolean isValid ()

Determine whether the current analysis was performed and is valid.

public Boolean isVarReachingFromTo (int varid, BasicBlock<InsnType> b0, int i0, BasicBlock<InsnType> b1, int i1)

Determine if a variable used by the start instruction reaches the final instruction with the same value.

Parameters
varid variable id
b0 start block
i0 final block
b1 index of the start instruction in the start block, exclusive
i1 index of the final instruction in the final block, also exclusive
Returns
  • success indicator; null means unknown

public Boolean isVarReachingFromTo (int varid, long addr0, long addr1)

Determine if a variable used by the start instruction reaches the final instruction with the same value.

Parameters
varid variable id
addr0 start address, exclusive
addr1 final address, also exclusive
Returns
  • success indicator; null means unknown

public void notifyInstructionUpdate (long addr)

public void perform ()

Perform data flow analysis on the CFG. Upon return, basic blocks will have their data chains (ud and du, full and simple) set up and accessible.

public void removeEntries (BasicBlock<InsnType> b, int index, boolean hardRemoval)

public void setCleanCopies (boolean cleanCopies)

public void setIntegrateCalculatedInputRegisters (boolean integrateCalculatedInputRegisters)

Parameters
integrateCalculatedInputRegisters if true, the live registers determined after analysis will be integrated in the use-def chains

public void setSanitizePotentialLists (boolean sanitizePotentialLists)

public void setVariableCollectionFlags (int flags)

Set the variable collection flags.

Parameters
flags flags, see DefUseInfo

public void setVariableInformationProvider (IVariableInformationProvider varInfoProvider)

public String toString ()

public void verifyDFA ()

Throws
IllegalStateException