7 #ifndef SYMBOLIC_EXPR_GRAPH_H
8 #define SYMBOLIC_EXPR_GRAPH_H
10 #include <llvm/IR/BasicBlock.h>
11 #include <llvm/IR/CallSite.h>
12 #include <llvm/IR/Constants.h>
13 #include <llvm/IR/Function.h>
14 #include <llvm/IR/InstIterator.h>
15 #include <llvm/IR/Instructions.h>
16 #include <llvm/IR/Value.h>
18 #include <llvm/Support/Casting.h>
19 #include <llvm/Support/FileSystem.h>
20 #include <llvm/Support/Format.h>
21 #include <llvm/Support/raw_ostream.h>
25 #include <unordered_map>
26 #include <unordered_set>
29 #include "Analysis/Alias/PathSensitiveAADriver/ProgramVal.h"
30 #include "IR/SEG/SEGValue.h"
31 #include "Transform/ValueComparator.h"
32 #include "Utils/ADT/MapIterators.h"
33 #include "Utils/ADT/kvec.h"
70 class SealEnhancedSEGWrapper;
74 static bool EnableValueToString;
75 static bool EnableArithmeticFlow;
79 friend class SEGSerializer;
89 SEGOBJK_ArgumentBegin,
90 SEGOBJK_CommonArgument,
92 SEGOBJK_PseudoArgument,
95 SEGOBJK_CallSiteOutputBegin,
96 SEGOBJK_CallSiteCommonOutput,
97 SEGOBJK_CallSitePseudoOutput,
98 SEGOBJK_CallSiteOutputEnd,
101 SEGOBJK_CommonReturn,
102 SEGOBJK_PseudoReturn,
109 SEGOBJK_SimpleOperand,
111 SEGOBJK_CallSitePseudoInput,
112 SEGOBJK_CallSiteSummaryArgument,
113 SEGOBJK_CallSiteSummaryReturn,
119 SEGOBJK_BinaryWithIntConst,
121 SEGOBJK_SimpleOpcode,
132 SEGOBJK_SimpleSiteBegin,
134 SEGOBJK_DereferenceSite,
138 SEGOBJK_SimpleSiteEnd,
144 const SEGObjectKind ObjKind;
150 BasicBlock *ParentBasicBlock =
nullptr;
153 int64_t ObjIndex = -1;
156 int64_t SEGIndex = -1;
184 virtual Value *getLLVMDbgValue()
const {
return nullptr; }
193 virtual Instruction *getLLVMDbgInstruction()
const {
194 Value *val = getLLVMDbgValue();
195 if (val !=
nullptr) {
196 return dyn_cast<Instruction>(val);
202 SEGObjectKind getKind()
const {
return ObjKind; }
204 int64_t getSEGIndex()
const {
205 assert(SEGIndex != -1 &&
"Index should not be -1");
209 void setObjIndex(int64_t index) { ObjIndex = index; }
211 int64_t getObjIndex()
const {
212 assert(ObjIndex != -1 &&
"Index should not be -1");
216 const char *getKindName()
const;
218 void setParentBasicBlock(BasicBlock *BB) { this->ParentBasicBlock = BB; }
220 BasicBlock *getParentBasicBlock()
const {
return ParentBasicBlock; }
222 Function *getParentFunction()
const {
return ParentBasicBlock->getParent(); }
228 void print(raw_ostream &O)
const;
232 friend raw_ostream &operator<<(llvm::raw_ostream &Out,
const SEGObject &N);
236 LLVMValueIndexer *instance;
237 seg_cmp() : instance(LLVMValueIndexer::get()) {}
240 int64_t indexSEGA = A ? A->getSEGIndex() : -1;
241 int64_t indexSEGB = B ? B->getSEGIndex() : -1;
242 if (indexSEGA != indexSEGB || (indexSEGA == -1 && indexSEGB == -1)) {
243 return indexSEGA < indexSEGB;
245 int64_t indexA = A ? A->getObjIndex() : -1;
246 int64_t indexB = B ? B->getObjIndex() : -1;
247 return indexA < indexB;
254 friend class SEGSerializer;
255 friend class SEGHash;
264 void setDescription(std::string &Desc) { Description = Desc; }
267 friend class SealEnhancedSEGWrapper;
271 std::string Description;
275 std::vector<SEGNodeBase *> Children;
278 std::map<const SEGNodeBase *, float, seg_cmp> Parents;
281 std::vector<SEGSiteBase *> UseSites;
282 std::set<SEGSiteBase *> UseSiteSet;
285 Type *LLVMType =
nullptr;
297 assert(Children.size() > I &&
298 "Invalid child index when querying SEG edges");
302 float getConfidence(
const SEGNodeBase *ParentNode)
const {
303 auto It = Parents.find(ParentNode);
304 assert(It != Parents.end() &&
305 "Invalid parent node when querying SEG edges");
309 unsigned getNumChildren()
const {
return Children.size(); }
311 unsigned getNumParents()
const {
return Parents.size(); }
313 void addChild(
SEGNodeBase *N,
float Confidence = 1.0f) {
314 Children.push_back(N);
315 N->Parents.insert(std::make_pair(
this, Confidence));
318 void eraseAllChildren() {
319 for (
auto *Child : Children) {
320 Child->Parents.erase(
this);
326 if (!UseSiteSet.count(U)) {
327 UseSiteSet.insert(U);
328 UseSites.push_back(U);
332 virtual bool isTerminalNode()
const {
return Children.empty(); }
336 bool containsParentNode(
const SEGNodeBase *N)
const {
337 return Parents.count(N);
340 const std::string &getDescription()
const {
return Description; }
343 virtual void dot(raw_fd_ostream &O)
const = 0;
345 friend raw_ostream &operator<<(llvm::raw_ostream &Out,
const SEGNodeBase &N);
351 key_iterator<std::map<const SEGNodeBase *, float>::const_iterator> It;
356 It = N->parent_end();
358 It = N->parent_begin();
364 : Node(VFIt.Node), It(VFIt.It) {}
368 this->Node = VFIt.Node;
401 ValueFlowIterator vflow_end()
const {
return {
this,
true}; }
403 key_iterator<std::map<const SEGNodeBase *, float>::const_iterator>
404 parent_begin()
const {
405 return {Parents.begin()};
408 key_iterator<std::map<const SEGNodeBase *, float>::const_iterator>
410 return {Parents.end()};
413 iterator_range<std::map<const SEGNodeBase *, float>::const_iterator>
415 return {Parents.begin(), Parents.end()};
418 std::vector<SEGNodeBase *>::const_iterator child_begin()
const {
419 return Children.begin();
422 std::vector<SEGNodeBase *>::const_iterator child_end()
const {
423 return Children.end();
426 iterator_range<std::vector<SEGNodeBase *>::const_iterator> children()
const {
427 return {Children.begin(), Children.end()};
430 std::map<const SEGNodeBase *, float>::const_iterator
431 parent_confidence_begin()
const {
432 return key_iterator<std::map<const SEGNodeBase *, float>::const_iterator>(
436 std::map<const SEGNodeBase *, float>::const_iterator
437 parent_confidence_end()
const {
438 return key_iterator<std::map<const SEGNodeBase *, float>::const_iterator>(
442 size_t child_size()
const {
return Children.size(); }
444 size_t parent_size()
const {
return Parents.size(); }
446 std::vector<SEGSiteBase *>::const_iterator use_site_begin()
const {
447 return UseSites.begin();
450 std::vector<SEGSiteBase *>::const_iterator use_site_end()
const {
451 return UseSites.end();
454 iterator_range<std::vector<SEGSiteBase *>::const_iterator> use_sites() {
455 return {UseSites.begin(), UseSites.end()};
458 size_t use_site_size()
const {
return UseSites.size(); }
461 static bool classof(
const SEGObject *N) {
462 return N->getKind() >= SEGOBJK_NodeBegin && N->getKind() <= SEGOBJK_NodeEnd;
473 Value *LLVMValue =
nullptr;
479 BasicBlock *BB,
bool fromDisk);
493 BasicBlock *BB,
bool fromDisk);
497 friend class SEGHash;
502 Value *getLLVMValue()
const {
return LLVMValue; }
504 SEGValue *getSEGValue()
const {
return segValue; }
506 void dot(raw_fd_ostream &O)
const override;
508 friend raw_ostream &operator<<(llvm::raw_ostream &Out,
510 if (Value *Val = N.getLLVMValue()) {
513 Out << N.getDescription();
518 virtual Value *getLLVMDbgValue()
const override {
return getLLVMValue(); }
521 static bool classof(
const SEGObject *N) {
522 return N->getKind() >= SEGOBJK_OperandBegin &&
523 N->getKind() <= SEGOBJK_OperandEnd;
527 void initialize(Value *Val);
537 CK_URem = CK_BinaryBegin,
555 CK_BinaryEnd = CK_AShr,
558 CK_AddressCast = CK_CastBegin,
571 CK_CastEnd = CK_FP2UI,
585 CK_FFalse = CK_CmpBegin,
631 CodeKind getOpcode()
const {
return Opcode; }
633 virtual void dot(raw_fd_ostream &O)
const;
635 bool isCmpNode()
const {
636 return Opcode <= CK_CmpEnd && Opcode >= CK_CmpBegin;
639 bool isSignedCmp()
const {
return Opcode <= CK_ISLE && Opcode >= CK_ISGT; }
641 bool isUnSignedCmp()
const {
return Opcode <= CK_IULE && Opcode >= CK_IUGT; }
643 bool isFloatCmp()
const {
return Opcode <= CK_FTrue && Opcode >= CK_FFalse; }
645 bool isAddNode()
const {
return Opcode == CK_Add; }
647 bool isSubNode()
const {
return Opcode == CK_Sub; }
649 bool isGEPNode()
const {
return Opcode == CK_GetElmtPtr; }
651 bool isSelectNode()
const {
return Opcode == CK_Select; }
653 bool isCastNode()
const {
654 return Opcode <= CK_CastEnd && Opcode >= CK_CastBegin;
657 bool isBinaryNode()
const {
658 return Opcode <= CK_BinaryEnd && Opcode >= CK_BinaryBegin;
661 bool isExtractElmtNode()
const {
return Opcode == CK_ExtractElmt; }
663 bool isInsertElmtNode()
const {
return Opcode == CK_InsertElmt; }
665 bool isConcatNode()
const {
return Opcode == CK_Concat; }
668 static bool classof(
const SEGObject *N) {
669 return N->getKind() >= SEGOBJK_OpcodeBegin &&
670 N->getKind() <= SEGOBJK_OpcodeEnd;
673 static const char *getOpcodeName(CodeKind CK);
679 Instruction *User =
nullptr;
691 CallSite getLLVMCallSite()
const {
return CallSite(User); }
693 Instruction *getInstruction()
const {
return User; }
695 SEGValue *getSEGValue()
const {
return segValue; }
697 virtual Value *getLLVMDbgValue()
const override {
return getInstruction(); }
699 friend raw_ostream &operator<<(llvm::raw_ostream &Out,
706 static bool classof(
const SEGObject *O) {
707 return O->getKind() >= SEGOBJK_SiteBegin && O->getKind() <= SEGOBJK_SiteEnd;
711 namespace FalconPlus {
715 class AbstractCondPtr;
719 namespace SymbolicExecution {
727 friend class IntraFalcon;
728 friend class PTGraph;
731 friend class SEGSerializer;
733 friend class FalconPlus::AbstractCond;
734 friend class FalconPlus::RegionCond;
735 friend class FalconPlus::IntraFalcon;
736 friend class FalconPlus::AbstractCondPtr;
737 friend class FalconPlus::MemValueSet;
739 friend class SymbolicExecution::AnalysisState;
749 : CondNode(CN), BB(B), Cond(C) {}
751 bool operator<(
const CDGCond &RHS)
const {
752 return (CondNode < RHS.CondNode) ||
753 (CondNode == RHS.CondNode && BB < RHS.BB) ||
754 (CondNode == RHS.CondNode && BB == RHS.BB && Cond < RHS.Cond);
757 bool operator==(
const CDGCond &RHS)
const {
758 return CondNode == RHS.CondNode && BB == RHS.BB && Cond == RHS.Cond;
761 BasicBlock *getBB()
const {
return BB; }
766 Function *BaseFunc =
nullptr;
769 std::vector<SEGObject *> NodesList;
772 std::unordered_map<Value *, SEGOperandNode *> ValueNodesMap;
777 std::vector<std::pair<Value *, SEGOperandNode *>> ValueNodePairs;
781 std::set<SEGNodeBase *> NonValueNodes;
788 std::map<Instruction *, SEGSiteBase *> InstSiteMap;
789 std::vector<SEGCallSite *> CallSites;
798 std::map<BasicBlock *, std::set<CDGCond> *> BlockCondMap;
800 int64_t SEGIndex = -1;
804 int64_t getSEGIndex()
const {
return SEGIndex; }
806 template <
class T> T *getSEGObject(int64_t index) {
807 assert(index == -1 || (index >= 0 && index < NodesList.size()));
810 auto *Obj = NodesList[index];
819 kvec<SEGPseudoReturnNode *> PseudoReturns;
821 kvec<SEGCommonArgumentNode *> CommonArgumentNodes;
822 kvec<SEGPseudoArgumentNode *> PseudoArgumentNodes;
823 kvec<SEGVarArgumentNode *> VarArgumentNodes;
837 std::unordered_map<SEGNodeBase *, int> SummaryArgNodes;
838 std::unordered_map<int, std::unordered_set<SEGNodeBase *>>
839 SummaryArgNodesCache;
840 std::unordered_map<SEGNodeBase *, int> SummaryReturnNodes;
841 std::unordered_map<int, std::unordered_set<SEGNodeBase *>>
842 SummaryReturnNodesCache;
845 std::map<std::string, SEGOperandNode *> NameToPseudoArgNode;
846 std::unordered_map<std::string, SEGOperandNode *> NameToNonArgPseudoNode;
847 std::unordered_map<std::string, std::unique_ptr<PseudoVal>> PseudoValStorage;
859 void addSummaryArgNode(
SEGNodeBase *Node,
int APDepth);
861 void addSummaryReturnNode(
SEGNodeBase *Node,
int APDepth);
864 size_t getNumCommonArgument()
const {
return CommonArgumentNodes.size(); }
866 size_t getNumPseudoArgument()
const {
return PseudoArgumentNodes.size(); }
868 size_t getNumVarArgument()
const {
return VarArgumentNodes.size(); }
870 size_t getNumPseudoReturn()
const {
return PseudoReturns.size(); }
872 bool hasCommonReturnNode()
const {
882 return PseudoReturns[Index];
886 return CommonArgumentNodes[Index];
890 return PseudoArgumentNodes[Index];
894 return VarArgumentNodes[Index];
897 bool isSummaryArgument(
const SEGNodeBase *Node)
const;
901 int getSummaryArgumentAPDepth(
const SEGNodeBase *Node)
const;
905 std::unordered_set<SEGNodeBase *> *getSummaryArgument(
int APDepth)
const;
907 bool isSummaryReturn(
const SEGNodeBase *Node)
const;
911 int getSummaryReturnAPDepth(
const SEGNodeBase *Node)
const;
915 std::unordered_set<SEGNodeBase *> *getSummaryReturn(
int APDepth)
const;
922 bool isDirectlyPassedToCaller(
const SEGNodeBase *Node)
const;
923 bool isDirectlyPassedFromCaller(
const SEGNodeBase *Node)
const;
933 std::unordered_map<SEGNodeBase *, SEGRegionNode *> positive_regions_cache;
934 std::unordered_map<SEGNodeBase *, SEGRegionNode *> negative_regions_cache;
936 std::unordered_map<SEGRegionNode *, SEGRegionNode *>>
937 compound_regions_cache_and;
939 std::unordered_map<SEGRegionNode *, SEGRegionNode *>>
940 compound_regions_cache_or;
943 std::unordered_map<BasicBlock *, SEGRegionNode *> bb_region_cache;
946 void clearRegionNodeCache();
964 SEGOperandNode *findOrCreateNode(Value *Val, Type *Ty, BasicBlock *BB);
968 template <
class OperandNodeTy>
969 OperandNodeTy *findOrCreateOperandNode(Value *Val, Type *Ty, BasicBlock *BB,
970 bool fromDisk =
false) {
972 assert(Val && !Val->getType()->isVoidTy());
973 assert((!(dyn_cast<Instruction>(Val)) ||
974 BB == ((Instruction *)Val)->getParent()) &&
975 "Incorrect BasicBlock detected");
977 auto It = ValueNodesMap.find(Val);
978 if (It != ValueNodesMap.end()) {
979 assert(isa<OperandNodeTy>(It->second));
980 return (OperandNodeTy *)It->second;
982 auto *N =
new OperandNodeTy(Val, Ty,
this, BB, fromDisk);
983 ValueNodePairs.push_back({Val, N});
984 ValueNodesMap[Val] = N;
991 template <
class OperandNodeTy>
993 clonePseudoVal(
const PseudoVal *Arg,
994 std::function<OperandNodeTy *(
const PseudoVal *)> Proc) {
995 const std::string &ArgName = Arg->getName();
996 auto ClonedArg = std::unique_ptr<PseudoVal>(Arg->clone());
997 auto *ArgNode = Proc(ClonedArg.get());
999 if (std::is_same<OperandNodeTy, SEGPseudoArgumentNode>::value) {
1000 NameToPseudoArgNode.insert(std::make_pair(ArgName, ArgNode));
1002 NameToNonArgPseudoNode.insert(std::make_pair(ArgName, ArgNode));
1005 assert(!PseudoValStorage.count(ArgName));
1006 PseudoValStorage.insert({ArgName, std::move(ClonedArg)});
1010 template <
class OperandNodeTy>
1012 findOrClonePseudoVal(
const PseudoVal *Arg,
1013 std::function<OperandNodeTy *(
const PseudoVal *)> Proc) {
1014 const std::string &ArgName = Arg->getName();
1015 if (std::is_same<OperandNodeTy, SEGPseudoArgumentNode>::value) {
1016 if (NameToPseudoArgNode.count(ArgName)) {
1017 return cast<OperandNodeTy>(NameToPseudoArgNode.at(ArgName));
1020 if (NameToNonArgPseudoNode.count(ArgName)) {
1022 std::is_base_of<SEGOperandNode, OperandNodeTy>::value,
1023 "OperandNodeTy must be a derived class of SEGOperandNode.");
1024 return cast<OperandNodeTy>(NameToNonArgPseudoNode.at(ArgName));
1028 return clonePseudoVal<OperandNodeTy>(Arg, Proc);
1034 void finalizePseudoArgumentNodes();
1035 SEGOperandNode *findOrCreateSimpleOperandFromPseudoVal(
const PseudoVal *Arg,
1040 BasicBlock *BB, CallSite CS,
1047 template <
class OperandNodeTy>
1048 OperandNodeTy *CreateUniqueOperandNode(Value *Val, Type *Ty, BasicBlock *BB,
1049 bool fromDisk =
false) {
1051 assert(Val && !Val->getType()->isVoidTy());
1052 assert((!(dyn_cast<Instruction>(Val)) ||
1053 BB == ((Instruction *)Val)->getParent()) &&
1054 "Incorrect BasicBlock detected");
1056 auto *N =
new OperandNodeTy(Val, Ty,
this, BB, fromDisk);
1057 ValueNodesMap[Val] = N;
1058 ValueNodePairs.push_back({Val, N});
1062 template <
class OperandNodeTy>
1063 OperandNodeTy *createOperandNode(Type *Ty, BasicBlock *BB,
1064 bool fromDisk =
false) {
1067 auto *Ret =
new OperandNodeTy(Ty,
this, BB, fromDisk);
1068 NonValueNodes.insert(Ret);
1074 template <
class SiteTy>
1075 SiteTy *findOrCreateSite(Instruction *I,
bool fromDisk =
false) {
1078 auto It = InstSiteMap.find(I);
1079 if (It != InstSiteMap.end()) {
1080 assert(isa<SiteTy>(It->second));
1081 return (SiteTy *)It->second;
1083 SiteTy *N =
new SiteTy(I,
this, fromDisk);
1087 CallSites.push_back(CS);
1098 createCallSiteArgumentSummaryNode(Type *Ty, BasicBlock *BB,
1099 Instruction *Callsite,
int APDepth,
1100 bool fromDisk =
false);
1106 createCallSiteReturnSummaryNode(Type *Ty, BasicBlock *BB,
1107 Instruction *Callsite,
float Confidence,
1108 bool fromDisk =
false);
1112 findOrCreateCallSiteOutputNode(Value *Val, Type *Ty, BasicBlock *BB,
1113 CallSite CS, Function *Callee,
bool IsCommon);
1116 BasicBlock *BB, CallSite CS,
1119 bool fromDisk =
false);
1123 findOrCreateCallSitePseudoInputNode(Value *Val, Type *Ty, BasicBlock *BB,
1124 CallSite CS, Function *Callee,
1125 bool fromDisk =
false);
1128 SEGStoreMemNode *findOrCreateStoreMemNode(Type *Ty, Instruction *StoreSite,
1129 Value *StoreVal, BasicBlock *BB,
1130 bool fromDisk =
false);
1134 bool cond =
false,
bool fromDisk =
false);
1166 BasicBlock *BB,
const kvec<SEGNodeBase *> &,
1167 bool fromDisk =
false);
1172 uint64_t TSz,
bool fromDisk =
false);
1178 bool fromDisk =
false);
1181 void addBlockCond(BasicBlock *CurrBB,
SEGNodeBase *BrNode, BasicBlock *DepBB,
1188 Function *getBaseFunc()
const {
return BaseFunc; }
1192 template <
class SiteTy> SiteTy *
findSite(Instruction *I)
const {
1195 auto It = InstSiteMap.find(I);
1196 if (It != InstSiteMap.end()) {
1198 return dyn_cast<SiteTy>(It->second);
1211 Instruction *I = dyn_cast<Instruction>(sValue->
getValue());
1214 auto It = InstSiteMap.find(I);
1215 if (It != InstSiteMap.end()) {
1217 return dyn_cast<SiteTy>(It->second);
1252 auto It = BlockCondMap.find(BB);
1253 if (It != BlockCondMap.end()) {
1260 void dot(
const char *FileName)
const;
1263 void dot(std::vector<const SEGNodeBase *> Srcs,
const char *FileName)
const;
1277 std::unordered_map<Value *, SEGOperandNode *>::const_iterator
1278 value_node_begin()
const {
1279 return ValueNodesMap.begin();
1282 std::unordered_map<Value *, SEGOperandNode *>::const_iterator
1283 value_node_end()
const {
1284 return ValueNodesMap.end();
1287 std::vector<std::pair<Value *, SEGOperandNode *>>::const_iterator
1288 value_node_pair_begin()
const {
1289 return ValueNodePairs.begin();
1292 std::vector<std::pair<Value *, SEGOperandNode *>>::const_iterator
1293 value_node_pair_end()
const {
1294 return ValueNodePairs.end();
1297 std::set<SEGNodeBase *>::const_iterator non_value_node_begin()
const {
1298 return NonValueNodes.begin();
1301 std::set<SEGNodeBase *>::const_iterator non_value_node_end()
const {
1302 return NonValueNodes.end();
1305 std::map<Instruction *, SEGSiteBase *>::const_iterator
1306 inst_site_begin()
const {
1307 return InstSiteMap.begin();
1310 std::map<Instruction *, SEGSiteBase *>::const_iterator inst_site_end()
const {
1311 return InstSiteMap.end();
1314 std::map<std::pair<Instruction *, Value *>,
SEGStoreMemNode *>::const_iterator
1315 store_mem_node_begin()
const {
1316 return StoreMemNodesMap.begin();
1319 std::map<std::pair<Instruction *, Value *>,
SEGStoreMemNode *>::const_iterator
1320 store_mem_node_end()
const {
1321 return StoreMemNodesMap.end();
1324 std::map<Instruction *, SEGSiteBase *>::const_iterator site_begin()
const {
1325 return InstSiteMap.begin();
1328 std::map<Instruction *, SEGSiteBase *>::const_iterator site_end()
const {
1329 return InstSiteMap.end();
1332 std::vector<SEGObject *>::const_iterator node_begin()
const {
1333 return NodesList.begin();
1336 std::vector<SEGObject *>::const_iterator node_end()
const {
1337 return NodesList.end();
1344 const kvec<SEGPseudoReturnNode *> &PseudoRets;
1348 const kvec<SEGPseudoReturnNode *> &PRs)
1349 : I(Id), CommonRet(CR), PseudoRets(PRs) {}
1352 : I(It.I), CommonRet(It.CommonRet), PseudoRets(It.PseudoRets) {}
1386 ReturnIterator return_end()
const {
1387 return ReturnIterator(getNumPseudoReturn() + (getCommonReturn() ? 1 : 0),
1388 CommonReturn, PseudoReturns);
1391 ReturnIterator pseudo_return_begin()
const {
1392 size_t StartIndex = getCommonReturn() ? 1 : 0;
1393 return ReturnIterator(StartIndex, CommonReturn, PseudoReturns);
1396 ReturnIterator pseudo_return_end()
const {
return return_end(); }
1401 const kvec<SEGCommonArgumentNode *> &CommonArgs;
1402 const kvec<SEGPseudoArgumentNode *> &PseudoArgs;
1403 const kvec<SEGVarArgumentNode *> &VarArgs;
1407 const kvec<SEGPseudoArgumentNode *> &PA,
1408 const kvec<SEGVarArgumentNode *> &VA)
1409 : I(Id), CommonArgs(CA), PseudoArgs(PA), VarArgs(VA) {}
1412 : I(It.I), CommonArgs(It.CommonArgs), PseudoArgs(It.PseudoArgs),
1413 VarArgs(It.VarArgs) {}
1427 if (I < (
size_t)CommonArgs.size()) {
1431 if (I < (
size_t)(CommonArgs.size() + PseudoArgs.size())) {
1436 (
size_t)(CommonArgs.size() + PseudoArgs.size() + VarArgs.size()));
1438 VarArgs[I - (CommonArgs.size() + PseudoArgs.size())];
1451 ArgumentIterator arg_end()
const {
1453 getNumCommonArgument() + getNumPseudoArgument() + getNumVarArgument();
1454 return ArgumentIterator(NumArgs, CommonArgumentNodes, PseudoArgumentNodes,
1458 ArgumentIterator common_arg_begin()
const {
return arg_begin(); }
1460 ArgumentIterator common_arg_end()
const {
1461 size_t NumArgs = getNumCommonArgument();
1462 return ArgumentIterator(NumArgs, CommonArgumentNodes, PseudoArgumentNodes,
1466 ArgumentIterator pseudo_arg_begin()
const {
return common_arg_end(); }
1468 ArgumentIterator pseudo_arg_end()
const {
1469 size_t EndId = getNumCommonArgument() + getNumPseudoArgument();
1470 return ArgumentIterator(EndId, CommonArgumentNodes, PseudoArgumentNodes,
1474 ArgumentIterator var_arg_begin()
const {
return pseudo_arg_end(); }
1476 ArgumentIterator var_arg_end()
const {
return arg_end(); }
1478 typedef std::vector<SEGCallSite *>::const_iterator SEGCallSiteIterator;
1479 SEGCallSiteIterator seg_callsite_begin()
const {
return CallSites.begin(); }
1481 SEGCallSiteIterator seg_callsite_end()
const {
return CallSites.end(); }
signed greater than
Definition: SymbolicExprGraph.h:609
Definition: SEGValue.h:38
Definition: SEGArgumentNode.h:89
Definition: SymbolicExprGraph.h:1340
Definition: SymbolicExprGraph.h:742
signed less or equal
Definition: SymbolicExprGraph.h:612
Definition: SEGCastNode.h:18
Definition: SEGReturnNode.h:84
Definition: SEGArgumentNode.h:121
const std::set< CDGCond > * getBlockCond(BasicBlock *BB) const
Definition: SymbolicExprGraph.h:1251
1 0 1 0 True if unordered or greater than
Definition: SymbolicExprGraph.h:595
Definition: SymbolicExprGraph.h:348
Definition: SymbolicExprGraph.h:1398
1 1 1 1 Always true (always folded)
Definition: SymbolicExprGraph.h:600
0 0 0 1 True if ordered and equal
Definition: SymbolicExprGraph.h:586
Definition: SEGArgumentNode.h:42
Definition: SEGArgumentNode.h:18
Definition: SEGSimpleOpcodeNode.h:18
unsigned less than
Definition: SymbolicExprGraph.h:607
0 1 1 0 True if ordered and operands are unequal
Definition: SymbolicExprGraph.h:591
Definition: SEGRegionNode.h:34
Definition: SEGBinaryWithIntConstNode.h:19
Definition: SEGCallSiteOutputNode.h:19
Definition: SEGLoadMemNode.h:21
Definition: SymbolicExprGraph.h:532
Definition: SEGCallSiteArgumentSummaryNode.h:17
Type * getLLVMType() const
get the type size of the node
Definition: SymbolicExprGraph.h:294
The return node.
Definition: SEGReturnNode.h:25
Value * getValue()
Get Value.
Definition: SEGValue.h:66
signed greater or equal
Definition: SymbolicExprGraph.h:610
Definition: SEGCallSiteReturnSummaryNode.h:20
1 1 0 1 True if unordered, less than, or equal
Definition: SymbolicExprGraph.h:598
0 0 1 1 True if ordered and greater than or equal
Definition: SymbolicExprGraph.h:588
signed less than
Definition: SymbolicExprGraph.h:611
unsigned less or equal
Definition: SymbolicExprGraph.h:608
Definition: SymbolicExprGraph.h:78
void dot(const char *FileName) const
Dot this graph to a file with filename.
Definition: SymbolicExprGraph.cpp:913
Definition: SymbolicExprGraphBuilder.h:35
not equal
Definition: SymbolicExprGraph.h:604
1 1 0 0 True if unordered or less than
Definition: SymbolicExprGraph.h:597
1 0 1 1 True if unordered, greater than, or equal
Definition: SymbolicExprGraph.h:596
Definition: SymbolicExprGraph.h:723
0 1 0 1 True if ordered and less than or equal
Definition: SymbolicExprGraph.h:590
Definition: SymbolicExprGraph.h:676
Definition: SymbolicExprGraph.h:72
unsigned greater than
Definition: SymbolicExprGraph.h:605
Definition: SymbolicExprGraph.h:469
The node base of symbolic expression graph.
Definition: SymbolicExprGraph.h:253
Definition: OCValueFlowBuilder.h:25
Definition: SEGPhiNode.h:28
equal
Definition: SymbolicExprGraph.h:603
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Definition: SymbolicExprGraph.h:593
unsigned greater or equal
Definition: SymbolicExprGraph.h:606
Definition: SEGCallSiteOutputNode.h:76
SiteTy * findSite(Instruction *I) const
Definition: SymbolicExprGraph.h:1192
CodeKind
Definition: SymbolicExprGraph.h:535
0 1 0 0 True if ordered and less than
Definition: SymbolicExprGraph.h:589
Definition: SEGReturnNode.h:64
0 0 1 0 True if ordered and greater than
Definition: SymbolicExprGraph.h:587
Definition: SEGCallSite.h:51
Definition: SEGStoreMemNode.h:23
1 0 0 1 True if unordered or equal
Definition: SymbolicExprGraph.h:594
Definition: SymbolicExprGraph.h:235
0 1 1 1 True if ordered (no nans)
Definition: SymbolicExprGraph.h:592
SiteTy * findSite(SEGValue *sValue) const
Get site node based on Value and specific comparison method.
Definition: SymbolicExprGraph.h:1210
1 1 1 0 True if unordered or not equal
Definition: SymbolicExprGraph.h:599