Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::SparseObjGraph Class Reference

#include <SparseObjGraph.h>

Inheritance diagram for SVF::SparseObjGraph:
SVF::GenericGraph< SparseObjNode, SparseObjEdge >

Public Types

typedef SparseObjNode Node
typedef SparseObjEdge Edge
Public Types inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge >
typedef SparseObjNode NodeType
typedef SparseObjEdge EdgeType
typedef OrderedMap< NodeID, NodeType * > IDToNodeMapTy
 NodeID to GenericNode map.
typedef IDToNodeMapTy::iterator iterator
 Node Iterators.
typedef IDToNodeMapTy::const_iterator const_iterator

Public Member Functions

 SparseObjGraph (const SVFG &svfg, ICFG &icfg, PointerAnalysis &pta, const PAG &pag)
 Construction uses static graphs and points-to results, not AE state.
 ~SparseObjGraph () override
 SparseObjGraph (const SparseObjGraph &)=delete
SparseObjGraph & operator= (const SparseObjGraph &)=delete
const std::vector< const Edge * > & getInputs (const ICFGNode *node) const
 Return incoming edges at this ICFG location for client-side value flow.
std::string toString () const
 Describe the static nodes and edges as text, without AE values.
void dump (const std::string &file)
 Write a DOT graph to <file>.dot through GraphPrinter.
const PAG & getPAG () const
Public Member Functions inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge >
 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.
