30 #ifndef INCLUDE_UTIL_ICFG_H_
31 #define INCLUDE_UTIL_ICFG_H_
58 typedef ICFGNodeIDToNodeMapTy::iterator
iterator;
169 if(srcfun !=
nullptr && dstfun !=
nullptr)
171 assert((srcfun == dstfun) &&
"src and dst nodes of an intra edge should in the same function!" );
180 return intraIcfgNode;
185 const SVFFunction* calledFunc,
bool isVararg,
bool isvcall,
191 isvcall, vcallIdx, funNameOfVcall);
263 std::vector<const ICFGNode*>& subNodes =
_subNodes[sub];
264 if(std::find(subNodes.begin(), subNodes.end(), rep) == subNodes.end())
266 subNodes.push_back(rep);
279 bool added1 = edge->
getDstNode()->addIncomingEdge(edge);
280 bool added2 = edge->
getSrcNode()->addOutgoingEdge(edge);
281 bool all_added = added1 && added2;
282 assert(all_added &&
"ICFGEdge not added?");
void setRetICFGNode(const RetICFGNode *r)
Return callsite.
NodeType * getSrcNode() const
NodeType * getDstNode() const
void addGNode(NodeID id, NodeType *node)
Add a Node.
void removeGNode(NodeType *node)
Delete a node.
NodeType * getGNode(NodeID id) const
Get a node.
bool hasGNode(NodeID id) const
Has a node.
GenericNode< ICFGNode, ICFGEdge >::GEdgeSetTy ICFGEdgeSetTy
virtual const SVFFunction * getFun() const
Return the function of this ICFGNode.
void view()
View graph from the debugger.
FunEntryICFGNode * getFunEntryICFGNode(const SVFFunction *fun)
Add a function entry node.
virtual void addICFGNode(ICFGNode *node)
Add a ICFG node.
bool hasICFGNode(NodeID id) const
Whether has the ICFGNode.
ICFGEdge::ICFGEdgeSetTy ICFGEdgeSetTy
FunExitICFGNode * getFunExitBlock(const SVFFunction *fun)
Get/Add a function exit node.
Map< const SVFFunction *, FunExitICFGNode * > FunToFunExitNodeMapTy
ICFGEdge * hasThreadICFGEdge(ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
void removeICFGNode(ICFGNode *node)
Remove a ICFGNode.
const ICFGNodeToSVFLoopVec & getIcfgNodeToSVFLoopVec() const
Map< const ICFGNode *, SVFLoopVec > ICFGNodeToSVFLoopVec
Map< const SVFFunction *, FunEntryICFGNode * > FunToFunEntryNodeMapTy
bool addICFGEdge(ICFGEdge *edge)
Add ICFG edge, only used by addIntraEdge, addCallEdge, addRetEdge etc.
friend class ICFGSimplification
SVFLoopVec & getSVFLoops(const ICFGNode *node)
Get loops where a node resides.
ICFGNodeIDToNodeMapTy::iterator iterator
void removeICFGEdge(ICFGEdge *edge)
Remove a ICFG edge.
virtual FunEntryICFGNode * addFunEntryICFGNode(const SVFFunction *svfFunc)
void updateCallGraph(PTACallGraph *callgraph)
update ICFG for indirect calls
ICFGEdge * getICFGEdge(const ICFGNode *src, const ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
Get a SVFG edge according to src and dst.
ICFGNode * getICFGNode(NodeID id) const
Get a ICFG node.
const ICFGNode * getRepNode(const ICFGNode *node) const
FunToFunEntryNodeMapTy FunToFunEntryNodeMap
map a function to its FunExitICFGNode
void checkIntraEdgeParents(const ICFGNode *srcNode, const ICFGNode *dstNode)
sanitize Intra edges, verify that both nodes belong to the same function.
virtual FunExitICFGNode * addFunExitICFGNode(const SVFFunction *svfFunc)
Map< const ICFGNode *, const ICFGNode * > _repNode
map a subnode to its representative node(1st node of basicblock)
ICFGEdge * addCallEdge(ICFGNode *srcNode, ICFGNode *dstNode)
ICFGNodeToSVFLoopVec icfgNodeToSVFLoopVec
map ICFG node to the SVF loops where it resides
ICFGEdge * hasInterICFGEdge(ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
void addNodeToSVFLoop(const ICFGNode *node, const SVFLoop *loop)
Insert (node, loop) to icfgNodeToSVFLoopVec.
virtual IntraICFGNode * addIntraICFGNode(const SVFBasicBlock *bb, bool isRet)
GlobalICFGNode * globalBlockNode
unique basic block for all globals
ICFGNodeIDToNodeMapTy::const_iterator const_iterator
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
const std::vector< const ICFGNode * > & getSubNodes(const ICFGNode *node) const
ICFGEdge * addRetEdge(ICFGNode *srcNode, ICFGNode *dstNode)
ICFGEdge * hasIntraICFGEdge(ICFGNode *src, ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
Whether we has a SVFG edge.
FunToFunExitNodeMapTy FunToFunExitNodeMap
map a function to its FunEntryICFGNode
ICFGEdge * addConditionalIntraEdge(ICFGNode *srcNode, ICFGNode *dstNode, s64_t branchCondVal)
virtual CallICFGNode * addCallICFGNode(const SVFBasicBlock *bb, const SVFType *ty, const SVFFunction *calledFunc, bool isVararg, bool isvcall, s32_t vcallIdx, const std::string &funNameOfVcall)
OrderedMap< NodeID, ICFGNode * > ICFGNodeIDToNodeMapTy
virtual RetICFGNode * addRetICFGNode(CallICFGNode *call)
FunEntryICFGNode * getFunEntryBlock(const SVFFunction *fun)
Get/Add a function entry node.
void updateSubAndRep(const ICFGNode *rep, const ICFGNode *sub)
Map< const ICFGNode *, std::vector< const ICFGNode * > > _subNodes
map a node(1st node of basicblock) to its subnodes
std::vector< const SVFLoop * > SVFLoopVec
ICFGEdge * addIntraEdge(ICFGNode *srcNode, ICFGNode *dstNode)
Add intraprocedural and interprocedural control-flow edges.
GlobalICFGNode * getGlobalICFGNode() const
bool isInLoop(const ICFGNode *node)
Whether node is in a loop.
~ICFG() override
Destructor.
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 nod...
void addSubNode(const ICFGNode *rep, const ICFGNode *sub)
when ICFG is simplified, SubNode would merge repNode, then update the map
FunExitICFGNode * getFunExitICFGNode(const SVFFunction *fun)
Add a function exit node.
NodeID getId() const
Get ID.
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
std::map< Key, Value, Compare, Allocator > OrderedMap
GenericGraph< ICFGNode, ICFGEdge > GenericICFGTy