|
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 |
| void | destroyBacking () |
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 29 of file PointsTo.h.
Definition at line 40 of file PointsTo.h.
Definition at line 41 of file PointsTo.h.
| typedef std::shared_ptr<std::vector<NodeID> > SVF::PointsTo::MappingPtr |
Definition at line 43 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 63 of file PointsTo.cpp.
|
inline |
Definition at line 129 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 390 of file PointsTo.cpp.
| void SVF::PointsTo::clear | ( | ) |
Returns true if this set is a superset of rhs.
Definition at line 187 of file PointsTo.cpp.
| u32_t SVF::PointsTo::count | ( | void | ) | const |
Returns number of elements.
Definition at line 123 of file PointsTo.cpp.
|
private |
Ends the lifetime of the backing this set currently holds, through the type currently stored in type. Callers that then placement new a new backing must call this first, or whatever the old backing owned is lost.
Definition at line 55 of file PointsTo.cpp.
| bool SVF::PointsTo::empty | ( | ) | const |
Returns true if set is empty.
Definition at line 110 of file PointsTo.cpp.
|
inline |
Definition at line 133 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 215 of file PointsTo.cpp.
|
static |
Definition at line 373 of file PointsTo.cpp.
|
static |
Definition at line 378 of file PointsTo.cpp.
Returns reverseNodeMapping[n], checking for nullptr and size.
Definition at line 361 of file PointsTo.cpp.
Returns nodeMapping[n], checking for nullptr and size.
Definition at line 354 of file PointsTo.cpp.
| PointsTo::MappingPtr SVF::PointsTo::getNodeMapping | ( | ) | const |
Definition at line 349 of file PointsTo.cpp.
| size_t SVF::PointsTo::hash | ( | ) | const |
Return a hash of this set.
Definition at line 332 of file PointsTo.cpp.
Returns true if this set and rhs share any elements.
Definition at line 201 of file PointsTo.cpp.
Put intersection of lhs with complement of rhs into this set (overwrites).
Definition at line 310 of file PointsTo.cpp.
Returns true if this points-to set and pt have the same type, nodeMapping, and reverseNodeMapping
Definition at line 368 of file PointsTo.cpp.
Returns true if either this set or rhs has an element not in the other.
Definition at line 235 of file PointsTo.cpp.
Put intersection of this set and rhs into this set. Returns true if this set changed.
Definition at line 270 of file PointsTo.cpp.
Remove elements in rhs from this set. Returns true if this set changed.
Definition at line 284 of file PointsTo.cpp.
Copy assignment.
Definition at line 71 of file PointsTo.cpp.
Move assignment.
Definition at line 92 of file PointsTo.cpp.
Returns true if this set and rhs contain exactly the same elements.
Definition at line 221 of file PointsTo.cpp.
Definition at line 257 of file PointsTo.cpp.
Put union of this set and rhs into this set. Returns true if this set changed.
Definition at line 243 of file PointsTo.cpp.
| void SVF::PointsTo::reset | ( | u32_t | n | ) |
Removes n from the set.
Definition at line 178 of file PointsTo.cpp.
| void SVF::PointsTo::set | ( | u32_t | n | ) |
|
static |
Definition at line 383 of file PointsTo.cpp.
Returns true if n is in this set.
Definition at line 143 of file PointsTo.cpp.
Check if n is in set. If it is, returns false. Otherwise, inserts n and returns true.
Definition at line 156 of file PointsTo.cpp.
| NodeBS SVF::PointsTo::toNodeBS | ( | ) | const |
Returns this points-to set as a NodeBS.
Definition at line 325 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 176 of file PointsTo.h.
| CoreBitVector SVF::PointsTo::cbv |
Core bit vector backing.
Definition at line 174 of file PointsTo.h.
|
staticprivate |
Best node mapping we know of the for the analyses at hand.
Definition at line 163 of file PointsTo.h.
|
staticprivate |
Likewise, but reversed.
Definition at line 165 of file PointsTo.h.
|
private |
External nodes -> internal nodes.
Definition at line 182 of file PointsTo.h.
|
private |
Internal nodes -> external nodes.
Definition at line 184 of file PointsTo.h.
| SparseBitVector SVF::PointsTo::sbv |
Sparse bit vector backing.
Definition at line 172 of file PointsTo.h.
Type of this points-to set.
Definition at line 180 of file PointsTo.h.