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

#include <PreAnalysis.h>

Public Types

typedef SCCDetection< CallGraph * > CallGraphSCC
 

Public Member Functions

 PreAnalysis (SVFIR *pag, ICFG *icfg)
 
virtual ~PreAnalysis ()
 
AndersenWaveDiffgetPointerAnalysis () const
 Accessors for Andersen's results.
 
CallGraphgetCallGraph () const
 
CallGraphSCCgetCallGraphSCC () const
 
void initWTO ()
 Build WTO for each function using call graph SCC.
 
const Map< const FunObjVar *, const ICFGWTO * > & getFuncToWTO () const
 Accessors for WTO data.
 

Private Attributes

SVFIRsvfir
 
ICFGicfg
 
AndersenWaveDiffpta
 
CallGraphcallGraph
 
CallGraphSCCcallGraphSCC
 
Map< const FunObjVar *, const ICFGWTO * > funcToWTO
 

Detailed Description

Definition at line 47 of file PreAnalysis.h.

Member Typedef Documentation

◆ CallGraphSCC

Definition at line 50 of file PreAnalysis.h.

Constructor & Destructor Documentation

◆ PreAnalysis()

PreAnalysis::PreAnalysis ( SVFIR pag,
ICFG icfg 
)

Definition at line 34 of file PreAnalysis.cpp.

35 : svfir(pag), icfg(icfg)
36{
40}
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
Definition Andersen.h:407
CallGraph * getCallGraph() const
Return call graph.
CallGraphSCC * getCallGraphSCC() const
Return call graph SCC.
CallGraphSCC * callGraphSCC
Definition PreAnalysis.h:83
AndersenWaveDiff * pta
Definition PreAnalysis.h:81
CallGraph * callGraph
Definition PreAnalysis.h:82

◆ ~PreAnalysis()

PreAnalysis::~PreAnalysis ( )
virtual

Definition at line 42 of file PreAnalysis.cpp.

43{
44 for (auto& [func, wto] : funcToWTO)
45 delete wto;
46}
Map< const FunObjVar *, const ICFGWTO * > funcToWTO
Definition PreAnalysis.h:85
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ getCallGraph()

CallGraph * SVF::PreAnalysis::getCallGraph ( ) const
inline

Definition at line 60 of file PreAnalysis.h.

61 {
62 return callGraph;
63 }

◆ getCallGraphSCC()

CallGraphSCC * SVF::PreAnalysis::getCallGraphSCC ( ) const
inline

Definition at line 64 of file PreAnalysis.h.

65 {
66 return callGraphSCC;
67 }

◆ getFuncToWTO()

const Map< const FunObjVar *, const ICFGWTO * > & SVF::PreAnalysis::getFuncToWTO ( ) const
inline

Accessors for WTO data.

Definition at line 73 of file PreAnalysis.h.

74 {
75 return funcToWTO;
76 }

◆ getPointerAnalysis()

AndersenWaveDiff * SVF::PreAnalysis::getPointerAnalysis ( ) const
inline

Accessors for Andersen's results.

Definition at line 56 of file PreAnalysis.h.

57 {
58 return pta;
59 }

◆ initWTO()

void PreAnalysis::initWTO ( )

Build WTO for each function using call graph SCC.

Definition at line 48 of file PreAnalysis.cpp.

49{
50 callGraphSCC->find();
51
52 for (auto it = callGraph->begin(); it != callGraph->end(); it++)
53 {
54 const FunObjVar *fun = it->second->getFunction();
55 if (fun->isDeclaration())
56 continue;
57
58 NodeID repNodeId = callGraphSCC->repNode(it->second->getId());
59 auto cgSCCNodes = callGraphSCC->subNodes(repNodeId);
60
61 bool isEntry = false;
62 if (it->second->getInEdges().empty())
63 isEntry = true;
64 for (auto inEdge: it->second->getInEdges())
65 {
66 NodeID srcNodeId = inEdge->getSrcID();
67 if (!cgSCCNodes.test(srcNodeId))
68 isEntry = true;
69 }
70
71 if (isEntry)
72 {
74 for (const auto& node: cgSCCNodes)
75 {
76 funcScc.insert(callGraph->getGNode(node)->getFunction());
77 }
79 iwto->init();
80 funcToWTO[it->second->getFunction()] = iwto;
81 }
82 }
83
84}
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
bool isDeclaration() const
iterator begin()
Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
FunEntryICFGNode * getFunEntryICFGNode(const FunObjVar *fun)
Add a function entry node.
Definition ICFG.cpp:242
u32_t NodeID
Definition GeneralType.h:56

Member Data Documentation

◆ callGraph

CallGraph* SVF::PreAnalysis::callGraph
private

Definition at line 82 of file PreAnalysis.h.

◆ callGraphSCC

CallGraphSCC* SVF::PreAnalysis::callGraphSCC
private

Definition at line 83 of file PreAnalysis.h.

◆ funcToWTO

Map<const FunObjVar*, const ICFGWTO*> SVF::PreAnalysis::funcToWTO
private

Definition at line 85 of file PreAnalysis.h.

◆ icfg

ICFG* SVF::PreAnalysis::icfg
private

Definition at line 80 of file PreAnalysis.h.

◆ pta

AndersenWaveDiff* SVF::PreAnalysis::pta
private

Definition at line 81 of file PreAnalysis.h.

◆ svfir

SVFIR* SVF::PreAnalysis::svfir
private

Definition at line 79 of file PreAnalysis.h.


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