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

#include <SlicedGraphs.h>

Public Member Functions

 SlicedPAGView (SVFIR *pag, const OrderedSet< const SVFStmt * > &keptStmts)
 
const OrderedSet< const SVFStmt * > & getKeptStmts () const
 Get all kept statements.
 
const Set< NodeID > & getKeptNodeIds () const
 Node IDs (SVFVars) touched by the kept statements – the sliced PAG's nodes.
 
bool isKeptStmt (const SVFStmt *s) const
 
SVFIRgetSVFIR () const
 The underlying SVFIR (to resolve node ids to SVFVars).
 
void dump (const std::string &filename) const
 Dump the sliced PAG to a dot file.
 

Private Member Functions

void buildKeptNodeIds ()
 

Private Attributes

SVFIRpag
 
OrderedSet< const SVFStmt * > keptStmts
 
Set< NodeIDkeptNodeIds
 

Detailed Description

Definition at line 131 of file SlicedGraphs.h.

Constructor & Destructor Documentation

◆ SlicedPAGView()

SVF::SlicedPAGView::SlicedPAGView ( SVFIR pag,
const OrderedSet< const SVFStmt * > &  keptStmts 
)

Definition at line 551 of file SlicedGraphs.cpp.

553{
555}
OrderedSet< const SVFStmt * > keptStmts

Member Function Documentation

◆ buildKeptNodeIds()

void SVF::SlicedPAGView::buildKeptNodeIds ( )
private

Definition at line 557 of file SlicedGraphs.cpp.

558{
559 for (const SVFStmt* stmt : keptStmts)
560 {
561 // Handle the two SVF statement abstractions directly so new concrete
562 // statement subclasses cannot silently disappear from the PAG view.
563 if (const AssignStmt* assignStmt = SVFUtil::dyn_cast<AssignStmt>(stmt))
564 {
565 keptNodeIds.insert(assignStmt->getLHSVarID());
566 keptNodeIds.insert(assignStmt->getRHSVarID());
567 continue;
568 }
569 if (const MultiOpndStmt* multi =
570 SVFUtil::dyn_cast<MultiOpndStmt>(stmt))
571 {
572 keptNodeIds.insert(multi->getResID());
573 for (u32_t i = 0; i < multi->getOpVarNum(); ++i)
574 keptNodeIds.insert(multi->getOpVarID(i));
575 }
576 }
577}
unsigned u32_t
Definition CommandLine.h:18
Set< NodeID > keptNodeIds
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ dump()

void SVF::SlicedPAGView::dump ( const std::string &  filename) const

Dump the sliced PAG to a dot file.

Definition at line 579 of file SlicedGraphs.cpp.

580{
581 // Nodes = SVFVars of kept statements; edges = kept SVFStmts via
582 // GenericGraphTraits<const SlicedPAGView*>. MultiOpndStmts use the
583 // underlying src/dst (no operand fan-out).
585}
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:52

◆ getKeptNodeIds()

const Set< NodeID > & SVF::SlicedPAGView::getKeptNodeIds ( ) const
inline

Node IDs (SVFVars) touched by the kept statements – the sliced PAG's nodes.

Definition at line 143 of file SlicedGraphs.h.

144 {
145 return keptNodeIds;
146 }

◆ getKeptStmts()

const OrderedSet< const SVFStmt * > & SVF::SlicedPAGView::getKeptStmts ( ) const
inline

Get all kept statements.

Definition at line 137 of file SlicedGraphs.h.

138 {
139 return keptStmts;
140 }

◆ getSVFIR()

SVFIR * SVF::SlicedPAGView::getSVFIR ( ) const
inline

The underlying SVFIR (to resolve node ids to SVFVars).

Definition at line 156 of file SlicedGraphs.h.

157 {
158 return pag;
159 }

◆ isKeptStmt()

bool SVF::SlicedPAGView::isKeptStmt ( const SVFStmt s) const
inline

Canonical edge membership: a kept SVFVar may have incident statements not in the slice, so traits/queries keep only statements in keptStmts.

Definition at line 150 of file SlicedGraphs.h.

151 {
152 return keptStmts.count(s) > 0;
153 }

Member Data Documentation

◆ keptNodeIds

Set<NodeID> SVF::SlicedPAGView::keptNodeIds
private

Definition at line 167 of file SlicedGraphs.h.

◆ keptStmts

OrderedSet<const SVFStmt*> SVF::SlicedPAGView::keptStmts
private

Definition at line 166 of file SlicedGraphs.h.

◆ pag

SVFIR* SVF::SlicedPAGView::pag
private

Definition at line 165 of file SlicedGraphs.h.


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