31 #ifndef INCLUDE_UTIL_SVFBASICTYPES_H_ 32 #define INCLUDE_UTIL_SVFBASICTYPES_H_ 34 #include <llvm/ADT/SparseBitVector.h> 35 #include <llvm/Support/raw_ostream.h> 36 #include <llvm/Support/CommandLine.h> 37 #include <llvm/ADT/StringMap.h> 42 #include <unordered_set> 44 #include <unordered_map> 52 template <
class T>
struct Hash;
54 template <
class S,
class T>
struct Hash<
std::pair<S, T>> {
58 return a > b ? b * b + a : a * a + a + b;
62 Hash<decltype(t.first)> first;
63 Hash<decltype(t.second)> second;
64 return szudzik(first(t.first), second(t.second));
68 template <
class T>
struct Hash {
76 typedef unsigned long long u64_t;
87 typedef llvm::SparseBitVector<>
NodeBS;
91 template <
typename Key,
typename Hash = Hash<Key>,
typename KeyEqual = std::equal_to<Key>,
92 typename Allocator = std::allocator<Key>>
93 using Set = std::unordered_set<Key, Hash, KeyEqual, Allocator>;
95 template<
typename Key,
typename Value,
typename Hash = Hash<Key>,
96 typename KeyEqual = std::equal_to<Key>,
97 typename Allocator = std::allocator<std::pair<const Key, Value>>>
98 using Map = std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>;
100 template<
typename Key,
typename Compare = std::less<Key>,
typename Allocator = std::allocator<Key>>
103 template<
typename Key,
typename Value,
typename Compare = std::less<Key>,
104 typename Allocator = std::allocator<std::pair<const Key, Value>>>
107 template <
typename T,
unsigned N>
128 #define DBOUT(TYPE, X) DEBUG_WITH_TYPE(TYPE, X) 130 #define DOTIMESTAT(X) X 133 #define DGENERAL "general" 135 #define DPAGBuild "pag" 136 #define DMemModel "mm" 137 #define DMemModelCE "mmce" 138 #define DCOMModel "comm" 140 #define DDumpPT "dumppt" 141 #define DRefinePT "sbpt" 142 #define DCache "cache" 145 #define DInstrument "ins" 146 #define DAndersen "ander" 147 #define DSaber "saber" 155 #define TIMEINTERVAL 1000 156 #define CLOCK_IN_MS() (clock() / (CLOCKS_PER_SEC / TIMEINTERVAL)) 198 return value == rhs->
value;
203 return value != rhs->
value;
240 template <
typename T,
unsigned N>
244 if (sv.empty())
return 0;
245 if (sv.size() == 1)
return sv[0];
251 for (
const T &t : sv)
253 hash = hts(std::make_pair(ht(t), hash));
std::set< Key, Compare, Allocator > OrderedSet
SVFValue(const llvm::StringRef &val, SVFValKind k)
Constructor.
llvm::raw_ostream raw_ostream
LLVM outputs.
std::stack< NodeID > NodeStack
provide extra hash function for std::pair handling
const llvm::StringRef getName() const
Set< NodePair > NodePairSet
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
static bool classof(const SVFValue *node)
std::list< NodeID > NodeList
size_t operator()(const T &t) const
llvm::SmallVector< T, N > SmallVector
GNodeK getKind() const
Get the type of this SVFValue.
static size_t szudzik(size_t a, size_t b)
bool operator!=(SVFValue *rhs) const
Map< NodePair, NodeID > NodePairMap
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
bool operator==(SVFValue *rhs) const
std::vector< NodeID > NodeVector
SmallVector< u32_t, 16 > SmallVector16
SmallVector< u32_t, 8 > SmallVector8
llvm::StringRef StringRef
std::vector< EdgeID > EdgeVector
raw_ostream & operator<<(raw_ostream &o, const std::pair< F, S > &var)
size_t operator()(const SVF::SmallVector< T, N > &sv) const
std::deque< NodeID > NodeDeque
const std::string & getValue() const
llvm::SparseBitVector NodeBS
OrderedSet< NodeID > OrderedNodeSet
std::pair< NodeID, Version > VersionedVar
std::pair< NodeID, NodeID > NodePair
GNodeK kind
Type of this SVFValue.
llvm::StringMap< u32_t > StringMap
size_t operator()(const std::pair< S, T > &t) const
bool operator()(const SVFValue *lhs, const SVFValue *rhs) const
Add the hash function for std::set (we also can overload operator< to implement this) ...
std::map< Key, Value, Compare, Allocator > OrderedMap