Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::BinaryOPStmt Class Reference

#include <SVFStatements.h>

Inheritance diagram for SVF::BinaryOPStmt:
SVF::MultiOpndStmt SVF::SVFStmt SVF::GenericEdge< SVFVar >

Public Types

enum  OpCode : unsigned {
  Add = 13 , FAdd = 14 , Sub = 15 , FSub = 16 ,
  Mul = 17 , FMul = 18 , UDiv = 19 , SDiv = 20 ,
  FDiv = 21 , URem = 22 , SRem = 23 , FRem = 24 ,
  Shl = 25 , LShr = 26 , AShr = 27 , And = 28 ,
  Or = 29 , Xor = 30
}
 OpCode for BinaryOPStmt, enum value is same to llvm BinaryOperator (llvm/IR/Instruction.def). 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< SVFVar >
typedef SVFVar 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

 BinaryOPStmt (ValVar *res, const OPVars &opnds, u32_t oc)
 constructor
u32_t getOpcode () 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< SVFVar >
 GenericEdge (SVFVar *s, SVFVar *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 BinaryOPStmt *)
 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

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

Private Attributes

u32_t opcode

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< SVFVar >
static constexpr unsigned char EdgeKindMaskBits
 We use the lower 8 bits to denote edge kind.
static constexpr u64_t EdgeKindMask

Detailed Description

Binary statement

Definition at line 1123 of file SVFStatements.h.

Member Enumeration Documentation

◆ OpCode

enum SVF::BinaryOPStmt::OpCode : unsigned

OpCode for BinaryOPStmt, enum value is same to llvm BinaryOperator (llvm/IR/Instruction.def).

Enumerator
Add 
FAdd 
Sub 
FSub 
Mul 
FMul 
UDiv 
SDiv 
FDiv 
URem 
SRem 
FRem 
Shl 
LShr 
AShr 
And 
Or 
Xor 

Definition at line 1133 of file SVFStatements.h.

1134 {
1135 Add = 13, // Sum of integers
1136 FAdd = 14, // Sum of floats
1137 Sub = 15, // Subtraction of integers
1138 FSub = 16, // Subtraction of floats
1139 Mul = 17, // Product of integers.
1140 FMul = 18, // Product of floats.
1141 UDiv = 19, // Unsigned division.
1142 SDiv = 20, // Signed division.
1143 FDiv = 21, // Float division.
1144 URem = 22, // Unsigned remainder
1145 SRem = 23, // Signed remainder
1146 FRem = 24, // Float remainder
1147 Shl = 25, // Shift left (logical)
1148 LShr = 26, // Shift right (logical)
1149 AShr = 27, // Shift right (arithmetic)
1150 And = 28, // Logical and
1151 Or = 29, // Logical or
1152 Xor = 30 // Logical xor
1153 };

Constructor & Destructor Documentation

◆ BinaryOPStmt() [1/2]

SVF::BinaryOPStmt::BinaryOPStmt ( const BinaryOPStmt & )
private

place holder

◆ BinaryOPStmt() [2/2]

BinaryOPStmt::BinaryOPStmt ( ValVar * res,
const OPVars & opnds,
u32_t oc )

constructor

Definition at line 544 of file SVFStatements.cpp.

546 s, opnds,
548 opcode(oc)
549{
550 assert(opnds.size() == 2 && "BinaryOPStmt can only have two operands!");
551}
MultiOpndStmt()
place holder
static GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar *var)

Member Function Documentation

◆ classof() [1/4]

bool SVF::BinaryOPStmt::classof ( const BinaryOPStmt * )
inlinestatic

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

Definition at line 1157 of file SVFStatements.h.

1158 {
1159 return true;
1160 }

◆ classof() [2/4]

bool SVF::BinaryOPStmt::classof ( const GenericPAGEdgeTy * edge)
inlinestatic

Definition at line 1169 of file SVFStatements.h.

1170 {
1171 return edge->getEdgeKind() == SVFStmt::BinaryOp;
1172 }

◆ classof() [3/4]

bool SVF::BinaryOPStmt::classof ( const MultiOpndStmt * edge)
inlinestatic

Definition at line 1165 of file SVFStatements.h.

1166 {
1167 return edge->getEdgeKind() == SVFStmt::BinaryOp;
1168 }

◆ classof() [4/4]

bool SVF::BinaryOPStmt::classof ( const SVFStmt * edge)
inlinestatic

Definition at line 1161 of file SVFStatements.h.

1162 {
1163 return edge->getEdgeKind() == SVFStmt::BinaryOp;
1164 }

◆ getOpcode()

u32_t SVF::BinaryOPStmt::getOpcode ( ) const
inline

Definition at line 1178 of file SVFStatements.h.

1179 {
1180 return opcode;
1181 }

◆ operator=()

void SVF::BinaryOPStmt::operator= ( const BinaryOPStmt & )
private

place holder

◆ toString()

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

Reimplemented from SVF::SVFStmt.

Definition at line 155 of file SVFStatements.cpp.

156{
157 std::string str;
158 std::stringstream rawstr(str);
159 rawstr << "BinaryOPStmt: [Var" << getResID() << " <-- (Var" << getOpVarID(0) << " opcode" << getOpcode() << " Var" << getOpVarID(1) << ")]\t";
161 {
162 rawstr << "\n";
163 rawstr << getValue()->toString();
164 }
165 return rawstr.str();
166}
u32_t getOpcode() const
NodeID getOpVarID(u32_t pos) const
NodeID getResID() const
static const Option< bool > ShowSVFIRValue
Definition Options.h:120
const SVFVar * getValue() const
virtual const std::string toString() const
Get string representation.

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 1125 of file SVFStatements.h.

Member Data Documentation

◆ opcode

u32_t SVF::BinaryOPStmt::opcode
private

Definition at line 1129 of file SVFStatements.h.


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