Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
SVF::CmpStmt Class Reference

#include <SVFStatements.h>

Inheritance diagram for SVF::CmpStmt:
SVF::MultiOpndStmt SVF::SVFStmt SVF::GenericEdge< NodeTy >

Public Types

enum  Predicate : unsigned {
  FCMP_FALSE = 0 , FCMP_OEQ = 1 , FCMP_OGT = 2 , FCMP_OGE = 3 ,
  FCMP_OLT = 4 , FCMP_OLE = 5 , FCMP_ONE = 6 , FCMP_ORD = 7 ,
  FCMP_UNO = 8 , FCMP_UEQ = 9 , FCMP_UGT = 10 , FCMP_UGE = 11 ,
  FCMP_ULT = 12 , FCMP_ULE = 13 , FCMP_UNE = 14 , FCMP_TRUE = 15 ,
  FIRST_FCMP_PREDICATE = FCMP_FALSE , LAST_FCMP_PREDICATE = FCMP_TRUE , BAD_FCMP_PREDICATE = FCMP_TRUE + 1 , ICMP_EQ = 32 ,
  ICMP_NE = 33 , ICMP_UGT = 34 , ICMP_UGE = 35 , ICMP_ULT = 36 ,
  ICMP_ULE = 37 , ICMP_SGT = 38 , ICMP_SGE = 39 , ICMP_SLT = 40 ,
  ICMP_SLE = 41 , FIRST_ICMP_PREDICATE = ICMP_EQ , LAST_ICMP_PREDICATE = ICMP_SLE , BAD_ICMP_PREDICATE = ICMP_SLE + 1
}
 OpCode for CmpStmt, enum value is same to llvm CmpInst. More...
 
- Public Types inherited from SVF::MultiOpndStmt
typedef std::vector< SVFVar * > OPVars
 
- Public Types inherited from SVF::SVFStmt
enum  PEDGEK {
  Addr , Copy , Store , Load ,
  Call , Ret , Gep , Phi ,
  Select , Cmp , BinaryOp , UnaryOp ,
  Branch , ThreadFork , ThreadJoin
}
 
typedef GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
 
typedef Map< EdgeID, SVFStmtSetTyPAGEdgeToSetMapTy
 
typedef PAGEdgeToSetMapTy KindToSVFStmtMapTy
 
typedef SVFStmtSetTy PAGEdgeSetTy
 
- Public Types inherited from SVF::GenericEdge< NodeTy >
typedef NodeTy NodeType
 Node type.
 
typedef u64_t GEdgeFlag
 
typedef s64_t GEdgeKind
 
typedef struct SVF::GenericEdge::equalGEdge equalGEdge
 Add the hash function for std::set (we also can overload operator< to implement this)
 

Public Member Functions

 CmpStmt (SVFVar *s, const OPVars &opnds, u32_t pre)
 constructor
 
u32_t getPredicate () const
 
virtual const std::string toString () const override
 
- Public Member Functions inherited from SVF::MultiOpndStmt
const SVFVargetOpVar (u32_t pos) const
 Operand SVFVars.
 
const SVFVargetRes () const
 Result SVFVar.
 
NodeID getOpVarID (u32_t pos) const
 
NodeID getResID () const
 
u32_t getOpVarNum () const
 
const OPVarsgetOpndVars () const
 
OPVars::const_iterator opVarBegin () const
 
OPVars::const_iterator opVerEnd () const
 
- Public Member Functions inherited from SVF::SVFStmt
 SVFStmt (SVFVar *s, SVFVar *d, GEdgeFlag k, bool real=true)
 Constructor.
 
 ~SVFStmt ()
 Destructor.
 
EdgeID getEdgeID () const
 Return Edge ID.
 
bool isPTAEdge () const
 Whether src and dst nodes are both of pointer type.
 
const SVFInstructiongetInst () const
 Get/set methods for llvm instruction.
 
void setValue (const SVFValue *val)
 
const SVFValuegetValue () const
 
void setBB (const SVFBasicBlock *bb)
 
const SVFBasicBlockgetBB () const
 
void setICFGNode (ICFGNode *node)
 
ICFGNodegetICFGNode () const
 
- Public Member Functions inherited from SVF::GenericEdge< NodeTy >
 GenericEdge (NodeTy *s, NodeTy *d, GEdgeFlag k)
 Constructor.
 
virtual ~GenericEdge ()
 Destructor.
 
NodeID getSrcID () const
 get methods of the components
 
NodeID getDstID () const
 
GEdgeKind getEdgeKind () const
 
