AbstractInterpreter
struct AbstractInterpreter<Domain> : Sendable where Domain : AbstractDomain
Undocumented
-
An abstract interpretation context.
Declaration
Swift
typealias Context = AbstractContext<Domain> -
The knowledge of the abstract interpreter about a single block.
Declaration
-
A map from function block to the context of the abstract interpreter before and after the evaluation of its instructions.
Declaration
Swift
typealias State = [Function.Blocks.Address : BlockState] -
A closure that processes
blockincontext.Declaration
-
The function being interpreted.
Declaration
Swift
private let subject: Function.ID -
The control flow graph of the function being interpreted.
Declaration
Swift
private var cfg: ControlFlowGraph -
The dominator tree of the function being interpreted.
Declaration
Swift
private var dominatorTree: DominatorTree -
The state of the abstract interpreter before and after the visited basic blocks.
Declaration
Swift
private var state: State -
A FILO list of blocks to visit.
Declaration
Swift
private var work: Deque<Function.Blocks.Address> -
The set of blocks that no longer need to be visited.
Declaration
Swift
private var done: Set<Function.Blocks.Address> -
Creates an interpreter analyzing
fwhich is inm, starting withentryContext. -
Recomputes the CFG of the function being interpreted.
Call this method to update the control-flow information used by this instance to guide abstract interpretation.
Declaration
Swift
mutating func recomputeControlFlow(_ m: Module) -
Removes
bfrom the work list.Requires
bis in the work list.Declaration
Swift
mutating func removeWork(_ b: Function.Blocks.Address) -
Adds
bto the work list.Requires
bis a basic block of the function being analyzed.Declaration
Swift
mutating func addWork(_ b: Function.Blocks.Address) -
Runs this instance using
interpretto interpret basic blocks.Declaration
Swift
mutating func fixedPoint(_ interpret: Interpret) -
Returns
trueifbhas been visited.Declaration
Swift
private func visited(_ b: Function.Blocks.Address) -> Bool -
Returns
trueifbis ready to be visited.Computing the before-context of
brequires knowing the state of all uses inbthat are defined its (transitive) predecessors. Because a definition must dominate all its uses, we can assume the predecessors dominated bybdon’t define variables used inb. Hence,bcan be visited iff all its predecessors have been visited or are dominated byb.Declaration
Swift
private func isVisitable(_ b: Function.Blocks.Address) -> Bool -
Returns the before-context of
band the predecessors from which it’s been computed.Requires
isVisitable(b)istrueDeclaration
-
Returns the after-context of
bby processing it withinterpretininitialContext.Declaration
View on GitHub