101 return typeSet.begin();
105 return typeSet.end();
109 return typeSet.begin();
111 inline const_iterator
end()
const 113 return typeSet.end();
120 return typeSet.size();
126 std::pair<iterator, bool> ret = typeSet.insert(type);
133 return typeSet.find(type) != typeSet.end();
144 const_iterator first = begin();
147 else if (typeset->
size() == 1)
149 const_iterator first = typeset->
begin();
150 return containType(*first);
154 const_iterator first1 = typeset->
begin(), first2 = begin(),
155 last1 = typeset->
end(), last2 = end();
156 const_iterator largest1 = last1, largest2 = last2;
159 if (*largest1 < *first2 || *largest2 < *first1)
162 while (first1 != last1 && first2 != last2)
164 if (*first1 < *first2)
166 else if (*first2 < *first1)
178 for (const_iterator it = begin(), eit = end(); it != eit; ++it)
197 typedef typename VarToTypeSetMapTy::iterator
iterator;
204 return VarToTypeSetMap.begin();
208 return VarToTypeSetMap.end();
212 return VarToTypeSetMap.begin();
214 inline const_iterator
end()
const 216 return VarToTypeSetMap.end();
223 translateLLVMTypeToPTAType(pag);
229 const_iterator it = VarToTypeSetMap.find(var);
230 return it != VarToTypeSetMap.end();
236 const_iterator it = VarToTypeSetMap.find(var);
237 assert(it != VarToTypeSetMap.end() &&
"Can not find typeset for var");
245 iterator it = VarToTypeSetMap.find(var);
246 if (it != VarToTypeSetMap.end())
255 VarToTypeSetMap[var] = typeSet;
265 return addTypeForVar(var, ptaTy);
270 TypeToVarsMapTy::iterator it = typeToVarsMap.find(type);
271 if (it == typeToVarsMap.end())
275 typeToVarsMap[
type] = nodes;
279 NodeBS &nodes = it->second;
287 return addVarForType(var, ptaTy);
292 TypeToVarsMapTy::const_iterator it = typeToVarsMap.find(type);
293 return it != typeToVarsMap.end();
298 TypeToVarsMapTy::iterator it = typeToVarsMap.find(type);
299 assert(it != typeToVarsMap.end() &&
"Can not find vars for type");
305 void printTypeSystem()
const 308 for (const_iterator it = VarToTypeSetMap.begin(),
309 eit = VarToTypeSetMap.end(); it != eit; ++it)
313 const TypeSet *typeSet = it->second;
334 const PAGNode *pagNode = it->second;
339 const Type *valType = value->getType();
341 const Type *nodeType = valType;
343 if (
const GepValPN *gepvalnode = SVFUtil::dyn_cast<GepValPN>(pagNode))
345 nodeType = gepvalnode->getType();
347 else if (SVFUtil::isa<RetPN>(pagNode))
351 nodeType = funTy->getReturnType();
355 if (addTypeForVar(pagNode->
getId(), ptaType))
356 addVarForType(pagNode->
getId(), ptaType);
iterator begin()
Iterators.
VarToTypeSetMapTy::const_iterator const_iterator
Map< NodeID, TypeSet * > VarToTypeSetMapTy
TypeToVarsMapTy typeToVarsMap
bool addTypeForVar(NodeID var, const PTAType &type)
void addVarForType(NodeID var, const Type *type)
void translateLLVMTypeToPTAType(const PAG *pag)
llvm::FunctionType FunctionType
void dump() const
Dump the type.
std::set< Key, Compare, Allocator > OrderedSet
bool operator<(const PTAType &ty) const
iterator begin()
Iterators.
bool containType(const PTAType &type) const
Contain a ptatype or not.
llvm::PointerType PointerType
raw_ostream & errs()
Overwrite llvm::errs()
bool operator!=(const PTAType &ty) const
bool addTypeForVar(NodeID var, const Type *type)
bool operator==(const PTAType &ty) const
Operator overloading.
const Value * getValue() const
Get/has methods of the components.
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
IDToNodeMapTy::const_iterator const_iterator
bool intersect(const TypeSet *typeset) const
Intersect with another typeset or not.
const_iterator end() const
void dumpTypes() const
Dump all types in the typeset.
void addVarForType(NodeID var, const PTAType &type)
bool operator>(const PTAType &ty) const
const Type * getLLVMType() const
Get the contained llvm type.
TypeSetTy::const_iterator const_iterator
const_iterator end() const
OrderedSet< PTAType > allPTATypes
VarToTypeSetMapTy::iterator iterator
const TypeSet * getTypeSet(NodeID var) const
Get a var's typeset.
TypeSetTy::iterator iterator
const_iterator begin() const
bool hasTypeSet(NodeID var) const
Has typeset or not.
OrderedMap< PTAType, NodeBS > TypeToVarsMapTy
PTAType(const Type *ty)
Constructor.
NodeID getId() const
Get ID.
llvm::SparseBitVector NodeBS
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const_iterator begin() const
VarToTypeSetMapTy VarToTypeSetMap
u32_t size() const
Number of types contained.
OrderedSet< PTAType > TypeSetTy
TypeSystem(const PAG *pag)
Constructor.
NodeBS & getVarsForType(const PTAType &type)
bool hasVarsForType(const PTAType &type) const
bool addType(const PTAType &type)
Add a ptatype.
std::map< Key, Value, Compare, Allocator > OrderedMap