Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVFIR.cpp
Go to the documentation of this file.
1//===- SVFIR.cpp -- IR of SVF ---------------------------------------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23/*
24 * SVFIR.cpp
25 *
26 * Created on: 31, 12, 2021
27 * Author: Yulei Sui
28 */
29
30#include "Util/Options.h"
31#include "SVFIR/SVFIR.h"
32#include "Graphs/CallGraph.h"
33
34using namespace SVF;
35using namespace SVFUtil;
36
37
38std::unique_ptr<SVFIR> SVFIR::pag;
39
40std::string SVFIR::pagReadFromTxt = "";
41
45
46
47const FunObjVar *SVFIR::getFunObjVar(const std::string &name)
48{
49 for (const auto &item: *callGraph)
50 {
51 if (item.second->getName() == name)
52 {
53 return item.second->getFunction();
54 }
55 }
56 return nullptr;
57}
58
59
64{
65 SVFVar* srcNode = getGNode(src);
66 SVFVar* dstNode = getGNode(dst);
68 return nullptr;
69 else
70 {
73 return addrPE;
74 }
75}
77{
79 addEdge(getGNode(edge->getRHSVarID()),getGNode(edge->getLHSVarID()), edge);
80}
81
86{
87 SVFVar* srcNode = getGNode(src);
88 SVFVar* dstNode = getGNode(dst);
90 return nullptr;
91 else
92 {
95 return copyPE;
96 }
97}
98
100{
102 addEdge(getGNode(edge->getRHSVarID()),getGNode(edge->getLHSVarID()), edge);
103}
104
109{
110 ValVar* opNode = const_cast<ValVar*>(getValVar(opnd));
111 ValVar* resNode = const_cast<ValVar*>(getValVar(res));
112 PHINodeMap::iterator it = phiNodeMap.find(resNode);
113 if(it == phiNodeMap.end())
114 {
115 PhiStmt* phi = new PhiStmt(resNode, {opNode}, {pred});
117 return phi;
118 }
119 else
120 {
121 it->second->addOpVar(opNode,pred);
123 return nullptr;
124 }
125}
126
128{
129 SVFVar* opNode = src;
130 SVFVar* resNode = dst;
131
135
136}
137
142{
143 ValVar* op1Node = const_cast<ValVar*>(getValVar(op1));
144 ValVar* op2Node = const_cast<ValVar*>(getValVar(op2));
145 ValVar* dstNode = const_cast<ValVar*>(getValVar(res));
146 const SVFVar* condNode = getGNode(cond);
148 return nullptr;
149 else
150 {
151 std::vector<ValVar*> opnds = {op1Node, op2Node};
154 return select;
155 }
156}
157
159{
161 addEdge(src, dst, edge);
162}
163
168{
169 ValVar* op1Node = const_cast<ValVar*>(getValVar(op1));
170 ValVar* op2Node = const_cast<ValVar*>(getValVar(op2));
171 ValVar* dstNode = const_cast<ValVar*>(getValVar(dst));
173 return nullptr;
174 else
175 {
176 std::vector<ValVar*> opnds = {op1Node, op2Node};
177 CmpStmt* cmp = new CmpStmt(dstNode, opnds, predicate);
179 return cmp;
180 }
181}
182
184{
186 addEdge(src, dst, edge);
187}
188
189
194{
195 ValVar* op1Node = const_cast<ValVar*>(getValVar(op1));
196 ValVar* op2Node = const_cast<ValVar*>(getValVar(op2));
197 ValVar* dstNode = const_cast<ValVar*>(getValVar(dst));
199 return nullptr;
200 else
201 {
202 std::vector<ValVar*> opnds = {op1Node, op2Node};
205 return binaryOP;
206 }
207}
208
210{
212 addEdge(src, dst, edge);
213}
218{
219 ValVar* srcNode = const_cast<ValVar*>(getValVar(src));
220 ValVar* dstNode = const_cast<ValVar*>(getValVar(dst));
222 return nullptr;
223 else
224 {
227 return unaryOP;
228 }
229}
230
232{
234 addEdge(src, dst, edge);
235}
236
237/*
238* Add BranchStmt
239*/
241{
242 ValVar* brNode = const_cast<ValVar*>(getValVar(br));
243 ValVar* condNode = const_cast<ValVar*>(getValVar(cond));
245 return nullptr;
246 else
247 {
250 return branch;
251 }
252}
253
255{
257 addEdge(src, dst, edge);
258}
259
264{
265 SVFVar* srcNode = getGNode(src);
266 SVFVar* dstNode = getGNode(dst);
268 return nullptr;
269 else
270 {
273 return loadPE;
274 }
275}
276
278{
280 addEdge(getGNode(edge->getRHSVarID()),getGNode(edge->getLHSVarID()), edge);
281}
282
288{
289 SVFVar* srcNode = getGNode(src);
290 SVFVar* dstNode = getGNode(dst);
292 return nullptr;
293 else
294 {
295 StoreStmt* storePE = new StoreStmt(srcNode, dstNode, curVal);
297 return storePE;
298 }
299}
300
302{
304 addEdge(src,dst, edge);
305}
306
311{
312 ValVar* opNode = const_cast<ValVar*>(getValVar(src));
313 ValVar* resNode = const_cast<ValVar*>(getValVar(dst));
314 FParmToCallPEMap::iterator it = fParmToCallPEMap.find(resNode);
315 // if first operand, create a new CallPE, otherwise add the operand to the existing CallPE
316 if(it == fParmToCallPEMap.end())
317 {
318 CallPE* callPE = new CallPE(resNode, {opNode}, {cs}, entry);
319 addCallPE(callPE, opNode, resNode);
320 return callPE;
321 }
322 else
323 {
324 it->second->addOpVar(opNode, cs);
326 return nullptr;
327 }
328}
329
331{
333 addEdge(src, dst, edge);
334 fParmToCallPEMap[dst] = edge;
335}
336
341{
342 SVFVar* srcNode = getGNode(src);
343 SVFVar* dstNode = getGNode(dst);
345 return nullptr;
346 else
347 {
348 RetPE* retPE = new RetPE(srcNode, dstNode, cs, exit);
349 addRetPE(retPE,srcNode,dstNode);
350 return retPE;
351 }
352}
353
355{
357 addEdge(src, dst, edge);
358}
359
364{
366 return pag->addAddrStmt(pag->getBlackHoleNode(), node);
367 else
368 return pag->addCopyStmt(pag->getNullPtr(), node, CopyStmt::COPYVAL);
369}
370
375{
376 ValVar* opNode = const_cast<ValVar*>(getValVar(src));
377 ValVar* resNode = const_cast<ValVar*>(getValVar(dst));
378 FParmToCallPEMap::iterator it = fParmToCallPEMap.find(resNode);
379 // if first operand, create a new TDForkPE, otherwise add the operand to the existing TDForkPE
380 if(it == fParmToCallPEMap.end())
381 {
382 TDForkPE* forkPE = new TDForkPE(resNode, {opNode}, {cs}, entry);
386 return forkPE;
387 }
388 else
389 {
390 it->second->addOpVar(opNode, cs);
391 return nullptr;
392 }
393}
394
399{
400 SVFVar* srcNode = getGNode(src);
401 SVFVar* dstNode = getGNode(dst);
403 return nullptr;
404 else
405 {
406 TDJoinPE* joinPE = new TDJoinPE(srcNode, dstNode, cs, exit);
408 return joinPE;
409 }
410}
411
412
419{
420
421 SVFVar* node = getGNode(src);
422 if (!constGep || node->hasIncomingVariantGepEdge())
423 {
426 return addVariantGepStmt(src, dst, ap);
427 }
428 else
429 {
430 return addNormalGepStmt(src, dst, ap);
431 }
432}
433
438{
439 SVFVar* baseNode = getGNode(src);
440 SVFVar* dstNode = getGNode(dst);
442 return nullptr;
443 else
444 {
445 GepStmt* gepPE = new GepStmt(baseNode, dstNode, ap);
447 return gepPE;
448 }
449}
450
452{
453 SVFVar* baseNode = getGNode(gepPE->getRHSVarID());
454 SVFVar* dstNode = getGNode(gepPE->getLHSVarID());
457
458}
459
465{
466 SVFVar* baseNode = getGNode(src);
467 SVFVar* dstNode = getGNode(dst);
469 return nullptr;
470 else
471 {
472 GepStmt* gepPE = new GepStmt(baseNode, dstNode, ap, true);
475 return gepPE;
476 }
477}
478
479
480
486{
487 NodeID base = baseVar->getId();
488 //assert(findPAGNode(i) == false && "this node should not be created before");
489 assert(0==GepValObjMap[curInst].count(std::make_pair(base, ap))
490 && "this node should not be created before");
491 GepValObjMap[curInst][std::make_pair(base, ap)] = i;
492 GepValVar *node = new GepValVar(baseVar, i, ap, type, icn);
494 return addValNode(node);
495}
496
501{
502 const SVFVar* node = pag->getSVFVar(id);
503 if (const GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
504 return getGepObjVar(gepNode->getBaseObj(), gepNode->getConstantFieldIdx() + apOffset);
505 else if (const BaseObjVar* baseNode = SVFUtil::dyn_cast<BaseObjVar>(node))
506 return getGepObjVar(baseNode, apOffset);
507 else if (const DummyObjVar* baseNode = SVFUtil::dyn_cast<DummyObjVar>(node))
508 return getGepObjVar(baseNode, apOffset);
509 else
510 {
511 assert(false && "new gep obj node kind?");
512 return id;
513 }
514}
515
523{
524 NodeID base = baseObj->getId();
525
527 if (baseObj->isFieldInsensitive())
528 return getFIObjVar(baseObj);
529
530 APOffset newLS = pag->getModulusOffset(baseObj, apOffset);
531
532 // Base and first field are the same memory location.
533 if (Options::FirstFieldEqBase() && newLS == 0) return base;
534
535 OffsetToGepVarMap::iterator iter = GepObjVarMap.find(std::make_pair(base, newLS));
536 if (iter == GepObjVarMap.end())
537 {
540 }
541 else
542 return iter->second;
543
544}
545
547{
548 assert(0==GepObjVarMap.count(std::make_pair(base, apOffset))
549 && "this node should not be created before");
550 GepObjVarMap[std::make_pair(base, apOffset)] = gepObj->getId();
551 memToFieldsMap[base].set(gepObj->getId());
552 return addObjNode(gepObj);
553}
554
559{
560 //assert(findPAGNode(i) == false && "this node should not be created before");
561 NodeID base = baseObj->getId();
562 assert(0==GepObjVarMap.count(std::make_pair(base, apOffset))
563 && "this node should not be created before");
564 //ABTest
565 GepObjVar *node = new GepObjVar(baseObj, gepId, apOffset);
566 return addGepObjNode(node, base, apOffset);
567}
568
573{
574 NodeID base = obj->getId();
575 return memToFieldsMap[base];
576}
577
582{
583 const SVFVar* node = pag->getSVFVar(id);
584 assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
586}
587
594{
595 const SVFVar* node = pag->getSVFVar(id);
596 assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
597 const BaseObjVar* obj = getBaseObject(id);
598 if(obj->isFieldInsensitive())
599 {
600 NodeBS bs;
602 return bs;
603 }
604 else
605 return getAllFieldsObjVars(obj);
606}
607
612{
613 GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
614 if(iter==GepValObjMap.end())
615 {
616 return UINT_MAX;
617 }
618 else
619 {
620 NodeAccessPathMap::const_iterator lit =
621 iter->second.find(std::make_pair(base, ap));
622 if (lit == iter->second.end())
623 return UINT_MAX;
624 else
625 return lit->second;
626 }
627}
628
629
634{
635 delete icfg;
636 icfg = nullptr;
637 delete chgraph;
638 chgraph = nullptr;
639 delete callGraph;
640 callGraph = nullptr;
641}
642
647{
648
649 outs() << "-------------------SVFIR------------------------------------\n";
650 SVFStmt::SVFStmtSetTy& addrs = pag->getSVFStmtSet(SVFStmt::Addr);
651 for (SVFStmt::SVFStmtSetTy::iterator iter = addrs.begin(), eiter =
652 addrs.end(); iter != eiter; ++iter)
653 {
654 outs() << (*iter)->getSrcID() << " -- Addr --> " << (*iter)->getDstID()
655 << "\n";
656 }
657
658 SVFStmt::SVFStmtSetTy& copys = pag->getSVFStmtSet(SVFStmt::Copy);
659 for (SVFStmt::SVFStmtSetTy::iterator iter = copys.begin(), eiter =
660 copys.end(); iter != eiter; ++iter)
661 {
662 outs() << (*iter)->getSrcID() << " -- Copy --> " << (*iter)->getDstID()
663 << "\n";
664 }
665
666 SVFStmt::SVFStmtSetTy& calls = pag->getSVFStmtSet(SVFStmt::Call);
667 for (SVFStmt::SVFStmtSetTy::iterator iter = calls.begin(), eiter =
668 calls.end(); iter != eiter; ++iter)
669 {
670 outs() << (*iter)->getSrcID() << " -- Call --> " << (*iter)->getDstID()
671 << "\n";
672 }
673
674 SVFStmt::SVFStmtSetTy& rets = pag->getSVFStmtSet(SVFStmt::Ret);
675 for (SVFStmt::SVFStmtSetTy::iterator iter = rets.begin(), eiter =
676 rets.end(); iter != eiter; ++iter)
677 {
678 outs() << (*iter)->getSrcID() << " -- Ret --> " << (*iter)->getDstID()
679 << "\n";
680 }
681
683 for (SVFStmt::SVFStmtSetTy::iterator iter = tdfks.begin(), eiter =
684 tdfks.end(); iter != eiter; ++iter)
685 {
686 outs() << (*iter)->getSrcID() << " -- ThreadFork --> "
687 << (*iter)->getDstID() << "\n";
688 }
689
691 for (SVFStmt::SVFStmtSetTy::iterator iter = tdjns.begin(), eiter =
692 tdjns.end(); iter != eiter; ++iter)
693 {
694 outs() << (*iter)->getSrcID() << " -- ThreadJoin --> "
695 << (*iter)->getDstID() << "\n";
696 }
697
698 SVFStmt::SVFStmtSetTy& ngeps = pag->getSVFStmtSet(SVFStmt::Gep);
699 for (SVFStmt::SVFStmtSetTy::iterator iter = ngeps.begin(), eiter =
700 ngeps.end(); iter != eiter; ++iter)
701 {
702 GepStmt* gep = SVFUtil::cast<GepStmt>(*iter);
703 if(gep->isVariantFieldGep())
704 outs() << (*iter)->getSrcID() << " -- VariantGep --> "
705 << (*iter)->getDstID() << "\n";
706 else
707 outs() << gep->getRHSVarID() << " -- Gep (" << gep->getConstantStructFldIdx()
708 << ") --> " << gep->getLHSVarID() << "\n";
709 }
710
711 SVFStmt::SVFStmtSetTy& loads = pag->getSVFStmtSet(SVFStmt::Load);
712 for (SVFStmt::SVFStmtSetTy::iterator iter = loads.begin(), eiter =
713 loads.end(); iter != eiter; ++iter)
714 {
715 outs() << (*iter)->getSrcID() << " -- Load --> " << (*iter)->getDstID()
716 << "\n";
717 }
718
720 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
721 stores.end(); iter != eiter; ++iter)
722 {
723 outs() << (*iter)->getSrcID() << " -- Store --> " << (*iter)->getDstID()
724 << "\n";
725 }
726 outs() << "----------------------------------------------------------\n";
727
728}
729
732{
733 // collect candidate pointers for demand-driven analysis
734 for (iterator nIter = begin(); nIter != end(); ++nIter)
735 {
736 NodeID nodeId = nIter->first;
737 // do not compute points-to for isolated node
738 if (isValidPointer(nodeId) == false)
739 continue;
741 }
742}
743/*
744 * If this is a dummy node or node does not have incoming edges and outgoing edges we assume it is not a pointer here.
745 * However, if it is a pointer and it is an argument of a function definition, we assume it is a pointer here.
746 */
748{
749 const SVFVar* node = pag->getSVFVar(nodeId);
750
751 if(node->isPointer())
752 if (const ValVar* pVar = pag->getBaseValVar(nodeId))
753 if (const ArgValVar* arg = SVFUtil::dyn_cast<ArgValVar>(pVar))
754 if (!(arg->getParent()->isDeclaration()))
755 return true;
756
757 if ((node->getInEdges().empty() && node->getOutEdges().empty()))
758 return false;
759 return node->isPointer();
760}
761
763{
764 if (SVFUtil::isa<ValVar>(node))
765 {
766 if (isValidPointer(node->getId()))
767 {
768 const ValVar* baseVar = pag->getBaseValVar(node->getId());
769 if(!SVFUtil::isa<DummyValVar, BlackHoleValVar>(baseVar))
771 }
772 }
773 return false;
774}
775
783
785{
786 assert(node && "node cannot be nullptr.");
787 assert(hasGNode(node->getId()) == false &&
788 "This NodeID clashes here. Please check NodeIDAllocator. Switch "
789 "Strategy::DBUG to SEQ or DENSE");
790 return addNode(node);
791}
792
794{
795 assert(node && "node cannot be nullptr.");
796 assert(hasGNode(node->getId()) == false &&
797 "This NodeID clashes here. Please check NodeIDAllocator. Switch "
798 "Strategy::DBUG to SEQ or DENSE");
799 return addNode(node);
800}
801
803{
804 return addObjNode(node);
805}
newitem type
Definition cJSON.cpp:2739
const cJSON *const b
Definition cJSON.h:255
const char *const name
Definition cJSON.h:264
cJSON * item
Definition cJSON.h:222
int count
Definition cJSON.h:216
void setValue(T v)
Class representing a function argument variable in the SVFIR.
std::vector< std::pair< const ICFGNode *, s32_t > > SuccAndCondPairVec
void addOpVar(ValVar *op, const CallICFGNode *call)
Add an operand (actual param) from a call site.
bool hasGNode(NodeID id) const
Has a node.
IDToNodeMapTy::iterator iterator
Node Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
void setLLVMVarInstID(NodeID id)
Set the LLVM variable ID associated with this GepValVar.
SVFStmt * hasLabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind, const ICFGNode *cs)
Definition IRGraph.cpp:291
NodeID addNode(SVFVar *node)
Add a node into the graph.
Definition IRGraph.h:117
bool addEdge(SVFVar *src, SVFVar *dst, SVFStmt *edge)
Add an edge into the graph.
Definition IRGraph.cpp:253
SVFStmt * hasNonlabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind)
Definition IRGraph.cpp:268
static NodeIDAllocator * get(void)
Return (singleton) allocator.
NodeID allocateGepObjectId(NodeID base, u32_t offset, u32_t maxFieldLimit)
static const Option< bool > FirstFieldEqBase
Definition Options.h:100
static Option< bool > HandBlackHole
Definition Options.h:99
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
Definition Options.h:35
GepStmt * addVariantGepStmt(NodeID src, NodeID dst, const AccessPath &ap)
Add Variant(Gep) edge.
Definition SVFIR.cpp:464
CopyStmt * addCopyStmt(NodeID src, NodeID dst, CopyStmt::CopyKind type)
Add Copy edge.
Definition SVFIR.cpp:85
NodeID getGepValVar(NodeID curInst, NodeID base, const AccessPath &ap) const
Due to constraint expression, curInst is used to distinguish different instructions (e....
Definition SVFIR.cpp:611
RetPE * addRetPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
Add Return edge.
Definition SVFIR.cpp:340
GepStmt * addGepStmt(NodeID src, NodeID dst, const AccessPath &ap, bool constGep)
Add Gep edge.
Definition SVFIR.cpp:418
void print()
Print SVFIR.
Definition SVFIR.cpp:646
static void handleBlackHole(bool b)
SVFIR build configurations.
Definition SVFIR.cpp:779
FParmToCallPEMap fParmToCallPEMap
Map a formal param to its CallPE.
Definition SVFIR.h:88
void addToStmt2TypeMap(SVFStmt *edge)
Map a SVFStatement type to a set of corresponding SVF statements.
Definition SVFIR.h:601
CommonCHGraph * chgraph
Definition SVFIR.h:99
SVFStmt * addBlackHoleAddrStmt(NodeID node)
Set a pointer points-to black hole (e.g. int2ptr)
Definition SVFIR.cpp:363
LoadStmt * addLoadStmt(NodeID src, NodeID dst)
Add Load edge.
Definition SVFIR.cpp:263
NodeID addGepValNode(NodeID curInst, const ValVar *base, const AccessPath &ap, NodeID i, const SVFType *type, const ICFGNode *node)
Add a temp field value node, this method can only invoked by getGepValVar.
Definition SVFIR.cpp:485
GepStmt * addNormalGepStmt(NodeID src, NodeID dst, const AccessPath &ap)
Add Offset(Gep) edge.
Definition SVFIR.cpp:437
MemObjToFieldsMap memToFieldsMap
Map a mem object id to all its fields.
Definition SVFIR.h:85
PHINodeMap phiNodeMap
A set of phi copy edges.
Definition SVFIR.h:87
NodeBS getFieldsAfterCollapse(NodeID id)
Definition SVFIR.cpp:593
NodeID addObjNode(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Add a memory obj node.
Definition SVFIR.h:722
CallPE * addCallPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
Add Call edge (phi-like: merges actual params from all call sites into formal param)
Definition SVFIR.cpp:310
bool isValidTopLevelPtr(const SVFVar *node)
Definition SVFIR.cpp:762
TDJoinPE * addThreadJoinPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
Add Thread join edge for parameter passing.
Definition SVFIR.cpp:398
CallGraph * callGraph
all the callsites of a program
Definition SVFIR.h:101
static std::string pagReadFromTxt
Definition SVFIR.h:104
void destroy()
Clean up memory.
Definition SVFIR.cpp:633
const BaseObjVar * getBaseObject(NodeID id) const
Definition SVFIR.h:496
const FunObjVar * getFunObjVar(const std::string &name)
Definition SVFIR.cpp:47
CmpStmt * addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t predict)
Add Copy edge.
Definition SVFIR.cpp:167
AddrStmt * addAddrStmt(NodeID src, NodeID dst)
Add an edge into SVFIR.
Definition SVFIR.cpp:63
UnaryOPStmt * addUnaryOPStmt(NodeID src, NodeID dst, u32_t opcode)
Add Unary edge.
Definition SVFIR.cpp:217
TDForkPE * addThreadForkPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
Add Thread fork edge for parameter passing.
Definition SVFIR.cpp:374
BinaryOPStmt * addBinaryOPStmt(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
Add Copy edge.
Definition SVFIR.cpp:193
NodeBS & getAllFieldsObjVars(const BaseObjVar *obj)
Get all fields of an object.
Definition SVFIR.cpp:572
static std::unique_ptr< SVFIR > pag
Callgraph with direct calls only; no change allowed after init and use callgraph in PointerAnalysis f...
Definition SVFIR.h:103
NodeID addValNode(NodeID i, const SVFType *type, const ICFGNode *icfgNode)
add node into SVFIR
Definition SVFIR.h:663
StoreStmt * addStoreStmt(NodeID src, NodeID dst, const ICFGNode *val)
Add Store edge.
Definition SVFIR.cpp:287
NodeID addGepObjNode(GepObjVar *gepObj, NodeID base, const APOffset &apOffset)
Definition SVFIR.cpp:546
OffsetToGepVarMap GepObjVarMap
Map a pair<base,off> to a gep obj node id.
Definition SVFIR.h:84
PhiStmt * addPhiStmt(NodeID res, NodeID opnd, const ICFGNode *pred)
Add phi node information.
Definition SVFIR.cpp:108
OrderedNodeSet candidatePointers
Definition SVFIR.h:97
ICFG * icfg
Definition SVFIR.h:98
SVFIR(bool buildFromFile)
Constructor.
Definition SVFIR.cpp:42
SelectStmt * addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond)
Add SelectStmt.
Definition SVFIR.cpp:141
GepValueVarMap GepValObjMap
Map a pair<base,off> to a gep value node id.
Definition SVFIR.h:82
const GepObjVar * getGepObjVar(NodeID id) const
Definition SVFIR.h:167
bool isValidPointer(NodeID nodeId) const
Whether a node is a valid pointer.
Definition SVFIR.cpp:747
BranchStmt * addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec &succs)
Add BranchStmt.
Definition SVFIR.cpp:240
const ValVar * getValVar(NodeID id) const
Definition SVFIR.h:137
void initialiseCandidatePointers()
Initialize candidate pointers.
Definition SVFIR.cpp:731
NodeID getFIObjVar(const BaseObjVar *obj) const
Get a field-insensitive obj SVFIR node according to a mem obj.
Definition SVFIR.h:522
NodeID addDummyObjNode(const SVFType *type)
Definition SVFIR.h:568
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
NodeID getId() const
Get ID.
Definition SVFValue.h:163
virtual bool isPointer() const
Check if this variable represents a pointer.
bool hasIncomingVariantGepEdge() const
Check for incoming variable field GEP edges.
void set(unsigned Idx)
bool isArgOfUncalledFunction(const SVFVar *svfvar)
Definition SVFUtil.cpp:422
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52
for isBitcode
Definition BasicTypes.h:70
u32_t NodeID
Definition GeneralType.h:56
s64_t APOffset
Definition GeneralType.h:60
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
unsigned u32_t
Definition GeneralType.h:47