NodeType * getGNode (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 ()

Private Types

typedef std::pair< const ICFGNode *, const IntraCFGEdge * > NodeKey
typedef std::pair< NodeKey, NodeKey > EdgeKey

Private Member Functions

bool isBranch (const ICFGNode *node) const
bool isControlBoundary (const ICFGNode *node) const
void addRoute (const NodeBS &bases, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch)
void addRoute (NodeID base, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch)
void connectFunction (const FunObjVar *fun, const NodeBS &funBases, const Map< const ICFGNode *, NodeBS > &eventsAt)
 Walk one function once, carrying base sets instead of one base.
void addSource (const ICFGNode *node, const NodeBS &bases)
void connectCallBypass (const CallICFGNode *call, const NodeBS &bases)
 Route the bases that no callee returns from the call to its return site.
void connectSegment (const FunObjVar *fun, const ICFGNode *source, const ICFGNode *start, const IntraCFGEdge *branch, const NodeBS &bases, const Map< const ICFGNode *, NodeBS > &eventsAt)
Node * getOrCreateNode (const ICFGNode *location, const IntraCFGEdge *branch)
const NodeBS * intern (const NodeBS &bases)
void finalize ()

Static Private Member Functions

static const NodeBS & getEvents (const Map< const ICFGNode *, NodeBS > &eventsAt, const ICFGNode *node)

Private Attributes

ICFG & icfg
const PAG & pag
Map< NodeKey, Node * > nodes
std::map< EdgeKey, NodeBS > routeLabels
Map< const ICFGNode *, std::vector< const Edge * > > inputs
Map< u64_t, std::vector< std::unique_ptr< NodeBS > > > labels
 Interned labels, bucketed by hash.
Map< const ICFGNode *, NodeBS > returnedGroups
Map< const ICFGNode *, Map< const FunObjVar *, NodeBS > > returnedGroupsByCallee
Map< const ICFGNode *, NodeBS > doneSources
 Worklist of connectFunction for the function being connected.
Map< const ICFGNode *, NodeBS > pendingSources
std::deque< const ICFGNode * > sourceWorklist

Additional Inherited Members

Public Attributes inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge >
u32_t edgeNum
 total num of node
u32_t nodeNum
 total num of edge
Protected Attributes inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge >
IDToNodeMapTy IDToNodeMap
 node map

Detailed Description

Prebuild Obj routes from SVFG object information and ICFG order. Fields and array elements of the same base are packed on one route: D: a[0] = 1; S: a[1] = 7; N: use(a[0]); Program order gives D -> S -> N, rather than two independent packed inputs from D and S. Bases that share a route segment share one labeled edge: S1: *p = 1 (p -> {a,b}); S2: *q = 2 (q -> {a,b}) gives one edge S1 -{a,b}-> S2. A branch edge gets one node, but the graph neither computes nor stores intervals; clients check feasibility and refine values.

Definition at line 79 of file SparseObjGraph.h.

Member Typedef Documentation

◆ Edge

Definition at line 83 of file SparseObjGraph.h.

◆ EdgeKey

typedef std::pair<NodeKey, NodeKey> SVF::SparseObjGraph::EdgeKey
private

Definition at line 106 of file SparseObjGraph.h.

◆ Node

Definition at line 82 of file SparseObjGraph.h.

◆ NodeKey

typedef std::pair<const ICFGNode*, const IntraCFGEdge*> SVF::SparseObjGraph::NodeKey
private

Definition at line 105 of file SparseObjGraph.h.

Constructor & Destructor Documentation

◆ SparseObjGraph() [1/2]

SparseObjGraph::SparseObjGraph ( const SVFG & svfg,
ICFG & icfg,
PointerAnalysis & pta,
const PAG & pag )

Construction uses static graphs and points-to results, not AE state.

Definition at line 56 of file SparseObjGraph.cpp.

58 : icfg(graph), pag(ir)
59{
60 // Step 1: collect, for each base Obj, the ICFG locations of its events.
62 for (auto it = svfg.begin(); it != svfg.end(); ++it)
63 {
64 const VFGNode* vfg = it->second;
65 const ICFGNode* location = vfg->getICFGNode();
66 // Only in-function SVFG nodes participate here; global entry routes
67 // are connected below.
68 if (location && location->getFun())
69 {
70 // An indirect call edge identifies the packed Obj passed to the
71 // callee: C: f(&x) -> P: callee entry. Register both C and P as
72 // events for x so intra-function routing stops and resumes there;
73 // the interprocedural C -> P route is added here.
74 for (const VFGEdge* edge : vfg->getInEdges())
75 {
76 if (const auto* call = SVFUtil::dyn_cast<CallIndSVFGEdge>(edge))
77 {
78 const ICFGNode* caller = call->getSrcNode()->getICFGNode();
79 if (caller)
80 {
81 for (NodeID obj : call->getPointsTo())
82 {
83 if (!pag.isNullOrBlkObj(obj))
84 {
85 const NodeID base = pag.getBaseObject(obj)->getId();
86 eventsByBase[base].insert(caller);
87 eventsByBase[base].insert(location);
88 addRoute(base, caller, location, nullptr);
89 }
90 }
91 }
92 }
93 }
94
95 // MRSVFGNode already supplies points-to objects. Group each by
96 // base without modifying the SVFG or strong/weak update rules.
97 const ValVar* pointer = nullptr;
98 if (const auto* memory = SVFUtil::dyn_cast<MRSVFGNode>(vfg))
99 {
100 for (NodeID obj : memory->getPointsTo())
101 if (!pag.isNullOrBlkObj(obj))
102 eventsByBase[pag.getBaseObject(obj)->getId()].insert(location);
103 }
104 else if (const auto* store = SVFUtil::dyn_cast<StoreVFGNode>(vfg))
105 pointer = store->getLHSVar();
106 else if (const auto* load = SVFUtil::dyn_cast<LoadVFGNode>(vfg))
107 pointer = load->getRHSVar();
108
109 // Resolve ordinary load/store targets with points-to analysis.
110 // If p points to a[1], record a's base so a[0] and a[1] travel
111 // through this location as one packed Obj.
112 if (pointer)
113 {
114 for (NodeID obj : pta.getPts(pointer->getId()))
115 if (!pag.isNullOrBlkObj(obj))
116 eventsByBase[pag.getBaseObject(obj)->getId()].insert(location);
117 }
118 }
119 }
120
121 // Step 2: connect callee Obj outputs to the caller return location.
122 // For C: f(&x); R: return from the call, a RetIndSVFGEdge for x gives
123 // callee-output -> R, where AE can read the computed Obj value.
124 for (auto it = icfg.begin(); it != icfg.end(); ++it)
125 {
126 if (const auto* ret = SVFUtil::dyn_cast<RetICFGNode>(it->second))
127 {
128 for (const VFGNode* target : ret->getVFGNodes())
129 {
130 for (const VFGEdge* edge : target->getInEdges())
131 {
132 if (const auto* output = SVFUtil::dyn_cast<RetIndSVFGEdge>(edge))
133 {
134 const ICFGNode* source = output->getSrcNode()->getICFGNode();
135 if (source)
136 {
137 for (NodeID obj : output->getPointsTo())
138 {
139 if (!pag.isNullOrBlkObj(obj))
140 {
141 const NodeID base = pag.getBaseObject(obj)->getId();
142 returnedGroups[ret].set(base);
143 if (source->getFun())
144 returnedGroupsByCallee[ret][source->getFun()].set(base);
145 eventsByBase[base].insert(ret);
146 if (source->getFun())
147 eventsByBase[base].insert(source);
148 addRoute(base, source, ret, nullptr);
149 }
150 }
151 }
152 }
153 }
154 }
155 }
156 }
157
158 // Index events by location and by function: a base is routed inside a
159 // function only if it has an event there (as in the per-base walk, whose
160 // sources are the base's events and the entries of their functions).
163 Set<NodeID> globalBases;
164 for (const auto& [base, events] : eventsByBase)
165 {
166 if (pag.getBaseObject(base)->isGlobalObj())
167 globalBases.insert(base);
168 for (const ICFGNode* event : events)
169 {
170 eventsAt[event].set(base);
171 funBases[event->getFun()].set(base);
172 }
173 }
174
175 // Connect global objects from global initialization to function entries.
176 if (!globalBases.empty())
177 {
178 NodeBS globals;
179 for (NodeID base : globalBases)
180 globals.set(base);
181 const ICFGNode* global = icfg.getGlobalICFGNode();
182 for (const ICFGEdge* edge : global->getOutEdges())
183 {
184 const ICFGNode* entry = edge->getDstNode();
186 continue;
187 const auto bases = funBases.find(entry->getFun());
188 if (bases == funBases.end())
189 continue;
190 NodeBS label = globals & bases->second;
191 if (!label.empty())
192 addRoute(label, global, entry, nullptr);
193 }
194 }
195
196 // Step 3: connect consecutive Obj events in ICFG order, one walk per
197 // function carrying base sets.
198 for (const auto& [fun, bases] : funBases)
199 connectFunction(fun, bases, eventsAt);
200
201 finalize();
202}
iterator begin()
Iterators.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
Definition ICFGNode.h:75
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
NodeID getId() const
Get ID.
Definition SVFValue.h:158
void set(unsigned Idx)
Map< const ICFGNode *, NodeBS > returnedGroups
Map< const ICFGNode *, Map< const FunObjVar *, NodeBS > > returnedGroupsByCallee
void connectFunction(const FunObjVar *fun, const NodeBS &funBases, const Map< const ICFGNode *, NodeBS > &eventsAt)
Walk one function once, carrying base sets instead of one base.
void addRoute(const NodeBS &bases, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch)
virtual const ICFGNode * getICFGNode() const
Return corresponding ICFG node.
Definition VFGNode.h:67
LLVM_NODISCARD bool isa(const Y &Val)
Definition Casting.h:241
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
Definition Casting.h:405
u32_t NodeID
Definition GeneralType.h:76
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition GeneralType.h:51
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition GeneralType.h:56
SparseBitVector NodeBS
Definition GeneralType.h:82

◆ ~SparseObjGraph()

SparseObjGraph::~SparseObjGraph ( )
overridedefault

◆ SparseObjGraph() [2/2]

SVF::SparseObjGraph::SparseObjGraph ( const SparseObjGraph & )
delete

Member Function Documentation

◆ addRoute() [1/2]

void SparseObjGraph::addRoute ( const NodeBS & bases,
const ICFGNode * source,
const ICFGNode * target,
const IntraCFGEdge * branch )
private

Record that bases travel from source (via branch, if non-null) to target. Labels accumulate in routeLabels and become edges in finalize.

Definition at line 233 of file SparseObjGraph.cpp.

236{
237 // B: if (z > 0) { use(x); use(z); }. For base z the route is
238 // B -> (B, true edge) -> Uz; AE refines B's state on the true edge
239 // once and then reads every base labeled on (B, true edge) -> Uz.
240 const NodeKey from{source, nullptr};
241 const NodeKey to{target, nullptr};
242 if (branch)
243 {
244 const NodeKey via{source, branch};
245 routeLabels[ {from, via}] |= bases;
246 routeLabels[ {via, to}] |= bases;
247 }
248 else
249 routeLabels[ {from, to}] |= bases;
250}
std::pair< const ICFGNode *, const IntraCFGEdge * > NodeKey
std::map< EdgeKey, NodeBS > routeLabels

◆ addRoute() [2/2]

void SparseObjGraph::addRoute ( NodeID base,
const ICFGNode * source,
const ICFGNode * target,
const IntraCFGEdge * branch )
private

Definition at line 224 of file SparseObjGraph.cpp.

227{
228 NodeBS bases;
229 bases.set(base);
230 addRoute(bases, source, target, branch);
231}

◆ addSource()

void SparseObjGraph::addSource ( const ICFGNode * node,
const NodeBS & bases )
private

Queue bases to start a route segment at node, skipping bases already processed there.

Definition at line 297 of file SparseObjGraph.cpp.

298{
299 NodeBS fresh = bases;
300 const auto done = doneSources.find(node);
301 if (done != doneSources.end())
302 fresh.intersectWithComplement(done->second);
303 if (fresh.empty())
304 return;
305 NodeBS& waiting = pendingSources[node];
306 if (waiting.empty())
307 sourceWorklist.push_back(node);
308 waiting |= fresh;
309}
bool intersectWithComplement(const SparseBitVector &RHS)
Map< const ICFGNode *, NodeBS > doneSources
Worklist of connectFunction for the function being connected.
std::deque< const ICFGNode * > sourceWorklist
Map< const ICFGNode *, NodeBS > pendingSources

◆ connectCallBypass()

void SparseObjGraph::connectCallBypass ( const CallICFGNode * call,
const NodeBS & bases )
private

Route the bases that no callee returns from the call to its return site.

Definition at line 311 of file SparseObjGraph.cpp.

313{
314 // C may call f_write(&x) or f_noop(&x). If a callee has no return edge
315 // for x, retain C -> R so that candidate carries the pre-call value; a
316 // candidate with a return edge uses callee-output -> R.
317 const RetICFGNode* ret = call->getRetICFGNode();
318 NodeBS returned;
319 const auto all = returnedGroups.find(ret);
320 if (all != returnedGroups.end())
321 returned = all->second;
322 const auto byCallee = returnedGroupsByCallee.find(ret);
323 for (const ICFGEdge* out : call->getOutEdges())
324 {
326 continue;
327 const NodeBS* calleeBases = nullptr;
328 if (byCallee != returnedGroupsByCallee.end())
329 {
330 const auto callee = byCallee->second.find(out->getDstNode()->getFun());
331 if (callee != byCallee->second.end())
332 calleeBases = &callee->second;
333 }
334 if (calleeBases)
335 returned &= *calleeBases;
336 else
337 returned.clear();
338 }
339
340 NodeBS bypass = bases;
341 bypass.intersectWithComplement(returned);
342 if (bypass.empty())
343 return;
344 // The return site is a control boundary: every bypassing base stops
345 // there and starts its next segment.
346 addRoute(bypass, call, ret, nullptr);
347 addSource(ret, bypass);
348}
const RetICFGNode * getRetICFGNode() const
Return callsite.
Definition ICFGNode.h:440
void addSource(const ICFGNode *node, const NodeBS &bases)

◆ connectFunction()

void SparseObjGraph::connectFunction ( const FunObjVar * fun,
const NodeBS & funBases,
const Map< const ICFGNode *, NodeBS > & eventsAt )
private

Walk one function once, carrying base sets instead of one base.

Definition at line 252 of file SparseObjGraph.cpp.

255{
256 // A source starts a route segment for some bases: their events, the
257 // function entry, and the control boundaries they reach. Each source
258 // processes only newly added bases; per base this is exactly the per-base
259 // walk, since a base's walk does not depend on other bases.
260 doneSources.clear();
261 pendingSources.clear();
262 sourceWorklist.clear();
263
264 addSource(icfg.getFunEntryICFGNode(fun), funBases);
265 for (const auto& event : eventsAt)
266 if (event.first->getFun() == fun)
267 addSource(event.first, event.second);
268
269 while (!sourceWorklist.empty())
270 {
271 const ICFGNode* source = sourceWorklist.front();
272 sourceWorklist.pop_front();
273 NodeBS fresh = std::move(pendingSources[source]);
274 pendingSources.erase(source);
276 if (fresh.empty())
277 continue;
278 doneSources[source] |= fresh;
279
280 if (const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(source))
281 {
282 connectCallBypass(call, fresh);
283 continue;
284 }
285 for (const ICFGEdge* out : source->getOutEdges())
286 {
287 const IntraCFGEdge* intra = SVFUtil::dyn_cast<IntraCFGEdge>(out);
288 if (!intra)
289 continue;
290 const IntraCFGEdge* branch = intra->getCondition() ? intra : nullptr;
291 connectSegment(fun, source, intra->getDstNode(), branch, fresh,
292 eventsAt);
293 }
294 }
295}
NodeType * getDstNode() const
const SVFVar * getCondition() const
Definition ICFGEdge.h:139
void connectCallBypass(const CallICFGNode *call, const NodeBS &bases)
Route the bases that no callee returns from the call to its return site.
void connectSegment(const FunObjVar *fun, const ICFGNode *source, const ICFGNode *start, const IntraCFGEdge *branch, const NodeBS &bases, const Map< const ICFGNode *, NodeBS > &eventsAt)

◆ connectSegment()

void SparseObjGraph::connectSegment ( const FunObjVar * fun,
const ICFGNode * source,
const ICFGNode * start,
const IntraCFGEdge * branch,
const NodeBS & bases,
const Map< const ICFGNode *, NodeBS > & eventsAt )
private

Follow ordinary ICFG nodes from start until each base reaches its next event or a control boundary.

Definition at line 350 of file SparseObjGraph.cpp.

354{
355 // Cross ordinary ICFG nodes between events, carrying the set of bases
356 // still travelling. A base stops at its next event; every base stops at
357 // a branch, call, or return.
359 std::deque<std::pair<const ICFGNode*, NodeBS>> walk;
360 walk.emplace_back(start, bases);
361 while (!walk.empty())
362 {
363 const ICFGNode* current = walk.front().first;
364 NodeBS travelling = std::move(walk.front().second);
365 walk.pop_front();
366 if (!current || current->getFun() != fun)
367 continue;
368 NodeBS& seen = arrived[current];
369 travelling.intersectWithComplement(seen);
370 if (travelling.empty())
371 continue;
372 seen |= travelling;
373
374 if (isControlBoundary(current))
375 {
376 addRoute(travelling, source, current, branch);
377 addSource(current, travelling);
378 continue;
379 }
380 NodeBS stop = travelling & getEvents(eventsAt, current);
381 if (!stop.empty())
382 {
383 addRoute(stop, source, current, branch);
384 travelling.intersectWithComplement(stop);
385 }
386 if (travelling.empty())
387 continue;
388 for (const ICFGEdge* next : current->getOutEdges())
389 if (const IntraCFGEdge* intra = SVFUtil::dyn_cast<IntraCFGEdge>(next))
390 walk.emplace_back(intra->getDstNode(), travelling);
391 }
392}
item next
Definition cJSON.cpp:2224
static const NodeBS & getEvents(const Map< const ICFGNode *, NodeBS > &eventsAt, const ICFGNode *node)
bool isControlBoundary(const ICFGNode *node) const

◆ dump()

void SparseObjGraph::dump ( const std::string & file)

Write a DOT graph to <file>.dot through GraphPrinter.

Definition at line 544 of file SparseObjGraph.cpp.

545{
547}
static void WriteGraphToFile(SVF::OutStream &O, const std::string &GraphName, const GraphType &GT, bool simple=false)
std::ostream & outs()
Overwrite llvm::outs().
Definition SVFUtil.h:58

◆ finalize()

void SparseObjGraph::finalize ( )
private

Definition at line 427 of file SparseObjGraph.cpp.

428{
429 for (const auto& [key, bases] : routeLabels)
430 {
431 Node* source = getOrCreateNode(key.first.first, key.first.second);
432 Node* target = getOrCreateNode(key.second.first, key.second.second);
433 Edge* edge = new Edge(source, target, intern(bases));
434 const bool addedOut = source->addOutgoingEdge(edge);
435 const bool addedIn = target->addIncomingEdge(edge);
436 assert(addedOut && addedIn);
437 (void)addedOut;
438 (void)addedIn;
439 incEdgeNum();
440 if (!target->branch)
441 inputs[target->location].push_back(edge);
442 }
443 routeLabels.clear();
444}
Map< const ICFGNode *, std::vector< const Edge * > > inputs
Node * getOrCreateNode(const ICFGNode *location, const IntraCFGEdge *branch)
const NodeBS * intern(const NodeBS &bases)

◆ getEvents()

const NodeBS & SparseObjGraph::getEvents ( const Map< const ICFGNode *, NodeBS > & eventsAt,
const ICFGNode * node )
staticprivate

Definition at line 394 of file SparseObjGraph.cpp.

396{
397 static const NodeBS empty;
398 const auto it = eventsAt.find(node);
399 return it == eventsAt.end() ? empty : it->second;
400}

◆ getInputs()

const std::vector< const SparseObjGraph::Edge * > & SparseObjGraph::getInputs ( const ICFGNode * node) const

Return incoming edges at this ICFG location for client-side value flow.

Definition at line 447 of file SparseObjGraph.cpp.

448{
449 static const std::vector<const Edge*> empty;
450 const auto it = inputs.find(node);
451 return it == inputs.end() ? empty : it->second;
452}

◆ getOrCreateNode()

SparseObjGraph::Node * SparseObjGraph::getOrCreateNode ( const ICFGNode * location,
const IntraCFGEdge * branch )
private

Definition at line 402 of file SparseObjGraph.cpp.

404{
405 Node*& node = nodes[ {location, branch}];
406 if (!node)
407 {
408 node = new Node(getTotalNodeNum(), location, branch);
409 addGNode(node->getId(), node);
410 }
411 return node;
412}
Map< NodeKey, Node * > nodes

◆ getPAG()

const PAG & SVF::SparseObjGraph::getPAG ( ) const
inline

Definition at line 99 of file SparseObjGraph.h.

100 {
101 return pag;
102 }

◆ intern()

const NodeBS * SparseObjGraph::intern ( const NodeBS & bases)
private

Definition at line 414 of file SparseObjGraph.cpp.

415{
416 u64_t hash = 1469598103934665603ULL;
417 for (NodeID base : bases)
418 hash = (hash ^ base) * 1099511628211ULL;
419 auto& bucket = labels[hash];
420 for (const auto& label : bucket)
421 if (*label == bases)
422 return label.get();
423 bucket.push_back(std::make_unique<NodeBS>(bases));
424 return bucket.back().get();
425}
Map< u64_t, std::vector< std::unique_ptr< NodeBS > > > labels
Interned labels, bucketed by hash.
unsigned long long u64_t
Definition GeneralType.h:69

◆ isBranch()

bool SparseObjGraph::isBranch ( const ICFGNode * node) const
private

Definition at line 206 of file SparseObjGraph.cpp.

207{
208 // Only conditional intra-function ICFG edges count as branches.
209 for (const ICFGEdge* out : node->getOutEdges())
210 {
211 const auto* intra = SVFUtil::dyn_cast<IntraCFGEdge>(out);
212 if (intra && intra->getCondition())
213 return true;
214 }
215 return false;
216}

◆ isControlBoundary()

bool SparseObjGraph::isControlBoundary ( const ICFGNode * node) const
private

Definition at line 218 of file SparseObjGraph.cpp.

219{
220 return isBranch(node) || SVFUtil::isa<CallICFGNode>(node) ||
222}
bool isBranch(const ICFGNode *node) const

◆ operator=()

SparseObjGraph & SVF::SparseObjGraph::operator= ( const SparseObjGraph & )
delete

◆ toString()

std::string SparseObjGraph::toString ( ) const

Describe the static nodes and edges as text, without AE values.

Definition at line 454 of file SparseObjGraph.cpp.

455{
456 std::ostringstream out;
457 for (const auto& entry : *this)
458 out << entry.second->toString() << '\n';
459 for (const auto& entry : *this)
460 for (const Edge* edge : entry.second->getOutEdges())
461 out << edge->toString() << '\n';
462 return out.str();
463}

Member Data Documentation

◆ doneSources

Map<const ICFGNode*, NodeBS> SVF::SparseObjGraph::doneSources
private

Worklist of connectFunction for the function being connected.

Definition at line 149 of file SparseObjGraph.h.

◆ icfg

ICFG& SVF::SparseObjGraph::icfg
private

Definition at line 136 of file SparseObjGraph.h.

◆ inputs

Map<const ICFGNode*, std::vector<const Edge*> > SVF::SparseObjGraph::inputs
private

Definition at line 140 of file SparseObjGraph.h.

◆ labels

Map<u64_t, std::vector<std::unique_ptr<NodeBS> > > SVF::SparseObjGraph::labels
private

Interned labels, bucketed by hash.

Definition at line 142 of file SparseObjGraph.h.

◆ nodes

Map<NodeKey, Node*> SVF::SparseObjGraph::nodes
private

Definition at line 138 of file SparseObjGraph.h.

◆ pag

const PAG& SVF::SparseObjGraph::pag
private

Definition at line 137 of file SparseObjGraph.h.

◆ pendingSources

Map<const ICFGNode*, NodeBS> SVF::SparseObjGraph::pendingSources
private

Definition at line 150 of file SparseObjGraph.h.

◆ returnedGroups

Map<const ICFGNode*, NodeBS> SVF::SparseObjGraph::returnedGroups
private

Bases with a callee-output to caller-return SVFG edge. The second map distinguishes callees when deciding whether a multi-target call bypasses.

Definition at line 145 of file SparseObjGraph.h.

◆ returnedGroupsByCallee

Map<const ICFGNode*, Map<const FunObjVar*, NodeBS> > SVF::SparseObjGraph::returnedGroupsByCallee
private

Definition at line 146 of file SparseObjGraph.h.

◆ routeLabels

std::map<EdgeKey, NodeBS> SVF::SparseObjGraph::routeLabels
private

Definition at line 139 of file SparseObjGraph.h.

◆ sourceWorklist

std::deque<const ICFGNode*> SVF::SparseObjGraph::sourceWorklist
private

Definition at line 151 of file SparseObjGraph.h.


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