Static Value-Flow Analysis
Loading...
Searching...
No Matches
ConsG.cpp
Go to the documentation of this file.
1//===- ConsG.cpp -- Constraint graph representation-----------------------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-2017> <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 * ConstraintGraph.cpp
25 *
26 * Created on: Oct 14, 2013
27 * Author: Yulei Sui
28 */
29
30#include "Graphs/ConsG.h"
31#include "Util/Options.h"
32
33using namespace SVF;
34using namespace SVFUtil;
35
36
41{
42
43 // initialize nodes
44 for(SVFIR::iterator it = pag->begin(), eit = pag->end(); it!=eit; ++it)
45 {
46 addConstraintNode(new ConstraintNode(it->first), it->first);
47 }
48
49 // initialize edges
51 for (SVFStmt::SVFStmtSetTy::iterator iter = addrs.begin(), eiter =
52 addrs.end(); iter != eiter; ++iter)
53 {
54 const AddrStmt* edge = SVFUtil::cast<AddrStmt>(*iter);
55 addAddrCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
56 }
57
59 for (SVFStmt::SVFStmtSetTy::iterator iter = copys.begin(), eiter =
60 copys.end(); iter != eiter; ++iter)
61 {
62 const CopyStmt* edge = SVFUtil::cast<CopyStmt>(*iter);
63 if(edge->isBitCast() || edge->isValueCopy())
64 addCopyCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
65 }
66
68 for (SVFStmt::SVFStmtSetTy::iterator iter = phis.begin(), eiter =
69 phis.end(); iter != eiter; ++iter)
70 {
71 const PhiStmt* edge = SVFUtil::cast<PhiStmt>(*iter);
72 for(const auto opVar : edge->getOpndVars())
73 addCopyCGEdge(opVar->getId(),edge->getResID());
74 }
75
77 for (SVFStmt::SVFStmtSetTy::iterator iter = selects.begin(), eiter =
78 selects.end(); iter != eiter; ++iter)
79 {
80 const SelectStmt* edge = SVFUtil::cast<SelectStmt>(*iter);
81 for(const auto opVar : edge->getOpndVars())
82 addCopyCGEdge(opVar->getId(),edge->getResID());
83 }
84
86 for (SVFStmt::SVFStmtSetTy::iterator iter = calls.begin(), eiter =
87 calls.end(); iter != eiter; ++iter)
88 {
89 const CallPE* edge = SVFUtil::cast<CallPE>(*iter);
90 addCopyCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
91 }
92
94 for (SVFStmt::SVFStmtSetTy::iterator iter = rets.begin(), eiter =
95 rets.end(); iter != eiter; ++iter)
96 {
97 const RetPE* edge = SVFUtil::cast<RetPE>(*iter);
98 addCopyCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
99 }
100
102 for (SVFStmt::SVFStmtSetTy::iterator iter = tdfks.begin(), eiter =
103 tdfks.end(); iter != eiter; ++iter)
104 {
105 const TDForkPE* edge = SVFUtil::cast<TDForkPE>(*iter);
106 addCopyCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
107 }
108
110 for (SVFStmt::SVFStmtSetTy::iterator iter = tdjns.begin(), eiter =
111 tdjns.end(); iter != eiter; ++iter)
112 {
113 const TDJoinPE* edge = SVFUtil::cast<TDJoinPE>(*iter);
114 addCopyCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
115 }
116
118 for (SVFStmt::SVFStmtSetTy::iterator iter = ngeps.begin(), eiter =
119 ngeps.end(); iter != eiter; ++iter)
120 {
121 GepStmt* edge = SVFUtil::cast<GepStmt>(*iter);
122 if(edge->isVariantFieldGep())
123 addVariantGepCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
124 else
125 addNormalGepCGEdge(edge->getRHSVarID(),edge->getLHSVarID(),edge->getAccessPath());
126 }
127
129 for (SVFStmt::SVFStmtSetTy::iterator iter = loads.begin(), eiter =
130 loads.end(); iter != eiter; ++iter)
131 {
132 LoadStmt* edge = SVFUtil::cast<LoadStmt>(*iter);
133 addLoadCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
134 }
135
137 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
138 stores.end(); iter != eiter; ++iter)
139 {
140 StoreStmt* edge = SVFUtil::cast<StoreStmt>(*iter);
141 addStoreCGEdge(edge->getRHSVarID(),edge->getLHSVarID());
142 }
143
145}
146
151{
154 for(auto cs_pair : pag->getIndirectCallsites())
155 {
156 const RetICFGNode* retBlockNode = cs_pair.first->getRetICFGNode();
159 }
160
162 for (auto it = this->begin(); it != this->end(); ++it)
163 {
164 if (it->second->hasIncomingEdge() || it->second->hasOutgoingEdge())
165 continue;
166 if (pag->getSVFVar(it->first)->isPointer())
167 continue;
168 if (retFromIndCalls.find(it->first)!=retFromIndCalls.end())
169 continue;
170 nodesToRemove.insert(it->second);
171 }
172
173 for (auto node : nodesToRemove)
175}
176
183
188 : ConstraintEdge(s,d,Addr,id)
189{
190 // Retarget addr edges may lead s to be a dummy node
191 const SVFVar* node = SVFIR::getPAG()->getSVFVar(s->getId());
193 {
194 assert(!SVFUtil::isa<DummyValVar>(node) && "a dummy node??");
195 }
196}
197
202{
206 return nullptr;
208
209 bool inserted = AddrCGEdgeSet.insert(edge).second;
210 (void)inserted; // Suppress warning of unused variable under release build
211 assert(inserted && "new AddrCGEdge not added??");
212
213 srcNode->addOutgoingAddrEdge(edge);
214 dstNode->addIncomingAddrEdge(edge);
215 return edge;
216}
217
222{
223
227 return nullptr;
228
230
231 bool inserted = directEdgeSet.insert(edge).second;
232 (void)inserted; // Suppress warning of unused variable under release build
233 assert(inserted && "new CopyCGEdge not added??");
234
235 srcNode->addOutgoingCopyEdge(edge);
236 dstNode->addIncomingCopyEdge(edge);
237 return edge;
238}
239
240
245{
249 return nullptr;
250
253
254 bool inserted = directEdgeSet.insert(edge).second;
255 (void)inserted; // Suppress warning of unused variable under release build
256 assert(inserted && "new NormalGepCGEdge not added??");
257
258 srcNode->addOutgoingGepEdge(edge);
259 dstNode->addIncomingGepEdge(edge);
260 return edge;
261}
262
267{
271 return nullptr;
272
274
275 bool inserted = directEdgeSet.insert(edge).second;
276 (void)inserted; // Suppress warning of unused variable under release build
277 assert(inserted && "new VariantGepCGEdge not added??");
278
279 srcNode->addOutgoingGepEdge(edge);
280 dstNode->addIncomingGepEdge(edge);
281 return edge;
282}
283
288{
292 return nullptr;
293
295
296 bool inserted = LoadCGEdgeSet.insert(edge).second;
297 (void)inserted; // Suppress warning of unused variable under release build
298 assert(inserted && "new LoadCGEdge not added??");
299
300 srcNode->addOutgoingLoadEdge(edge);
301 dstNode->addIncomingLoadEdge(edge);
302 return edge;
303}
304
309{
313 return nullptr;
314
316
317 bool inserted = StoreCGEdgeSet.insert(edge).second;
318 (void)inserted; // Suppress warning of unused variable under release build
319 assert(inserted && "new StoreCGEdge not added??");
320
321 srcNode->addOutgoingStoreEdge(edge);
322 dstNode->addIncomingStoreEdge(edge);
323 return edge;
324}
325
326
335{
336 NodeID newDstNodeID = newDstNode->getId();
337 NodeID srcId = edge->getSrcID();
338 if(LoadCGEdge* load = SVFUtil::dyn_cast<LoadCGEdge>(edge))
339 {
340 removeLoadEdge(load);
342 }
343 else if(StoreCGEdge* store = SVFUtil::dyn_cast<StoreCGEdge>(edge))
344 {
345 removeStoreEdge(store);
347 }
348 else if(CopyCGEdge* copy = SVFUtil::dyn_cast<CopyCGEdge>(edge))
349 {
352 }
353 else if(NormalGepCGEdge* gep = SVFUtil::dyn_cast<NormalGepCGEdge>(edge))
354 {
355 const AccessPath ap = gep->getAccessPath();
358 }
359 else if(VariantGepCGEdge* gep = SVFUtil::dyn_cast<VariantGepCGEdge>(edge))
360 {
363 }
364 else if(AddrCGEdge* addr = SVFUtil::dyn_cast<AddrCGEdge>(edge))
365 {
367 }
368 else
369 assert(false && "no other edge type!!");
370}
371
379{
380 NodeID newSrcNodeID = newSrcNode->getId();
381 NodeID dstId = edge->getDstID();
382 if(LoadCGEdge* load = SVFUtil::dyn_cast<LoadCGEdge>(edge))
383 {
384 removeLoadEdge(load);
386 }
387 else if(StoreCGEdge* store = SVFUtil::dyn_cast<StoreCGEdge>(edge))
388 {
389 removeStoreEdge(store);
391 }
392 else if(CopyCGEdge* copy = SVFUtil::dyn_cast<CopyCGEdge>(edge))
393 {
396 }
397 else if(NormalGepCGEdge* gep = SVFUtil::dyn_cast<NormalGepCGEdge>(edge))
398 {
399 const AccessPath ap = gep->getAccessPath();
402 }
403 else if(VariantGepCGEdge* gep = SVFUtil::dyn_cast<VariantGepCGEdge>(edge))
404 {
407 }
408 else if(AddrCGEdge* addr = SVFUtil::dyn_cast<AddrCGEdge>(edge))
409 {
411 }
412 else
413 assert(false && "no other edge type!!");
414}
415
420{
423 u32_t num = AddrCGEdgeSet.erase(edge);
424 (void)num; // Suppress warning of unused variable under release build
425 assert(num && "edge not in the set, can not remove!!!");
426 delete edge;
427}
428
433{
436 u32_t num = LoadCGEdgeSet.erase(edge);
437 (void)num; // Suppress warning of unused variable under release build
438 assert(num && "edge not in the set, can not remove!!!");
439 delete edge;
440}
441
446{
449 u32_t num = StoreCGEdgeSet.erase(edge);
450 (void)num; // Suppress warning of unused variable under release build
451 assert(num && "edge not in the set, can not remove!!!");
452 delete edge;
453}
454
459{
460
463 u32_t num = directEdgeSet.erase(edge);
464 (void)num; // Suppress warning of unused variable under release build
465 assert(num && "edge not in the set, can not remove!!!");
466 delete edge;
467}
468
474{
475 std::vector<ConstraintEdge*> sccEdges;
476 std::vector<ConstraintEdge*> nonSccEdges;
477 for (ConstraintNode::const_iterator it = node->InEdgeBegin(), eit = node->InEdgeEnd(); it != eit;
478 ++it)
479 {
481 if(sccRepNode(subInEdge->getSrcID()) != rep->getId())
482 nonSccEdges.push_back(subInEdge);
483 else
484 {
485 sccEdges.push_back(subInEdge);
486 }
487 }
488 // if this edge is outside scc, then re-target edge dst to rep
489 while(!nonSccEdges.empty())
490 {
492 nonSccEdges.pop_back();
494 }
495
496 bool criticalGepInsideSCC = false;
497 // if this edge is inside scc, then remove this edge and two end nodes
498 while(!sccEdges.empty())
499 {
500 ConstraintEdge* edge = sccEdges.back();
501 sccEdges.pop_back();
503 if(SVFUtil::isa<CopyCGEdge>(edge))
505 else if (SVFUtil::isa<GepCGEdge>(edge))
506 {
507 // If the GEP is critical (i.e. may have a non-zero offset),
508 // then it brings impact on field-sensitivity.
510 {
512 }
514 }
515 else if(SVFUtil::isa<LoadCGEdge, StoreCGEdge>(edge))
517 else if(AddrCGEdge* addr = SVFUtil::dyn_cast<AddrCGEdge>(edge))
518 {
520 }
521 else
522 assert(false && "no such edge");
523 }
525}
526
532{
533
534 std::vector<ConstraintEdge*> sccEdges;
535 std::vector<ConstraintEdge*> nonSccEdges;
536
537 for (ConstraintNode::const_iterator it = node->OutEdgeBegin(), eit = node->OutEdgeEnd(); it != eit;
538 ++it)
539 {
541 if(sccRepNode(subOutEdge->getDstID()) != rep->getId())
542 nonSccEdges.push_back(subOutEdge);
543 else
544 {
545 sccEdges.push_back(subOutEdge);
546 }
547 }
548 // if this edge is outside scc, then re-target edge src to rep
549 while(!nonSccEdges.empty())
550 {
552 nonSccEdges.pop_back();
554 }
555 bool criticalGepInsideSCC = false;
556 // if this edge is inside scc, then remove this edge and two end nodes
557 while(!sccEdges.empty())
558 {
559 ConstraintEdge* edge = sccEdges.back();
560 sccEdges.pop_back();
562 if(SVFUtil::isa<CopyCGEdge>(edge))
564 else if (SVFUtil::isa<GepCGEdge>(edge))
565 {
566 // If the GEP is critical (i.e. may have a non-zero offset),
567 // then it brings impact on field-sensitivity.
569 {
571 }
573 }
574 else if(SVFUtil::isa<LoadCGEdge, StoreCGEdge>(edge))
576 else if(AddrCGEdge* addr = SVFUtil::dyn_cast<AddrCGEdge>(edge))
577 {
579 }
580 else
581 assert(false && "no such edge");
582 }
584}
585
586
591{
593}
594
599{
600
601 outs() << "-----------------ConstraintGraph--------------------------------------\n";
602
604 for (ConstraintEdge::ConstraintEdgeSetTy::iterator iter = addrs.begin(),
605 eiter = addrs.end(); iter != eiter; ++iter)
606 {
607 outs() << (*iter)->getSrcID() << " -- Addr --> " << (*iter)->getDstID()
608 << "\n";
609 }
610
612 for (ConstraintEdge::ConstraintEdgeSetTy::iterator iter = directs.begin(),
613 eiter = directs.end(); iter != eiter; ++iter)
614 {
615 if (CopyCGEdge* copy = SVFUtil::dyn_cast<CopyCGEdge>(*iter))
616 {
617 outs() << copy->getSrcID() << " -- Copy --> " << copy->getDstID()
618 << "\n";
619 }
620 else if (NormalGepCGEdge* ngep = SVFUtil::dyn_cast<NormalGepCGEdge>(*iter))
621 {
622 outs() << ngep->getSrcID() << " -- NormalGep (" << ngep->getConstantFieldIdx()
623 << ") --> " << ngep->getDstID() << "\n";
624 }
625 else if (VariantGepCGEdge* vgep = SVFUtil::dyn_cast<VariantGepCGEdge>(*iter))
626 {
627 outs() << vgep->getSrcID() << " -- VarintGep --> "
628 << vgep->getDstID() << "\n";
629 }
630 else
631 assert(false && "wrong constraint edge kind!");
632 }
633
635 for (ConstraintEdge::ConstraintEdgeSetTy::iterator iter = loads.begin(),
636 eiter = loads.end(); iter != eiter; ++iter)
637 {
638 outs() << (*iter)->getSrcID() << " -- Load --> " << (*iter)->getDstID()
639 << "\n";
640 }
641
643 for (ConstraintEdge::ConstraintEdgeSetTy::iterator iter = stores.begin(),
644 eiter = stores.end(); iter != eiter; ++iter)
645 {
646 outs() << (*iter)->getSrcID() << " -- Store --> " << (*iter)->getDstID()
647 << "\n";
648 }
649
650 outs()
651 << "--------------------------------------------------------------\n";
652
653}
654
659{
660 SVF::ViewGraph(this, "Constraint Graph");
661}
662
664
666{
667 if (Options::DetectPWC())
668 return directOutEdges.begin();
669 else
670 return copyOutEdges.begin();
671}
672
674{
675 if (Options::DetectPWC())
676 return directOutEdges.end();
677 else
678 return copyOutEdges.end();
679}
680
682{
683 if (Options::DetectPWC())
684 return directInEdges.begin();
685 else
686 return copyInEdges.begin();
687}
688
690{
691 if (Options::DetectPWC())
692 return directInEdges.end();
693 else
694 return copyInEdges.end();
695}
696
698{
699 if (Options::DetectPWC())
700 return directOutEdges.begin();
701 else
702 return copyOutEdges.begin();
703}
704
706{
707 if (Options::DetectPWC())
708 return directOutEdges.end();
709 else
710 return copyOutEdges.end();
711}
712
714{
715 if (Options::DetectPWC())
716 return directInEdges.begin();
717 else
718 return copyInEdges.begin();
719}
720
722{
723 if (Options::DetectPWC())
724 return directInEdges.end();
725 else
726 return copyInEdges.end();
727}
729
730const std::string ConstraintNode::toString() const
731{
732 return SVFIR::getPAG()->getSVFVar(getId())->toString();
733}
734
738namespace SVF
739{
740template<>
742{
743
745 DOTGraphTraits(bool isSimple = false) :
746 DOTGraphTraits<SVFIR*>(isSimple)
747 {
748 }
749
751 static std::string getGraphName(ConstraintGraph*)
752 {
753 return "ConstraintG";
754 }
755
757 {
758 if (Options::ShowHiddenNode()) return false;
759 else return (n->getInEdges().empty() && n->getOutEdges().empty());
760 }
761
764 static std::string getNodeLabel(NodeType *n, ConstraintGraph*)
765 {
766 const SVFVar* node = SVFIR::getPAG()->getSVFVar(n->getId());
768 bool nameDisplay = true;
769 std::string str;
770 std::stringstream rawstr(str);
771
772 if (briefDisplay)
773 {
774 if (SVFUtil::isa<ValVar>(node))
775 {
776 if (nameDisplay)
777 rawstr << node->getId() << ":" << node->getName();
778 else
779 rawstr << node->getId();
780 }
781 else
782 rawstr << node->getId();
783 }
784 else
785 {
786 // print the whole value
787 if (!SVFUtil::isa<DummyValVar>(node) && !SVFUtil::isa<DummyObjVar>(node))
788 rawstr << node->toString();
789 else
790 rawstr << node->getId() << ":";
791
792 }
793
794 return rawstr.str();
795 }
796
798 {
799 const SVFVar* node = SVFIR::getPAG()->getSVFVar(n->getId());
800 if (SVFUtil::isa<ValVar>(node))
801 {
802 if(SVFUtil::isa<GepValVar>(node))
803 return "shape=hexagon";
804 else if (SVFUtil::isa<DummyValVar>(node))
805 return "shape=diamond";
806 else
807 return "shape=box";
808 }
809 else if (SVFUtil::isa<ObjVar>(node))
810 {
811 if(SVFUtil::isa<GepObjVar>(node))
812 return "shape=doubleoctagon";
813 else if(SVFUtil::isa<BaseObjVar>(node))
814 return "shape=box3d";
815 else if (SVFUtil::isa<DummyObjVar>(node))
816 return "shape=tab";
817 else
818 return "shape=component";
819 }
820 else if (SVFUtil::isa<RetValPN>(node))
821 {
822 return "shape=Mrecord";
823 }
824 else if (SVFUtil::isa<VarArgValPN>(node))
825 {
826 return "shape=octagon";
827 }
828 else
829 {
830 assert(0 && "no such kind!!");
831 }
832 return "";
833 }
834
835 template<class EdgeIter>
837 {
838 ConstraintEdge* edge = *(EI.getCurrent());
839 assert(edge && "No edge found!!");
840 if (edge->getEdgeKind() == ConstraintEdge::Addr)
841 {
842 return "color=green";
843 }
844 else if (edge->getEdgeKind() == ConstraintEdge::Copy)
845 {
846 return "color=black";
847 }
848 else if (edge->getEdgeKind() == ConstraintEdge::NormalGep
849 || edge->getEdgeKind() == ConstraintEdge::VariantGep)
850 {
851 return "color=purple";
852 }
853 else if (edge->getEdgeKind() == ConstraintEdge::Store)
854 {
855 return "color=blue";
856 }
857 else if (edge->getEdgeKind() == ConstraintEdge::Load)
858 {
859 return "color=red";
860 }
861 else
862 {
863 assert(0 && "No such kind edge!!");
864 }
865 return "";
866 }
867
868 template<class EdgeIter>
870 {
871 return "";
872 }
873};
874} // End namespace llvm
copy vgep
Definition PAGGrammar.txt:9
copy
Definition cJSON.cpp:414
cJSON * n
Definition cJSON.cpp:2558
const char *const name
Definition cJSON.h:264
AddrCGEdge()
place holder
GenericNode< ConstraintNode, ConstraintEdge >::GEdgeSetTy ConstraintEdgeSetTy
Constraint edge type.
Definition ConsGEdge.h:85
bool moveInEdgesToRepNode(ConstraintNode *node, ConstraintNode *rep)
Definition ConsG.cpp:473
ConstraintEdge::ConstraintEdgeSetTy StoreCGEdgeSet
Definition ConsG.h:64
ConstraintEdge::ConstraintEdgeSetTy directEdgeSet
Definition ConsG.h:62
ConstraintEdge::ConstraintEdgeSetTy LoadCGEdgeSet
Definition ConsG.h:63
LoadCGEdge * addLoadCGEdge(NodeID src, NodeID dst)
Add Load edge.
Definition ConsG.cpp:287
SVFStmt::SVFStmtSetTy & getPAGEdgeSet(SVFStmt::PEDGEK kind)
Definition ConsG.h:72
void view()
View graph from the debugger.
Definition ConsG.cpp:658
NodeID sccRepNode(NodeID id) const
SCC rep/sub nodes methods.
Definition ConsG.h:230
ConstraintEdge::ConstraintEdgeSetTy & getStoreCGEdges()
Get Store edges.
Definition ConsG.h:206
ConstraintEdge::ConstraintEdgeSetTy & getDirectCGEdges()
Get Copy/call/ret/gep edges.
Definition ConsG.h:196
void reTargetDstOfEdge(ConstraintEdge *edge, ConstraintNode *newDstNode)
Used for cycle elimination.
Definition ConsG.cpp:334
AddrCGEdge * addAddrCGEdge(NodeID src, NodeID dst)
Add a SVFIR edge into Edge map.
Definition ConsG.cpp:201
ConstraintEdge::ConstraintEdgeSetTy AddrCGEdgeSet
Definition ConsG.h:61
void addConstraintNode(ConstraintNode *node, NodeID id)
Definition ConsG.h:109
bool hasEdge(ConstraintNode *src, ConstraintNode *dst, ConstraintEdge::ConstraintEdgeK kind)
Definition ConsG.h:125
ConstraintEdge::ConstraintEdgeSetTy & getLoadCGEdges()
Get Load edges.
Definition ConsG.h:201
CopyCGEdge * addCopyCGEdge(NodeID src, NodeID dst)
Add Copy edge.
Definition ConsG.cpp:221
StoreCGEdge * addStoreCGEdge(NodeID src, NodeID dst)
Add Store edge.
Definition ConsG.cpp:308
VariantGepCGEdge * addVariantGepCGEdge(NodeID src, NodeID dst)
Definition ConsG.cpp:266
void removeConstraintNode(ConstraintNode *node)
Definition ConsG.h:118
void removeDirectEdge(ConstraintEdge *edge)
Remove direct edge from their src and dst edge sets.
Definition ConsG.cpp:458
bool moveOutEdgesToRepNode(ConstraintNode *node, ConstraintNode *rep)
Definition ConsG.cpp:531
void removeLoadEdge(LoadCGEdge *edge)
Remove load edge from their src and dst edge sets.
Definition ConsG.cpp:432
ConstraintNode * getConstraintNode(NodeID id) const
Get/add/remove constraint node.
Definition ConsG.h:104
void print()
Print CG into terminal.
Definition ConsG.cpp:598
void reTargetSrcOfEdge(ConstraintEdge *edge, ConstraintNode *newSrcNode)
Remove edge from old src target, change edge dst id and add modified edge into new src.
Definition ConsG.cpp:378
void removeStoreEdge(StoreCGEdge *edge)
Remove store edge from their src and dst edge sets.
Definition ConsG.cpp:445
NormalGepCGEdge * addNormalGepCGEdge(NodeID src, NodeID dst, const AccessPath &ap)
Add Gep edge.
Definition ConsG.cpp:244
ConstraintEdge::ConstraintEdgeSetTy & getAddrCGEdges()
Get SVFIR edge.
Definition ConsG.h:191
void removeAddrEdge(AddrCGEdge *edge)
Remove addr edge from their src and dst edge sets.
Definition ConsG.cpp:419
bool isZeroOffsettedGepCGEdge(ConstraintEdge *edge) const
Check if a given edge is a NormalGepCGEdge with 0 offset.
Definition ConsG.h:289
void dump(std::string name)
Dump graph into dot file.
Definition ConsG.cpp:590
ConstraintEdge::ConstraintEdgeSetTy copyOutEdges
Definition ConsGNode.h:61
ConstraintEdge::ConstraintEdgeSetTy::iterator iterator
Definition ConsGNode.h:44
iterator directInEdgeEnd()
Definition ConsG.cpp:689
bool removeOutgoingStoreEdge(StoreCGEdge *outEdge)
Definition ConsGNode.h:367
bool removeIncomingStoreEdge(StoreCGEdge *inEdge)
Definition ConsGNode.h:376
ConstraintEdge::ConstraintEdgeSetTy copyInEdges
Definition ConsGNode.h:60
ConstraintEdge::ConstraintEdgeSetTy directInEdges
Definition ConsGNode.h:57
bool removeIncomingAddrEdge(AddrCGEdge *inEdge)
Definition ConsGNode.h:314
virtual const std::string toString() const
Definition ConsG.cpp:730
bool removeOutgoingDirectEdge(ConstraintEdge *outEdge)
Definition ConsGNode.h:323
bool removeIncomingDirectEdge(ConstraintEdge *inEdge)
Definition ConsGNode.h:336
bool removeOutgoingLoadEdge(LoadCGEdge *outEdge)
Definition ConsGNode.h:349
iterator directInEdgeBegin()
Definition ConsG.cpp:681
bool removeIncomingLoadEdge(LoadCGEdge *inEdge)
Definition ConsGNode.h:358
iterator directOutEdgeEnd()
Definition ConsG.cpp:673
ConstraintEdge::ConstraintEdgeSetTy::const_iterator const_iterator
Definition ConsGNode.h:45
bool removeOutgoingAddrEdge(AddrCGEdge *outEdge)
Remove constraint graph edges.
Definition ConsGNode.h:305
iterator directOutEdgeBegin()
Iterators.
Definition ConsG.cpp:665
ConstraintEdge::ConstraintEdgeSetTy directOutEdges
Definition ConsGNode.h:58
iterator begin()
Iterators.
IDToNodeMapTy::iterator iterator
Node Iterators.
iterator OutEdgeEnd()
iterator OutEdgeBegin()
iterators
iterator InEdgeBegin()
iterator InEdgeEnd()
static void WriteGraphToFile(SVF::OutStream &O, const std::string &GraphName, const GraphType &GT, bool simple=false)
static const Option< bool > BriefConsCGDotGraph
Definition Options.h:206
static Option< bool > DetectPWC
Definition Options.h:213
static const Option< bool > ShowHiddenNode
Definition Options.h:225
static bool pagReadFromTXT()
Definition SVFIR.h:266
const CallSiteToFunPtrMap & getIndirectCallsites() const
Add/get indirect callsites.
Definition SVFIR.h:433
const SVFVar * getSVFVar(NodeID id) const
ObjVar/GepObjVar/BaseObjVar.
Definition SVFIR.h:131
bool callsiteHasRet(const RetICFGNode *cs) const
Definition SVFIR.h:393
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:116
const SVFVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
Definition SVFIR.h:387
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
NodeID getId() const
Get ID.
Definition SVFValue.h:160
virtual const std::string & getName() const
Definition SVFValue.h:186
virtual bool isPointer() const
Check if this variable represents a pointer.
virtual const std::string toString() const
Get string representation.
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52
for isBitcode
Definition BasicTypes.h:68
Set< NodeID > NodeSet
u32_t NodeID
Definition GeneralType.h:56
void ViewGraph(const GraphType &G, const std::string &name, bool ShortNames=false, GraphProgram::Name Program=GraphProgram::DOT)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
unsigned u32_t
Definition GeneralType.h:47
u32_t EdgeID
Definition GeneralType.h:57
static std::string getNodeAttributes(NodeType *n, ConstraintGraph *)
Definition ConsG.cpp:797
static std::string getEdgeSourceLabel(NodeType *, EdgeIter)
Definition ConsG.cpp:869
static std::string getGraphName(ConstraintGraph *)
Return name of the graph.
Definition ConsG.cpp:751
static std::string getEdgeAttributes(NodeType *, EdgeIter EI, ConstraintGraph *)
Definition ConsG.cpp:836
static std::string getNodeLabel(NodeType *n, ConstraintGraph *)
Definition ConsG.cpp:764
static bool isNodeHidden(NodeType *n, ConstraintGraph *)
Definition ConsG.cpp:756
DOTGraphTraits(bool isSimple=false)
Definition ConsG.cpp:745