30#ifndef INCLUDE_UTIL_ICFG_H_
31#define INCLUDE_UTIL_ICFG_H_
58 typedef ICFGNodeIDToNodeMapTy::iterator
iterator;
104 void dump(
const std::string& file,
bool simple =
false);
165 if(srcfun !=
nullptr && dstfun !=
nullptr)
167 assert((srcfun == dstfun) &&
"src and dst nodes of an intra edge should in the same function!" );
176 return intraIcfgNode;
181 const FunObjVar* calledFunc,
bool isVararg,
bool isvcall,
182 s32_t vcallIdx,
const std::string& funNameOfVcall)
187 isvcall, vcallIdx, funNameOfVcall);
217 if (svfFunc->
begin() != svfFunc->
end())
256 bool all_added = added1 && added2;
257 assert(all_added &&
"ICFGEdge not added?");
320 std::vector<const SVF::ICFGNode*>& out)
329 std::vector<const SVF::ICFGNode*>& out)
333 out.push_back(e->getDstNode());
336 std::vector<const SVF::ICFGNode*>& out)
340 out.push_back(e->getSrcNode());
void setRetICFGNode(const RetICFGNode *r)
Return callsite.
const FunObjVar * getFun() const override
Return function.
const FunObjVar * getFun() const override
Return function.
const_bb_iterator begin() const
const SVFBasicBlock * getEntryBlock() const
const_bb_iterator end() const
const SVFBasicBlock * getExitBB() const
NodeType * getSrcNode() const
NodeType * getDstNode() const
void removeGNode(NodeType *node)
bool hasGNode(NodeID id) const
NodeType * getGNode(NodeID id) const
u32_t removeOutgoingEdge(EdgeType *edge)
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
u32_t removeIncomingEdge(EdgeType *edge)
bool addOutgoingEdge(EdgeType *outEdge)
GenericNode< ICFGNode, ICFGEdge >::GEdgeSetTy ICFGEdgeSetTy
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
virtual FunEntryICFGNode * addFunEntryICFGNode(const FunObjVar *svfFunc)
virtual CallICFGNode * addCallICFGNode(const SVFBasicBlock *bb, const SVFType *ty, const FunObjVar *calledFunc, bool isVararg, bool isvcall, s32_t vcallIdx, const std::string &funNameOfVcall)
void view()
View graph from the debugger.
bool hasICFGNode(NodeID id) const
Whether has the ICFGNode.
ICFGEdge::ICFGEdgeSetTy ICFGEdgeSetTy
ICFGEdge * hasThreadICFGEdge(ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
const ICFGNodeToSVFLoopVec & getIcfgNodeToSVFLoopVec() const
void removeICFGNode(ICFGNode *node)
Remove a ICFGNode.
Map< const FunObjVar *, FunExitICFGNode * > FunToFunExitNodeMapTy
Map< const ICFGNode *, SVFLoopVec > ICFGNodeToSVFLoopVec
bool addICFGEdge(ICFGEdge *edge)
Add ICFG edge, only used by addIntraEdge, addCallEdge, addRetEdge etc.
friend class ICFGSimplification
ICFGNodeIDToNodeMapTy::iterator iterator
virtual RetICFGNode * addRetICFGNode(CallICFGNode *call)
void removeICFGEdge(ICFGEdge *edge)
Remove a ICFG edge.
ICFGEdge * getICFGEdge(const ICFGNode *src, const ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
Get a SVFG edge according to src and dst.
Map< const FunObjVar *, FunEntryICFGNode * > FunToFunEntryNodeMapTy
ICFGNode * getICFGNode(NodeID id) const
Get a ICFG node.
FunToFunEntryNodeMapTy FunToFunEntryNodeMap
map a function to its FunExitICFGNode
virtual IntraICFGNode * addIntraICFGNode(const SVFBasicBlock *bb, bool isRet)
void checkIntraEdgeParents(const ICFGNode *srcNode, const ICFGNode *dstNode)
sanitize Intra edges, verify that both nodes belong to the same function.
virtual FunExitICFGNode * addFunExitICFGNode(FunExitICFGNode *funExitICFGNode)
ICFGEdge * addCallEdge(ICFGNode *srcNode, ICFGNode *dstNode)
ICFGNodeToSVFLoopVec icfgNodeToSVFLoopVec
map ICFG node to the SVF loops where it resides
FunExitICFGNode * getFunExitICFGNode(const FunObjVar *fun)
Add a function exit node.
ICFGEdge * hasInterICFGEdge(ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
virtual FunEntryICFGNode * addFunEntryICFGNode(FunEntryICFGNode *funEntryICFGNode)
void addNodeToSVFLoop(const ICFGNode *node, const SVFLoop *loop)
Insert (node, loop) to icfgNodeToSVFLoopVec.
GlobalICFGNode * globalBlockNode
unique basic block for all globals
virtual void addGlobalICFGNode(GlobalICFGNode *globalICFGNode)
ICFGNodeIDToNodeMapTy::const_iterator const_iterator
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
virtual FunExitICFGNode * addFunExitICFGNode(const FunObjVar *svfFunc)
ICFGEdge * addRetEdge(ICFGNode *srcNode, ICFGNode *dstNode)
void updateCallGraph(CallGraph *callgraph)
update ICFG for indirect calls
ICFGEdge * hasIntraICFGEdge(ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
Whether we has a SVFG edge.
friend class GraphDBClient
FunToFunExitNodeMapTy FunToFunExitNodeMap
map a function to its FunEntryICFGNode
ICFGEdge * addConditionalIntraEdge(ICFGNode *srcNode, ICFGNode *dstNode, s64_t branchCondVal)
OrderedMap< NodeID, ICFGNode * > ICFGNodeIDToNodeMapTy
FunExitICFGNode * getFunExitBlock(const FunObjVar *fun)
Get/Add a function exit node.
std::vector< const SVFLoop * > SVFLoopVec
ICFGEdge * addIntraEdge(ICFGNode *srcNode, ICFGNode *dstNode)
Add intraprocedural and interprocedural control-flow edges.
FunEntryICFGNode * getFunEntryICFGNode(const FunObjVar *fun)
Add a function entry node.
bool isInLoop(const ICFGNode *node)
Whether node is in a loop.
~ICFG() override
Destructor.
virtual void addICFGNode(ICFGNode *node)
Add a ICFG node.
GlobalICFGNode * getGlobalICFGNode() const
FunEntryICFGNode * getFunEntryBlock(const FunObjVar *fun)
Get/Add a function entry node.
SVFLoopVec & getSVFLoops(const ICFGNode *node)
Get loops where a node resides.
const ICFGNode * front() const
std::map< Key, Value, Compare, Allocator > OrderedMap
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
GenericGraph< ICFGNode, ICFGEdge > GenericICFGTy
static void getPredNodes(SVF::ICFG *, const SVF::ICFGNode *n, std::vector< const SVF::ICFGNode * > &out)
static void getFunICFGNodes(SVF::ICFG *, const SVF::FunObjVar *fun, std::vector< const SVF::ICFGNode * > &out)
Nodes of fun contained in this graph (whole ICFG: all of them).
static const SVF::ICFGNode * getFunExit(SVF::ICFG *graph, const SVF::FunObjVar *fun)
Exit node of fun under the whole ICFG.
static bool containsNode(SVF::ICFG *, const SVF::ICFGNode *)
Whether n belongs to this graph (whole ICFG contains every node).
static const SVF::ICFGNode * getFunEntry(SVF::ICFG *, const SVF::FunObjVar *fun)
Entry node of fun under this graph (whole ICFG: the entry block's front).
static void getSuccNodes(SVF::ICFG *, const SVF::ICFGNode *n, std::vector< const SVF::ICFGNode * > &out)
Successors / predecessors of n under this graph.