Class DFA4<InsnType extends IInstruction>
- Type Parameters:
InsnType- instruction type
- All Implemented Interfaces:
IDFA<InsnType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCache basic def/use information at the instruction levelstatic final intCACHE_DUI+ cache standard ud-chains and du-chainsstatic final intDeprecated.static final intNothing is cachedstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongstatic final AtomicLongFields inherited from interface com.pnfsoftware.jeb.core.units.code.IDFA
STANDARD_COLLECTION_FLAGS, STANDARD_INTEGRATE_INPUTS -
Constructor Summary
ConstructorsConstructorDescriptionDFA4(IControlFlowGraph<InsnType, ? extends IBasicBlock<InsnType>> cfg) Create a DFA object with CFG-provided default collection flags and basic caching for instruction-level def-use information.DFA4(IControlFlowGraph<InsnType, ? extends IBasicBlock<InsnType>> cfg, int collectionFlags, int cacheConfig) Create a DFA object. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckInput(int varid) Determine whether a variable is an input.checkInputWithUses(int varid) Get uses of an input variable.booleancheckNoUse(long addr, int varid) Check whether a variable, defined at the provided instruction, is not used.booleancheckNoUse(long insnAddress, int varId, boolean reachOutIsUse) Check whether a variable, defined at the provided instruction, is not used.intcheckNoUse(long addr, int varid, boolean reachOutIsUse, int maxBlocks) Check whether a variable, defined at the provided instruction, is not used.booleancheckOutput(int varid) Determine whether a variable is an output of the CFG.booleancheckOutput(IBasicBlock<InsnType> blk, int varid) Determine whether a variable is an output of a block.checkOutputsWithDefs(int varid) Get definitions for a CFG output variable.checkOutputsWithDefs(IBasicBlock<InsnType> blk, int varid) Get definitions for a block output variable.checkSingleDef(long addr, int varid) Check whether a used variable has a single definition point.checkSingleDef(long addr, int varid, boolean liveInIsDef) Check whether a used variable has a single explicit definition point (i.e.checkSingleDefNoInput(long addr, int varid) Check whether a used variable has a single explicit definition point.checkSingleSource(long addr, int varid) Check whether a variable has a single source.checkSingleSource(long addr, int varid, boolean liveInIsDef) Check whether a variable has a single source.checkSingleUse(long addr, int varid) Check whether a defined variable has a single use.checkSingleUse(long addr, int varid, boolean reachOutIsUse) Check whether a defined variable has a single use.voidcollectInstructionAllDefs(long addr, Collection<Integer> r) Collect all variables defined by an instruction.voidcollectInstructionAllUses(long addr, Collection<Integer> r) Collect all variables used by an instruction.filterInputs(Collection<Integer> varids) Filter input variables.filterInputsWithUses(Collection<Integer> varids) Filter input variables with their uses.filterOutputs(IBasicBlock<InsnType> blk, Collection<Integer> varids) Filter output variables of a block.filterOutputs(Collection<Integer> varids) Filter output variables of the CFG.filterOutputsWithDefs(IBasicBlock<InsnType> blk, Collection<Integer> varids) Filter block output variables with their definitions.filterOutputsWithDefs(Collection<Integer> varids) Filter CFG output variables with their definitions.Format def-use information.getBlockDefUses(long addr, int varid) Get block-local use locations for a variable definition.getBlockDefUses(long addr, int varid, int stopCount) Get block-local use locations for a variable definition.getBlockUseDefs(long addr, int varid) Get block-local definition locations for a variable use.intRetrieve the cache configuration.getCfg()Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.getDefUseChains(long addr) Get def-use chains at an instruction.getDefUseChains(long addr, boolean recordReachOut) Get def-use chains at an instruction.getDefUses(long addr, int varid) Get use locations for a variable definition.getDefUses(long addr, int varid, int stopCount) Get use locations for a variable definition.getDefUses(long addr, int varid, int stopCount, boolean recordReachOut) Get use locations for a variable definition.getDefUses(long addr, int varid, int stopcount, boolean verifyStartOnDefPoint, boolean recordReachOut, IBasicBlock<InsnType> blkForLiveChains, int idxForLiveChains, int maxBlocks, boolean limitToStartBlock) Find the list of usage points for a defined variable.getDUI(long addr) Get def-use information for an instruction.Get def-use information for an instruction.Get def-use information for an addressable instruction.Get the input map.getInputMap(int varid) Get input locations for a variable.Get input variables.Get input variables with their uses.getInstructionAllDefs(long addr) Get all variables defined by an instruction.getInstructionAllUses(long addr) Get all variables used by an instruction.getInstructionDefs(long addr) Get the variables defined by an instruction.getInstructionPotentialDefs(long addr) Get variables potentially defined by an instruction.getInstructionPotentialUses(long addr) Get variables potentially used by an instruction.getInstructionSpoiledDefs(long addr) Get variables potentially spoiled by an instruction.getInstructionUses(long addr) Get the variables used by an instruction.getLiveChains(IBasicBlock<InsnType> b, int idx) Get live chains at a block location.getLiveChains(IBasicBlock<InsnType> b, int idx, int varid) Get live chains for a variable at a block location.getLiveChains(IBasicBlock<InsnType> b, int idx, int varid, int stopcount) Get live chains for a variable at a block location.getLiveChains(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) Get live chains at a block location.intRetrieve the maximum block count used for common DFA operations.Get the output map.getOutputMap(int varid) Get output locations for a variable.getOutputMap(IBasicBlock<InsnType> blk) Get the output map for a block.getOutputMap(IBasicBlock<InsnType> blk, int varid) Get output locations for a block and variable.Get output variables.getOutputs(IBasicBlock<InsnType> blk) Get output variables for a block.Get CFG output variables with their definitions.Get block output variables with their definitions.getReachChains(IBasicBlock<InsnType> b, int idx) Get reach chains at a block location.getReachChains(IBasicBlock<InsnType> b, int idx, int varid) Get reach chains for a variable at a block location.getReachChains(IBasicBlock<InsnType> b, int idx, int varid, int stopcount) Get reach chains for a variable at a block location.getReachChains(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) Get reach chains at a block location.getUseDefChains(long addr) Get use-def chains at an instruction.getUseDefChains(long addr, boolean recordLiveIn) Get use-def chains at an instruction.getUseDefs(long addr, int varid) Get definition locations for a variable use.getUseDefs(long addr, int varid, int stopCount) Get definition locations for a variable use.getUseDefs(long addr, int varid, int stopcount, boolean verifyStartOnUsePoint, boolean recordLiveIn, IBasicBlock<InsnType> blkForReachChains, int idxForReachChains, boolean[] aDetectedUseDiscrepancy, boolean treatSpoiledAsDefs, int maxBlocks, boolean limitToStartBlock) Find the list of definition points for a used variable.getUseDiscrepancies(long addr) Retrieve the list of use-discrepancies at the provided instruction address.intRetrieve the variable collection flags.Get the variable information provider.voidInvalidate the analysis.voidinvalidateForRemoval(long addr0) Selectively invalidate the cache in preparation for an instruction pseudo-removal (neutering).voidinvalidateForSubstitution(long addr0, Collection<Long> addr1coll, Collection<Long> srccoll) Selectively invalidate the cache in preparation for an expression-substitution.voidinvalidatePostSimpleSubstitutionWithMultiDefs(Collection<Long> addr0coll, long addr1, int varid) Selectively invalidate DFA cache after the substitution of a variableXby an immediate.booleanisAlive(IBasicBlock<InsnType> b, int idx, int varid) Determine whether a variable is alive at a block location.booleanDetermine whether irregular flows are always examined.booleanDetermine whether calculated input registers are integrated.booleanisNotRedefined(int varid, long addr0, long addr1) Determine whether a variable is not redefined between two addresses.booleanisNotRedefined(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) Determine whether a variable is not redefined between two block locations.booleanisReaching(IBasicBlock<InsnType> b, int idx, int varid) Determine whether a variable reaches a block location.booleanisTerminator(IBasicBlock<InsnType> blk) Determine whether the provided block is a terminator.booleanisUseDiscrepancy(long addr, int varid) Determine whether a use discrepancy exists for a variable.booleanisValid()Determine whether the current analysis was performed and is valid.isVarReachingFromTo(int varid, long addr0, long addr1) Determine if a variable used by the start instruction reaches the final instruction with the same value.isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) Determine if a variable used by the start instruction reaches the final instruction with the same value.isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean allowRedef, boolean performExtendedChecks, int maxBlocks) Determine whether a variable reaches one block location from another.isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean performExtendedChecks, int maxBlocks) Determine if a variable used by the start instruction reaches the final instruction with the same value.voidnotifyInstructionUpdate(long addr) Notify the DFA that an instruction was updated.voidperform()Perform data flow analysis on the CFG.voidReset cached chain information.booleansetAlwaysExamineIrregularFlows(boolean enabled) Set whether irregular flows should always be examined.voidsetCacheConfiguration(int value) Set or update the cache configuration of this object.booleansetIntegrateCalculatedInputRegisters(boolean enabled) Set whether calculated input registers should be integrated.intsetMaxBlocks(int maxBlocks) Set an exploration threshold for most DFA operations.voidsetVariableCollectionFlags(int flags) Set the variable collection flags.Set the variable information provider.toString()verifyNoRedefAfterSink(int varid, long addr0, long addr1) Verify that a variable is not redefined after a sink address.verifyNoRedefAfterSink(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, int maxBlocks) Verify that a variable is not redefined after a sink location.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pnfsoftware.jeb.core.units.code.IDFA
checkSingleDef, checkSingleSource, checkSingleUse, isConservative, setConservative
-
Field Details
-
CACHE_NONE
public static final int CACHE_NONENothing is cached- See Also:
-
CACHE_DUI
public static final int CACHE_DUICache basic def/use information at the instruction level- See Also:
-
CACHE_DUI_CHAINS
public static final int CACHE_DUI_CHAINSCACHE_DUI+ cache standard ud-chains and du-chains- See Also:
-
CACHE_DUI_UDC_DUC
Deprecated.useCACHE_DUI_CHAINSinstead- See Also:
-
dbgDuCacheTotalQueryCount
-
dbgDuCacheTotalHitCount
-
dbgDuCalculationTotalExectimeNs
-
dbgUdCacheTotalQueryCount
-
dbgUdCacheTotalHitCount
-
dbgUdCalculationTotalExectimeNs
-
dbgVrCacheTotalQueryCount
-
dbgVrCacheTotalHitCount
-
dbgVrCalculationTotalExectimeNs
-
-
Constructor Details
-
DFA4
Create a DFA object with CFG-provided default collection flags and basic caching for instruction-level def-use information. This object can be further configured by invoking its various setters.- Parameters:
cfg- control flow graph
-
DFA4
public DFA4(IControlFlowGraph<InsnType, ? extends IBasicBlock<InsnType>> cfg, int collectionFlags, int cacheConfig) Create a DFA object. This object can be further configured by invoking its various setters.- Parameters:
cfg- control flow graphcollectionFlags- collection flags, see constants inDefUseInfocacheConfig- 0= no cache, 1= cached for instruction-level def-use information; 2= 1 + cache for ud-chains and du-chains
-
-
Method Details
-
perform
public void perform()Description copied from interface:IDFAPerform 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.- Specified by:
performin interfaceIDFA<InsnType extends IInstruction>
-
isValid
public boolean isValid()Description copied from interface:IDFADetermine whether the current analysis was performed and is valid.- Specified by:
isValidin interfaceIDFA<InsnType extends IInstruction>- Returns:
- true if the analysis is valid
-
invalidate
public void invalidate()Description copied from interface:IDFAInvalidate 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.- Specified by:
invalidatein interfaceIDFA<InsnType extends IInstruction>
-
notifyInstructionUpdate
public void notifyInstructionUpdate(long addr) Description copied from interface:IDFANotify the DFA that an instruction was updated.- Specified by:
notifyInstructionUpdatein interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address
-
resetChainCaches
public void resetChainCaches()Reset cached chain information. -
invalidateForRemoval
public void invalidateForRemoval(long addr0) Description copied from interface:IDFASelectively invalidate the cache in preparation for an instruction pseudo-removal (neutering). This method should be called before neutering takes place.- Specified by:
invalidateForRemovalin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr0- address of the start instruction; it is assumed that this instruction is no-throw
-
invalidateForSubstitution
public void invalidateForSubstitution(long addr0, Collection<Long> addr1coll, Collection<Long> srccoll) Description copied from interface:IDFASelectively invalidate the cache in preparation for an expression-substitution. This method should be called before the substitution by an immediate took place.- Specified by:
invalidateForSubstitutionin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr0- address of the start instruction, which defines the variable being substituted; it is assumed that this instruction is no-throwaddr1coll- mandatory collection of addresses where the substitutions will take place placesrccoll- optional collection of source instructions; if not provided, all instructions defining some of the substituted variables will be invalidated from the cache
-
invalidatePostSimpleSubstitutionWithMultiDefs
public void invalidatePostSimpleSubstitutionWithMultiDefs(Collection<Long> addr0coll, long addr1, int varid) Description copied from interface:IDFASelectively invalidate DFA cache after the substitution of a variableXby an immediate. This method should be called after the substitution by an immediate took place.- Specified by:
invalidatePostSimpleSubstitutionWithMultiDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr0coll- collection of equivalent source instructions defining a target varX(e.g. X=3); these instructions must be left as-is when calling this method; it is assumed that these instructions are no-throwaddr1- destination instruction, whose target variableXwas replaced by a constantvarid- the variable that was propagated (X)
-
getCfg
Description copied from interface:IDFARetrieve a reference to the CFG object that will be accessed and modified when performing an analysis.- Specified by:
getCfgin interfaceIDFA<InsnType extends IInstruction>- Returns:
- control flow graph
-
setVariableCollectionFlags
public void setVariableCollectionFlags(int flags) Description copied from interface:IDFASet the variable collection flags.- Specified by:
setVariableCollectionFlagsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
flags- flags, seeDefUseInfo
-
getVariableCollectionFlags
public int getVariableCollectionFlags()Description copied from interface:IDFARetrieve the variable collection flags.- Specified by:
getVariableCollectionFlagsin interfaceIDFA<InsnType extends IInstruction>- Returns:
- flags, see
DefUseInfo
-
setCacheConfiguration
public void setCacheConfiguration(int value) Set or update the cache configuration of this object.- Parameters:
value- one ofCACHE_xxxattribute
-
getCacheConfiguration
public int getCacheConfiguration()Retrieve the cache configuration.- Returns:
- value one of
CACHE_xxxattribute
-
setIntegrateCalculatedInputRegisters
public boolean setIntegrateCalculatedInputRegisters(boolean enabled) Description copied from interface:IDFASet whether calculated input registers should be integrated.- Specified by:
setIntegrateCalculatedInputRegistersin interfaceIDFA<InsnType extends IInstruction>- Parameters:
enabled- if true, the live registers determined after analysis will be integrated in the use-def chains- Returns:
- the previous value for this setting
-
isIntegrateCalculatedInputRegisters
public boolean isIntegrateCalculatedInputRegisters()Description copied from interface:IDFADetermine whether calculated input registers are integrated.- Specified by:
isIntegrateCalculatedInputRegistersin interfaceIDFA<InsnType extends IInstruction>- Returns:
- true if calculated input registers are integrated
-
setAlwaysExamineIrregularFlows
public boolean setAlwaysExamineIrregularFlows(boolean enabled) Description copied from interface:IDFASet whether irregular flows should always be examined.- Specified by:
setAlwaysExamineIrregularFlowsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
enabled- true to always examine irregular flows- Returns:
- the previous value for this setting
-
isAlwaysExamineIrregularFlows
public boolean isAlwaysExamineIrregularFlows()Description copied from interface:IDFADetermine whether irregular flows are always examined.- Specified by:
isAlwaysExamineIrregularFlowsin interfaceIDFA<InsnType extends IInstruction>- Returns:
- true if irregular flows are always examined
-
setVariableInformationProvider
Description copied from interface:IDFASet the variable information provider.- Specified by:
setVariableInformationProviderin interfaceIDFA<InsnType extends IInstruction>- Parameters:
provider- variable information provider- Returns:
- the previously set provider
-
getVariableInformationProvider
Description copied from interface:IDFAGet the variable information provider.- Specified by:
getVariableInformationProviderin interfaceIDFA<InsnType extends IInstruction>- Returns:
- variable information provider
-
setMaxBlocks
public int setMaxBlocks(int maxBlocks) Description copied from interface:IDFASet an exploration threshold for most DFA operations. By default, there is no threshold. The threshold is a block count; if a block count is reached, a chain may contain a reference to the invalid address -2 in order to indicate an incomplete result.- Specified by:
setMaxBlocksin interfaceIDFA<InsnType extends IInstruction>- Parameters:
maxBlocks- -1 means no limit- Returns:
- the previous value for this setting
-
getMaxBlocks
public int getMaxBlocks()Description copied from interface:IDFARetrieve the maximum block count used for common DFA operations. SeeIDFA.setMaxBlocks(int)for details.- Specified by:
getMaxBlocksin interfaceIDFA<InsnType extends IInstruction>- Returns:
- maximum block count
-
formatDUI
Format def-use information.- Parameters:
o- def-use information- Returns:
- formatted def-use information
-
getDUI
Description copied from interface:IDFAGet def-use information for an instruction.- Specified by:
getDUIin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- def-use information
-
getDUI
Description copied from interface:IDFAGet def-use information for an addressable instruction.- Specified by:
getDUIin interfaceIDFA<InsnType extends IInstruction>- Parameters:
a- addressable instruction- Returns:
- def-use information
-
getDUI
Description copied from interface:IDFAGet def-use information for an instruction.- Specified by:
getDUIin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressinsn- instruction- Returns:
- def-use information
-
getUseDefs
public Collection<Long> getUseDefs(long addr, int varid, int stopcount, boolean verifyStartOnUsePoint, boolean recordLiveIn, IBasicBlock<InsnType> blkForReachChains, int idxForReachChains, boolean[] aDetectedUseDiscrepancy, boolean treatSpoiledAsDefs, int maxBlocks, boolean limitToStartBlock) Find the list of definition points for a used variable.- Parameters:
addr- initial instruction address (disregarded if computing reachability, in which case, blkForReachChains must be provided)varid- used variable, for which definitions are to be collectedstopcount- the search will stop if the def-count reaches that threshold; use <=0 to mean no stopcountverifyStartOnUsePoint- if true, the variable must be used at the provided instruction (else the method will return null)recordLiveIn- if true, a candidate argument-definition is recorded as -1 in the returned listblkForReachChains- optional basic block used to record reaching variablesidxForReachChains- optional block index used to record reaching variablesaDetectedUseDiscrepancy- optional one-element array, if provided, any use discrepancy (using a potentially undefined variable) will interrupt the search, and this flag will be set to truetreatSpoiledAsDefs- if true, spoiled information for variables will be treated as a regular definitionmaxBlocks- maximum number of basic blocks to be examined; use -1 to mean all; if a positive value is provided, the returned list of addresses may contain -2 to indicate that a definition may be located in an unexplored blocklimitToStartBlock- true to limit the search to the start block- Returns:
- a read-only collection of addresses where the variable was defined; the list may contain -1 to indicate a candidate argument-definition; never return null unless verifyStartOnUsePoint was true
-
getUseDefs
Description copied from interface:IDFAGet definition locations for a variable use.- Specified by:
getUseDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- a variable, which must be used by the provided instruction- Returns:
- a collection (possibly empty) or null if the variable is not used by the instruction
-
getUseDefs
Description copied from interface:IDFAGet definition locations for a variable use.- Specified by:
getUseDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- a variable, which must be used by the provided instructionstopCount- optional stop count- Returns:
- a collection (possibly empty) or null if the variable is not used by the instruction
-
getBlockUseDefs
Description copied from interface:IDFAGet block-local definition locations for a variable use.- Specified by:
getBlockUseDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable id- Returns:
- definition locations
-
isTerminator
Description copied from interface:IDFADetermine whether the provided block is a terminator. A terminator has no output and its final instruction is a clean routine terminator.- Specified by:
isTerminatorin interfaceIDFA<InsnType extends IInstruction>- Parameters:
blk- block to test- Returns:
- true if the block is a clean terminator
-
getDefUses
public Collection<Long> getDefUses(long addr, int varid, int stopcount, boolean verifyStartOnDefPoint, boolean recordReachOut, IBasicBlock<InsnType> blkForLiveChains, int idxForLiveChains, int maxBlocks, boolean limitToStartBlock) Find the list of usage points for a defined variable.- Parameters:
addr- initial instruction address (disregarded if computing liveness, in which case, blkForLiveChains must be provided)varid- defined variablestopcount- the search will stop if the use-count reaches that threshold; use <= 0 to mean no stopcountverifyStartOnDefPoint- if true, the variable must be defined by the provided initial instruction (else the method will return null)recordReachOut- if true, if the variable reaches the CFG output, a pseudo usage will be recorded as -1blkForLiveChains- optional basic block used to record live variablesidxForLiveChains- optional block index used to record live variablesmaxBlocks- maximum number of basic blocks to be examined; use -1 to mean all; if a positive value is provided, the returned list of addresses may contain -2 to indicate that a usage may be located in an unexplored blocklimitToStartBlock- if true, the exploration will stop as soon as a use is detected outside the provided starting block, where the def took place, and -2 will be added to the returned list (if true, blkForLiveChains should be null); note: unlike what maxBlocks intends to do, a -2 in the resulting collection will indicate a definite out-of-block use- Returns:
- a read-only collection of addresses where the variable is used; the list may contain -1 to indicate the the variable reached an output; never returns null unless verifyStartOnDefPoint was true
-
getDefUses
Description copied from interface:IDFAGet use locations for a variable definition.- Specified by:
getDefUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- a variable, which must be defined by the provided instruction- Returns:
- a collection (possibly empty) or null if the variable is not defined by the instruction
-
getDefUses
Description copied from interface:IDFAGet use locations for a variable definition.- Specified by:
getDefUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- a variable, which must be defined by the provided instructionstopCount- optional stop count (-1 to collect as many uses as possible)- Returns:
- a collection (possibly empty) or null if the variable is not defined by the instruction
-
getDefUses
Description copied from interface:IDFAGet use locations for a variable definition.- Specified by:
getDefUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- a variable, which must be defined by the provided instructionstopCount- optional stop count (-1 to collect as many uses as possible)recordReachOut- if true, a variable reaching is considered used (if so, the output list will contain -1)- Returns:
- a collection (possibly empty) or null if the variable is not defined by the instruction
-
getBlockDefUses
Description copied from interface:IDFAGet block-local use locations for a variable definition.- Specified by:
getBlockDefUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable id- Returns:
- use locations
-
getBlockDefUses
Description copied from interface:IDFAGet block-local use locations for a variable definition.- Specified by:
getBlockDefUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable idstopCount- optional stop count- Returns:
- use locations
-
checkNoUse
public int checkNoUse(long addr, int varid, boolean reachOutIsUse, int maxBlocks) Description copied from interface:IDFACheck whether a variable, defined at the provided instruction, is not used.- Specified by:
checkNoUsein interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- initial instruction addressvarid- defined variable at the initial instructionreachOutIsUse- true if reaching out is considered a usemaxBlocks- optional maximum block count- Returns:
- 1: some uses; 0: no use; -1: no use, but may be a meaningful output; -2: unknown (may be returned only if maxBlocks is positive); -3: error
-
checkNoUse
public boolean checkNoUse(long insnAddress, int varId, boolean reachOutIsUse) Description copied from interface:IDFACheck whether a variable, defined at the provided instruction, is not used.- Specified by:
checkNoUsein interfaceIDFA<InsnType extends IInstruction>- Parameters:
insnAddress- initial instruction addressvarId- defined variable at the initial instructionreachOutIsUse- true if reaching out is considered a use- Returns:
- true if the variable is not used, and optionally (if reachOutIsUse is true), is overwritten before reaching possible end-blocks
-
checkNoUse
public boolean checkNoUse(long addr, int varid) Description copied from interface:IDFACheck whether a variable, defined at the provided instruction, is not used.- Specified by:
checkNoUsein interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- initial instruction addressvarid- defined variable at the initial instruction- Returns:
- true if the variable is not used; reaching-out is not considered a use
-
checkSingleUse
Check whether a defined variable has a single use.- Parameters:
addr- instruction addressvarid- variable idreachOutIsUse- true if reaching out is considered a use- Returns:
- single use address, or null
-
checkSingleUse
Description copied from interface:IDFACheck whether a defined variable has a single use.- Specified by:
checkSingleUsein interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable id- Returns:
- single use address, or null
-
checkSingleDef
Check whether a used variable has a single explicit definition point (i.e. it is a non-input defined at a unique address).- Parameters:
addr- initial instruction addressvarid- used variable at the initial instructionliveInIsDef- true if live-in variables are treated as definitions- Returns:
- the instruction address, if the variable used at the provided instruction has a single def-point; -1 is returned if the variable has no explicit def-point (as would be the case for method arguments); on error, or if multiple def-points are detected, null is returned
-
checkSingleDefNoInput
Description copied from interface:IDFACheck whether a used variable has a single explicit definition point. The def point cannot be a routine input (i.e. the definition must be explicit).- Specified by:
checkSingleDefNoInputin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- initial instruction addressvarid- used variable at the initial instruction- Returns:
- single definition address, or null
-
checkSingleDef
Description copied from interface:IDFACheck whether a used variable has a single definition point. The def point may be explicit (e.g. resulting from an assignment) or implicit (e.g. provided as a parameter to the routine, which is always represented as the address -1).- Specified by:
checkSingleDefin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- initial instruction addressvarid- used variable at the initial instruction (it must be used at the provided address; else, refer tocheckSingleSource)- Returns:
- single definition address, or null
-
checkSingleSource
Description copied from interface:IDFACheck whether a variable has a single source.- Specified by:
checkSingleSourcein interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable idliveInIsDef- true if live-in variables are treated as definitions- Returns:
- single source address, or null
-
checkSingleSource
Description copied from interface:IDFACheck whether a variable has a single source.- Specified by:
checkSingleSourcein interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable id- Returns:
- single source address, or null
-
collectInstructionAllDefs
Description copied from interface:IDFACollect all variables defined by an instruction.- Specified by:
collectInstructionAllDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressr- output collection
-
collectInstructionAllUses
Description copied from interface:IDFACollect all variables used by an instruction.- Specified by:
collectInstructionAllUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressr- output collection
-
getInstructionAllDefs
Description copied from interface:IDFAGet all variables defined by an instruction.- Specified by:
getInstructionAllDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- defined variables
-
getInstructionAllUses
Description copied from interface:IDFAGet all variables used by an instruction.- Specified by:
getInstructionAllUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- used variables
-
getInstructionDefs
Description copied from interface:IDFAGet the variables defined by an instruction.- Specified by:
getInstructionDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- a list of variables defined by the instruction at index in the block
-
getInstructionUses
Description copied from interface:IDFAGet the variables used by an instruction.- Specified by:
getInstructionUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- a list of variables used by the instruction at index in the block
-
getInstructionPotentialDefs
Description copied from interface:IDFAGet variables potentially defined by an instruction.- Specified by:
getInstructionPotentialDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- a list of variables potentially defined by the instruction at index in the block; note that this data may not be present (empty lists) depending on DFA settings
-
getInstructionPotentialUses
Description copied from interface:IDFAGet variables potentially used by an instruction.- Specified by:
getInstructionPotentialUsesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- a list of variables potentially used by the instruction at index in the block; note that this data may not be present (empty lists) depending on DFA settings
-
getInstructionSpoiledDefs
Description copied from interface:IDFAGet variables potentially spoiled by an instruction.- Specified by:
getInstructionSpoiledDefsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- a list of variables potentially spoiled by the instruction at index in the block; note that this data may not be present (empty lists) depending on DFA settings
-
getUseDefChains
Get use-def chains at an instruction.- Parameters:
addr- instruction addressrecordLiveIn- true to record live-in definitions- Returns:
- use-def chains
-
getUseDefChains
Description copied from interface:IDFAGet use-def chains at an instruction.- Specified by:
getUseDefChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- use-def chains
-
getDefUseChains
Get def-use chains at an instruction.- Parameters:
addr- instruction addressrecordReachOut- true to record reaching outputs- Returns:
- def-use chains
-
getDefUseChains
Description copied from interface:IDFAGet def-use chains at an instruction.- Specified by:
getDefUseChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction address- Returns:
- def-use chains
-
getLiveChains
public Map<Integer,Collection<Long>> getLiveChains(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) Get live chains at a block location.- Parameters:
b- basic blockidx- instruction indexvarids- optional variable filterstopcount- optional stop count- Returns:
- live chains
-
getLiveChains
Description copied from interface:IDFAGet live chains for a variable at a block location.- Specified by:
getLiveChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction indexvarid- variable id- Returns:
- live chains
-
getLiveChains
Description copied from interface:IDFAGet live chains for a variable at a block location.- Specified by:
getLiveChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction indexvarid- variable idstopcount- optional stop count- Returns:
- live chains
-
getLiveChains
Description copied from interface:IDFAGet live chains at a block location.- Specified by:
getLiveChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction index- Returns:
- live chains
-
isAlive
Description copied from interface:IDFADetermine whether a variable is alive at a block location.- Specified by:
isAlivein interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction indexvarid- variable id- Returns:
- true if the variable is alive
-
getReachChains
public Map<Integer,Collection<Long>> getReachChains(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) Get reach chains at a block location.- Parameters:
b- basic blockidx- instruction indexvarids- optional variable filterstopcount- optional stop count- Returns:
- reach chains
-
getReachChains
Description copied from interface:IDFAGet reach chains for a variable at a block location.- Specified by:
getReachChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction indexvarid- variable id- Returns:
- reach chains
-
getReachChains
Description copied from interface:IDFAGet reach chains for a variable at a block location.- Specified by:
getReachChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction indexvarid- variable idstopcount- optional stop count- Returns:
- reach chains
-
getReachChains
Description copied from interface:IDFAGet reach chains at a block location.- Specified by:
getReachChainsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction index- Returns:
- reach chains
-
isReaching
Description copied from interface:IDFADetermine whether a variable reaches a block location.- Specified by:
isReachingin interfaceIDFA<InsnType extends IInstruction>- Parameters:
b- basic blockidx- instruction indexvarid- variable id- Returns:
- true if the variable is reaching
-
getUseDiscrepancies
Description copied from interface:IDFARetrieve the list of use-discrepancies at the provided instruction address.- Specified by:
getUseDiscrepanciesin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- 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 if the variable)
-
isUseDiscrepancy
public boolean isUseDiscrepancy(long addr, int varid) Description copied from interface:IDFADetermine whether a use discrepancy exists for a variable.- Specified by:
isUseDiscrepancyin interfaceIDFA<InsnType extends IInstruction>- Parameters:
addr- instruction addressvarid- variable id- Returns:
- true if a use discrepancy exists
-
checkInput
public boolean checkInput(int varid) Determine whether a variable is an input.- Parameters:
varid- variable id- Returns:
- true if the variable is an input
-
getInputs
Description copied from interface:IDFAGet input variables.- Specified by:
getInputsin interfaceIDFA<InsnType extends IInstruction>- Returns:
- input variables
-
filterInputs
Filter input variables.- Parameters:
varids- optional collection of potential argument variables for which we want to verify uses; leave null to retrieve all potential arguments- Returns:
- a collection of variables that are used in the routine, that look like they have definitions outside the routine (if `varids` was provided, this output collection is a subset of it)
-
getInputsWithUses
Get input variables with their uses.- Returns:
- input use map
-
checkInputWithUses
Get uses of an input variable.- Parameters:
varid- variable id- Returns:
- use addresses
-
filterInputsWithUses
Filter input variables with their uses.- Parameters:
varids- optional variable filter- Returns:
- input read-only use map (there may be more varid keys than requested)
-
getInputMap
Description copied from interface:IDFAGet the input map.- Specified by:
getInputMapin interfaceIDFA<InsnType extends IInstruction>- Returns:
- input map
-
getInputMap
Description copied from interface:IDFAGet input locations for a variable.- Specified by:
getInputMapin interfaceIDFA<InsnType extends IInstruction>- Parameters:
varid- variable id- Returns:
- input locations
-
checkOutput
Determine whether a variable is an output of a block.- Parameters:
blk- basic blockvarid- variable id- Returns:
- true if the variable is an output
-
getOutputs
Description copied from interface:IDFAGet output variables for a block.- Specified by:
getOutputsin interfaceIDFA<InsnType extends IInstruction>- Parameters:
blk- basic block- Returns:
- output variables
-
filterOutputs
Filter output variables of a block.- Parameters:
blk- basic blockvarids- optional variable filter- Returns:
- output variables
-
getOutputsWithDefs
Get block output variables with their definitions.- Parameters:
blk- basic block- Returns:
- output definition map
-
checkOutputsWithDefs
Get definitions for a block output variable.- Parameters:
blk- basic blockvarid- variable id- Returns:
- definition addresses
-
filterOutputsWithDefs
public Map<Integer,Collection<Long>> filterOutputsWithDefs(IBasicBlock<InsnType> blk, Collection<Integer> varids) Filter block output variables with their definitions.- Parameters:
blk- basic blockvarids- optional variable filter- Returns:
- output definition map
-
getOutputMap
Description copied from interface:IDFAGet the output map for a block.- Specified by:
getOutputMapin interfaceIDFA<InsnType extends IInstruction>- Parameters:
blk- basic block- Returns:
- output map
-
getOutputMap
Description copied from interface:IDFAGet output locations for a block and variable.- Specified by:
getOutputMapin interfaceIDFA<InsnType extends IInstruction>- Parameters:
blk- basic blockvarid- variable id- Returns:
- output locations
-
checkOutput
public boolean checkOutput(int varid) Determine whether a variable is an output of the CFG.- Parameters:
varid- variable id- Returns:
- true if the variable is an output
-
getOutputs
Description copied from interface:IDFAGet output variables.- Specified by:
getOutputsin interfaceIDFA<InsnType extends IInstruction>- Returns:
- output variables
-
filterOutputs
Filter output variables of the CFG.- Parameters:
varids- optional variable filter- Returns:
- output variables
-
getOutputsWithDefs
Get CFG output variables with their definitions.- Returns:
- output definition map
-
checkOutputsWithDefs
Get definitions for a CFG output variable.- Parameters:
varid- variable id- Returns:
- definition addresses
-
filterOutputsWithDefs
Filter CFG output variables with their definitions.- Parameters:
varids- optional variable filter- Returns:
- output read-only def map (there may be more varid keys than requested)
-
getOutputMap
Description copied from interface:IDFAGet the output map.- Specified by:
getOutputMapin interfaceIDFA<InsnType extends IInstruction>- Returns:
- output map
-
getOutputMap
Description copied from interface:IDFAGet output locations for a variable.- Specified by:
getOutputMapin interfaceIDFA<InsnType extends IInstruction>- Parameters:
varid- variable id- Returns:
- output locations
-
isNotRedefined
public boolean isNotRedefined(int varid, long addr0, long addr1) Determine whether a variable is not redefined between two addresses.- Parameters:
varid- variable idaddr0- start addressaddr1- end address- Returns:
- true if the variable is not redefined
-
isNotRedefined
public boolean isNotRedefined(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) Determine whether a variable is not redefined between two block locations.- Parameters:
varid- variable idb0- start blocki0- start instruction indexb1- end blocki1- end instruction index- Returns:
- true if the variable is not redefined
-
isVarReachingFromTo
Description copied from interface:IDFADetermine if a variable used by the start instruction reaches the final instruction with the same value.Important notes:
- This method provides a must-reach result: if a multiple paths exist from source to sink, where the variable reaches the sink via some paths, but not on others (it is overwritten), the method returns false.
- This method works from the source to the sink, and provides the guarantee that the variable was not overwritten when it reached the sink. There is no guarantee provided at the sink itself regarding other paths that may exist from different sources to the same sink.
- This method also checks that the paths from the sink back that may connect back to the sink do not overwrite the variable defined at the source.- Specified by:
isVarReachingFromToin interfaceIDFA<InsnType extends IInstruction>- Parameters:
varid- variable idaddr0- source: start address, exclusiveaddr1- sink: final address, also exclusive- Returns:
- success indicator; null means unknown
-
isVarReachingFromTo
public Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) Description copied from interface:IDFADetermine if a variable used by the start instruction reaches the final instruction with the same value.Important notes:
- This method provides a must-reach result: if a multiple paths exist from source to sink, where the variable reaches the sink via some paths, but not on others (it is overwritten), the method returns false.
- This method works from the source to the sink, and provides the guarantee that the variable was not overwritten when it reached the sink. There is no guarantee provided at the sink itself regarding other paths that may exist from different sources to the same sink.
- This method also checks that the paths from the sink back that may connect back to the sink do not overwrite the variable defined at the source.- Specified by:
isVarReachingFromToin interfaceIDFA<InsnType extends IInstruction>- Parameters:
varid- variable idb0- start block (source)i0- final block (sink)b1- index of the start instruction in the start block, exclusivei1- index of the final instruction in the final block, also exclusive- Returns:
- success indicator; null means unknown
-
isVarReachingFromTo
public Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean performExtendedChecks, int maxBlocks) Description copied from interface:IDFADetermine if a variable used by the start instruction reaches the final instruction with the same value.Important notes:
- This method provides a must-reach result: if a multiple paths exist from source to sink, where the variable reaches the sink via some paths, but not on others (it is overwritten), the method returns false.
- This method works from the source to the sink, and provides the guarantee that the variable was not overwritten when it reached the sink. There is no guarantee provided at the sink itself regarding other paths that may exist from different sources to the same sink.
- if `performExtendedChecks` is true, this method also checks that the paths from the sink back that may connect back to the sink do not overwrite the variable defined at the source.- Specified by:
isVarReachingFromToin interfaceIDFA<InsnType extends IInstruction>- Parameters:
varid- variable idb0- start block (source)i0- final block (sink)b1- index of the start instruction in the start block, exclusivei1- index of the final instruction in the final block, also exclusiveperformExtendedChecks- true to perform extended reachability checksmaxBlocks- optional maximum count of blocks to be explored before failing- Returns:
- success indicator; null means unknown
-
isVarReachingFromTo
public Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean allowRedef, boolean performExtendedChecks, int maxBlocks) Determine whether a variable reaches one block location from another.- Parameters:
varid- variable idb0- start blocki0- start instruction indexb1- end blocki1- end instruction indexallowRedef- true to allow redefinitionsperformExtendedChecks- true to perform extended checksmaxBlocks- optional maximum block count- Returns:
- success indicator; null means unknown
-
verifyNoRedefAfterSink
Verify that a variable is not redefined after a sink address.- Parameters:
varid- variable idaddr0- source addressaddr1- sink address- Returns:
- success indicator; null means unknown
-
verifyNoRedefAfterSink
public Boolean verifyNoRedefAfterSink(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, int maxBlocks) Verify that a variable is not redefined after a sink location.- Parameters:
varid- variable idb0- source blocki0- source instruction indexb1- sink blocki1- sink instruction indexmaxBlocks- optional maximum block count- Returns:
- success indicator; null means unknown
-
toString
-
CACHE_DUI_CHAINSinstead