48 assert(
false &&
"No preAbsTrace for this node");
106 assert(
false &&
"Unknown SVFVar kind");
119 return it->second.getVarToVal().count(var->
getId()) != 0;
127 return it->second.getLocToVal().count(var->
getId()) != 0;
158 assert(
false &&
"Unknown SVFVar kind");
164 for (
const ValVar* var : vars)
174 for (
const ObjVar* var : vars)
184 for (
const SVFVar* var : vars)
188 u32_t id = valVar->getId();
213 idxLb = idxUb = constInt->getSExtValue();
237 if (so.empty() || idxUb >= (
APOffset)so.size() || idxLb < 0)
270 u32_t elemByteSize = 1;
272 elemByteSize = arrOperandType->getTypeOfElement()->getByteSize();
276 assert(
false &&
"idxOperandType must be ArrType or PtrType");
281 ? op->getSExtValue() * elemByteSize
292 s64_t ub = (idxVal.
ub().getIntNumeral() < 0) ? 0
296 s64_t lb = (idxVal.
lb().getIntNumeral() < 0) ? 0
310 assert(
false &&
"gep type pair only support arr/ptr/struct");
328 for (
const auto& addr : addrs.
getAddrs())
363 if (targets.
size() != 1)
367 if (
svfir->isNullOrBlkObj(obj))
371 const auto* pta =
preAnalysis->getPointerAnalysis();
373 if (pta->isHeapMemObj(obj) ||
375 pta->isLocalVarInRecursiveFun(obj))
380 if (pta->isArrayMemObj(obj) && !
svfir->isGepObjVar(obj))
424 return svfir->getBaseObject(objId)->getType();
435 if (
svfir->getBaseObject(objvar->getId())->isConstantByteSize())
437 const u32_t size =
svfir->getBaseObject(objvar->getId())->getByteSizeOfObj();
442 const std::vector<SVFVar*>& sizes = addr->
getArrSize();
443 u32_t elementSize = 1;
444 u64_t upper = elementSize;
445 u64_t lower = sizes.empty() ? 0 : elementSize;
446 for (
const SVFVar* value : sizes)
458 return {
static_cast<u32_t>(std::min(lower, upper)),
static_cast<u32_t>(upper)};
461 assert(
false &&
"Addr rhs value is not ObjVar");
AbstractState & getAbsState(const ICFGNode *node)
bool isStrongUpdate(const AddressValue &targets, const AbstractState &state) const
virtual bool hasAbsValue(const ValVar *var, const ICFGNode *node) const
Side-effect-free existence check.
IntervalValue getGepByteOffset(const GepStmt *gep)
virtual AbstractValue loadValue(const ValVar *pointer, const ICFGNode *node)
Read memory through the pointer's address targets.
AddressValue getGepObjAddrs(const ValVar *pointer, IntervalValue offset)
IntervalValue getGepElementIndex(const GepStmt *gep)
virtual void joinStates(AbstractState &dst, const AbstractState &src)
SVFIR * svfir
Data and helpers reachable from SparseAbstractInterpretation.
virtual const AbstractValue & getAbsValue(const ValVar *var, const ICFGNode *node)
AllocationSizeBounds getAllocaInstByteSize(const AddrStmt *addr)
bool hasAbsState(const ICFGNode *node)
const SVFType * getPointeeElement(const ObjVar *var, const ICFGNode *node)
Map< const ICFGNode *, AbstractState > abstractTrace
per-node trace; owned here
virtual void updateAbsValue(const ValVar *var, const AbstractValue &val, const ICFGNode *node)
virtual void storeValue(const ValVar *pointer, const AbstractValue &val, const ICFGNode *node)
virtual void updateAbsState(const ICFGNode *node, const AbstractState &state)
const VarToAbsValMap & getVarToVal() const
get var2val map
u32_t getIDFromAddr(u32_t addr) const
Return the internal index if addr is an address otherwise return the value of idx.
void store(u32_t addr, const AbstractValue &val)
void joinWith(const AbstractState &other)
domain join with other, important! other widen this.
static bool isNullOrBlackHoleAddr(u32_t addr)
Whether addr has no concrete backing memory object.
virtual AbstractValue & load(u32_t addr)
static u32_t getVirtualMemAddress(u32_t idx)
The physical address starts with 0x7f...... + idx.
void join_with(const AbstractValue &other)
IntervalValue & getInterval()
AddressValue & getAddrs()
u32_t getElementNum(const SVFType *type) const
Return element number of a type.
const SVFType * gepSrcPointeeType() const
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 ObjVar * getRHSVar() const
const std::vector< SVFVar * > & getArrSize() const
std::pair< AddressValue::AddrSet::iterator, bool > insert(u32_t id)
AddrSet::const_iterator begin() const
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.
bool isFieldInsensitive() const
Return true if its field limit is 0.
const SVFType * getType() const
Get obj type.
s64_t getIntNumeral() const
APOffset accumulateConstantOffset() const
Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
APOffset accumulateConstantByteOffset() const
const AccessPath::IdxOperandPairs getOffsetVarAndGepTypePairVec() const
const AccessPath & getAccessPath() const
bool isConstantOffset() const
Return TRUE if this is a constant location set.
u32_t getFlattenedElemIdx(const SVFType *T, u32_t origId)
Flattened element idx of an array or struct by considering stride.
const StInfo * getTypeInfo(const SVFType *T) const
Get struct info.
void meet_with(const IntervalValue &other)
Return a intersected IntervalValue.
const BoundedInt & ub() const
Return the upper bound.
static IntervalValue top()
Create the IntervalValue [-inf, +inf].
const BoundedInt & lb() const
Return the lower bound.
static Option< bool > ModelArrays
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.
ICFGNode * getICFGNode() const
u32_t getByteSize() const
NodeID getId() const
Get ID.
virtual const SVFType * getType() const
std::vector< u32_t > & getFlattenedElemIdxVec()
u32_t getNumOfFlattenElements() const
Return number of elements after flattening (including array elements).
const ICFGNode * getICFGNode() const
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
LLVM_NODISCARD bool isa(const Y &Val)
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set