Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
SVF::BinaryOPStmt Class Reference

#include <SVFStatements.h>

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

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< 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. More...
 
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) More...
 

Public Member Functions

 BinaryOPStmt (SVFVar *s, const OPVars &opnds, u32_t oc)
 constructor More...
 
u32_t getOpcode () const
 
virtual const std::string toString () const override
 
- Public Member Functions inherited from SVF::MultiOpndStmt
const SVFVargetOpVar (u32_t pos) const
 Operand SVFVars. More...
 
const SVFVargetRes () const
 Result SVFVar. More...
 
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. More...
 
 ~SVFStmt ()
 Destructor. More...
 
EdgeID getEdgeID () const
 Return Edge ID. More...
 
bool isPTAEdge () const
 Whether src and dst nodes are both of pointer type. More...
 
const SVFInstructiongetInst () const
 Get/set methods for llvm instruction. More...
 
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. More...
 
virtual ~GenericEdge ()
 Destructor. More...
 
NodeID getSrcID () const
 get methods of the components More...
 
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 BinaryOPStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
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: More...
 
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. More...
 
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

 BinaryOPStmt ()
 Constructs empty BinaryOPStmt (for SVFIRReader/serialization) More...
 
 BinaryOPStmt (const BinaryOPStmt &)
 place holder More...
 
void operator= (const BinaryOPStmt &)
 place holder More...
 

Private Attributes

u32_t opcode
 

Friends

class SVFIRWriter
 
class SVFIRReader
 

Additional Inherited Members

- Static Public Attributes inherited from SVF::SVFStmt
static u32_t totalEdgeNum
 Total edge number. More...
 
- Protected Member Functions inherited from SVF::MultiOpndStmt
 MultiOpndStmt (SVFVar *r, const OPVars &opnds, GEdgeFlag k)
 Constructor, only used by subclasses but not external users. More...
 
 MultiOpndStmt (GEdgeFlag k)
 Constructs empty MultiOpndStmt (for SVFIRReader/serialization) More...
 
- Protected Member Functions inherited from SVF::SVFStmt
 SVFStmt (GEdgeFlag k)
 Private constructor for reading SVFIR from file without side-effect. More...
 
- 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. More...
 
static constexpr u64_t EdgeKindMask = (~0ULL) >> (64 - EdgeKindMaskBits)
 

Detailed Description

Binary statement

Definition at line 1023 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 1037 of file SVFStatements.h.

1038  {
1039  Add = 13, // Sum of integers
1040  FAdd = 14, // Sum of floats
1041  Sub = 15, // Subtraction of integers
1042  FSub = 16, // Subtraction of floats
1043  Mul = 17, // Product of integers.
1044  FMul = 18, // Product of floats.
1045  UDiv = 19, // Unsigned division.
1046  SDiv = 20, // Signed division.
1047  FDiv = 21, // Float division.
1048  URem = 22, // Unsigned remainder
1049  SRem = 23, // Signed remainder
1050  FRem = 24, // Float remainder
1051  Shl = 25, // Shift left (logical)
1052  LShr = 26, // Shift right (logical)
1053  AShr = 27, // Shift right (arithmetic)
1054  And = 28, // Logical and
1055  Or = 29, // Logical or
1056  Xor = 30 // Logical xor
1057  };

Constructor & Destructor Documentation

◆ BinaryOPStmt() [1/3]

SVF::BinaryOPStmt::BinaryOPStmt ( )
inlineprivate

Constructs empty BinaryOPStmt (for SVFIRReader/serialization)

Definition at line 1030 of file SVFStatements.h.

◆ BinaryOPStmt() [2/3]

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

place holder

◆ BinaryOPStmt() [3/3]

BinaryOPStmt::BinaryOPStmt ( SVFVar s,
const OPVars opnds,
u32_t  oc 
)

constructor

Definition at line 366 of file SVFStatements.cpp.

367  : MultiOpndStmt(
368  s, opnds,
370  opcode(oc)
371 {
372  assert(opnds.size() == 2 && "BinaryOPStmt can only have two operands!");
373 }
static GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar *var)

Member Function Documentation

◆ classof() [1/4]

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

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

Definition at line 1061 of file SVFStatements.h.

1062  {
1063  return true;
1064  }

◆ classof() [2/4]

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

Definition at line 1073 of file SVFStatements.h.

1074  {
1075  return edge->getEdgeKind() == SVFStmt::BinaryOp;
1076  }

◆ classof() [3/4]

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

Definition at line 1069 of file SVFStatements.h.

1070  {
1071  return edge->getEdgeKind() == SVFStmt::BinaryOp;
1072  }

◆ classof() [4/4]

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

Definition at line 1065 of file SVFStatements.h.

1066  {
1067  return edge->getEdgeKind() == SVFStmt::BinaryOp;
1068  }

◆ getOpcode()

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

Definition at line 1082 of file SVFStatements.h.

1083  {
1084  return opcode;
1085  }

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

146 {
147  std::string str;
148  std::stringstream rawstr(str);
149  rawstr << "BinaryOPStmt: [Var" << getResID() << " <-- (Var" << getOpVarID(0) << " opcode" << getOpcode() << " Var" << getOpVarID(1) << ")]\t";
151  {
152  rawstr << "\n";
153  rawstr << getValue()->toString();
154  }
155  return rawstr.str();
156 }
const char *const string
Definition: cJSON.h:172
u32_t getOpcode() 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:663

Friends And Related Function Documentation

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 1026 of file SVFStatements.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 1025 of file SVFStatements.h.

Member Data Documentation

◆ opcode

u32_t SVF::BinaryOPStmt::opcode
private

Definition at line 1033 of file SVFStatements.h.


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