Static Value-Flow Analysis
|
#include <ICFG.h>
Public Types | |
typedef OrderedMap< NodeID, ICFGNode * > | ICFGNodeIDToNodeMapTy |
typedef ICFGEdge::ICFGEdgeSetTy | ICFGEdgeSetTy |
typedef ICFGNodeIDToNodeMapTy::iterator | iterator |
typedef ICFGNodeIDToNodeMapTy::const_iterator | const_iterator |
typedef Map< const SVFFunction *, FunEntryICFGNode * > | FunToFunEntryNodeMapTy |
typedef Map< const SVFFunction *, FunExitICFGNode * > | FunToFunExitNodeMapTy |
typedef std::vector< const SVFLoop * > | SVFLoopVec |
typedef Map< const ICFGNode *, SVFLoopVec > | ICFGNodeToSVFLoopVec |
Public Types inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
typedef NodeTy | NodeType |
typedef EdgeTy | EdgeType |
typedef OrderedMap< NodeID, NodeType * > | IDToNodeMapTy |
NodeID to GenericNode map. More... | |
typedef IDToNodeMapTy::iterator | iterator |
Node Iterators. More... | |
typedef IDToNodeMapTy::const_iterator | const_iterator |
Public Member Functions | |
ICFG () | |
Constructor. More... | |
~ICFG () override | |
Destructor. More... | |
ICFGNode * | getICFGNode (NodeID id) const |
Get a ICFG node. More... | |
bool | hasICFGNode (NodeID id) const |
Whether has the ICFGNode. More... | |
ICFGEdge * | hasIntraICFGEdge (ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind) |
Whether we has a SVFG edge. More... | |
ICFGEdge * | hasInterICFGEdge (ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind) |
ICFGEdge * | hasThreadICFGEdge (ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind) |
ICFGEdge * | getICFGEdge (const ICFGNode *src, const ICFGNode *dst, ICFGEdge::ICFGEdgeK kind) |
Get a SVFG edge according to src and dst. More... | |
void | dump (const std::string &file, bool simple=false) |
Dump graph into dot file. More... | |
void | view () |
View graph from the debugger. More... | |
void | updateCallGraph (PTACallGraph *callgraph) |
update ICFG for indirect calls More... | |
bool | isInLoop (const ICFGNode *node) |
Whether node is in a loop. More... | |
void | addNodeToSVFLoop (const ICFGNode *node, const SVFLoop *loop) |
Insert (node, loop) to icfgNodeToSVFLoopVec. More... | |
SVFLoopVec & | getSVFLoops (const ICFGNode *node) |
Get loops where a node resides. More... | |
const ICFGNodeToSVFLoopVec & | getIcfgNodeToSVFLoopVec () const |
FunEntryICFGNode * | getFunEntryICFGNode (const SVFFunction *fun) |
Add a function entry node. More... | |
FunExitICFGNode * | getFunExitICFGNode (const SVFFunction *fun) |
Add a function exit node. More... | |
GlobalICFGNode * | getGlobalICFGNode () const |
const std::vector< const ICFGNode * > & | getSubNodes (const ICFGNode *node) const |
const ICFGNode * | getRepNode (const ICFGNode *node) const |
void | updateSubAndRep (const ICFGNode *rep, const ICFGNode *sub) |
Public Member Functions inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
GenericGraph () | |
Constructor. More... | |
virtual | ~GenericGraph () |
Destructor. More... | |
void | destroy () |
Release memory. More... | |
iterator | begin () |
Iterators. More... | |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
void | addGNode (NodeID id, NodeType *node) |
Add a Node. More... | |
NodeType * | getGNode (NodeID id) const |
Get a node. More... | |
bool | hasGNode (NodeID id) const |
Has a node. More... | |
void | removeGNode (NodeType *node) |
Delete a node. More... | |
u32_t | getTotalNodeNum () const |
Get total number of node/edge. More... | |
u32_t | getTotalEdgeNum () const |
void | incNodeNum () |
Increase number of node/edge. More... | |
void | incEdgeNum () |
Public Attributes | |
NodeID | totalICFGNode |
Public Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
u32_t | edgeNum |
total num of node More... | |
u32_t | nodeNum |
total num of edge More... | |
Protected Member Functions | |
ICFGEdge * | addIntraEdge (ICFGNode *srcNode, ICFGNode *dstNode) |
Add intraprocedural and interprocedural control-flow edges. More... | |
ICFGEdge * | addConditionalIntraEdge (ICFGNode *srcNode, ICFGNode *dstNode, s64_t branchCondVal) |
ICFGEdge * | addCallEdge (ICFGNode *srcNode, ICFGNode *dstNode) |
ICFGEdge * | addRetEdge (ICFGNode *srcNode, ICFGNode *dstNode) |
void | removeICFGEdge (ICFGEdge *edge) |
Remove a ICFG edge. More... | |
void | removeICFGNode (ICFGNode *node) |
Remove a ICFGNode. More... | |
void | checkIntraEdgeParents (const ICFGNode *srcNode, const ICFGNode *dstNode) |
sanitize Intra edges, verify that both nodes belong to the same function. More... | |
virtual IntraICFGNode * | addIntraICFGNode (const SVFBasicBlock *bb, bool isRet) |
virtual CallICFGNode * | addCallICFGNode (const SVFBasicBlock *bb, const SVFType *ty, const SVFFunction *calledFunc, bool isVararg, bool isvcall, s32_t vcallIdx, const std::string &funNameOfVcall) |
virtual RetICFGNode * | addRetICFGNode (CallICFGNode *call) |
virtual FunEntryICFGNode * | addFunEntryICFGNode (const SVFFunction *svfFunc) |
virtual FunExitICFGNode * | addFunExitICFGNode (const SVFFunction *svfFunc) |
virtual void | addICFGNode (ICFGNode *node) |
Add a ICFG node. More... | |
Private Member Functions | |
void | addSubNode (const ICFGNode *rep, const ICFGNode *sub) |
when ICFG is simplified, SubNode would merge repNode, then update the map More... | |
void | updateRepNode (const ICFGNode *rep, const ICFGNode *sub) |
when ICFG is simplified, some node would be removed, this map records the removed node to its rep node More... | |
bool | addICFGEdge (ICFGEdge *edge) |
Add ICFG edge, only used by addIntraEdge, addCallEdge, addRetEdge etc. More... | |
FunEntryICFGNode * | getFunEntryBlock (const SVFFunction *fun) |
Get/Add a function entry node. More... | |
FunExitICFGNode * | getFunExitBlock (const SVFFunction *fun) |
Get/Add a function exit node. More... | |
Private Attributes | |
FunToFunEntryNodeMapTy | FunToFunEntryNodeMap |
map a function to its FunExitICFGNode More... | |
FunToFunExitNodeMapTy | FunToFunExitNodeMap |
map a function to its FunEntryICFGNode More... | |
GlobalICFGNode * | globalBlockNode |
unique basic block for all globals More... | |
ICFGNodeToSVFLoopVec | icfgNodeToSVFLoopVec |
map ICFG node to the SVF loops where it resides More... | |
Map< const ICFGNode *, std::vector< const ICFGNode * > > | _subNodes |
map a node(1st node of basicblock) to its subnodes More... | |
Map< const ICFGNode *, const ICFGNode * > | _repNode |
map a subnode to its representative node(1st node of basicblock) More... | |
Friends | |
class | ICFGBuilder |
class | SVFIRWriter |
class | SVFIRReader |
class | ICFGSimplification |
Additional Inherited Members | |
Protected Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
IDToNodeMapTy | IDToNodeMap |
node map More... | |
typedef ICFGNodeIDToNodeMapTy::const_iterator SVF::ICFG::const_iterator |
typedef Map<const SVFFunction*, FunEntryICFGNode *> SVF::ICFG::FunToFunEntryNodeMapTy |
typedef Map<const SVFFunction*, FunExitICFGNode *> SVF::ICFG::FunToFunExitNodeMapTy |
typedef OrderedMap<NodeID, ICFGNode *> SVF::ICFG::ICFGNodeIDToNodeMapTy |
typedef Map<const ICFGNode *, SVFLoopVec> SVF::ICFG::ICFGNodeToSVFLoopVec |
typedef ICFGNodeIDToNodeMapTy::iterator SVF::ICFG::iterator |
typedef std::vector<const SVFLoop *> SVF::ICFG::SVFLoopVec |
ICFG::ICFG | ( | ) |
|
override |
Add interprocedural call edges between two nodes
Definition at line 366 of file ICFG.cpp.
|
inlineprotectedvirtual |
Definition at line 183 of file ICFG.h.
|
protected |
Add conditional intraprocedural edges between two nodes
Definition at line 344 of file ICFG.cpp.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprivate |
Add ICFG edge, only used by addIntraEdge, addCallEdge, addRetEdge etc.
|
inlineprotectedvirtual |
Add a ICFG node.
Definition at line 219 of file ICFG.h.
|
inlineprotectedvirtual |
Insert (node, loop) to icfgNodeToSVFLoopVec.
Add interprocedural return edges between two nodes
Definition at line 384 of file ICFG.cpp.
|
inlineprotectedvirtual |
|
inlineprotected |
sanitize Intra edges, verify that both nodes belong to the same function.
void ICFG::dump | ( | const std::string & | file, |
bool | simple = false |
||
) |
Dump graph into dot file.
Dump ICFG
Definition at line 403 of file ICFG.cpp.
|
inlineprivate |
FunEntryICFGNode * ICFG::getFunEntryICFGNode | ( | const SVFFunction * | fun | ) |
Add a function entry node.
Get a basic block ICFGNode TODO:: need to fix the assertions
Definition at line 234 of file ICFG.cpp.
|
inlineprivate |
FunExitICFGNode * ICFG::getFunExitICFGNode | ( | const SVFFunction * | fun | ) |
Add a function exit node.
Definition at line 241 of file ICFG.cpp.
|
inline |
ICFGEdge * ICFG::getICFGEdge | ( | const ICFGNode * | src, |
const ICFGNode * | dst, | ||
ICFGEdge::ICFGEdgeK | kind | ||
) |
Get a ICFG node.
Definition at line 86 of file ICFG.h.
|
inline |
|
inline |
|
inline |
ICFGEdge * ICFG::hasInterICFGEdge | ( | ICFGNode * | src, |
ICFGNode * | dst, | ||
ICFGEdge::ICFGEdgeK | kind | ||
) |
Whether we has an inter ICFG edge
Definition at line 268 of file ICFG.cpp.
ICFGEdge * ICFG::hasIntraICFGEdge | ( | ICFGNode * | src, |
ICFGNode * | dst, | ||
ICFGEdge::ICFGEdgeK | kind | ||
) |
ICFGEdge * ICFG::hasThreadICFGEdge | ( | ICFGNode * | src, |
ICFGNode * | dst, | ||
ICFGEdge::ICFGEdgeK | kind | ||
) |
|
inline |
|
inlineprotected |
|
inlineprotected |
Remove a ICFGNode.
Definition at line 159 of file ICFG.h.
void ICFG::updateCallGraph | ( | PTACallGraph * | callgraph | ) |
update ICFG for indirect calls
Update ICFG for indirect calls
if this is an external function (no function body), connect calleeEntryNode to calleeExitNode
Remove callBlockNode to retBlockNode intraICFGEdge since we found at least one inter procedural edge
Definition at line 419 of file ICFG.cpp.
Definition at line 252 of file ICFG.h.
void ICFG::view | ( | ) |
View graph from the debugger.
View ICFG
Definition at line 411 of file ICFG.cpp.
|
friend |
|
friend |
|
friend |
|
private |
map a function to its FunExitICFGNode
|
private |
map a function to its FunEntryICFGNode
|
private |
|
private |