30#ifndef INCLUDE_SVFIR_SVFTYPE_H_
31#define INCLUDE_SVFIR_SVFTYPE_H_
86 std::vector<const SVFType*>
finfo;
262 virtual void print(std::ostream&
os)
const = 0;
333 void print(std::ostream&
os)
const override;
357 void print(std::ostream&
os)
const override;
418 void print(std::ostream&
os)
const override;
453 void print(std::ostream&
os)
const override;
501 void print(std::ostream&
os)
const override;
557 void print(std::ostream&
os)
const override;
575#if !defined NDBUG && defined USE_SVF_DBOUT
580# define SVF_DEBUG_WITH_TYPE(TYPE, X) \
586# define SVF_DEBUG_WITH_TYPE(TYPE, X) \
593#define DBOUT(TYPE, X) SVF_DEBUG_WITH_TYPE(TYPE, X)
595#define DOTIMESTAT(X) X
599#define DGENERAL "general"
601#define DPAGBuild "pag"
602#define DMemModel "mm"
603#define DMemModelCE "mmce"
604#define DCOMModel "comm"
606#define DDumpPT "dumppt"
607#define DRefinePT "sbpt"
608#define DCache "cache"
611#define DInstrument "ins"
612#define DAndersen "ander"
613#define DSaber "saber"
621#define TIMEINTERVAL 1000
622#define CLOCK_IN_MS() (clock() / (CLOCKS_PER_SEC / TIMEINTERVAL))
625#define NATIVE_INT_SIZE (sizeof(unsigned long long) * CHAR_BIT)
645template <>
struct std::hash<
SVF::NodePair>
653 uint32_t first = (uint32_t)(
p.first);
654 uint32_t second = (uint32_t)(
p.second);
655 return ((uint64_t)(first) << 32) | (uint64_t)(second);
660template <
unsigned N>
struct std::hash<
SVF::SparseBitVector<N>>
670template <
typename T>
struct std::hash<std::vector<T>>
680 h ^= hf(t) + 0x9e3779b9 + (h << 6) + (h >> 2);
const std::string structName
const unsigned getNumOfElement() const
const SVFType * getTypeOfElement() const
const SVFType * typeOfElement
For printing & debugging.
void setTypeOfElement(const SVFType *elemType)
void setNumOfElement(unsigned elemNum)
static bool classof(const SVFType *node)
friend class GraphDBClient
void print(std::ostream &os) const override
SVFArrayType(u32_t i, u32_t byteSize=1)
For printing & debugging.
const SVFType * getReturnType() const
static bool classof(const SVFType *node)
SVFFunctionType(u32_t i, const SVFType *rt, const std::vector< const SVFType * > &p, bool isvararg)
const std::vector< const SVFType * > & getParamTypes() const
std::vector< const SVFType * > params
const void setReturnType(const SVFType *rt)
friend class GraphDBClient
void addParamType(const SVFType *type)
void print(std::ostream &os) const override
short signAndWidth
For printing.
short getSignAndWidth() const
void print(std::ostream &os) const override
friend class GraphDBClient
SVFIntegerType(u32_t i, u32_t byteSize=1)
void setSignAndWidth(short sw)
static bool classof(const SVFType *node)
const std::string & getRepr()
void print(std::ostream &os) const override
void setRepr(std::string &&r)
static bool classof(const SVFType *node)
void setRepr(const std::string &r)
friend class GraphDBClient
const std::string & getRepr() const
SVFOtherType(u32_t i, bool isSingleValueTy, u32_t byteSize=1)
Field representation for printing.
static bool classof(const SVFType *node)
SVFPointerType(u32_t i, u32_t byteSize=1)
friend class GraphDBClient
void print(std::ostream &os) const override
void addFieldsType(const SVFType *type)
std::string name
Field for printing & debugging.
const std::string & getName() const
static bool classof(const SVFType *node)
void setName(const std::string &structName)
std::vector< const SVFType * > fields
const std::vector< const SVFType * > & getFieldTypes() const
friend class GraphDBClient
void print(std::ostream &os) const override
void setName(std::string &&structName)
const std::string & getName()
SVFStructType(u32_t i, std::vector< const SVFType * > &f, u32_t byteSize=1)
const StInfo * getTypeInfo() const
static void setSVFInt8Type(SVFType *i8Ty)
GNodeK kind
used for classof
u32_t byteSize
LLVM Byte Size.
static SVFType * getSVFPtrType()
bool isSingleValueType() const
SVFType(bool svt, SVFTyKind k, u32_t i=0, u32_t Sz=1)
static SVFType * svfPtrTy
ptr type
static void setSVFPtrType(SVFType *ptrTy)
set svfptrty and svfi8ty when initializing SVFType from db query results
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.
static SVFType * getSVFInt8Type()
void setTypeInfo(StInfo *ti)
virtual void print(std::ostream &os) const =0
void addFldWithType(u32_t fldIdx, const SVFType *type, u32_t elemIdx)
Add field index and element index and their corresponding type.
void operator=(const StInfo &)=delete
const SVFType * getOriginalElemType(u32_t fldIdx) const
std::vector< const SVFType * > & getFlattenElementTypes()
const std::vector< u32_t > & getFlattenedElemIdxVec() const
void setNumOfFieldsAndElems(u32_t nf, u32_t ne)
Set number of fields and elements of an aggregate.
std::vector< u32_t > & getFlattenedElemIdxVec()
StInfo()=delete
Max field limit.
const Map< u32_t, const SVFType * > & getFldIdx2TypeMap() const
u32_t getNumOfFlattenElements() const
Return number of elements after flattening (including array elements)
std::vector< const SVFType * > & getFlattenFieldTypes()
~StInfo()=default
Destructor.
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 u32_t getStinfoId() const
u32_t numOfFlattenFields
number of fields after flattening (ignoring array elements)
const std::vector< const SVFType * > & getFlattenFieldTypes() const
friend class GraphDBClient
std::vector< const SVFType * > flattenElementTypes
Type vector of fields.
StInfo(u32_t id, std::vector< u32_t > fldIdxVec, std::vector< u32_t > elemIdxVec, Map< u32_t, const SVFType * > fldIdx2TypeMap, std::vector< const SVFType * > finfo, u32_t stride, u32_t numOfFlattenElements, u32_t numOfFlattenFields, std::vector< const SVFType * > flattenElementTypes)
void setStinfoId(u32_t id)
const std::vector< const SVFType * > & getFlattenElementTypes() const
std::vector< u32_t > & getFlattenedFieldIdxVec()
const std::vector< u32_t > & getFlattenedFieldIdxVec() const
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.
llvm::IRBuilder IRBuilder
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