|
Static Value-Flow Analysis
|
AbstractInterpretation is same as Abstract Execution. More...
#include <AbstractInterpretation.h>
Public Types | |
| enum | HandleRecur { TOP , WIDEN_ONLY , WIDEN_NARROW } |
| typedef SCCDetection< CallGraph * > | CallGraphSCC |
Public Member Functions | |
| AbstractInterpretation () | |
| Constructor. | |
| virtual void | runOnModule (ICFG *icfg) |
| virtual | ~AbstractInterpretation () |
| Destructor. | |
| void | analyse () |
| Program entry. | |
| void | addDetector (std::unique_ptr< AEDetector > detector) |
| AbstractState & | getAbsStateFromTrace (const ICFGNode *node) |
| Retrieves the abstract state from the trace for a given ICFG node. | |
Static Public Member Functions | |
| static AbstractInterpretation & | getAEInstance () |
Public Attributes | |
| Set< const CallICFGNode * > | checkpoints |
Private Attributes | |
| SVFIR * | svfir |
| protected data members, also used in subclasses | |
| AEAPI * | api {nullptr} |
| Execution State, used to store the Interval Value of every SVF variable. | |
| ICFG * | icfg |
| AEStat * | stat |
| std::vector< const CallICFGNode * > | callSiteStack |
| Map< const FunObjVar *, const ICFGWTO * > | funcToWTO |
| Set< std::pair< const CallICFGNode *, NodeID > > | nonRecursiveCallSites |
| Set< const FunObjVar * > | recursiveFuns |
| Map< const ICFGNode *, const ICFGCycleWTO * > | cycleHeadToCycle |
| Map< std::string, std::function< void(const CallICFGNode *)> > | func_map |
| Map< const ICFGNode *, AbstractState > | abstractTrace |
| std::string | moduleName |
| std::vector< std::unique_ptr< AEDetector > > | detectors |
| AbsExtAPI * | utils |
| Map< s32_t, s32_t > | _reverse_predicate |
| Map< s32_t, s32_t > | _switch_lhsrhs_predicate |
Friends | |
| class | AEStat |
| class | AEAPI |
| class | BufOverflowDetector |
| class | NullptrDerefDetector |
AbstractInterpretation is same as Abstract Execution.
Definition at line 104 of file AbstractInterpretation.h.
Definition at line 112 of file AbstractInterpretation.h.
| Enumerator | |
|---|---|
| TOP | |
| WIDEN_ONLY | |
| WIDEN_NARROW | |
Definition at line 129 of file AbstractInterpretation.h.
| AbstractInterpretation::AbstractInterpretation | ( | ) |
|
virtual |
Destructor.
Definition at line 68 of file AbstractInterpretation.cpp.
|
inline |
Definition at line 153 of file AbstractInterpretation.h.
| void AbstractInterpretation::analyse | ( | ) |
Program entry.
Definition at line 166 of file AbstractInterpretation.cpp.
|
private |
Definition at line 1338 of file AbstractInterpretation.cpp.
|
private |
Definition at line 1298 of file AbstractInterpretation.cpp.
|
private |
Recursively collect cycle heads from nested WTO components.
Recursively collect cycle heads from nested WTO components
| comps | The list of WTO components to collect cycle heads from |
This helper function traverses the WTO component tree and builds the cycleHeadToCycle map, which maps each cycle head node to its corresponding ICFGCycleWTO object. This enables efficient O(1) lookup of cycles during analysis.
Definition at line 82 of file AbstractInterpretation.cpp.
|
inline |
Retrieves the abstract state from the trace for a given ICFG node.
| node | Pointer to the ICFG node. |
| Assertion | if no trace exists for the node. |
Definition at line 166 of file AbstractInterpretation.h.
|
inlinestatic |
Definition at line 147 of file AbstractInterpretation.h.
|
private |
Get callee function: directly for direct calls, via pointer analysis for indirect calls.
Definition at line 878 of file AbstractInterpretation.cpp.
|
private |
Get the next nodes of a node within the same function
| node | The node to get successors for |
Get the next nodes of a node within the same function For CallICFGNode, includes shortcut to RetICFGNode
Definition at line 679 of file AbstractInterpretation.cpp.
|
private |
Get the next nodes outside a cycle
| cycle | The cycle to get exit successors for |
Get the next nodes outside a cycle Inner cycles are skipped since their next nodes cannot be outside the outer cycle
Definition at line 704 of file AbstractInterpretation.cpp.
|
inlineprivate |
Definition at line 339 of file AbstractInterpretation.h.
handle call node in ICFGNode
| node | ICFGNode which has a single CallICFGNode |
Definition at line 799 of file AbstractInterpretation.cpp.
|
privatevirtual |
Definition at line 822 of file AbstractInterpretation.cpp.
|
privatevirtual |
Handle direct or indirect call: get callee, process function body, set return state.
Definition at line 949 of file AbstractInterpretation.cpp.
Handle a function using worklist algorithm
| funEntry | The entry node of the function to handle |
Handle a function using worklist algorithm This replaces the recursive WTO component handling with explicit worklist iteration
Definition at line 757 of file AbstractInterpretation.cpp.
|
privatevirtual |
Global ICFGNode is handled at the entry of the program,.
handle global node
Definition at line 182 of file AbstractInterpretation.cpp.
Handle an ICFG node by merging states and processing statements
| node | The ICFG node to handle |
Handle an ICFG node by merging states from predecessors and processing statements Returns true if the abstract state has changed, false if fixpoint reached or infeasible
Definition at line 593 of file AbstractInterpretation.cpp.
|
privatevirtual |
handle wto cycle (loop)
| cycle | WTOCycle which has weak topo order of basic blocks and nested cycles |
Handle WTO cycle (loop or recursive function) using widening/narrowing iteration.
Widening is applied at the cycle head to ensure termination of the analysis. The cycle head's abstract state is iteratively updated until a fixpoint is reached.
== What is being widened == The abstract state at the cycle head node, which includes:
i starting at 0 and incrementing each iteration== Regular loops (non-recursive functions) == All modes (TOP/WIDEN_ONLY/WIDEN_NARROW) behave the same for regular loops:
== Recursive function cycles == Behavior depends on Options::HandleRecur():
Definition at line 1012 of file AbstractInterpretation.cpp.
|
privatevirtual |
handle instructions in svf basic blocks
handle instructions in ICFGSingletonWTO
| block | basic block that has one instruction or a series of instructions |
Definition at line 566 of file AbstractInterpretation.cpp.
handle SVF Statement like CmpStmt, CallStmt, GepStmt, LoadStmt, StoreStmt, etc.
| stmt | SVFStatement which is a value flow of instruction |
Definition at line 1093 of file AbstractInterpretation.cpp.
Definition at line 334 of file AbstractInterpretation.h.
|
private |
Compute IWTO for each function partition entry.
Definition at line 95 of file AbstractInterpretation.cpp.
|
private |
Check if execution state exist at the branch edge
| intraEdge | the edge from CmpStmt to the next node |
Definition at line 538 of file AbstractInterpretation.cpp.
|
private |
Check if this cmpStmt and succ are satisfiable to the execution state.
| cmpStmt | CmpStmt is a conditional branch statement |
| succ | the value of cmpStmt (True or False) |
Definition at line 268 of file AbstractInterpretation.cpp.
|
privatevirtual |
Definition at line 817 of file AbstractInterpretation.cpp.
|
privatevirtual |
Check if a call node calls a recursive function.
Definition at line 840 of file AbstractInterpretation.cpp.
|
privatevirtual |
Check if a call is a recursive callsite (within same SCC, not entry call from outside)
Definition at line 870 of file AbstractInterpretation.cpp.
Check if a function is recursive (part of a call graph SCC)
Definition at line 834 of file AbstractInterpretation.cpp.
|
private |
Check if this SwitchInst and succ are satisfiable to the execution state.
| var | var in switch inst |
| succ | the case value of switch inst |
Definition at line 494 of file AbstractInterpretation.cpp.
Check if execution state exist by merging states of predecessor nodes
| icfgNode | The icfg node to analyse |
get execution state by merging states of predecessor blocks Scenario 1: preblock --—(intraEdge)-—> block, join the preES of inEdges Scenario 2: preblock --—(callEdge)-—> block
Definition at line 197 of file AbstractInterpretation.cpp.
|
privatevirtual |
Handle recursive call in TOP mode: set all stores and return value to TOP.
Definition at line 850 of file AbstractInterpretation.cpp.
|
virtual |
collect checkpoint
Definition at line 43 of file AbstractInterpretation.cpp.
|
privatevirtual |
Set all store values in a recursive function to TOP (used in TOP mode)
Definition at line 1155 of file AbstractInterpretation.cpp.
Check if narrowing should be applied: always for regular loops, mode-dependent for recursion.
Definition at line 926 of file AbstractInterpretation.cpp.
|
private |
Skip recursive callsites (within SCC); entry calls from outside SCC are not skipped.
Definition at line 908 of file AbstractInterpretation.cpp.
Definition at line 1444 of file AbstractInterpretation.cpp.
|
private |
Find the comparison predicates in "class BinaryOPStmt:OpCode" under SVF/svf/include/SVFIR/SVFStatements.h You are only required to handle integer predicates, including Add, FAdd, Sub, FSub, Mul, FMul, SDiv, FDiv, UDiv, SRem, FRem, URem, Xor, And, Or, AShr, Shl, LShr
Definition at line 1454 of file AbstractInterpretation.cpp.
Definition at line 1516 of file AbstractInterpretation.cpp.
Definition at line 1747 of file AbstractInterpretation.cpp.
Definition at line 1354 of file AbstractInterpretation.cpp.
Definition at line 1731 of file AbstractInterpretation.cpp.
Definition at line 1388 of file AbstractInterpretation.cpp.
Definition at line 1435 of file AbstractInterpretation.cpp.
|
private |
Definition at line 1370 of file AbstractInterpretation.cpp.
Definition at line 1739 of file AbstractInterpretation.cpp.
Definition at line 107 of file AbstractInterpretation.h.
Definition at line 106 of file AbstractInterpretation.h.
|
friend |
Definition at line 108 of file AbstractInterpretation.h.
|
friend |
Definition at line 109 of file AbstractInterpretation.h.
|
private |
Definition at line 360 of file AbstractInterpretation.h.
Execution State, used to store the Interval Value of every SVF variable.
Definition at line 322 of file AbstractInterpretation.h.
|
private |
Definition at line 327 of file AbstractInterpretation.h.
| Set<const CallICFGNode*> SVF::AbstractInterpretation::checkpoints |
Definition at line 158 of file AbstractInterpretation.h.
|
private |
Definition at line 331 of file AbstractInterpretation.h.
|
private |
Definition at line 363 of file AbstractInterpretation.h.
|
private |
Definition at line 358 of file AbstractInterpretation.h.
Definition at line 328 of file AbstractInterpretation.h.
|
private |
Definition at line 324 of file AbstractInterpretation.h.
|
private |
Definition at line 361 of file AbstractInterpretation.h.
|
private |
Definition at line 329 of file AbstractInterpretation.h.
Definition at line 330 of file AbstractInterpretation.h.
|
private |
Definition at line 325 of file AbstractInterpretation.h.
|
private |
protected data members, also used in subclasses
Definition at line 320 of file AbstractInterpretation.h.
|
private |
Definition at line 364 of file AbstractInterpretation.h.