#include <LocationSet.h>
Definition at line 93 of file LocationSet.h.
◆ ElemNumStridePairVec
◆ LSRelation
Enumerator |
---|
NonOverlap | |
Overlap | |
Subset | |
Superset | |
Same | |
Definition at line 98 of file LocationSet.h.
◆ LocationSet() [1/3]
SVF::LocationSet::LocationSet |
( |
Size_t |
o = 0 | ) |
|
|
inline |
Constructor.
Definition at line 106 of file LocationSet.h.
Size_t byteOffset
offset relative to base
Size_t fldIdx
offset relative to base
◆ LocationSet() [2/3]
SVF::LocationSet::LocationSet |
( |
const LocationSet & |
ls | ) |
|
|
inline |
Copy Constructor.
Definition at line 110 of file LocationSet.h.
114 ElemNumStridePairVec::const_iterator it = vec.begin();
115 ElemNumStridePairVec::const_iterator eit = vec.end();
116 for (; it != eit; ++it)
FieldInfo::ElemNumStridePairVec ElemNumStridePairVec
void addElemNumStridePair(const NodePair &pair)
Size_t byteOffset
offset relative to base
Size_t fldIdx
offset relative to base
◆ LocationSet() [3/3]
SVF::LocationSet::LocationSet |
( |
const FieldInfo & |
fi | ) |
|
|
inline |
Initialization from FieldInfo.
Definition at line 121 of file LocationSet.h.
125 ElemNumStridePairVec::const_iterator it = vec.begin();
126 ElemNumStridePairVec::const_iterator eit = vec.end();
127 for (; it != eit; ++it)
FieldInfo::ElemNumStridePairVec ElemNumStridePairVec
void addElemNumStridePair(const NodePair &pair)
Size_t byteOffset
offset relative to base
Size_t fldIdx
offset relative to base
◆ ~LocationSet()
SVF::LocationSet::~LocationSet |
( |
| ) |
|
|
inline |
◆ addElemNumStridePair()
void LocationSet::addElemNumStridePair |
( |
const NodePair & |
pair | ) |
|
Add element num and stride pair
The pair will not be added if any number of a stride is zero, because they will not have effect on the locations represented by this LocationSet.
Find the GCD stride
Definition at line 42 of file LocationSet.cpp.
46 if (pair.first == 0 || pair.second == 0)
57 NodeID newStride =
gcd(pair.second, existStride);
58 if (newStride != existStride)
static const llvm::cl::opt< bool > SingleStride
unsigned gcd(unsigned n1, unsigned n2) const
Return greatest common divisor.
static u32_t getMaxFieldLimit()
ElemNumStridePairVec numStridePair
element number and stride pair
◆ checkRelation()
Check relations of two location sets.
Definition at line 231 of file LocationSet.h.
233 PointsTo lhsLocations = LHS.computeAllLocations();
234 PointsTo rhsLocations = RHS.computeAllLocations();
235 if (lhsLocations.intersects(rhsLocations))
237 if (lhsLocations == rhsLocations)
239 else if (lhsLocations.contains(rhsLocations))
241 else if (rhsLocations.contains(lhsLocations))
◆ computeAllLocations()
PointsTo LocationSet::computeAllLocations |
( |
| ) |
const |
|
private |
Compute all possible locations according to offset and number-stride pairs.
Compute all possible locations according to offset and number-stride pairs.
Definition at line 116 of file LocationSet.cpp.
125 std::vector<NodeID> indices;
126 u32_t size = lhsVec.size();
129 indices.push_back(0);
137 while (i < lhsVec.size())
139 ofst += (lhsVec[i].second * indices[i]);
FieldInfo::ElemNumStridePairVec ElemNumStridePairVec
bool isConstantOffset() const
Return TRUE if this is a constant location set.
bool increaseIfNotReachUpperBound(std::vector< NodeID > &indices, const ElemNumStridePairVec &pairVec) const
Return TRUE if successfully increased any index by 1.
Size_t getOffset() const
Get methods.
const ElemNumStridePairVec & getNumStridePair() const
◆ dump()
std::string SVF::LocationSet::dump |
( |
| ) |
const |
|
inline |
Dump location set.
Definition at line 253 of file LocationSet.h.
258 rawstr <<
"LocationSet\tField_Index: " <<
getOffset();
260 <<
",\tNum-Stride: {";
262 ElemNumStridePairVec::const_iterator it = vec.begin();
263 ElemNumStridePairVec::const_iterator eit = vec.end();
264 for (; it != eit; ++it)
266 rawstr <<
" (" << it->first <<
"," << it->second <<
")";
Size_t getByteOffset() const
FieldInfo::ElemNumStridePairVec ElemNumStridePairVec
llvm::raw_string_ostream raw_string_ostream
Size_t getOffset() const
Get methods.
const ElemNumStridePairVec & getNumStridePair() const
◆ gcd()
unsigned SVF::LocationSet::gcd |
( |
unsigned |
n1, |
|
|
unsigned |
n2 |
|
) |
| const |
|
inlineprivate |
Return greatest common divisor.
Definition at line 279 of file LocationSet.h.
281 return (n2 == 0) ? n1 :
gcd (n2, n1 % n2);
unsigned gcd(unsigned n1, unsigned n2) const
Return greatest common divisor.
◆ getByteOffset()
Size_t SVF::LocationSet::getByteOffset |
( |
| ) |
const |
|
inline |
Definition at line 198 of file LocationSet.h.
Size_t byteOffset
offset relative to base
◆ getNumStridePair()
Definition at line 210 of file LocationSet.h.
ElemNumStridePairVec numStridePair
element number and stride pair
◆ getOffset()
Size_t SVF::LocationSet::getOffset |
( |
| ) |
const |
|
inline |
Get methods.
Definition at line 194 of file LocationSet.h.
Size_t fldIdx
offset relative to base
◆ increaseIfNotReachUpperBound()
Return TRUE if successfully increased any index by 1.
Return TRUE if it successfully increases any index by 1
Check if all indices reach upper bound
Increase index if not reach upper bound
Definition at line 75 of file LocationSet.cpp.
78 assert(indices.size() == pairVec.size() &&
"vector size not match");
81 bool reachUpperBound =
true;
82 for (
u32_t i = 0; i < indices.size(); i++)
84 assert(pairVec[i].first > 0 &&
"number must be greater than 0");
85 if (indices[i] < (pairVec[i].first - 1))
86 reachUpperBound =
false;
90 bool increased =
false;
91 if (reachUpperBound ==
false)
94 while (increased ==
false)
96 if (indices[i] < (pairVec[i].first - 1))
◆ intersects()
bool SVF::LocationSet::intersects |
( |
const LocationSet & |
RHS | ) |
const |
|
inline |
Return TRUE if we share any location in common with RHS.
Definition at line 225 of file LocationSet.h.
PointsTo computeAllLocations() const
Compute all possible locations according to offset and number-stride pairs.
◆ isConstantOffset()
bool SVF::LocationSet::isConstantOffset |
( |
| ) |
const |
|
inline |
Return TRUE if this is a constant location set.
Definition at line 219 of file LocationSet.h.
ElemNumStridePairVec numStridePair
element number and stride pair
◆ operator+()
Overload operators.
Definition at line 136 of file LocationSet.h.
143 for (; it != eit; ++it)
144 ls.addElemNumStridePair(*it);
Size_t getByteOffset() const
LocationSet(Size_t o=0)
Constructor.
Size_t getOffset() const
Get methods.
const ElemNumStridePairVec & getNumStridePair() const
◆ operator<()
bool SVF::LocationSet::operator< |
( |
const LocationSet & |
rhs | ) |
const |
|
inline |
Definition at line 155 of file LocationSet.h.
158 return (
fldIdx < rhs.fldIdx);
165 if (pairVec.size() != rhsPairVec.size())
166 return (pairVec.size() < rhsPairVec.size());
169 ElemNumStridePairVec::const_iterator it = pairVec.begin();
170 ElemNumStridePairVec::const_iterator rhsIt = rhsPairVec.begin();
171 for (; it != pairVec.end() && rhsIt != rhsPairVec.end(); ++it, ++rhsIt)
173 if ((*it).first != (*rhsIt).first)
174 return ((*it).first < (*rhsIt).first);
175 else if ((*it).second != (*rhsIt).second)
176 return ((*it).second < (*rhsIt).second);
FieldInfo::ElemNumStridePairVec ElemNumStridePairVec
Size_t fldIdx
offset relative to base
const ElemNumStridePairVec & getNumStridePair() const
◆ operator=()
Definition at line 148 of file LocationSet.h.
Size_t byteOffset
offset relative to base
Size_t fldIdx
offset relative to base
ElemNumStridePairVec numStridePair
element number and stride pair
◆ operator==()
bool SVF::LocationSet::operator== |
( |
const LocationSet & |
rhs | ) |
const |
|
inline |
Definition at line 184 of file LocationSet.h.
186 return this->
fldIdx == rhs.fldIdx
Size_t byteOffset
offset relative to base
Size_t fldIdx
offset relative to base
ElemNumStridePairVec numStridePair
element number and stride pair
◆ setByteOffset()
void SVF::LocationSet::setByteOffset |
( |
Size_t |
os | ) |
|
|
inline |
Definition at line 206 of file LocationSet.h.
Size_t byteOffset
offset relative to base
◆ setFldIdx()
void SVF::LocationSet::setFldIdx |
( |
Size_t |
idx | ) |
|
|
inline |
Definition at line 202 of file LocationSet.h.
Size_t fldIdx
offset relative to base
◆ LocSymTableInfo
◆ SymbolTableInfo
◆ byteOffset
Size_t SVF::LocationSet::byteOffset |
|
private |
◆ fldIdx
Size_t SVF::LocationSet::fldIdx |
|
private |
◆ numStridePair
The documentation for this class was generated from the following files: