31#ifndef INCLUDE_SVFIR_SVFSTATEMENT_H_
32#define INCLUDE_SVFIR_SVFSTATEMENT_H_
44class FunEntryICFGNode;
205 virtual const std::string
toString()
const;
212 o <<
edge.toString();
346 virtual const std::string
toString()
const override;
444 virtual const std::string
toString()
const override;
483 virtual const std::string
toString()
const override;
520 virtual const std::string
toString()
const override;
588 assert(
isVariantFieldGep()==
false &&
"Can't retrieve the AccessPath if using a variable field index (pointer arithmetic) for struct field access ");
603 virtual const std::string
toString()
const;
665 virtual const std::string
toString()
const override;
726 virtual const std::string
toString()
const override;
856 "Numbers of operands and their ICFGNodes are not consistent?");
863 "Numbers of operands and their ICFGNodes are not consistent?");
876 virtual const std::string
toString()
const override;
918 virtual const std::string
toString()
const override;
1017 virtual const std::string
toString()
const override;
1087 virtual const std::string
toString()
const override;
1154 virtual const std::string
toString()
const override;
1244 virtual const std::string
toString()
const override;
1285 virtual const std::string
toString()
const;
1326 virtual const std::string
toString()
const;
std::vector< IdxOperandPair > IdxOperandPairs
bool isConstantOffset() const
Return TRUE if this is a constant location set.
APOffset computeConstantByteOffset() const
APOffset getConstantStructFldIdx() const
Get methods.
const IdxOperandPairs & getIdxOperandPairVec() const
APOffset computeConstantOffset() const
For example,.
AddrStmt()
Constructs empty AddrStmt (for SVFIRReader/serialization)
void operator=(const AddrStmt &)
place holder
AddrStmt(const AddrStmt &)
place holder
static bool classof(const AddrStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
std::vector< SVFValue * > arrSize
Array size of the allocated memory.
AddrStmt(SVFVar *s, SVFVar *d)
constructor
static bool classof(const GenericPAGEdgeTy *edge)
const std::vector< SVFValue * > & getArrSize() const
virtual const std::string toString() const override
void addArrSize(SVFValue *size)
get array size of the allocated memory
static bool classof(const SVFStmt *edge)
AssignStmt(GEdgeFlag k)
Constructor to create empty AssignStmt (for SVFIRReader/serialization)
SVFVar * getSrcNode()
not allowed, use getRHSVar() instead
SVFVar * getDstNode()
not allowed, use getLHSVar() instead
AssignStmt(const AssignStmt &)
place holder
NodeID getRHSVarID() const
static bool classof(const AssignStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const GenericPAGEdgeTy *edge)
NodeID getLHSVarID() const
NodeID getDstID()
not allowed, use getLHSVarID() instead
NodeID getSrcID()
not allowed, use getRHSVarID() instead
SVFVar * getLHSVar() const
virtual const std::string toString() const =0
SVFVar * getRHSVar() const
void operator=(const AssignStmt &)
place holder
static bool classof(const SVFStmt *edge)
AssignStmt(SVFVar *s, SVFVar *d, GEdgeFlag k)
constructor
virtual const std::string toString() const override
OpCode
OpCode for BinaryOPStmt, enum value is same to llvm BinaryOperator (llvm/IR/Instruction....
BinaryOPStmt()
Constructs empty BinaryOPStmt (for SVFIRReader/serialization)
static bool classof(const MultiOpndStmt *edge)
void operator=(const BinaryOPStmt &)
place holder
BinaryOPStmt(const BinaryOPStmt &)
place holder
static bool classof(const BinaryOPStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFStmt *edge)
static bool classof(const GenericPAGEdgeTy *edge)
u32_t getNumSuccessors() const
bool isUnconditional() const
The branch is unconditional if cond is a null value.
const ICFGNode * getSuccessor(u32_t i) const
SuccAndCondPairVec successors
void operator=(const BranchStmt &)
place holder
static bool classof(const SVFStmt *edge)
BranchStmt(SVFVar *inst, SVFVar *c, const SuccAndCondPairVec &succs)
constructor
std::vector< std::pair< const ICFGNode *, s32_t > > SuccAndCondPairVec
BranchStmt(const BranchStmt &)
place holder
bool isConditional() const
The branch is conditional if cond is not a null value.
static bool classof(const BranchStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
s64_t getSuccessorCondValue(u32_t i) const
BranchStmt()
Constructs empty BranchStmt (for SVFIRReader/serialization)
SVFVar * getDstNode()
place holder, not allowed
const SVFVar * getCondition() const
Return the condition.
NodeID getSrcID()
place holder, use getOpVarID(pos) instead
const SVFVar * getBranchInst() const
SVFVar * getSrcNode()
place holder, not allowed
const SuccAndCondPairVec & getSuccessors() const
NodeID getDstID()
place holder, use getResID() instead
static bool classof(const GenericPAGEdgeTy *edge)
virtual const std::string toString() const override
static bool classof(const GenericPAGEdgeTy *edge)
CallPE(GEdgeFlag k=SVFStmt::Call)
the function exit statement calling to
static bool classof(const SVFStmt *edge)
CallPE(const CallPE &)
place holder
const CallICFGNode * getCallSite() const
const FunEntryICFGNode * getFunEntryICFGNode() const
static bool classof(const CallPE *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const FunEntryICFGNode * entry
the callsite statement calling from
void operator=(const CallPE &)
place holder
const CallICFGNode * call
const CallICFGNode * getCallInst() const
Get method for the call instruction.
virtual const std::string toString() const override
static bool classof(const SVFStmt *edge)
virtual const std::string toString() const override
static bool classof(const MultiOpndStmt *edge)
CmpStmt()
Constructs empty CmpStmt (for SVFIRReader/serialization)
void operator=(const CmpStmt &)
place holder
u32_t getPredicate() const
CmpStmt(const CmpStmt &)
place holder
Predicate
OpCode for CmpStmt, enum value is same to llvm CmpInst.
@ ICMP_SGT
signed greater than
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
@ ICMP_UGE
unsigned greater or equal
@ FCMP_UGT
1 0 1 0 True if unordered or greater than
@ ICMP_ULE
unsigned less or equal
@ FCMP_OGE
0 0 1 1 True if ordered and greater than or equal
@ FCMP_OLT
0 1 0 0 True if ordered and less than
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
@ FCMP_TRUE
1 1 1 1 Always true (always folded)
@ ICMP_ULT
unsigned less than
@ FCMP_ULE
1 1 0 1 True if unordered, less than, or equal
@ ICMP_SLT
signed less than
@ ICMP_UGT
unsigned greater than
@ FCMP_OEQ
0 0 0 1 True if ordered and equal
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
@ FCMP_OLE
0 1 0 1 True if ordered and less than or equal
@ FCMP_FALSE
0 0 0 0 Always false (always folded)
@ FCMP_ULT
1 1 0 0 True if unordered or less than
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
@ FCMP_UGE
1 0 1 1 True if unordered, greater than, or equal
@ ICMP_SGE
signed greater or equal
@ FCMP_UNE
1 1 1 0 True if unordered or not equal
@ ICMP_SLE
signed less or equal
static bool classof(const CmpStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const GenericPAGEdgeTy *edge)
static bool classof(const GenericPAGEdgeTy *edge)
static bool classof(const CopyStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
CopyStmt(SVFVar *s, SVFVar *d, CopyKind k)
constructor
u32_t getCopyKind() const
Return the kind of the copy statement.
static bool classof(const SVFStmt *edge)
CopyStmt()
Constructs empty CopyStmt (for SVFIRReader/serialization)
void operator=(const CopyStmt &)
place holder
CopyStmt(const CopyStmt &)
place holder
virtual const std::string toString() const override
NodeType * getSrcNode() const
NodeType * getDstNode() const
GEdgeKind getEdgeKind() const
NodeID getSrcID() const
get methods of the components
static constexpr unsigned char EdgeKindMaskBits
We use the lower 8 bits to denote edge kind.
OrderedSet< EdgeType *, typename EdgeType::equalGEdge > GEdgeSetTy
Edge kind.
bool isVariantFieldGep() const
Gep statement with a variant field index (pointer arithmetic) for struct field access.
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
static bool classof(const GepStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
APOffset getConstantStructFldIdx() const
Field index of the gep statement if it access the field of a struct.
GepStmt(const GepStmt &)
place holder
GepStmt(SVFVar *s, SVFVar *d, const AccessPath &ap, bool varfld=false)
constructor
static bool classof(const SVFStmt *edge)
const AccessPath & getAccessPath() const
GepStmt()
Constructs empty GepStmt (for SVFIRReader/serialization)
void operator=(const GepStmt &)
place holder
bool isConstantOffset() const
Return TRUE if this is a constant location set.
static bool classof(const GenericPAGEdgeTy *edge)
virtual const std::string toString() const
AccessPath ap
Access path of the GEP edge.
bool variantField
Gep statement with a variant field index (pointer arithmetic) for struct field access (e....
static bool classof(const LoadStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
LoadStmt(const LoadStmt &)
place holder
LoadStmt()
Constructs empty LoadStmt (for SVFIRReader/serialization)
virtual const std::string toString() const override
LoadStmt(SVFVar *s, SVFVar *d)
constructor
static bool classof(const GenericPAGEdgeTy *edge)
static bool classof(const SVFStmt *edge)
void operator=(const LoadStmt &)
place holder
const OPVars & getOpndVars() const
const SVFVar * getRes() const
Result SVFVar.
NodeID getDstID()
not allowed, use getResID() instead
NodeID getOpVarID(u32_t pos) const
static bool classof(const SVFStmt *node)
MultiOpndStmt()
place holder
MultiOpndStmt(const MultiOpndStmt &)
place holder
SVFVar * getSrcNode()
not allowed, use getOpVar(idx) instead
MultiOpndStmt(GEdgeFlag k)
Constructs empty MultiOpndStmt (for SVFIRReader/serialization)
static bool classof(const MultiOpndStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const SVFVar * getOpVar(u32_t pos) const
Operand SVFVars.
OPVars::const_iterator opVarBegin() const
SVFVar * getDstNode()
not allowed, use getRes() instead
NodeID getSrcID()
not allowed, use getOpVarID(idx) instead
std::vector< SVFVar * > OPVars
static bool classof(const GenericPAGEdgeTy *node)
OPVars::const_iterator opVerEnd() const
u32_t getOpVarNum() const
void operator=(const MultiOpndStmt &)
place holder
virtual const std::string toString() const override
const ICFGNode * getOpICFGNode(u32_t op_idx) const
Return the corresponding ICFGNode of this operand.
void operator=(const PhiStmt &)
place holder
std::vector< const ICFGNode * > OpICFGNodeVec
OpICFGNodeVec opICFGNodes
PhiStmt()
Constructs empty PhiStmt (for SVFIRReader/serialization)
PhiStmt(const PhiStmt &)
place holder
bool isFunctionRetPhi() const
static bool classof(const GenericPAGEdgeTy *edge)
static bool classof(const PhiStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFStmt *edge)
PhiStmt(SVFVar *s, const OPVars &opnds, const OpICFGNodeVec &icfgNodes)
constructor
void addOpVar(SVFVar *op, const ICFGNode *inode)
static bool classof(const MultiOpndStmt *edge)
RetPE(const RetPE &)
place holder
const CallICFGNode * getCallSite() const
static bool classof(const GenericPAGEdgeTy *edge)
static bool classof(const RetPE *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const CallICFGNode * getCallInst() const
Get method for call instruction at caller.
virtual const std::string toString() const override
const FunExitICFGNode * exit
the callsite statement returning to
RetPE(GEdgeFlag k=SVFStmt::Ret)
the function exit statement returned from
const FunExitICFGNode * getFunExitICFGNode() const
static bool classof(const SVFStmt *edge)
const CallICFGNode * call
void operator=(const RetPE &)
place holder
static bool classof(const GenericPAGEdgeTy *edge)
ICFGNode * getICFGNode() const
bool isPTAEdge() const
Whether src and dst nodes are both of pointer type.
void setBB(const SVFBasicBlock *bb)
friend OutStream & operator<<(OutStream &o, const SVFStmt &edge)
Overloading operator << for dumping SVFVar value.
const SVFInstruction * getInst() const
Get/set methods for llvm instruction.
Map< EdgeID, SVFStmtSetTy > PAGEdgeToSetMapTy
static u64_t callEdgeLabelCounter
Call site Instruction counter.
static Var2LabelMap var2LabelMap
Second operand of MultiOpndStmt to label map.
SVFStmtSetTy PAGEdgeSetTy
static GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar *var)
const SVFBasicBlock * getBB() const
static GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k, const ICFGNode *cs)
SVFStmt(GEdgeFlag k)
Private constructor for reading SVFIR from file without side-effect.
ICFGNode * icfgNode
ICFGNode.
static u64_t storeEdgeLabelCounter
Store Instruction counter.
Map< const ICFGNode *, u32_t > Inst2LabelMap
const SVFValue * value
LLVM value.
void setValue(const SVFValue *val)
const SVFBasicBlock * basicBlock
LLVM BasicBlock.
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
PAGEdgeToSetMapTy KindToSVFStmtMapTy
const SVFValue * getValue() const
static u64_t multiOpndLabelCounter
MultiOpndStmt counter.
static Inst2LabelMap inst2LabelMap
Call site Instruction to label map.
static bool classof(const SVFStmt *)
ClassOf.
virtual const std::string toString() const
Map< const SVFVar *, u32_t > Var2LabelMap
static GEdgeFlag makeEdgeFlagWithStoreInst(GEdgeKind k, const ICFGNode *store)
void setICFGNode(ICFGNode *node)
static u32_t totalEdgeNum
Total edge number.
EdgeID getEdgeID() const
Return Edge ID.
static bool classof(const MultiOpndStmt *edge)
const SVFVar * getCondition() const
const SVFVar * getTrueValue() const
static bool classof(const SVFStmt *edge)
virtual const std::string toString() const override
const SVFVar * getFalseValue() const
static bool classof(const SelectStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
SelectStmt()
Constructs empty SelectStmt (for SVFIRReader/serialization)
static bool classof(const GenericPAGEdgeTy *edge)
SelectStmt(const SelectStmt &)
place holder
void operator=(const SelectStmt &)
place holder
StoreStmt(const StoreStmt &)
place holder
static bool classof(const SVFStmt *edge)
virtual const std::string toString() const override
static bool classof(const GenericPAGEdgeTy *edge)
void operator=(const StoreStmt &)
place holder
StoreStmt()
Constructs empty StoreStmt (for SVFIRReader/serialization)
static bool classof(const StoreStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
void operator=(const TDForkPE &)
place holder
static bool classof(const SVFStmt *edge)
static bool classof(const TDForkPE *)
Methods for support type inquiry through isa, cast, and dyn_cast:
TDForkPE()
Constructs empty TDForkPE (for SVFIRReader/serialization)
static bool classof(const GenericPAGEdgeTy *edge)
virtual const std::string toString() const
TDForkPE(const TDForkPE &)
place holder
TDForkPE(SVFVar *s, SVFVar *d, const CallICFGNode *i, const FunEntryICFGNode *entry)
constructor
static bool classof(const SVFStmt *edge)
static bool classof(const GenericPAGEdgeTy *edge)
TDJoinPE()
Constructs empty TDJoinPE (for SVFIRReader/serialization)
void operator=(const TDJoinPE &)
place holder
TDJoinPE(const TDJoinPE &)
place holder
virtual const std::string toString() const
static bool classof(const TDJoinPE *)
Methods for support type inquiry through isa, cast, and dyn_cast:
TDJoinPE(SVFVar *s, SVFVar *d, const CallICFGNode *i, const FunExitICFGNode *e)
Constructor.
UnaryOPStmt()
Constructs empty UnaryOPStmt (for SVFIRReader/serialization)
virtual const std::string toString() const override
static bool classof(const SVFStmt *edge)
UnaryOPStmt(SVFVar *s, SVFVar *d, u32_t oc)
constructor
NodeID getSrcID()
place holder, use getOpVarID(pos) instead
const SVFVar * getOpVar() const
void operator=(const UnaryOPStmt &)
place holder
SVFVar * getSrcNode()
place holder, use getOpVar() instead
NodeID getOpVarID() const
SVFVar * getDstNode()
place holder, use getRes() instead
UnaryOPStmt(const UnaryOPStmt &)
place holder
NodeID getDstID()
place holder, use getResID() instead
static bool classof(const UnaryOPStmt *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const SVFVar * getRes() const
OpCode
OpCode for UnaryOPStmt, enum value is same to llvm::UnaryOperator.
static bool classof(const GenericPAGEdgeTy *edge)
llvm::IRBuilder IRBuilder
GenericEdge< SVFVar > GenericPAGEdgeTy