Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 45 additions & 14 deletions svf/include/AE/Svfexe/AbstractInterpretation.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,26 +218,55 @@ class AbstractInterpretation
*
* @param cycle WTOCycle which has weak topo order of basic blocks and nested cycles
*/
virtual void handleCycleWTO(const ICFGCycleWTO* cycle);
virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle);

void handleWTOComponents(const std::list<const ICFGWTOComp*>& wtoComps);
/**
* Handle a function using worklist algorithm
*
* @param funEntry The entry node of the function to handle
*/
void handleFunction(const ICFGNode* funEntry);

void handleWTOComponent(const ICFGWTOComp* wtoComp);
/**
* Handle an ICFG node by merging states and processing statements
*
* @param node The ICFG node to handle
* @return true if state changed, false if fixpoint reached or infeasible
*/
bool handleICFGNode(const ICFGNode* node);

/**
* Get the next nodes of a node within the same function
*
* @param node The node to get successors for
* @return Vector of successor nodes
*/
std::vector<const ICFGNode*> getNextNodes(const ICFGNode* node) const;

/**
* handle SVF Statement like CmpStmt, CallStmt, GepStmt, LoadStmt, StoreStmt, etc.
* Get the next nodes outside a cycle
*
* @param stmt SVFStatement which is a value flow of instruction
* @param cycle The cycle to get exit successors for
* @return Vector of successor nodes outside the cycle
*/
virtual void handleSVFStatement(const SVFStmt* stmt);
std::vector<const ICFGNode*> getNextNodesOfCycle(const ICFGCycleWTO* cycle) const;

/**
* Check if this callnode is recursive call and skip it.
* Recursively collect cycle heads from nested WTO components
*
* @param callnode CallICFGNode which calls a recursive function
* @param comps The list of WTO components to collect cycle heads from
*/
virtual void SkipRecursiveCall(const CallICFGNode* callnode);
void collectCycleHeads(const std::list<const ICFGWTOComp*>& comps);


/**
* handle SVF Statement like CmpStmt, CallStmt, GepStmt, LoadStmt, StoreStmt, etc.
*
* @param stmt SVFStatement which is a value flow of instruction
*/
virtual void handleSVFStatement(const SVFStmt* stmt);

virtual void setTopToObjInRecursion(const CallICFGNode* callnode);


/**
Expand Down Expand Up @@ -299,6 +328,7 @@ class AbstractInterpretation
Map<const FunObjVar*, const ICFGWTO*> funcToWTO;
Set<std::pair<const CallICFGNode*, NodeID>> nonRecursiveCallSites;
Set<const FunObjVar*> recursiveFuns;
Map<const ICFGNode*, const ICFGCycleWTO*> cycleHeadToCycle;


bool hasAbsStateFromTrace(const ICFGNode* node)
Expand All @@ -313,15 +343,16 @@ class AbstractInterpretation

// helper functions in handleCallSite
virtual bool isExtCall(const CallICFGNode* callNode);
virtual void extCallPass(const CallICFGNode* callNode);
virtual void handleExtCall(const CallICFGNode* callNode);
virtual bool isRecursiveFun(const FunObjVar* fun);
virtual bool isRecursiveCall(const CallICFGNode* callNode);
virtual void recursiveCallPass(const CallICFGNode *callNode);
virtual bool isRecursiveCallSite(const CallICFGNode* callNode, const FunObjVar *);
virtual bool isDirectCall(const CallICFGNode* callNode);
virtual void directCallFunPass(const CallICFGNode* callNode);
virtual bool isIndirectCall(const CallICFGNode* callNode);
virtual void indirectCallFunPass(const CallICFGNode* callNode);
virtual void handleFunCall(const CallICFGNode* callNode);

bool skipRecursiveCall(const CallICFGNode* callNode);
const FunObjVar* getCallee(const CallICFGNode* callNode);
bool shouldApplyNarrowing(const FunObjVar* fun);

// there data should be shared with subclasses
Map<std::string, std::function<void(const CallICFGNode*)>> func_map;
Expand Down
Loading
Loading