Static Value-Flow Analysis
|
#include <PointsTo.h>
Classes | |
class | PointsToIterator |
Public Types | |
enum | Type { SBV , CBV , BV } |
typedef PointsToIterator | const_iterator |
typedef const_iterator | iterator |
typedef std::shared_ptr< std::vector< NodeID > > | MappingPtr |
Public Member Functions | |
PointsTo () | |
Construct empty points-to set. | |
PointsTo (const PointsTo &pt) | |
Copy constructor. | |
PointsTo (PointsTo &&pt) noexcept | |
Move constructor. | |
~PointsTo () | |
PointsTo & | operator= (const PointsTo &rhs) |
Copy assignment. | |
PointsTo & | operator= (PointsTo &&rhs) noexcept |
Move assignment. | |
bool | empty () const |
Returns true if set is empty. | |
u32_t | count () const |
Returns number of elements. | |
void | clear () |
Empty the set. | |
bool | test (u32_t n) const |
Returns true if n is in this set. | |
bool | test_and_set (u32_t n) |
void | set (u32_t n) |
Inserts n in the set. | |
void | reset (u32_t n) |
Removes n from the set. | |
bool | contains (const PointsTo &rhs) const |
Returns true if this set is a superset of rhs. | |
bool | intersects (const PointsTo &rhs) const |
Returns true if this set and rhs share any elements. | |
int | find_first () |
bool | operator== (const PointsTo &rhs) const |
Returns true if this set and rhs contain exactly the same elements. | |
bool | operator!= (const PointsTo &rhs) const |
Returns true if either this set or rhs has an element not in the other. | |
bool | operator|= (const PointsTo &rhs) |
bool | operator|= (const NodeBS &rhs) |
bool | operator&= (const PointsTo &rhs) |
bool | operator-= (const PointsTo &rhs) |
bool | intersectWithComplement (const PointsTo &rhs) |
void | intersectWithComplement (const PointsTo &lhs, const PointsTo &rhs) |
Put intersection of lhs with complement of rhs into this set (overwrites). | |
NodeBS | toNodeBS () const |
Returns this points-to set as a NodeBS. | |
size_t | hash () const |
Return a hash of this set. | |
void | checkAndRemap () |
const_iterator | begin () const |
const_iterator | end () const |
MappingPtr | getNodeMapping () const |
Static Public Member Functions | |
static MappingPtr | getCurrentBestNodeMapping () |
static MappingPtr | getCurrentBestReverseNodeMapping () |
static void | setCurrentBestNodeMapping (MappingPtr newCurrentBestNodeMapping, MappingPtr newCurrentBestReverseNodeMapping) |
Private Member Functions | |
NodeID | getInternalNode (NodeID n) const |
Returns nodeMapping[n], checking for nullptr and size. | |
NodeID | getExternalNode (NodeID n) const |
Returns reverseNodeMapping[n], checking for nullptr and size. | |
bool | metaSame (const PointsTo &pt) const |
Private Attributes | ||
union { | ||
SparseBitVector sbv | ||
Sparse bit vector backing. More... | ||
CoreBitVector cbv | ||
Core bit vector backing. More... | ||
BitVector bv | ||
Bit vector backing. More... | ||
}; | ||
enum Type | type | |
Type of this points-to set. | ||
MappingPtr | nodeMapping | |
External nodes -> internal nodes. | ||
MappingPtr | reverseNodeMapping | |
Internal nodes -> external nodes. | ||
Static Private Attributes | |
static MappingPtr | currentBestNodeMapping = nullptr |
Best node mapping we know of the for the analyses at hand. | |
static MappingPtr | currentBestReverseNodeMapping = nullptr |
Likewise, but reversed. | |
Wraps data structures to provide a points-to set. Underlying data structure can be changed globally. Includes support for mapping nodes for better internal representation.
Definition at line 28 of file PointsTo.h.
Definition at line 39 of file PointsTo.h.
Definition at line 40 of file PointsTo.h.
typedef std::shared_ptr<std::vector<NodeID> > SVF::PointsTo::MappingPtr |
Definition at line 42 of file PointsTo.h.
SVF::PointsTo::PointsTo | ( | ) |
Construct empty points-to set.
Definition at line 25 of file PointsTo.cpp.
Copy constructor.
Definition at line 35 of file PointsTo.cpp.
|
noexcept |
Move constructor.
Definition at line 45 of file PointsTo.cpp.
SVF::PointsTo::~PointsTo | ( | ) |
Definition at line 55 of file PointsTo.cpp.
|
inline |
Definition at line 128 of file PointsTo.h.
void SVF::PointsTo::checkAndRemap | ( | ) |
Checks if this points-to set is using the current best mapping. If not, remaps.
Definition at line 378 of file PointsTo.cpp.
void SVF::PointsTo::clear | ( | ) |
Returns true if this set is a superset of rhs.
Definition at line 175 of file PointsTo.cpp.
u32_t SVF::PointsTo::count | ( | void | ) | const |
Returns number of elements.
Definition at line 111 of file PointsTo.cpp.
bool SVF::PointsTo::empty | ( | ) | const |
Returns true if set is empty.
Definition at line 98 of file PointsTo.cpp.
|
inline |
Definition at line 132 of file PointsTo.h.
int SVF::PointsTo::find_first | ( | ) |
Returns the first element the set. Returns -1 when the set is empty. TODO: should we diverge from LLVM about the int return?
Definition at line 203 of file PointsTo.cpp.
|
static |
Definition at line 361 of file PointsTo.cpp.
|
static |
Definition at line 366 of file PointsTo.cpp.
Returns reverseNodeMapping[n], checking for nullptr and size.
Definition at line 349 of file PointsTo.cpp.
Returns nodeMapping[n], checking for nullptr and size.
Definition at line 342 of file PointsTo.cpp.
PointsTo::MappingPtr SVF::PointsTo::getNodeMapping | ( | ) | const |
Definition at line 337 of file PointsTo.cpp.
size_t SVF::PointsTo::hash | ( | ) | const |
Return a hash of this set.
Definition at line 320 of file PointsTo.cpp.
Returns true if this set and rhs share any elements.
Definition at line 189 of file PointsTo.cpp.
Put intersection of lhs with complement of rhs into this set (overwrites).
Definition at line 298 of file PointsTo.cpp.
Returns true if this points-to set and pt have the same type, nodeMapping, and reverseNodeMapping
Definition at line 356 of file PointsTo.cpp.
Returns true if either this set or rhs has an element not in the other.
Definition at line 223 of file PointsTo.cpp.
Put intersection of this set and rhs into this set. Returns true if this set changed.
Definition at line 258 of file PointsTo.cpp.
Remove elements in rhs from this set. Returns true if this set changed.
Definition at line 272 of file PointsTo.cpp.
Copy assignment.
Definition at line 66 of file PointsTo.cpp.
Move assignment.
Definition at line 83 of file PointsTo.cpp.
Returns true if this set and rhs contain exactly the same elements.
Definition at line 209 of file PointsTo.cpp.
Definition at line 245 of file PointsTo.cpp.
Put union of this set and rhs into this set. Returns true if this set changed.
Definition at line 231 of file PointsTo.cpp.
void SVF::PointsTo::reset | ( | u32_t | n | ) |
Removes n from the set.
Definition at line 166 of file PointsTo.cpp.
void SVF::PointsTo::set | ( | u32_t | n | ) |
|
static |
Definition at line 371 of file PointsTo.cpp.
Returns true if n is in this set.
Definition at line 131 of file PointsTo.cpp.
Check if n is in set. If it is, returns false. Otherwise, inserts n and returns true.
Definition at line 144 of file PointsTo.cpp.
NodeBS SVF::PointsTo::toNodeBS | ( | ) | const |
Returns this points-to set as a NodeBS.
Definition at line 313 of file PointsTo.cpp.
union { ... } SVF::PointsTo |
Holds backing data structure. TODO: std::variant when we move to C++17.
BitVector SVF::PointsTo::bv |
Bit vector backing.
Definition at line 170 of file PointsTo.h.
CoreBitVector SVF::PointsTo::cbv |
Core bit vector backing.
Definition at line 168 of file PointsTo.h.
|
staticprivate |
Best node mapping we know of the for the analyses at hand.
Definition at line 157 of file PointsTo.h.
|
staticprivate |
Likewise, but reversed.
Definition at line 159 of file PointsTo.h.
|
private |
External nodes -> internal nodes.
Definition at line 176 of file PointsTo.h.
|
private |
Internal nodes -> external nodes.
Definition at line 178 of file PointsTo.h.
SparseBitVector SVF::PointsTo::sbv |
Sparse bit vector backing.
Definition at line 166 of file PointsTo.h.
Type of this points-to set.
Definition at line 174 of file PointsTo.h.