Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SVF::SlicedTCT Class Reference

#include <MTASlicer.h>

Inheritance diagram for SVF::SlicedTCT:
SVF::TCT SVF::GenericGraph< NodeTy, EdgeTy >

Public Member Functions

 ~SlicedTCT () override=default
 
- Public Member Functions inherited from SVF::TCT
virtual ~TCT ()
 Destructor.
 
ThreadCallGraphgetThreadCallGraph () const
 Get TCG.
 
PointerAnalysisgetPTA () const
 Get PTA.
 
TCTNodegetTCTNode (NodeID id) const
 Get TCT node.
 
TCTEdgehasGraphEdge (TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind) const
 Whether we have already created this call graph edge.
 
TCTEdgegetGraphEdge (TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind)
 Get call graph edge via nodes.
 
ThreadCreateEdgeSet::const_iterator getChildrenBegin (const TCTNode *node) const
 Get children and parent nodes.
 
ThreadCreateEdgeSet::const_iterator getChildrenEnd (const TCTNode *node) const
 
ThreadCreateEdgeSet::const_iterator getParentsBegin (const TCTNode *node) const
 
ThreadCreateEdgeSet::const_iterator getParentsEnd (const TCTNode *node) const
 
const FunSetgetMakredProcs () const
 Get marked candidate functions.
 
const FunSetgetEntryProcs () const
 Get marked candidate functions.
 
u32_t getTCTNodeNum () const
 Get Statistics.
 
u32_t getTCTEdgeNum () const
 
u32_t getMaxCxtSize () const
 
bool isExtCall (const ICFGNode *inst)
 Whether it is calling an external function.
 
bool isCallSite (const ICFGNode *inst)
 Whether it is a callsite.
 
bool hasTCTNode (const CxtThread &ct) const
 Find/Get TCT node.
 
TCTNodegetTCTNode (const CxtThread &ct) const
 
bool isCandidateFun (const CallGraph::FunctionSet &callees) const
 Whether it is a candidate function for indirect call.
 
bool isCandidateFun (const FunObjVar *fun) const
 
bool inSameCallGraphSCC (const CallGraphNode *src, const CallGraphNode *dst)
 Whether two functions in the same callgraph scc.
 
bool hasParentThread (NodeID tid) const
 Get parent and sibling threads.
 
NodeBS getParentThreads (NodeID tid) const
 Get parent threads.
 
const NodeBS getAncestorThreads (NodeID tid) const
 Get all ancestor threads.
 
const NodeBS getSiblingThread (NodeID tid) const
 Get sibling threads.
 
const CallStrCxtSetgetCxtOfCxtThread (const CxtThread &ct) const
 get the contexts of a thread at its spawning sites (fork sites)
 
const FunObjVargetStartRoutineOfCxtThread (const CxtThread &ct) const
 get the start routine function of a thread
 
LoopBBsgetJoinLoop (const CallICFGNode *join)
 Get loop for join site.
 
bool hasJoinLoop (const CallICFGNode *join) const
 
bool hasLoop (const SVFBasicBlock *bb) const
 
bool hasLoop (const ICFGNode *inst) const
 
bool isJoinMustExecutedInLoop (const LoopBBs &lp, const ICFGNode *join)
 Return true if a join instruction must be executed inside a loop.
 
const LoopBBsgetLoop (const ICFGNode *inst)
 Get loop for an instruction.
 
const LoopBBsgetLoop (const SVFBasicBlock *bb)
 Get loop for fork/join site.
 
