117 if (
pag->isPhiNode(fun_ret)==
false)
133 if (intersection.
empty() ==
false)
146 if (intersection.
empty() ==
false)
244 return (inter1 && inter2);
273 assert(it !=
ValVarToDefMap.end() &&
"a SVFIR node doesn't have definition before");
274 it->second = node->
getId();
283 assert(inserted &&
"can not set actual-in's def twice");
290 assert(inserted &&
"can not set formal-out's def twice");
const CallICFGNode * getCallSite() const
Callsite.
const CallICFGNode * getCallSite() const
Callsite.
const CallICFGNode * getCallSite() const
Return callsite.
const ValVar * getRev() const
Receive parameter at callsite.
const RetICFGNode * getRetICFGNode() const
Return callsite.
bool hasAddressTaken() const
bool hasIncomingEdge() const
Has incoming/outgoing edge set.
bool hasOutgoingEdge() const
iterator OutEdgeBegin()
iterators
const NodeBS & getPointsTo() const
Return points-to of the MR.
u32_t getOpVerNum() const
void setOpVer(u32_t pos, const ValVar *node)
Set< SVFGNode * > SVFGNodeSet
bool isDefOfAInFOut(const SVFGNode *node)
SVFGEdge * addCallIndirectSVFGEdge(NodeID srcId, NodeID dstId, CallSiteID csid, const NodeBS &cpts)
Add inter-procedural value flow edge.
void buildAndWriteSVFG(const std::string &filename)
Optimised SVFG's shouldn't be written in their optimised form; writes the full SVFG to file before op...
void replaceFParamARetWithPHI(PHISVFGNode *phi, SVFGNode *svfgNode)
Replace FormalParam/ActualRet node with PHI node.
void handleIntraValueFlow()
Remove MSSAPHI SVFG nodes.
void retargetEdgesOfAOutFIn(SVFGNode *node)
Connect actual-out/formal-in's predecessors to their successors directly.
void setFormalOUTDef(NodeID fo, NodeID def)
FIFOWorkList< const MSSAPHISVFGNode * > WorkList
void setActualINDef(NodeID ai, NodeID def)
void handleInterValueFlow()
void bypassMSSAPHINode(const MSSAPHISVFGNode *node)
Remove MSSAPHI node if possible.
void resetDef(const ValVar *valVar, const SVFGNode *node)
NodeID getActualINDef(NodeID ai) const
Get def-site of actual-in/formal-out.
Map< NodeID, NodeID > NodeIDToNodeIDMap
void removeInEdges(const SVFGNode *node)
void connectAInAndFIn(const ActualINSVFGNode *actualIn, const FormalINSVFGNode *formalIn, CallSiteID csId, SVFGEdgeSetTy &edges) override
Connect actual-in and formal-in.
SVFGOPT(std::unique_ptr< MemSSA > mssa, VFGK kind)
Constructor.
bool addNewSVFGEdge(NodeID srcId, NodeID dstId, const SVFGEdge *preEdge, const SVFGEdge *succEdge)
Add new SVFG edge from src to dst.
bool bothInterEdges(const SVFGEdge *edge1, const SVFGEdge *edge2) const
Return TRUE if both edges are indirect call/ret edges.
bool formalInOfAddressTakenFunc(const FormalINSVFGNode *fi) const
Check if formal-in/formal-out reside in address-taken function.
bool addIntoWorklist(const SVFGNode *node)
void buildSVFG() override
Start building SVFG.
bool actualOutOfIndCS(const ActualOUTSVFGNode *ao) const
bool keepActualOutFormalIn
InterPHISVFGNode * addInterPHIForAR(const ActualRetSVFGNode *ar)
Add inter PHI SVFG node for actual return.
void connectAParamAndFParam(const ValVar *cs_arg, const ValVar *fun_arg, const CallICFGNode *, CallSiteID csId, SVFGEdgeSetTy &edges) override
Connect SVFG nodes between caller and callee for indirect call sites.
bool formalOutOfAddressTakenFunc(const FormalOUTSVFGNode *fo) const
NodeID getFormalOUTDef(NodeID fo) const
WorkList worklist
storing MSSAPHI nodes which may be removed.
NodeIDToNodeIDMap actualInToDefMap
map actual-in to its def-site node
void setTokeepAllSelfCycle()
InterPHISVFGNode * addInterPHIForFP(const FormalParmSVFGNode *fp)
Add inter PHI SVFG node for formal parameter.
bool isConnectingTwoCallSites(const SVFGNode *node) const
Return TRUE if this node has both incoming call/ret and outgoing call/ret edges.
void readAndOptSVFG(const std::string &filename)
Optimised SVFG's aren't written in their optimised form; read full SVFG and optimise it.
void connectFRetAndARet(const ValVar *fun_ret, const ValVar *cs_ret, CallSiteID csId, SVFGEdgeSetTy &edges) override
Connect formal-ret and actual ret.
bool canBeRemoved(const SVFGNode *node)
NodeIDToNodeIDMap formalOutToDefMap
map formal-out to its def-site node
NodeBS defNodes
preserved def nodes of formal-in/actual-out
void setTokeepContextSelfCycle()
void retargetEdgesOfAInFOut(SVFGNode *node)
Retarget edges related to actual-in/-out and formal-in/-out.
void removeAllEdges(const SVFGNode *node)
Remove edges of a SVFG node.
void addInterPHIOperands(PHISVFGNode *phi, const ValVar *operand)
void parseSelfCycleHandleOption()
bool keepContextSelfCycle
~SVFGOPT() override=default
Destructor.
void connectFOutAndAOut(const FormalOUTSVFGNode *formalOut, const ActualOUTSVFGNode *actualOut, CallSiteID csId, SVFGEdgeSetTy &edges) override
Connect formal-out and actual-out.
void optimiseSVFG()
Separate optimisation function to avoid duplicate code.
void initialWorkList()
Initial work list with MSSAPHI nodes which may be removed.
void removeOutEdges(const SVFGNode *node)
void setTokeepActualOutFormalIn()
bool actualInOfIndCS(const ActualINSVFGNode *ai) const
Check if actual-in/actual-out exist at indirect call site.
SVFGEdge * addRetIndirectSVFGEdge(NodeID srcId, NodeID dstId, CallSiteID csid, const NodeBS &cpts)
Add indirect ret edge from src to dst with one call site ID.
bool checkSelfCycleEdges(const MSSAPHISVFGNode *node)
Remove self cycle edges if needed. Return TRUE if some self cycle edges remained.
SVFG(std::unique_ptr< MemSSA > mssa, VFGK k)
Constructor.
SVFGNode * getSVFGNode(NodeID id) const
Get a SVFG node.
virtual void addSVFGNode(SVFGNode *node, ICFGNode *icfgNode)
Add SVFG node.
void removeSVFGEdge(SVFGEdge *edge)
Remove a SVFG edge.
NodeID getDef(const ValVar *valVar) const
std::unique_ptr< MemSSA > mssa
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
NodeID getId() const
Get ID.
virtual const FunObjVar * getFun() const
Get the function of this SVFGNode.
VFGNodeIDToNodeMapTy::const_iterator const_iterator
VFGEdge * addRetEdge(NodeID srcId, NodeID dstId, CallSiteID csId)
ValVarToDefMapTy ValVarToDefMap
map a pag node to its definition SVG node
VFGEdge * addCallEdge(NodeID srcId, NodeID dstId, CallSiteID csId)
VFGEdge::SVFGEdgeSetTy SVFGEdgeSetTy
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
LLVM_NODISCARD bool isa(const Y &Val)
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
InterPHIVFGNode InterPHISVFGNode
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
ActualRetVFGNode ActualRetSVFGNode
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
FormalParmVFGNode FormalParmSVFGNode