Module DefUse
Module containing the predicates that connect uses to their reaching definition. The reaching definitions are
computed separately for each unique use MemoryLocation
. An instruction is treated as a definition of a use location
if the defined location overlaps the use location in any way. Thus, a single instruction may serve as a definition
for multiple use locations, since a single definition location may overlap many use locations.
Definitions and uses are identified by a block and an integer “offset”. An offset of -1 indicates the definition
from a Phi
instruction at the beginning of the block. An offset of 2i indicates a definition or use on the
instruction at index i
in the block. An offset of 2i+1 indicates a definition or use on the Chi
instruction that
will be inserted immediately after the instruction at index i
in the block.
For a given use location, each definition and use is also assigned a “rank” within its block. The rank is simply the one-based index of that definition or use within the list of definitions and uses of that location within the block, ordered by offset. The rank allows the various reachability predicates to be computed more efficiently than they would if based solely on offset, since the set of possible ranks is dense while the set of possible offsets is potentially very sparse.
Import path
import semmle.code.cpp.ir.implementation.aliased_ssa.internal.SSAConstruction
Predicates
definitionReachesEndOfBlock | Holds if the definition that overlaps |
definitionReachesUse | Holds if a definition that overlaps |
getDefinitionOrChiInstruction | |
hasDefinitionAtRank | Holds if there is a definition at offset |
hasPhiOperandDefinition | Holds if the |
hasUseAtRank | Holds if there is a use of memory location |
locationLiveOnEntryToBlock | Holds if the specified |
locationLiveOnExitFromBlock | Holds if the specified |