virtual void pushCxt (CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
 Context helper functions.
 
bool matchAndPopCxt (CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
 Match context.
 
bool isContextSuffix (const CallStrCxt &lhs, const CallStrCxt &call)
 If lhs is a suffix of rhs, including equal.
 
bool isJoinSiteInRecursion (const CallICFGNode *join) const
 Whether a join site is in recursion.
 
void dumpCxt (CallStrCxt &cxt)
 Dump calling context.
 
void dump (const std::string &filename)
 Dump the graph.
 
void print () const
 Print TCT information.
 
- Public Member Functions inherited from SVF::GenericGraph< NodeTy, EdgeTy >
 GenericGraph ()
 Constructor.
 
virtual ~GenericGraph ()
 Destructor.
 
void destroy ()
 Release memory.
 
iterator begin ()
 Iterators.
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void addGNode (NodeID id, NodeType *node)
 Add a Node.
 
NodeTypegetGNode (NodeID id) const
 Get a node.
 
bool hasGNode (NodeID id) const
 Has a node.
 
void removeGNode (NodeType *node)
 Delete a node.
 
u32_t getTotalNodeNum () const
 Get total number of node/edge.
 
u32_t getTotalEdgeNum () const
 
void incNodeNum ()
 Increase number of node/edge.
 
void incEdgeNum ()
 

Static Public Member Functions

static std::unique_ptr< SlicedTCTcreate (PointerAnalysis &pointerAnalysis, const SlicedSVFIRView &slicedView, u32_t contextLimit)
 
- Static Public Member Functions inherited from SVF::TCT
static std::unique_ptr< TCTcreate (PointerAnalysis *p)
 Construct and build a TCT with the command-line context bound.
 
static std::unique_ptr< TCTcreate (PointerAnalysis *p, u32_t contextLimit)
 

Protected Member Functions

void build () override
 Build TCT.
 
void markRelProcs () override
 Mark relevant procedures that are backward reachable from any fork/join site.
 
void markRelProcs (const FunObjVar *fun) override
 
void collectLoopInfoForJoin () override
 Handle join site in loop.
 
void handleCallRelation (CxtThreadProc &ctp, const CallGraphEdge *cgEdge, const CallICFGNode *cs) override
 Handle call relations.
 
- Protected Member Functions inherited from SVF::TCT
 TCT (PointerAnalysis *p, u32_t contextLimit)
 
TCTNodeaddTCTNode (const CxtThread &ct)
 Add TCT node.
 
bool addTCTEdge (TCTNode *src, TCTNode *dst)
 Add TCT edge.
 
void collectMultiForkedThreads ()
 
bool isLoopHeaderOfJoinLoop (const SVFBasicBlock *bb)
 Whether a given bb is a loop head of a inloop join site.
 
bool isLoopExitOfJoinLoop (const SVFBasicBlock *bb)
 Whether a given bb is an exit of a inloop join site.
 
bool isInLoopInstruction (const ICFGNode *inst)
 Multi-forked threads.
 
bool isInRecursion (const ICFGNode *inst) const
 Whether an instruction is in a recursion.
 
TCTNodegetOrCreateTCTNode (const CallStrCxt &cxt, const ICFGNode *fork, const CxtThreadProc &forkSiteCtp, const FunObjVar *routine)
 Get or create a tct node based on CxtThread.
 
void setMultiForkedAttrs (CxtThread &ct)
 Set multi-forked thread attributes.
 
bool addCxtOfCxtThread (NodeID pTid, const CallStrCxt &cxt, const CxtThread &ct)
 
void addStartRoutineOfCxtThread (const FunObjVar *fun, const CxtThread &ct)
 Add start routine function of a cxt thread.
 
ICFGNodecreateDummyForkSite ()
 Create and get a new dummy fork site for starter routines.
 
bool pushToCTPWorkList (const CxtThreadProc &ctp)
 WorkList helper functions.
 
CxtThreadProc popFromCTPWorkList ()
 
bool isVisitedCTPs (const CxtThreadProc &ctp) const
 

Private Member Functions

 SlicedTCT (PointerAnalysis &pointerAnalysis, const SlicedSVFIRView &slicedView, u32_t contextLimit)
 
void collectEntryFunInCallGraph () override
 Get entry functions that are neither called by other functions nor extern functions.
 
bool isKeptNode (const CallGraphNode *node) const
 
bool isKeptEdge (const CallGraphEdge *edge) const
 
void getKeptForkSites (std::vector< const ICFGNode * > &out) const
 
void getKeptJoinSites (std::vector< const ICFGNode * > &out) const
 

Private Attributes

const SlicedThreadCallGraphViewtcgView
 

Additional Inherited Members

- Public Types inherited from SVF::TCT
typedef SVFLoopAndDomInfo::LoopBBs LoopBBs
 
typedef TCTEdge::ThreadCreateEdgeSet ThreadCreateEdgeSet
 
typedef ThreadCreateEdgeSet::iterator TCTNodeIter
 
typedef OrderedSet< const FunObjVar *, FunObjVarIdCmpFunSet
 
typedef std::vector< const ICFGNode * > InstVec
 
typedef Set< const ICFGNode * > InstSet
 
typedef Set< const CallGraphNode * > PTACGNodeSet
 
typedef Map< CxtThread, TCTNode * > CxtThreadToNodeMap
 
typedef Set< std::pair< NodeID, CallStrCxt > > CallStrCxtSet
 
typedef Map< CxtThread, CallStrCxtSetCxtThreadToForkCxtSet
 
typedef Map< CxtThread, const FunObjVar * > CxtThreadToFun
 
typedef Map< const ICFGNode *, LoopBBsInstToLoopMap
 
typedef FIFOWorkList< CxtThreadProcCxtThreadProcVec
 
typedef Set< CxtThreadProcCxtThreadProcSet
 
typedef SCCDetection< CallGraph * > ThreadCallGraphSCC
 
typedef Set< const ICFGNode * > DummyForkSiteSet
 
- Public Types inherited from SVF::GenericGraph< NodeTy, EdgeTy >
typedef NodeTy NodeType
 
typedef EdgeTy EdgeType
 
typedef OrderedMap< NodeID, NodeType * > IDToNodeMapTy
 NodeID to GenericNode map.
 
typedef IDToNodeMapTy::iterator iterator
 Node Iterators.
 
typedef IDToNodeMapTy::const_iterator const_iterator
 
- Public Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy >
u32_t edgeNum
 total num of node
 
u32_t nodeNum
 total num of edge
 
- Protected Attributes inherited from SVF::TCT
ThreadCallGraphtcg
 
PointerAnalysispta
 
const u32_t contextLimit
 
u32_t TCTNodeNum
 
u32_t TCTEdgeNum
 
u32_t MaxCxtSize
 
FunSet entryFuncSet
 
FunSet candidateFuncSet
 Procedures that are neither called by other functions nor extern functions.
 
ThreadCallGraphSCCtcgSCC
 Procedures we care about during call graph traversing when creating TCT.
 
CxtThreadProcVec ctpList
 Thread call graph SCC.
 
CxtThreadProcSet visitedCTPs
 CxtThreadProc List.
 
CxtThreadToNodeMap ctpToNodeMap
 Record all visited ctps.
 
CxtThreadToForkCxtSet ctToForkCxtsMap
 Map a ctp to its graph node.
 
CxtThreadToFun ctToRoutineFunMap
 Map a CxtThread to the context at its spawning site (fork site).
 
InstToLoopMap joinSiteToLoopMap
 Map a CxtThread to its start routine function.
 
Set< const ICFGNode * > inRecurJoinSites
 Fork or Join sites in recursions.
 
DummyForkSiteSet dummyForkSites
 set of dummy fork sites for starter routines
 
NodeID dummyForkICFGNodeID = UINT32_MAX
 unique ID generator for dummy
 
- Protected Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy >
IDToNodeMapTy IDToNodeMap
 node map
 

Detailed Description

Definition at line 82 of file MTASlicer.h.

Constructor & Destructor Documentation

◆ ~SlicedTCT()

SVF::SlicedTCT::~SlicedTCT ( )
overridedefault

◆ SlicedTCT()

SVF::SlicedTCT::SlicedTCT ( PointerAnalysis pointerAnalysis,
const SlicedSVFIRView slicedView,
u32_t  contextLimit 
)
private

Definition at line 66 of file MTASlicer.cpp.

69 tcgView(*slicedView.getThreadCallGraph())
70{
71}
const SlicedThreadCallGraphView & tcgView
Definition MTASlicer.h:107
const u32_t contextLimit
Definition TCT.h:459
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

Member Function Documentation

◆ build()

void SVF::SlicedTCT::build ( )
overrideprotectedvirtual

Build TCT.

Start building TCT

Reimplemented from SVF::TCT.

Definition at line 73 of file MTASlicer.cpp.

74{
78
79 for (const FunObjVar* entry : entryFuncSet)
80 {
81 if (!isCandidateFun(entry))
82 continue;
83 CallStrCxt context;
84 CxtThreadProc parent(-1, context, nullptr);
86 context, createDummyForkSite(), parent, entry);
87 pushToCTPWorkList(CxtThreadProc(root->getId(), context, entry));
88 }
89
90 while (!ctpList.empty())
91 {
93 CallGraphNode* node = tcg->getCallGraphNode(process.getProc());
94 if (!isCandidateFun(node->getFunction()) || !isKeptNode(node))
95 continue;
96
97 std::vector<const CallGraphEdge*> outEdges;
99 for (const CallGraphEdge* edge : outEdges)
100 {
101 std::vector<const CallICFGNode*> directCalls;
102 std::vector<const CallICFGNode*> indirectCalls;
103 tcgView.getDirectCallsOf(edge, directCalls);
104 tcgView.getIndirectCallsOf(edge, indirectCalls);
105 for (const CallICFGNode* call : directCalls)
107 for (const CallICFGNode* call : indirectCalls)
109 }
110 }
111
113
115 {
116 print();
117 dump("tct");
118 }
119}
const FunObjVar * getFunction() const
Get function of this call node.
Definition CallGraph.h:191
const CallGraphNode * getCallGraphNode(const std::string &name) const
Get call graph node.
bool empty() const
Definition WorkList.h:161
static const Option< bool > TCTDotGraph
Definition Options.h:159
NodeID getId() const
Get ID.
Definition SVFValue.h:158
void collectEntryFunInCallGraph() override
Get entry functions that are neither called by other functions nor extern functions.
void collectLoopInfoForJoin() override
Handle join site in loop.
void handleCallRelation(CxtThreadProc &ctp, const CallGraphEdge *cgEdge, const CallICFGNode *cs) override
Handle call relations.
bool isKeptNode(const CallGraphNode *node) const
void markRelProcs() override
Mark relevant procedures that are backward reachable from any fork/join site.
void getDirectCallsOf(const CallGraphEdge *edge, std::vector< const CallICFGNode * > &out) const
Retained callsites carried by an aggregated call-graph edge.
void getIndirectCallsOf(const CallGraphEdge *edge, std::vector< const CallICFGNode * > &out) const
void getOutEdgesOf(const CallGraphNode *node, std::vector< const CallGraphEdge * > &out) const
Get out edges of a node (only returns kept edges and target nodes)
bool pushToCTPWorkList(const CxtThreadProc &ctp)
WorkList helper functions.
Definition TCT.h:595
FunSet entryFuncSet
Definition TCT.h:615
TCTNode * getOrCreateTCTNode(const CallStrCxt &cxt, const ICFGNode *fork, const CxtThreadProc &forkSiteCtp, const FunObjVar *routine)
Get or create a tct node based on CxtThread.
Definition TCT.h:528
ICFGNode * createDummyForkSite()
Create and get a new dummy fork site for starter routines.
Definition TCT.h:586
void dump(const std::string &filename)
Dump the graph.
Definition TCT.cpp:569
bool isCandidateFun(const CallGraph::FunctionSet &callees) const
Whether it is a candidate function for indirect call.
Definition TCT.h:294
CxtThreadProcVec ctpList
Thread call graph SCC.
Definition TCT.h:618
void print() const
Print TCT information.
Definition TCT.cpp:577
ThreadCallGraph * tcg
Definition TCT.h:457
void collectMultiForkedThreads()
Definition TCT.cpp:239
CxtThreadProc popFromCTPWorkList()
Definition TCT.h:604
std::vector< u32_t > CallStrCxt
Definition GeneralType.h:96

◆ collectEntryFunInCallGraph()

void SVF::SlicedTCT::collectEntryFunInCallGraph ( )
overrideprivatevirtual

Get entry functions that are neither called by other functions nor extern functions.

Get entry function, i.e., functions without callers, e.g., main function

Reimplemented from SVF::TCT.

Definition at line 209 of file MTASlicer.cpp.

210{
211 // A removed caller must not turn its callee into a new program root.
212 // Start only from original roots that remain in the sliced view.
214
215 for (const CallGraphNode* node : keptNodes)
216 {
217 const FunObjVar* fun = node->getFunction();
218 if (SVFUtil::isExtCall(fun))
219 continue;
220
221 if (!node->hasIncomingEdge())
222 {
223 entryFuncSet.insert(fun);
224 }
225 }
226
227 assert(!getEntryProcs().empty() && "Can't find any function in module!");
228}
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
const OrderedSet< const CallGraphNode * > & getKeptNodes() const
Get all kept nodes.
const FunSet & getEntryProcs() const
Get marked candidate functions.
Definition TCT.h:245
bool isExtCall(const FunObjVar *fun)
Definition SVFUtil.cpp:441

◆ collectLoopInfoForJoin()

void SVF::SlicedTCT::collectLoopInfoForJoin ( )
overrideprotectedvirtual

Handle join site in loop.

collect loop info for join sites

Collect loop info for join sites the in-loop join site must be joined if the loop is executed

Reimplemented from SVF::TCT.

Definition at line 182 of file MTASlicer.cpp.

183{
184 // Get kept join sites from sliced view
185 std::vector<const ICFGNode*> keptJoinSites;
187
188 for(const ICFGNode* join : keptJoinSites)
189 {
190 const FunObjVar* svffun = join->getFun();
191 const SVFBasicBlock* svfbb = join->getBB();
192
193 if(svffun->hasLoopInfo(svfbb))
194 {
195 const LoopBBs& lp = svffun->getLoopInfo(svfbb);
196 if(!lp.empty() && isJoinMustExecutedInLoop(lp,join))
197 {
199 }
200 }
201
203 {
204 inRecurJoinSites.insert(join);
205 }
206 }
207}
void getKeptJoinSites(std::vector< const ICFGNode * > &out) const
bool isInRecursion(const ICFGNode *inst) const
Whether an instruction is in a recursion.
Definition TCT.cpp:123
InstToLoopMap joinSiteToLoopMap
Map a CxtThread to its start routine function.
Definition TCT.h:623
bool isJoinMustExecutedInLoop(const LoopBBs &lp, const ICFGNode *join)
Return true if a join instruction must be executed inside a loop.
Definition TCT.cpp:326
Set< const ICFGNode * > inRecurJoinSites
Fork or Join sites in recursions.
Definition TCT.h:624
SVFLoopAndDomInfo::LoopBBs LoopBBs
Definition TCT.h:159

◆ create()

std::unique_ptr< SlicedTCT > SVF::SlicedTCT::create ( PointerAnalysis pointerAnalysis,
const SlicedSVFIRView slicedView,
u32_t  contextLimit 
)
static
Parameters
pointerAnalysisthe shared Andersen pre-analysis
slicedViewSlicedSVFIRView containing a SlicedThreadCallGraphView
contextLimitmaximum context length for the main analysis

Definition at line 56 of file MTASlicer.cpp.

59{
60 std::unique_ptr<SlicedTCT> tct(
62 tct->build();
63 return tct;
64}

◆ getKeptForkSites()

void SVF::SlicedTCT::getKeptForkSites ( std::vector< const ICFGNode * > &  out) const
private

Definition at line 254 of file MTASlicer.cpp.

255{
256 out.clear();
257 // Get all fork sites from original ThreadCallGraph, but filter by:
258 // 1. The function containing the fork site is kept
259 // 2. There exists a kept fork edge from this fork site
260 for (ThreadCallGraph::CallSiteSet::const_iterator it = tcg->forksitesBegin(), eit = tcg->forksitesEnd(); it != eit; ++it)
261 {
262 const ICFGNode* forkSite = *it;
263 const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(forkSite);
264 if (callNode == nullptr)
265 continue;
266
267 std::vector<const CallGraphEdge*> forkEdges;
270 if (!forkEdges.empty())
271 out.push_back(forkSite);
272 }
273}
CallSiteSet::const_iterator forksitesEnd() const
CallSiteSet::const_iterator forksitesBegin() const
Fork sites iterators.

◆ getKeptJoinSites()

void SVF::SlicedTCT::getKeptJoinSites ( std::vector< const ICFGNode * > &  out) const
private

Definition at line 275 of file MTASlicer.cpp.

276{
277 out.clear();
278 // Get all join sites from original ThreadCallGraph, but filter by:
279 // 1. The function containing the join site is kept
280 // 2. There exists a kept join edge to this join site
281 for (ThreadCallGraph::CallSiteSet::const_iterator it = tcg->joinsitesBegin(), eit = tcg->joinsitesEnd(); it != eit; ++it)
282 {
283 const ICFGNode* joinSite = *it;
284 const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(joinSite);
285 if (callNode == nullptr)
286 continue;
287
288 std::vector<const CallGraphEdge*> joinEdges;
291 if (!joinEdges.empty())
292 out.push_back(joinSite);
293 }
294}
CallSiteSet::const_iterator joinsitesEnd() const
CallSiteSet::const_iterator joinsitesBegin() const
Join sites iterators.

◆ handleCallRelation()

void SVF::SlicedTCT::handleCallRelation ( CxtThreadProc ctp,
const CallGraphEdge cgEdge,
const CallICFGNode cs 
)
overrideprotectedvirtual

Handle call relations.

Handle call relations

handle calling context for candidate functions only

Create spawnee TCT node

Add TCT nodes and edge

Reimplemented from SVF::TCT.

Definition at line 230 of file MTASlicer.cpp.

231{
232 // Check if the call site and callee are kept in sliced view
233 if (!isKeptEdge(cgEdge))
234 return;
235
236 const CallGraphNode* dstNode = cgEdge->getDstNode();
237 if (!isKeptNode(dstNode))
238 return;
239
240 // Call base class implementation
242}
bool isKeptEdge(const CallGraphEdge *edge) const
virtual void handleCallRelation(CxtThreadProc &ctp, const CallGraphEdge *cgEdge, const CallICFGNode *call)
Handle call relations.
Definition TCT.cpp:277

◆ isKeptEdge()

bool SVF::SlicedTCT::isKeptEdge ( const CallGraphEdge edge) const
private

Definition at line 249 of file MTASlicer.cpp.

250{
251 return tcgView.isKeptEdge(edge);
252}
bool isKeptEdge(const CallGraphEdge *e) const

◆ isKeptNode()

bool SVF::SlicedTCT::isKeptNode ( const CallGraphNode node) const
private

Definition at line 244 of file MTASlicer.cpp.

245{
246 return tcgView.isKeptNode(node);
247}
bool isKeptNode(const CallGraphNode *node) const
Check if a node is in the sliced view.

◆ markRelProcs() [1/2]

void SVF::SlicedTCT::markRelProcs ( )
overrideprotectedvirtual

Mark relevant procedures that are backward reachable from any fork/join site.

Mark relevant procedures that are backward reachable from any fork/join site

Reimplemented from SVF::TCT.

Definition at line 121 of file MTASlicer.cpp.

122{
123 // Get kept fork sites from sliced view
124 std::vector<const ICFGNode*> keptForkSites;
126
127 for (const ICFGNode* forkSite : keptForkSites)
128 {
129 // Get function from fork site
130 const FunObjVar* svfun = forkSite->getFun();
132
133 const CallICFGNode* callNode = SVFUtil::cast<CallICFGNode>(forkSite);
134 std::vector<const CallGraphEdge*> forkEdges;
137 for (const CallGraphEdge* edge : forkEdges)
138 {
139 candidateFuncSet.insert(edge->getDstNode()->getFunction());
140 }
141 }
142
143 // Get kept join sites from sliced view
144 std::vector<const ICFGNode*> keptJoinSites;
146
147 for (const ICFGNode* joinSite : keptJoinSites)
148 {
149 const FunObjVar* svfun = joinSite->getFun();
151 }
152
153 if(getMakredProcs().empty())
154 SVFUtil::writeWrnMsg("We didn't recognize any fork site, this is single thread program?");
155}
void getKeptForkSites(std::vector< const ICFGNode * > &out) const
const FunSet & getMakredProcs() const
Get marked candidate functions.
Definition TCT.h:239
FunSet candidateFuncSet
Procedures that are neither called by other functions nor extern functions.
Definition TCT.h:616
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
Definition SVFUtil.cpp:72

◆ markRelProcs() [2/2]

void SVF::SlicedTCT::markRelProcs ( const FunObjVar svffun)
overrideprotectedvirtual

Add relevant procedures that are backward reachable from svffun on Thread Call Graph

Reimplemented from SVF::TCT.

Definition at line 157 of file MTASlicer.cpp.

158{
159 const CallGraphNode* start = tcg->getCallGraphNode(fun);
160 if (!isKeptNode(start))
161 return;
162
164 PTACGNodeSet visited;
165 worklist.push(start);
166 visited.insert(start);
167 while (!worklist.empty())
168 {
169 const CallGraphNode* node = worklist.pop();
170 candidateFuncSet.insert(node->getFunction());
171 std::vector<const CallGraphEdge*> inEdges;
173 for (const CallGraphEdge* edge : inEdges)
174 {
175 const CallGraphNode* caller = edge->getSrcNode();
176 if (visited.insert(caller).second)
177 worklist.push(caller);
178 }
179 }
180}
bool push(const Data &data)
Definition WorkList.h:180
void getInEdgesOf(const CallGraphNode *node, std::vector< const CallGraphEdge * > &out) const
Get in edges of a node (only returns kept edges and source nodes)
Set< const CallGraphNode * > PTACGNodeSet
Definition TCT.h:176

Member Data Documentation

◆ tcgView

const SlicedThreadCallGraphView& SVF::SlicedTCT::tcgView
private

Definition at line 107 of file MTASlicer.h.


The documentation for this class was generated from the following files: