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< ValVar * > 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, SVFStmtSetTy > PAGEdgeToSetMapTy
 
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 (ValVar *res, 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 ValVar * getOpVar (u32_t pos) const
 Operand SVFVars.
 
const ValVar * getRes () const
 Result SVFVar.
 
NodeID getOpVarID (u32_t pos) const
 
NodeID getResID () const
 
u32_t getOpVarNum () const
 
const OPVars & getOpndVars () 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.
 
virtual bool isPTAEdge () const
 Whether src and dst nodes are both of pointer type.
 
void setValue (const SVFVar *val)
 Get/set methods for llvm instruction.
 
const SVFVar * getValue () const
 
void setBB (const SVFBasicBlock *bb)
 
const SVFBasicBlock * getBB () const
 
void setICFGNode (ICFGNode *node)
 
ICFGNode * getICFGNode () 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
 
NodeType * getSrcNode () const
 
NodeType * getDstNode () 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)
 
static const Inst2LabelMap * getInst2LabelMap ()
 
static const Var2LabelMap * getVar2LabelMap ()
 
static const u64_t * getCallEdgeLabelCounter ()
 
static const u64_t * getStoreEdgeLabelCounter ()
 
static const u64_t * getMultiOpndLabelCounter ()
 

Private Member Functions

 CmpStmt (const CmpStmt &)
 place holder
 
void operator= (const CmpStmt &)
 place holder
 

Private Attributes

u32_t predicate
 

Friends

class GraphDBClient
 

Additional Inherited Members

- Protected Member Functions inherited from SVF::MultiOpndStmt
 MultiOpndStmt (ValVar *r, const OPVars &opnds, GEdgeFlag k)
 Constructor, only used by subclasses but not external users.
 
- Protected Member Functions inherited from SVF::SVFStmt
 SVFStmt (GEdgeFlag k)
 Private constructor for reading SVFIR from file without side-effect.
 
 SVFStmt (SVFVar *s, SVFVar *d, GEdgeFlag k, EdgeID eid, SVFVar *value, ICFGNode *icfgNode, bool real=true)
 
void setBasicBlock (const SVFBasicBlock *bb)
 
void setCallEdgeLabelCounter (u64_t counter)
 
void setStoreEdgeLabelCounter (u64_t counter)
 
void setMultiOpndLabelCounter (u64_t counter)
 
- Static Protected Member Functions inherited from SVF::SVFStmt
static void addInst2Labeled (const ICFGNode *cs, u32_t label)
 
static void addVar2Labeled (const SVFVar *var, u32_t label)
 
- 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 1040 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 1051 of file SVFStatements.h.

1052 {
1053 // Opcode U L G E Intuitive operation
1054 FCMP_FALSE = 0,
1055 FCMP_OEQ = 1,
1056 FCMP_OGT = 2,
1057 FCMP_OGE = 3,
1058 FCMP_OLT = 4,
1059 FCMP_OLE = 5,
1060 FCMP_ONE = 6,
1061 FCMP_ORD = 7,
1062 FCMP_UNO = 8,
1063 FCMP_UEQ = 9,
1064 FCMP_UGT = 10,
1065 FCMP_UGE = 11,
1066 FCMP_ULT = 12,
1067 FCMP_ULE = 13,
1068 FCMP_UNE = 14,
1069 FCMP_TRUE = 15,
1073 ICMP_EQ = 32,
1074 ICMP_NE = 33,
1075 ICMP_UGT = 34,
1076 ICMP_UGE = 35,
1077 ICMP_ULT = 36,
1078 ICMP_ULE = 37,
1079 ICMP_SGT = 38,
1080 ICMP_SGE = 39,
1081 ICMP_SLT = 40,
1082 ICMP_SLE = 41,
1086 };
@ 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/2]

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

place holder

◆ CmpStmt() [2/2]

CmpStmt::CmpStmt ( ValVar *  res,
const OPVars &  opnds,
u32_t  pre 
)

constructor

Definition at line 528 of file SVFStatements.cpp.

532{
533 assert(opnds.size() == 2 && "CmpStmt can only have two operands!");
534}
MultiOpndStmt()
place holder
static GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar *var)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

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 1090 of file SVFStatements.h.

1091 {
1092 return true;
1093 }

◆ classof() [2/4]

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

Definition at line 1102 of file SVFStatements.h.

1103 {
1104 return edge->getEdgeKind() == SVFStmt::Cmp;
1105 }

◆ classof() [3/4]

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

Definition at line 1098 of file SVFStatements.h.

1099 {
1100 return edge->getEdgeKind() == SVFStmt::Cmp;
1101 }

◆ classof() [4/4]

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

Definition at line 1094 of file SVFStatements.h.

1095 {
1096 return edge->getEdgeKind() == SVFStmt::Cmp;
1097 }

◆ getPredicate()

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

Definition at line 1111 of file SVFStatements.h.

1112 {
1113 return predicate;
1114 }

◆ 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 142 of file SVFStatements.cpp.

143{
144 std::string str;
145 std::stringstream rawstr(str);
146 rawstr << "CmpStmt: [Var" << getResID() << " <-- (Var" << getOpVarID(0) << " predicate" << getPredicate() << " Var" << getOpVarID(1) << ")]\t";
148 {
149 rawstr << "\n";
150 rawstr << getValue()->toString();
151 }
152 return rawstr.str();
153}
u32_t getPredicate() const
NodeID getOpVarID(u32_t pos) const
NodeID getResID() const
static const Option< bool > ShowSVFIRValue
Definition Options.h:118
const SVFVar * getValue() const
virtual const std::string toString() const
Get string representation.

Friends And Related Symbol Documentation

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 1042 of file SVFStatements.h.

Member Data Documentation

◆ predicate

u32_t SVF::CmpStmt::predicate
private

Definition at line 1047 of file SVFStatements.h.


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