GEdgeKind getEdgeKindWithoutMask () const
 
NodeTypegetSrcNode () const
 
NodeTypegetDstNode () const
 
virtual bool operator== (const GenericEdge< NodeType > *rhs) const
 

Static Public Member Functions

static bool classof (const CmpStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
static bool classof (const SVFStmt *edge)
 
static bool classof (const MultiOpndStmt *edge)
 
static bool classof (const GenericPAGEdgeTy *edge)
 
- Static Public Member Functions inherited from SVF::MultiOpndStmt
static bool classof (const MultiOpndStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
static bool classof (const SVFStmt *node)
 
static bool classof (const GenericPAGEdgeTy *node)
 
- Static Public Member Functions inherited from SVF::SVFStmt
static bool classof (const SVFStmt *)
 ClassOf.
 
static bool classof (const GenericPAGEdgeTy *edge)
 
static GEdgeFlag makeEdgeFlagWithAddionalOpnd (GEdgeKind k, const SVFVar *var)
 
static GEdgeFlag makeEdgeFlagWithCallInst (GEdgeKind k, const ICFGNode *cs)
 
static GEdgeFlag makeEdgeFlagWithStoreInst (GEdgeKind k, const ICFGNode *store)
 

Private Member Functions

 CmpStmt ()
 Constructs empty CmpStmt (for SVFIRReader/serialization)
 
 CmpStmt (const CmpStmt &)
 place holder
 
void operator= (const CmpStmt &)
 place holder
 

Private Attributes

u32_t predicate
 

Friends

class SVFIRWriter
 
class SVFIRReader
 

Additional Inherited Members

- Static Public Attributes inherited from SVF::SVFStmt
static u32_t totalEdgeNum
 Total edge number.
 
- Protected Member Functions inherited from SVF::MultiOpndStmt
 MultiOpndStmt (SVFVar *r, const OPVars &opnds, GEdgeFlag k)
 Constructor, only used by subclasses but not external users.
 
 MultiOpndStmt (GEdgeFlag k)
 Constructs empty MultiOpndStmt (for SVFIRReader/serialization)
 
- Protected Member Functions inherited from SVF::SVFStmt
 SVFStmt (GEdgeFlag k)
 Private constructor for reading SVFIR from file without side-effect.
 
- Protected Attributes inherited from SVF::MultiOpndStmt
OPVars opVars
 
- Static Protected Attributes inherited from SVF::GenericEdge< NodeTy >
static constexpr unsigned char EdgeKindMaskBits = 8
 We use the lower 8 bits to denote edge kind.
 
static constexpr u64_t EdgeKindMask = (~0ULL) >> (64 - EdgeKindMaskBits)
 

Detailed Description

Comparison statement

Definition at line 937 of file SVFStatements.h.

Member Enumeration Documentation

◆ Predicate

OpCode for CmpStmt, enum value is same to llvm CmpInst.

Enumerator
FCMP_FALSE 

0 0 0 0 Always false (always folded)

FCMP_OEQ 

0 0 0 1 True if ordered and equal

FCMP_OGT 

0 0 1 0 True if ordered and greater than

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_OLE 

0 1 0 1 True if ordered and less than or equal

FCMP_ONE 

0 1 1 0 True if ordered and operands are unequal

FCMP_ORD 

0 1 1 1 True if ordered (no nans)

FCMP_UNO 

1 0 0 0 True if unordered: isnan(X) | isnan(Y)

FCMP_UEQ 

1 0 0 1 True if unordered or equal

FCMP_UGT 

1 0 1 0 True if unordered or greater than

FCMP_UGE 

1 0 1 1 True if unordered, greater than, or equal

FCMP_ULT 

1 1 0 0 True if unordered or less than

FCMP_ULE 

1 1 0 1 True if unordered, less than, or equal

FCMP_UNE 

1 1 1 0 True if unordered or not equal

FCMP_TRUE 

1 1 1 1 Always true (always folded)

FIRST_FCMP_PREDICATE 
LAST_FCMP_PREDICATE 
BAD_FCMP_PREDICATE 
ICMP_EQ 

equal

ICMP_NE 

not equal

ICMP_UGT 

unsigned greater than

ICMP_UGE 

unsigned greater or equal

ICMP_ULT 

unsigned less than

ICMP_ULE 

unsigned less or equal

ICMP_SGT 

signed greater than

ICMP_SGE 

signed greater or equal

ICMP_SLT 

signed less than

ICMP_SLE 

signed less or equal

FIRST_ICMP_PREDICATE 
LAST_ICMP_PREDICATE 
BAD_ICMP_PREDICATE 

Definition at line 952 of file SVFStatements.h.

953 {
954 // Opcode U L G E Intuitive operation
955 FCMP_FALSE = 0,
956 FCMP_OEQ = 1,
957 FCMP_OGT = 2,
958 FCMP_OGE = 3,
959 FCMP_OLT = 4,
960 FCMP_OLE = 5,
961 FCMP_ONE = 6,
962 FCMP_ORD = 7,
963 FCMP_UNO = 8,
964 FCMP_UEQ = 9,
965 FCMP_UGT = 10,
966 FCMP_UGE = 11,
967 FCMP_ULT = 12,
968 FCMP_ULE = 13,
969 FCMP_UNE = 14,
970 FCMP_TRUE = 15,
974 ICMP_EQ = 32,
975 ICMP_NE = 33,
976 ICMP_UGT = 34,
977 ICMP_UGE = 35,
978 ICMP_ULT = 36,
979 ICMP_ULE = 37,
980 ICMP_SGT = 38,
981 ICMP_SGE = 39,
982 ICMP_SLT = 40,
983 ICMP_SLE = 41,
987 };
@ 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
@ ICMP_NE
not equal
@ 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

Constructor & Destructor Documentation

◆ CmpStmt() [1/3]

SVF::CmpStmt::CmpStmt ( )
inlineprivate

Constructs empty CmpStmt (for SVFIRReader/serialization)

Definition at line 944 of file SVFStatements.h.

◆ CmpStmt() [2/3]

SVF::CmpStmt::CmpStmt ( const CmpStmt )
private

place holder

◆ CmpStmt() [3/3]

CmpStmt::CmpStmt ( SVFVar s,
const OPVars opnds,
u32_t  pre 
)

constructor

Definition at line 350 of file SVFStatements.cpp.

354{
355 assert(opnds.size() == 2 && "CmpStmt can only have two operands!");
356}
static GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar *var)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ classof() [1/4]

static bool SVF::CmpStmt::classof ( const CmpStmt )
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line 991 of file SVFStatements.h.

992 {
993 return true;
994 }

◆ classof() [2/4]

static bool SVF::CmpStmt::classof ( const GenericPAGEdgeTy edge)
inlinestatic

Definition at line 1003 of file SVFStatements.h.

1004 {
1005 return edge->getEdgeKind() == SVFStmt::Cmp;
1006 }

◆ classof() [3/4]

static bool SVF::CmpStmt::classof ( const MultiOpndStmt edge)
inlinestatic

Definition at line 999 of file SVFStatements.h.

1000 {
1001 return edge->getEdgeKind() == SVFStmt::Cmp;
1002 }

◆ classof() [4/4]

static bool SVF::CmpStmt::classof ( const SVFStmt edge)
inlinestatic

Definition at line 995 of file SVFStatements.h.

996 {
997 return edge->getEdgeKind() == SVFStmt::Cmp;
998 }

◆ getPredicate()

u32_t SVF::CmpStmt::getPredicate ( ) const
inline

Definition at line 1012 of file SVFStatements.h.

1013 {
1014 return predicate;
1015 }

◆ operator=()

void SVF::CmpStmt::operator= ( const CmpStmt )
private

place holder

◆ toString()

const std::string CmpStmt::toString ( ) const
overridevirtual

Reimplemented from SVF::SVFStmt.

Definition at line 132 of file SVFStatements.cpp.

133{
134 std::string str;
135 std::stringstream rawstr(str);
136 rawstr << "CmpStmt: [Var" << getResID() << " <-- (Var" << getOpVarID(0) << " predicate" << getPredicate() << " Var" << getOpVarID(1) << ")]\t";
138 {
139 rawstr << "\n";
140 rawstr << getValue()->toString();
141 }
142 return rawstr.str();
143}
u32_t getPredicate() const
NodeID getOpVarID(u32_t pos) const
NodeID getResID() const
static const Option< bool > ShowSVFIRValue
Definition Options.h:122
const SVFValue * getValue() const
std::string toString() const
Needs to be implemented by a SVF front end.
Definition LLVMUtil.cpp:721

Friends And Related Symbol Documentation

◆ SVFIRReader

Definition at line 940 of file SVFStatements.h.

◆ SVFIRWriter

Definition at line 939 of file SVFStatements.h.

Member Data Documentation

◆ predicate

u32_t SVF::CmpStmt::predicate
private

Definition at line 948 of file SVFStatements.h.


The documentation for this class was generated from the following files: