30 #ifndef INCLUDE_SVFIR_SVFTYPE_H_
31 #define INCLUDE_SVFIR_SVFTYPE_H_
60 std::vector<const SVFType*>
finfo;
180 assert(
svfPtrTy &&
"ptr type not set?");
186 assert(
svfI8Ty &&
"int8 type not set?");
222 virtual void print(std::ostream& os)
const = 0;
232 assert(
typeinfo &&
"set the type info first");
238 assert(
typeinfo &&
"set the type info first");
288 void print(std::ostream& os)
const override;
306 void print(std::ostream& os)
const override;
341 void print(std::ostream& os)
const override;
361 void print(std::ostream& os)
const override;
397 void print(std::ostream& os)
const override;
448 void print(std::ostream& os)
const override;
460 uint32_t first = (uint32_t)(
p.first);
461 uint32_t second = (uint32_t)(
p.second);
462 return ((uint64_t)(first) << 32) | (uint64_t)(second);
466 #if !defined NDBUG && defined USE_SVF_DBOUT
471 # define SVF_DEBUG_WITH_TYPE(TYPE, X) \
477 # define SVF_DEBUG_WITH_TYPE(TYPE, X) \
484 #define DBOUT(TYPE, X) SVF_DEBUG_WITH_TYPE(TYPE, X)
486 #define DOTIMESTAT(X) X
490 #define DGENERAL "general"
492 #define DPAGBuild "pag"
493 #define DMemModel "mm"
494 #define DMemModelCE "mmce"
495 #define DCOMModel "comm"
497 #define DDumpPT "dumppt"
498 #define DRefinePT "sbpt"
499 #define DCache "cache"
502 #define DInstrument "ins"
503 #define DAndersen "ander"
504 #define DSaber "saber"
512 #define TIMEINTERVAL 1000
513 #define CLOCK_IN_MS() (clock() / (CLOCKS_PER_SEC / TIMEINTERVAL))
516 #define NATIVE_INT_SIZE (sizeof(unsigned long long) * CHAR_BIT)
544 uint32_t first = (uint32_t)(
p.first);
545 uint32_t second = (uint32_t)(
p.second);
546 return ((uint64_t)(first) << 32) | (uint64_t)(second);
551 template <
unsigned N>
struct std::hash<
SVF::SparseBitVector<N>>
561 template <
typename T>
struct std::hash<std::vector<T>>
571 h ^= hf(t) + 0x9e3779b9 + (h << 6) + (h >> 2);
const std::string structName
const SVFType * getTypeOfElement() const
const SVFType * typeOfElement
For printing & debugging.
SVFArrayType(u32_t byteSize=1)
For printing & debugging.
void setTypeOfElement(const SVFType *elemType)
void setNumOfElement(unsigned elemNum)
static bool classof(const SVFType *node)
void print(std::ostream &os) const override
static bool classof(const SVFType *node)
const SVFType * getReturnType() const
SVFFunctionType(const SVFType *rt)
void print(std::ostream &os) const override
SVFIntegerType(u32_t byteSize=1)
short signAndWidth
For printing.
void print(std::ostream &os) const override
void setSignAndWidth(short sw)
static bool classof(const SVFType *node)
void print(std::ostream &os) const override
void setRepr(std::string &&r)
static bool classof(const SVFType *node)
void setRepr(const std::string &r)
SVFOtherType(bool isSingleValueTy, u32_t byteSize=1)
Field representation for printing.
const std::string & getRepr()
static bool classof(const SVFType *node)
SVFPointerType(u32_t byteSize=1)
void print(std::ostream &os) const override
std::string name
Field for printing & debugging.
static bool classof(const SVFType *node)
void setName(const std::string &structName)
SVFStructType(u32_t byteSize=1)
void print(std::ostream &os) const override
const std::string & getName()
void setName(std::string &&structName)
SVFType(bool svt, SVFTyKind k, u32_t Sz=1)
static SVFType * getSVFInt8Type()
static SVFType * getSVFPtrType()
GNodeK kind
used for classof
bool isSingleValueType() const
static SVFType * svfPtrTy
ptr type
StInfo * typeinfo
SVF's TypeInfo.
std::string toString() const
u32_t getByteSize() const
static SVFType * svfI8Ty
8-bit int type
bool isSingleValTy
The type represents a single value, not struct or.
void setTypeInfo(StInfo *ti)
virtual void print(std::ostream &os) const =0
const StInfo * getTypeInfo() const
void operator=(const StInfo &)=delete
std::vector< const SVFType * > & getFlattenElementTypes()
const SVFType * getOriginalElemType(u32_t fldIdx) const
void setNumOfFieldsAndElems(u32_t nf, u32_t ne)
Set number of fields and elements of an aggregate.
const std::vector< u32_t > & getFlattenedFieldIdxVec() const
StInfo()=delete
Max field limit.
u32_t getNumOfFlattenElements() const
Return number of elements after flattening (including array elements)
std::vector< u32_t > & getFlattenedElemIdxVec()
~StInfo()=default
Destructor.
const std::vector< const SVFType * > & getFlattenElementTypes() const
std::vector< u32_t > fldIdxVec
flattened field indices of a struct (ignoring arrays)
u32_t numOfFlattenElements
number of elements after flattening (including array elements)
std::vector< u32_t > elemIdxVec
StInfo(u32_t s)
Constructor.
StInfo(const StInfo &st)=delete
const std::vector< u32_t > & getFlattenedElemIdxVec() const
const std::vector< const SVFType * > & getFlattenFieldTypes() const
u32_t numOfFlattenFields
number of fields after flattening (ignoring array elements)
void addFldWithType(u32_t fldIdx, const SVFType *type, u32_t elemIdx)
Add field index and element index and their corresponding type.
std::vector< u32_t > & getFlattenedFieldIdxVec()
std::vector< const SVFType * > flattenElementTypes
Type vector of fields.
std::vector< const SVFType * > & getFlattenFieldTypes()
Map< u32_t, const SVFType * > fldIdx2TypeMap
Types of all fields of a struct.
std::vector< const SVFType * > finfo
All field infos after flattening a struct.
u32_t getNumOfFlattenFields() const
Return the number of fields after flattening (ignoring array elements)
u32_t getStride() const
Return the stride.
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
std::pair< NodeID, NodeID > NodePair
IntervalValue operator<<(const IntervalValue &lhs, const IntervalValue &rhs)
Left binary shift of IntervalValues.
size_t operator()(const NodePair &p) const
provide extra hash function for std::pair handling
size_t operator()(const SVF::NodePair &p) const
size_t operator()(const SVF::SparseBitVector< N > &sbv) const
size_t operator()(const std::vector< T > &v) const