71 else if (
type->isPointerTy())
89 assert(
false &&
"What other types for this gep?");
102 u32_t structByteOffset = 0;
105 for (
u32_t structField = 0; structField < (
u32_t) op->getSExtValue(); ++structField)
110 return structByteOffset;
114 assert(
false &&
"struct type can only pair with constant idx");
147 assert(
type &&
"this GepStmt comes from ExternalAPI cannot call this api");
152 type2 = arrType->getTypeOfElement();
170 u32_t flattenIdx = structType->getTypeInfo()->getFlattenedFieldIdxVec()[structField];
183 return totalConstOffset;
234 totalConstOffset += constOffset;
250 SVFUtil::errs() <<
"It is an overflow access, hence it is the last idx\n";
258 u32_t flattenOffset =
261 totalConstOffset += flattenOffset;
265 return totalConstOffset;
296 if (pairVec.size() != rhsPairVec.size())
297 return (pairVec.size() < rhsPairVec.size());
300 IdxOperandPairs::const_iterator it = pairVec.begin();
301 IdxOperandPairs::const_iterator rhsIt = rhsPairVec.begin();
302 for (; it != pairVec.end() && rhsIt != rhsPairVec.end(); ++it, ++rhsIt)
304 return (*it) < (*rhsIt);
318 if (lhsLocations == rhsLocations)
320 else if (lhsLocations.
contains(rhsLocations))
322 else if (rhsLocations.
contains(lhsLocations))
337 std::stringstream rawstr(str);
340 rawstr <<
",\tNum-Stride: {";
342 IdxOperandPairs::const_iterator it = vec.begin();
343 IdxOperandPairs::const_iterator eit = vec.end();
344 for (; it != eit; ++it)
346 const SVFType* ty = it->second;
347 rawstr <<
" (Svf var: " << it->first->
toString() <<
", Iter type: " << *ty <<
")";
std::vector< IdxOperandPair > IdxOperandPairs
const SVFType * gepPointeeType
u32_t getElementNum(const SVFType *type) const
Return element number of a type.
bool isConstantOffset() const
Return TRUE if this is a constant location set.
APOffset computeConstantByteOffset() const
std::string dump() const
Dump location set.
IdxOperandPairs idxOperandPairs
a vector of actual offset in the form of <SVF Var, iterator type>
APOffset getConstantStructFldIdx() const
Get methods.
AccessPath operator+(const AccessPath &rhs) const
Overload operators.
const SVFType * gepSrcPointeeType() const
NodeBS computeAllLocations() const
Compute all possible locations according to offset and number-stride pairs.
LSRelation checkRelation(const AccessPath &LHS, const AccessPath &RHS)
Check relations of two location sets.
APOffset fldIdx
Accumulated Constant Offsets.
u32_t getStructFieldOffset(const ValVar *idxOperandVar, const SVFStructType *idxOperandType) const
Return byte offset from the beginning of the structure to the field where it is located for struct ty...
const IdxOperandPairs & getIdxOperandPairVec() const
AccessPath(APOffset o=0, const SVFType *srcTy=nullptr)
Constructor.
bool addOffsetVarAndGepTypePair(const ValVar *var, const SVFType *gepIterType)
bool operator<(const AccessPath &rhs) const
APOffset computeConstantOffset() const
For example,.
s64_t getSExtValue() const
u32_t getFlattenedElemIdx(const SVFType *T, u32_t origId)
Flattened element idx of an array or struct by considering stride.
u32_t getNumOfFlattenElements(const SVFType *T)
const StInfo * getTypeInfo(const SVFType *T) const
Get struct info.
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
std::string toString() const
u32_t getByteSize() const
bool intersects(const SparseBitVector< ElementSize > *RHS) const
bool contains(const SparseBitVector< ElementSize > &RHS) const
const SVFType * getOriginalElemType(u32_t fldIdx) const
std::vector< u32_t > & getFlattenedElemIdxVec()
std::vector< u32_t > & getFlattenedFieldIdxVec()
LLVM_NODISCARD bool isa(const Y &Val)
std::ostream & errs()
Overwrite llvm::errs().
std::ostream & outs()
Overwrite llvm::outs().
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)