266 PAGNode *currNode = it->second;
270 for (PAGEdge::PAGEdgeSetTy::iterator it =
277 static_cast<const CallInst *
>(inst)->getCalledFunction();
279 if (currFunction !=
nullptr)
282 std::string currFunctionName = currFunction->getName().str();
284 if (std::find(functions.begin(), functions.end(),
285 currFunctionName) != functions.end())
289 if (callDsts.find(callEdge->
getDstNode()) == callDsts.end())
293 functionToPAGNodes[svfFun].push_back(callEdge->
getDstNode());
300 for (
auto it = functionToPAGNodes.begin(); it != functionToPAGNodes.end();
310 std::stack<PAGNode *> todoNodes;
312 std::vector<PAGNode *>
argNodes = it->second;
316 outs() <<
"PAG for function: " << functionName <<
"\n";
317 for (
auto node = argNodes.begin(); node != argNodes.end(); ++node)
319 todoNodes.push(*node);
322 while (!todoNodes.empty())
324 PAGNode *currNode = todoNodes.top();
328 if (nodes.find(currNode) != nodes.end())
continue;
329 nodes.insert(currNode);
339 for (
auto outEdge = outEdges.begin(); outEdge != outEdges.end();
342 edges.insert(*outEdge);
343 todoNodes.push((*outEdge)->getDstNode());
347 for (
auto node = nodes.begin(); node != nodes.end(); ++node)
351 if (std::find(argNodes.begin(), argNodes.end(), *node)
355 getArgNo(
function, (*node)->getValue()));
357 else if (*node == retNode)
367 for (
auto edge = edges.begin(); edge != edges.end(); ++edge)
373 outs() <<
"PAG for functionName " << functionName <<
" done\n";
iterator begin()
Iterators.
std::string functionName
Name of the function this external PAG represents.
OrderedSet< std::tuple< NodeID, NodeID, std::string, int > > edges
Map< int, NodeID > argNodes
static void outputPAGEdge(raw_ostream &o, PAGEdge *pagEdge)
bool hasOutgoingEdges(PAGEdge::PEDGEK kind) const
Has outgoing PAG edges.
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
static PAG * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis. ...
IDToNodeMapTy::iterator iterator
Node Iterators.
static bool classof(const RetPN *)
NodeType * getDstNode() const
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
llvm::Instruction Instruction
const GEdgeSetTy & getOutEdges() const
raw_ostream & outs()
Overwrite llvm::outs()
const CallBlockNode * getCallInst() const
Get method for the call instruction.
static void outputPAGNode(raw_ostream &o, PAGNode *pagNode)
PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesBegin(PAGEdge::PEDGEK kind) const
Get outgoing PAGEdge iterator.
static LLVMModuleSet * getLLVMModuleSet()
const Instruction * getCallSite() const
Return callsite.
const SVFFunction * getSVFFunction(const Function *fun) const
int getArgNo(const SVFFunction *function, const Value *arg)
PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesEnd(PAGEdge::PEDGEK kind) const
Get outgoing PAGEdge iterator.