Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVFValue.h
Go to the documentation of this file.
1//===- BasicTypes.h -- Basic types used in SVF-------------------------------//
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 * BasicTypes.h
25 *
26 * Created on: Apr 1, 2014
27 * Author: Yulei Sui
28 */
29
30#ifndef INCLUDE_SVFIR_SVFVALUE_H_
31#define INCLUDE_SVFIR_SVFVALUE_H_
32
33#include "SVFIR/SVFType.h"
34#include "Graphs/GraphPrinter.h"
35#include "Util/Casting.h"
36
37namespace SVF
38{
39
42
43class CallGraphNode;
44class SVFInstruction;
45class SVFBasicBlock;
46class SVFArgument;
47class SVFFunction;
48class SVFType;
49
51{
52 friend class SVFIRWriter;
53 friend class SVFIRReader;
54public:
56 typedef std::vector<const SVFBasicBlock*> BBList;
57 typedef BBList LoopBBs;
58
59private:
67
68public:
70 {
71 }
72
73 virtual ~SVFLoopAndDomInfo() {}
74
76 {
77 return dfBBsMap;
78 }
79
84
85 inline bool hasLoopInfo(const SVFBasicBlock* bb) const
86 {
87 return bb2LoopMap.find(bb) != bb2LoopMap.end();
88 }
89
90 const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const;
91
92 inline const SVFBasicBlock* getLoopHeader(const LoopBBs& lp) const
93 {
94 assert(!lp.empty() && "this is not a loop, empty basic block");
95 return lp.front();
96 }
97
98 inline bool loopContainsBB(const LoopBBs& lp, const SVFBasicBlock* bb) const
99 {
100 return std::find(lp.begin(), lp.end(), bb) != lp.end();
101 }
102
103 inline void addToBB2LoopMap(const SVFBasicBlock* bb, const SVFBasicBlock* loopBB)
104 {
105 bb2LoopMap[bb].push_back(loopBB);
106 }
107
109 {
110 return pdtBBsMap;
111 }
112
117
119 {
120 return bb2PdomLevel;
121 }
122
127
129 {
130 return bb2PIdom;
131 }
132
137
138
140 {
141 return dtBBsMap;
142 }
143
145 {
146 return dtBBsMap;
147 }
148
149 inline bool isUnreachable(const SVFBasicBlock* bb) const
150 {
151 return std::find(reachableBBs.begin(), reachableBBs.end(), bb) ==
152 reachableBBs.end();
153 }
154
155 inline const BBList& getReachableBBs() const
156 {
157 return reachableBBs;
158 }
159
161 {
163 }
164
165 void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const;
166
167 bool isLoopHeader(const SVFBasicBlock* bb) const;
168
169 bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const;
170
171 bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const;
172
175};
176
178{
179 friend class SVFIRWriter;
180 friend class SVFIRReader;
181 friend class LLVMModuleSet;
182
183public:
184 typedef s64_t GNodeK;
185
205
206private:
210
211protected:
212 const SVFType* type;
213 std::string name;
214 std::string sourceLoc;
221
225 {
226 constDataOrAggData = true;
227 }
229 {
230 ptrInUncalledFun = true;
231 }
233public:
234 SVFValue() = delete;
235 virtual ~SVFValue() = default;
236
238 inline GNodeK getKind() const
239 {
240 return kind;
241 }
242
243 inline const std::string &getName() const
244 {
245 return name;
246 }
247 inline void setName(const std::string& n)
248 {
249 name = n;
250 }
251 inline void setName(std::string&& n)
252 {
253 name = std::move(n);
254 }
255
256 inline virtual const SVFType* getType() const
257 {
258 return type;
259 }
260 inline bool isConstDataOrAggData() const
261 {
262 return constDataOrAggData;
263 }
264 inline bool ptrInUncalledFunction() const
265 {
266 return ptrInUncalledFun;
267 }
268 inline bool isblackHole() const
269 {
270 return getKind() == SVFBlackHole;;
271 }
272 inline bool isNullPtr() const
273 {
274 return getKind() == SVFNullPtr;
275 }
276 inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
277 {
279 }
280 inline virtual const std::string getSourceLoc() const
281 {
282 return sourceLoc;
283 }
284
286 std::string toString() const;
287
289
290 friend OutStream& operator<<(OutStream &os, const SVFValue &value)
291 {
292 return os << value.toString();
293 }
295};
296
297class SVFFunction : public SVFValue
298{
299 friend class LLVMModuleSet;
300 friend class SVFIRWriter;
301 friend class SVFIRReader;
302 friend class SVFIRBuilder;
303
304public:
305 typedef std::vector<const SVFBasicBlock*>::const_iterator const_iterator;
309
310private:
311 bool isDecl;
315 bool isNotRet;
316 bool varArg;
320 std::vector<const SVFBasicBlock*> allBBs;
321 std::vector<const SVFArgument*> allArgs;
324
325protected:
327 {
329 }
330
332 inline void addBasicBlock(const SVFBasicBlock* bb)
333 {
334 allBBs.push_back(bb);
335 }
336
338 {
339 allArgs.push_back(arg);
340 }
341
346
347 inline void setIsNotRet(bool notRet)
348 {
350 }
351
353 {
355 }
357
358public:
359 SVFFunction(const SVFType* ty,const SVFFunctionType* ft, bool declare, bool intrinsic, bool addrTaken, bool varg, SVFLoopAndDomInfo* ld);
360 SVFFunction(void) = delete;
361 virtual ~SVFFunction();
362
363 inline const CallGraphNode* getCallGraphNode() const
364 {
365 return callGraphNode;
366 }
367
368 static inline bool classof(const SVFValue *node)
369 {
370 return node->getKind() == SVFFunc;
371 }
372
374 {
375 return loopAndDom;
376 }
377 inline bool isDeclaration() const
378 {
379 return isDecl;
380 }
381
382 inline bool isIntrinsic() const
383 {
384 return intrinsic;
385 }
386
387 inline bool hasAddressTaken() const
388 {
389 return addrTaken;
390 }
391
393 inline const SVFFunctionType* getFunctionType() const
394 {
395 return funcType;
396 }
397
399 inline const SVFType* getReturnType() const
400 {
401 return funcType->getReturnType();
402 }
403
405 {
406 if(realDefFun==nullptr)
407 return this;
408 return realDefFun;
409 }
410
411 u32_t arg_size() const;
412 const SVFArgument* getArg(u32_t idx) const;
413 bool isVarArg() const;
414
415 inline bool hasBasicBlock() const
416 {
417 return !allBBs.empty();
418 }
419
420 inline const SVFBasicBlock* getEntryBlock() const
421 {
422 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
423 return allBBs.front();
424 }
425
428 const SVFBasicBlock* getExitBB() const;
429
430 void setExitBlock(SVFBasicBlock *bb);
431
432 inline const SVFBasicBlock* front() const
433 {
434 return getEntryBlock();
435 }
436
437 inline const SVFBasicBlock* back() const
438 {
439 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
443 return allBBs.back();
444 }
445
446 inline const_iterator begin() const
447 {
448 return allBBs.begin();
449 }
450
451 inline const_iterator end() const
452 {
453 return allBBs.end();
454 }
455
456 inline const std::vector<const SVFBasicBlock*>& getBasicBlockList() const
457 {
458 return allBBs;
459 }
460
461 inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
462 {
463 return loopAndDom->getReachableBBs();
464 }
465
466 inline bool isUncalledFunction() const
467 {
468 return isUncalled;
469 }
470
471 inline bool hasReturn() const
472 {
473 return !isNotRet;
474 }
475
476 inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
477 {
479 }
480
481 inline bool hasLoopInfo(const SVFBasicBlock* bb) const
482 {
483 return loopAndDom->hasLoopInfo(bb);
484 }
485
486 const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
487 {
488 return loopAndDom->getLoopInfo(bb);
489 }
490
491 inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
492 {
493 return loopAndDom->getLoopHeader(lp);
494 }
495
496 inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
497 {
498 return loopAndDom->loopContainsBB(lp,bb);
499 }
500
502 {
503 return loopAndDom->getDomTreeMap();
504 }
505
507 {
509 }
510
511 inline bool isLoopHeader(const SVFBasicBlock* bb) const
512 {
513 return loopAndDom->isLoopHeader(bb);
514 }
515
516 inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
517 {
519 }
520
521 inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
522 {
524 }
525};
526
527class ICFGNode;
528
530{
531 friend class LLVMModuleSet;
532 friend class SVFIRWriter;
533 friend class SVFIRReader;
534 friend class SVFIRBuilder;
535 friend class SVFFunction;
536 friend class ICFGBuilder;
537 friend class ICFG;
538
539public:
540 typedef std::vector<const ICFGNode*>::const_iterator const_iterator;
541
542private:
543 std::vector<const ICFGNode*> allICFGNodes;
544 std::vector<const SVFBasicBlock*> succBBs;
545 std::vector<const SVFBasicBlock*> predBBs;
547
548protected:
550
551 inline void addICFGNode(const ICFGNode* icfgNode)
552 {
554 icfgNode) == getICFGNodeList().end() && "duplicated icfgnode");
555 allICFGNodes.push_back(icfgNode);
556 }
557
559 {
560 succBBs.push_back(succ);
561 }
562
564 {
565 predBBs.push_back(pred);
566 }
568
569public:
571 SVFBasicBlock(const SVFType* ty, const SVFFunction* f);
572 SVFBasicBlock() = delete;
573 ~SVFBasicBlock() override;
574
575 static inline bool classof(const SVFValue *node)
576 {
577 return node->getKind() == SVFBB;
578 }
579
580 inline const std::vector<const ICFGNode*>& getICFGNodeList() const
581 {
582 return allICFGNodes;
583 }
584
585 inline const_iterator begin() const
586 {
587 return allICFGNodes.begin();
588 }
589
590 inline const_iterator end() const
591 {
592 return allICFGNodes.end();
593 }
594
595 inline const SVFFunction* getParent() const
596 {
597 return fun;
598 }
599
600 inline const SVFFunction* getFunction() const
601 {
602 return fun;
603 }
604
605 inline const ICFGNode* front() const
606 {
607 assert(!allICFGNodes.empty() && "bb empty?");
608 return allICFGNodes.front();
609 }
610
611 inline const ICFGNode* back() const
612 {
613 assert(!allICFGNodes.empty() && "bb empty?");
614 return allICFGNodes.back();
615 }
616
617 inline const std::vector<const SVFBasicBlock*>& getSuccessors() const
618 {
619 return succBBs;
620 }
621
622 inline const std::vector<const SVFBasicBlock*>& getPredecessors() const
623 {
624 return predBBs;
625 }
627 {
628 return succBBs.size();
629 }
634};
635
637{
638 friend class SVFIRWriter;
639 friend class SVFIRReader;
640
641private:
644 bool ret;
645
646public:
648 SVFInstruction(const SVFType* ty, const SVFBasicBlock* b, bool tm,
649 bool isRet, SVFValKind k = SVFInst);
650 SVFInstruction(void) = delete;
651
652 static inline bool classof(const SVFValue *node)
653 {
654 return node->getKind() == SVFInst ||
655 node->getKind() == SVFCall ||
656 node->getKind() == SVFVCall;
657 }
658
659 inline const SVFBasicBlock* getParent() const
660 {
661 return bb;
662 }
663
664 inline const SVFFunction* getFunction() const
665 {
666 return bb->getParent();
667 }
668
669 inline bool isRetInst() const
670 {
671 return ret;
672 }
673};
674
676{
677 friend class SVFIRWriter;
678 friend class SVFIRReader;
679 friend class LLVMModuleSet;
680 friend class SVFIRBuilder;
681
682private:
683 std::vector<const SVFValue*> args;
684 bool varArg;
686
687protected:
689 inline void addArgument(const SVFValue* a)
690 {
691 args.push_back(a);
692 }
693 inline void setCalledOperand(const SVFValue* v)
694 {
695 calledVal = v;
696 }
698
699public:
700 SVFCallInst(const SVFType* ty, const SVFBasicBlock* b, bool va, bool tm, SVFValKind k = SVFCall) :
702 {
703 }
704 SVFCallInst(void) = delete;
705
706 static inline bool classof(const SVFValue *node)
707 {
708 return node->getKind() == SVFCall || node->getKind() == SVFVCall;
709 }
710 static inline bool classof(const SVFInstruction *node)
711 {
712 return node->getKind() == SVFCall || node->getKind() == SVFVCall;
713 }
714 inline u32_t arg_size() const
715 {
716 return args.size();
717 }
718 inline bool arg_empty() const
719 {
720 return args.empty();
721 }
722 inline const SVFValue* getArgOperand(u32_t i) const
723 {
724 assert(i < arg_size() && "out of bound access of the argument");
725 return args[i];
726 }
728 {
729 return arg_size();
730 }
731 inline const SVFValue* getCalledOperand() const
732 {
733 return calledVal;
734 }
735 inline bool isVarArg() const
736 {
737 return varArg;
738 }
739 inline const SVFFunction* getCalledFunction() const
740 {
741 return SVFUtil::dyn_cast<SVFFunction>(calledVal);
742 }
743 inline const SVFFunction* getCaller() const
744 {
745 return getFunction();
746 }
747};
748
749class SVFConstant : public SVFValue
750{
751 friend class SVFIRWriter;
752 friend class SVFIRReader;
753public:
755 {
756 }
757 SVFConstant() = delete;
758
759 static inline bool classof(const SVFValue *node)
760 {
761 return node->getKind() == SVFConst ||
762 node->getKind() == SVFGlob ||
763 node->getKind() == SVFConstData ||
764 node->getKind() == SVFConstInt ||
765 node->getKind() == SVFConstFP ||
766 node->getKind() == SVFNullPtr ||
767 node->getKind() == SVFBlackHole;
768 }
769
770};
771
773{
774 friend class SVFIRWriter;
775 friend class SVFIRReader;
776 friend class LLVMModuleSet;
777
778private:
780
781protected:
783 {
785 }
786
787public:
791 SVFGlobalValue(std::string&& name, const SVFType* ty) : SVFGlobalValue(ty)
792 {
793 setName(std::move(name));
794 }
795 SVFGlobalValue() = delete;
796
798 {
799 if(realDefGlobal==nullptr)
800 return this;
801 return realDefGlobal;
802 }
803 static inline bool classof(const SVFValue *node)
804 {
805 return node->getKind() == SVFGlob;
806 }
807 static inline bool classof(const SVFConstant *node)
808 {
809 return node->getKind() == SVFGlob;
810 }
811};
812
813class SVFArgument : public SVFValue
814{
815 friend class SVFIRWriter;
816 friend class SVFIRReader;
817private:
821public:
823 bool uncalled)
826 {
827 }
828 SVFArgument() = delete;
829
830 inline const SVFFunction* getParent() const
831 {
832 return fun;
833 }
834
837 inline u32_t getArgNo() const
838 {
839 return argNo;
840 }
841
842 inline bool isArgOfUncalledFunction() const
843 {
844 return uncalled;
845 }
846
847 static inline bool classof(const SVFValue *node)
848 {
849 return node->getKind() == SVFArg;
850 }
851};
852
854{
855 friend class SVFIRWriter;
856 friend class SVFIRReader;
857public:
862 SVFConstantData() = delete;
863
864 static inline bool classof(const SVFValue *node)
865 {
866 return node->getKind() == SVFConstData ||
867 node->getKind() == SVFConstInt ||
868 node->getKind() == SVFConstFP ||
869 node->getKind() == SVFNullPtr ||
870 node->getKind() == SVFBlackHole;
871 }
872 static inline bool classof(const SVFConstantData *node)
873 {
874 return node->getKind() == SVFConstData ||
875 node->getKind() == SVFConstInt ||
876 node->getKind() == SVFConstFP ||
877 node->getKind() == SVFNullPtr ||
878 node->getKind() == SVFBlackHole;
879 }
880};
881
883{
884 friend class SVFIRWriter;
885 friend class SVFIRReader;
886private:
889public:
894 SVFConstantInt() = delete;
895
896 static inline bool classof(const SVFValue *node)
897 {
898 return node->getKind() == SVFConstInt;
899 }
900 static inline bool classof(const SVFConstantData *node)
901 {
902 return node->getKind() == SVFConstInt;
903 }
904 // Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate for the type of this constant.
905 inline u64_t getZExtValue () const
906 {
907 return zval;
908 }
909 // Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the type of this constant
910 inline s64_t getSExtValue () const
911 {
912 return sval;
913 }
914};
915
917{
918 friend class SVFIRWriter;
919 friend class SVFIRReader;
920private:
921 float dval;
922public:
923 SVFConstantFP(const SVFType* ty, double d)
925 {
926 }
927 SVFConstantFP() = delete;
928
929 inline double getFPValue () const
930 {
931 return dval;
932 }
933 static inline bool classof(const SVFValue *node)
934 {
935 return node->getKind() == SVFConstFP;
936 }
937 static inline bool classof(const SVFConstantData *node)
938 {
939 return node->getKind() == SVFConstFP;
940 }
941};
942
944{
945 friend class SVFIRWriter;
946 friend class SVFIRReader;
947
948public:
954
955 static inline bool classof(const SVFValue *node)
956 {
957 return node->getKind() == SVFNullPtr;
958 }
959 static inline bool classof(const SVFConstantData *node)
960 {
961 return node->getKind() == SVFNullPtr;
962 }
963};
964
966{
967 friend class SVFIRWriter;
968 friend class SVFIRReader;
969
970public:
976
977 static inline bool classof(const SVFValue *node)
978 {
979 return node->getKind() == SVFBlackHole;
980 }
981 static inline bool classof(const SVFConstantData *node)
982 {
983 return node->getKind() == SVFBlackHole;
984 }
985};
986
988{
989 friend class SVFIRWriter;
990 friend class SVFIRReader;
991public:
996 SVFOtherValue() = delete;
997
998 static inline bool classof(const SVFValue *node)
999 {
1000 return node->getKind() == SVFOther || node->getKind() == SVFMetaAsValue;
1001 }
1002};
1003
1004/*
1005 * This class is only for LLVM's MetadataAsValue
1006*/
1008{
1009 friend class SVFIRWriter;
1010 friend class SVFIRReader;
1011public:
1017
1018 static inline bool classof(const SVFValue *node)
1019 {
1020 return node->getKind() == SVFMetaAsValue;
1021 }
1022 static inline bool classof(const SVFOtherValue *node)
1023 {
1024 return node->getKind() == SVFMetaAsValue;
1025 }
1026};
1027
1028
1033std::string dumpLLVMValue(const SVFValue* svfValue);
1034
1035template <typename F, typename S>
1036OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
1037{
1038 o << "<" << var.first << ", " << var.second << ">";
1039 return o;
1040}
1041
1042} // End namespace SVF
1043
1044#endif /* INCLUDE_SVFIR_SVFVALUE_H_ */
#define false
Definition cJSON.cpp:70
cJSON * a
Definition cJSON.cpp:2560
cJSON * n
Definition cJSON.cpp:2558
const cJSON *const b
Definition cJSON.h:255
bool isArgOfUncalledFunction() const
Definition SVFValue.h:842
const SVFFunction * fun
Definition SVFValue.h:818
static bool classof(const SVFValue *node)
Definition SVFValue.h:847
SVFArgument()=delete
u32_t getArgNo() const
Definition SVFValue.h:837
const SVFFunction * getParent() const
Definition SVFValue.h:830
SVFArgument(const SVFType *ty, const SVFFunction *fun, u32_t argNo, bool uncalled)
Definition SVFValue.h:822
static bool classof(const SVFValue *node)
Definition SVFValue.h:575
const SVFFunction * getParent() const
Definition SVFValue.h:595
const SVFFunction * getFunction() const
Definition SVFValue.h:600
const std::vector< const ICFGNode * > & getICFGNodeList() const
Definition SVFValue.h:580
void addPredBasicBlock(const SVFBasicBlock *pred)
Definition SVFValue.h:563
const std::vector< const SVFBasicBlock * > & getSuccessors() const
Definition SVFValue.h:617
const std::vector< const SVFBasicBlock * > & getPredecessors() const
Definition SVFValue.h:622
u32_t getBBPredecessorPos(const SVFBasicBlock *succbb)
Definition SVFValue.cpp:241
void addICFGNode(const ICFGNode *icfgNode)
Function where this BasicBlock is.
Definition SVFValue.h:551
const ICFGNode * front() const
Definition SVFValue.h:605
std::vector< const SVFBasicBlock * > succBBs
all successor BasicBlocks of this BasicBlock
Definition SVFValue.h:544
std::vector< constICFGNode * >::const_iterator const_iterator
Definition SVFValue.h:540
std::vector< const ICFGNode * > allICFGNodes
all ICFGNodes in this BasicBlock
Definition SVFValue.h:543
const_iterator end() const
Definition SVFValue.h:590
u32_t getBBSuccessorPos(const SVFBasicBlock *succbb)
Definition SVFValue.cpp:212
~SVFBasicBlock() override
Definition SVFValue.cpp:204
void addSuccBasicBlock(const SVFBasicBlock *succ)
Definition SVFValue.h:558
const_iterator begin() const
Definition SVFValue.h:585
const SVFFunction * fun
Definition SVFValue.h:546
SVFBasicBlock()=delete
u32_t getNumSuccessors() const
Definition SVFValue.h:626
std::vector< const SVFBasicBlock * > predBBs
all predecessor BasicBlocks of this BasicBlock
Definition SVFValue.h:545
const ICFGNode * back() const
Definition SVFValue.h:611
static bool classof(const SVFValue *node)
Definition SVFValue.h:977
static bool classof(const SVFConstantData *node)
Definition SVFValue.h:981
SVFBlackHoleValue(const SVFType *ty)
Definition SVFValue.h:971
const SVFValue * calledVal
Definition SVFValue.h:685
bool isVarArg() const
Definition SVFValue.h:735
static bool classof(const SVFValue *node)
Definition SVFValue.h:706
u32_t arg_size() const
Definition SVFValue.h:714
SVFCallInst(const SVFType *ty, const SVFBasicBlock *b, bool va, bool tm, SVFValKind k=SVFCall)
Definition SVFValue.h:700
void setCalledOperand(const SVFValue *v)
Definition SVFValue.h:693
const SVFValue * getCalledOperand() const
Definition SVFValue.h:731
static bool classof(const SVFInstruction *node)
Definition SVFValue.h:710
SVFCallInst(void)=delete
const SVFFunction * getCaller() const
Definition SVFValue.h:743
u32_t getNumArgOperands() const
Definition SVFValue.h:727
void addArgument(const SVFValue *a)
attributes to be set only through Module builders e.g., LLVMModule
Definition SVFValue.h:689
const SVFValue * getArgOperand(u32_t i) const
Definition SVFValue.h:722
const SVFFunction * getCalledFunction() const
Definition SVFValue.h:739
bool arg_empty() const
Definition SVFValue.h:718
std::vector< const SVFValue * > args
Definition SVFValue.h:683
SVFConstantData(const SVFType *ty, SVFValKind k=SVFConstData)
Definition SVFValue.h:858
static bool classof(const SVFValue *node)
Definition SVFValue.h:864
static bool classof(const SVFConstantData *node)
Definition SVFValue.h:872
SVFConstantFP()=delete
static bool classof(const SVFConstantData *node)
Definition SVFValue.h:937
static bool classof(const SVFValue *node)
Definition SVFValue.h:933
SVFConstantFP(const SVFType *ty, double d)
Definition SVFValue.h:923
double getFPValue() const
Definition SVFValue.h:929
SVFConstantInt(const SVFType *ty, u64_t z, s64_t s)
Definition SVFValue.h:890
static bool classof(const SVFValue *node)
Definition SVFValue.h:896
s64_t getSExtValue() const
Definition SVFValue.h:910
u64_t getZExtValue() const
Definition SVFValue.h:905
static bool classof(const SVFConstantData *node)
Definition SVFValue.h:900
SVFConstantNullPtr(const SVFType *ty)
Definition SVFValue.h:949
static bool classof(const SVFConstantData *node)
Definition SVFValue.h:959
static bool classof(const SVFValue *node)
Definition SVFValue.h:955
SVFConstant(const SVFType *ty, SVFValKind k=SVFConst)
Definition SVFValue.h:754
SVFConstant()=delete
static bool classof(const SVFValue *node)
Definition SVFValue.h:759
const SVFType * getReturnType() const
Definition SVFType.h:336
bool intrinsic
return true if this function does not have a body
Definition SVFValue.h:312
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.h:516
static bool classof(const SVFValue *node)
Definition SVFValue.h:368
void addBasicBlock(const SVFBasicBlock *bb)
attributes to be set only through Module builders e.g., LLVMModule
Definition SVFValue.h:332
const SVFArgument * getArg(u32_t idx) const
Definition SVFValue.cpp:175
bool varArg
return true if this function never returns
Definition SVFValue.h:316
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.h:486
bool loopContainsBB(const BBList &lp, const SVFBasicBlock *bb) const
Definition SVFValue.h:496
bool isUncalled
return true if this function is address-taken (for indirect call purposes)
Definition SVFValue.h:314
void setCallGraphNode(CallGraphNode *cgn)
call graph node for this function
Definition SVFValue.h:326
const_iterator end() const
Definition SVFValue.h:451
SVFBasicBlock * exitBlock
all formal arguments of this function
Definition SVFValue.h:322
void setIsUncalledFunction(bool uncalledFunction)
Definition SVFValue.h:342
bool addrTaken
return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the ...
Definition SVFValue.h:313
const std::vector< const SVFBasicBlock * > & getReachableBBs() const
Definition SVFValue.h:461
const std::vector< const SVFBasicBlock * > & getBasicBlockList() const
Definition SVFValue.h:456
const_iterator begin() const
Definition SVFValue.h:446
SVFLoopAndDomInfo * getLoopAndDomInfo()
Definition SVFValue.h:373
virtual ~SVFFunction()
Definition SVFValue.cpp:161
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
Definition SVFValue.h:476
std::vector< const SVFArgument * > allArgs
all BasicBlocks of this function
Definition SVFValue.h:321
const CallGraphNode * getCallGraphNode() const
Definition SVFValue.h:363
bool hasReturn() const
Definition SVFValue.h:471
std::vector< constSVFBasicBlock * >::const_iterator const_iterator
Definition SVFValue.h:305
const SVFBasicBlock * getEntryBlock() const
Definition SVFValue.h:420
bool hasAddressTaken() const
Definition SVFValue.h:387
const SVFFunction * realDefFun
the loop and dominate information
Definition SVFValue.h:319
bool isIntrinsic() const
Definition SVFValue.h:382
SVFFunction(void)=delete
bool isUncalledFunction() const
Definition SVFValue.h:466
SVFLoopAndDomInfo::LoopBBs LoopBBs
Definition SVFValue.h:308
bool hasBasicBlock() const
Definition SVFValue.h:415
const SVFType * getReturnType() const
Returns the FunctionType.
Definition SVFValue.h:399
const SVFFunctionType * getFunctionType() const
Returns the FunctionType.
Definition SVFValue.h:393
std::vector< const SVFBasicBlock * > allBBs
the definition of a function across multiple modules
Definition SVFValue.h:320
const CallGraphNode * callGraphNode
a 'single' basic block having no successors and containing return instruction in a function
Definition SVFValue.h:323
void setIsNotRet(bool notRet)
Definition SVFValue.h:347
bool isDeclaration() const
Definition SVFValue.h:377
u32_t arg_size() const
Definition SVFValue.cpp:170
const SVFFunction * getDefFunForMultipleModule() const
Definition SVFValue.h:404
void setExitBlock(SVFBasicBlock *bb)
Definition SVFValue.cpp:193
const SVFBasicBlock * back() const
Definition SVFValue.h:437
const SVFBasicBlock * getExitBB() const
Definition SVFValue.cpp:186
bool isNotRet
return true if this function is never called
Definition SVFValue.h:315
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.h:521
SVFLoopAndDomInfo::BBList BBList
Definition SVFValue.h:307
const SVFFunctionType * funcType
return true if this function supports variable arguments
Definition SVFValue.h:317
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
Definition SVFValue.h:506
const SVFBasicBlock * front() const
Definition SVFValue.h:432
void addArgument(SVFArgument *arg)
Definition SVFValue.h:337
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
Definition SVFValue.h:501
SVFLoopAndDomInfo::BBSet BBSet
Definition SVFValue.h:306
bool isVarArg() const
Definition SVFValue.cpp:181
bool hasLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.h:481
SVFLoopAndDomInfo * loopAndDom
FunctionType, which is different from the type (PointerType) of this SVFFunction.
Definition SVFValue.h:318
void setDefFunForMultipleModule(const SVFFunction *deffun)
Definition SVFValue.h:352
const SVFBasicBlock * getLoopHeader(const BBList &lp) const
Definition SVFValue.h:491
bool isLoopHeader(const SVFBasicBlock *bb) const
Definition SVFValue.h:511
SVFGlobalValue(const SVFType *ty)
Definition SVFValue.h:788
const SVFValue * getDefGlobalForMultipleModule() const
Definition SVFValue.h:797
const SVFValue * realDefGlobal
Definition SVFValue.h:779
static bool classof(const SVFConstant *node)
Definition SVFValue.h:807
static bool classof(const SVFValue *node)
Definition SVFValue.h:803
void setDefGlobalForMultipleModule(const SVFValue *defg)
the definition of a function across multiple modules
Definition SVFValue.h:782
SVFGlobalValue(std::string &&name, const SVFType *ty)
Definition SVFValue.h:791
const SVFFunction * getFunction() const
Definition SVFValue.h:664
static bool classof(const SVFValue *node)
Definition SVFValue.h:652
bool isRetInst() const
Definition SVFValue.h:669
bool ret
return true if this is a terminator instruction
Definition SVFValue.h:644
SVFInstruction(void)=delete
bool terminator
The BasicBlock where this Instruction resides.
Definition SVFValue.h:643
const SVFBasicBlock * getParent() const
Definition SVFValue.h:659
const SVFBasicBlock * bb
Definition SVFValue.h:642
const Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap() const
Definition SVFValue.h:108
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:28
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
Definition SVFValue.h:75
Map< const SVFBasicBlock *, BBSet > & getDomTreeMap()
Definition SVFValue.h:139
std::vector< const SVFBasicBlock * > BBList
Definition SVFValue.h:56
Map< const SVFBasicBlock *, BBSet > dtBBsMap
map a BasicBlock to BasicBlocks it Dominates
Definition SVFValue.h:61
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.cpp:54
bool isLoopHeader(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:141
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
Definition SVFValue.cpp:35
const SVFBasicBlock * findNearestCommonPDominator(const SVFBasicBlock *A, const SVFBasicBlock *B) const
find nearest common post dominator of two basic blocks
Definition SVFValue.cpp:115
Map< const SVFBasicBlock *, BBSet > pdtBBsMap
map a BasicBlock to BasicBlocks it PostDominates
Definition SVFValue.h:62
const Map< const SVFBasicBlock *, u32_t > & getBBPDomLevel() const
Definition SVFValue.h:118
const BBList & getReachableBBs() const
Definition SVFValue.h:155
Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap()
Definition SVFValue.h:113
Map< const SVFBasicBlock *, u32_t > bb2PdomLevel
map a BasicBlock to its level in pdom tree, used in findNearestCommonPDominator
Definition SVFValue.h:65
const Map< const SVFBasicBlock *, const SVFBasicBlock * > & getBB2PIdom() const
Definition SVFValue.h:128
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
Definition SVFValue.h:144
Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap()
Definition SVFValue.h:80
bool isUnreachable(const SVFBasicBlock *bb) const
Definition SVFValue.h:149
const SVFBasicBlock * getLoopHeader(const LoopBBs &lp) const
Definition SVFValue.h:92
virtual ~SVFLoopAndDomInfo()
Definition SVFValue.h:73
Map< const SVFBasicBlock *, const SVFBasicBlock * > bb2PIdom
map a BasicBlock to its immediate dominator in pdom tree, used in findNearestCommonPDominator
Definition SVFValue.h:66
bool hasLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.h:85
void setReachableBBs(BBList &bbs)
Definition SVFValue.h:160
Set< const SVFBasicBlock * > BBSet
Definition SVFValue.h:55
Map< const SVFBasicBlock *, LoopBBs > bb2LoopMap
map a BasicBlock (if it is in a loop) to all the BasicBlocks in this loop
Definition SVFValue.h:64
bool loopContainsBB(const LoopBBs &lp, const SVFBasicBlock *bb) const
Definition SVFValue.h:98
Map< const SVFBasicBlock *, BBSet > dfBBsMap
map a BasicBlock to its Dominate Frontier BasicBlocks
Definition SVFValue.h:63
void addToBB2LoopMap(const SVFBasicBlock *bb, const SVFBasicBlock *loopBB)
Definition SVFValue.h:103
Map< const SVFBasicBlock *, const SVFBasicBlock * > & getBB2PIdom()
Definition SVFValue.h:133
BBList reachableBBs
reachable BasicBlocks from the function entry.
Definition SVFValue.h:60
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.cpp:85
Map< const SVFBasicBlock *, u32_t > & getBBPDomLevel()
Definition SVFValue.h:123
static bool classof(const SVFOtherValue *node)
Definition SVFValue.h:1022
SVFMetadataAsValue(const SVFType *ty)
Definition SVFValue.h:1012
static bool classof(const SVFValue *node)
Definition SVFValue.h:1018
SVFOtherValue()=delete
SVFOtherValue(const SVFType *ty, SVFValKind k=SVFValue::SVFOther)
Definition SVFValue.h:992
static bool classof(const SVFValue *node)
Definition SVFValue.h:998
void setName(std::string &&n)
Definition SVFValue.h:251
GNodeK getKind() const
Get the type of this SVFValue.
Definition SVFValue.h:238
bool ptrInUncalledFunction() const
Definition SVFValue.h:264
std::string toString() const
Needs to be implemented by a SVF front end.
Definition LLVMUtil.cpp:721
SVFValue(const SVFType *ty, SVFValKind k)
Constructor without name.
Definition SVFValue.h:216
virtual void setSourceLoc(const std::string &sourceCodeInfo)
Definition SVFValue.h:276
const std::string & getName() const
Definition SVFValue.h:243
virtual const SVFType * getType() const
Definition SVFValue.h:256
virtual const std::string getSourceLoc() const
Definition SVFValue.h:280
void setName(const std::string &n)
Definition SVFValue.h:247
std::string sourceLoc
Definition SVFValue.h:214
friend OutStream & operator<<(OutStream &os, const SVFValue &value)
Overloading operator << for dumping ICFG node ID.
Definition SVFValue.h:290
virtual ~SVFValue()=default
bool ptrInUncalledFun
true if this pointer is in an uncalled function
Definition SVFValue.h:208
std::string name
Short name of value for printing & debugging.
Definition SVFValue.h:213
bool isNullPtr() const
Definition SVFValue.h:272
void setPtrInUncalledFunction()
Definition SVFValue.h:228
bool isblackHole() const
Definition SVFValue.h:268
bool isConstDataOrAggData() const
Definition SVFValue.h:260
SVFValue()=delete
GNodeK kind
used for classof
Definition SVFValue.h:207
bool constDataOrAggData
true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate
Definition SVFValue.h:209
const SVFType * type
Type of this SVFValue.
Definition SVFValue.h:212
void setConstDataOrAggData()
Definition SVFValue.h:224
for isBitcode
Definition BasicTypes.h:68
unsigned long long u64_t
Definition GeneralType.h:48
std::ostream OutStream
Definition GeneralType.h:45
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
unsigned u32_t
Definition GeneralType.h:46
std::string dumpLLVMValue(const SVFValue *svfValue)
signed long long s64_t
Definition GeneralType.h:49
IntervalValue operator<<(const IntervalValue &lhs, const IntervalValue &rhs)
Left binary shift of IntervalValues.