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

#include <SVFStatements.h>

Inheritance diagram for SVF::CopyStmt:
SVF::AssignStmt SVF::SVFStmt SVF::GenericEdge< SVFVar >

Public Types

enum  CopyKind {
  COPYVAL , ZEXT , SEXT , BITCAST ,
  TRUNC , FPTRUNC , FPTOUI , FPTOSI ,
  UITOFP , SITOFP , INTTOPTR , PTRTOINT
}
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

u32_t getCopyKind () const
 Return the kind of the copy statement.
bool isBitCast () const
bool isValueCopy () const
bool isInt2Ptr () const
bool isPtr2Int () const
bool isZext () const
bool isSext () const
 CopyStmt (SVFVar *s, SVFVar *d, CopyKind k)
 constructor
const ValVar * getRHSVar () const
const ValVar * getLHSVar () const
const ValVar * getSrcNode () const
const ValVar * getDstNode () const
virtual const std::string toString () const override
Public Member Functions inherited from SVF::AssignStmt
SVFVar * getRHSVar () const
SVFVar * getLHSVar () const
NodeID getRHSVarID () const
NodeID getLHSVarID () 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 CopyStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const SVFStmt *edge)
static bool classof (const GenericPAGEdgeTy *edge)
Static Public Member Functions inherited from SVF::AssignStmt
static bool classof (const AssignStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const SVFStmt *edge)
static bool classof (const GenericPAGEdgeTy *edge)
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

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

Private Attributes

u32_t copyKind

Friends

class GraphDBClient

Additional Inherited Members

Protected Member Functions inherited from SVF::AssignStmt
 AssignStmt (SVFVar *s, SVFVar *d, GEdgeFlag k)
 constructor
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)
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

Copy statements (simple assignment and casting)

Definition at line 435 of file SVFStatements.h.

Member Enumeration Documentation

◆ CopyKind

Enumerator
COPYVAL 
ZEXT 
SEXT 
BITCAST 
TRUNC 
FPTRUNC 
FPTOUI 
FPTOSI 
UITOFP 
SITOFP 
INTTOPTR 
PTRTOINT 

Definition at line 444 of file SVFStatements.h.

445 {
446 COPYVAL, // Value copies (default one)
447 ZEXT, // Zero extend integers
448 SEXT, // Sign extend integers
449 BITCAST, // Type cast
450 TRUNC, // Truncate integers
451 FPTRUNC, // Truncate floating point
452 FPTOUI, // floating point -> UInt
453 FPTOSI, // floating point -> SInt
454 UITOFP, // UInt -> floating point
455 SITOFP, // SInt -> floating point
456 INTTOPTR, // Integer -> Pointer
457 PTRTOINT // Pointer -> Integer
458 };

Constructor & Destructor Documentation

◆ CopyStmt() [1/2]

SVF::CopyStmt::CopyStmt ( const CopyStmt & )
private

place holder

◆ CopyStmt() [2/2]

SVF::CopyStmt::CopyStmt ( SVFVar * s,
SVFVar * d,
CopyKind k )
inline

constructor

Definition at line 512 of file SVFStatements.h.

512: AssignStmt(s, d, SVFStmt::Copy), copyKind(k) {}
AssignStmt()
place holder

Member Function Documentation

◆ classof() [1/3]

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

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

Definition at line 461 of file SVFStatements.h.

462 {
463 return true;
464 }

◆ classof() [2/3]

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

Definition at line 469 of file SVFStatements.h.

470 {
471 return edge->getEdgeKind() == SVFStmt::Copy;
472 }

◆ classof() [3/3]

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

Definition at line 465 of file SVFStatements.h.

466 {
467 return edge->getEdgeKind() == SVFStmt::Copy;
468 }

◆ getCopyKind()

u32_t SVF::CopyStmt::getCopyKind ( ) const
inline

Return the kind of the copy statement.

Definition at line 476 of file SVFStatements.h.

477 {
478 return copyKind;
479 }

◆ getDstNode()

const ValVar * CopyStmt::getDstNode ( ) const

Definition at line 336 of file SVFStatements.cpp.

337{
338 return getLHSVar();
339}
const ValVar * getLHSVar() const

◆ getLHSVar()

const ValVar * CopyStmt::getLHSVar ( ) const

Definition at line 328 of file SVFStatements.cpp.

329{
331}
NodeType * getDstNode() const
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
Definition Casting.h:360

◆ getRHSVar()

const ValVar * CopyStmt::getRHSVar ( ) const

Definition at line 324 of file SVFStatements.cpp.

325{
327}
NodeType * getSrcNode() const

◆ getSrcNode()

const ValVar * CopyStmt::getSrcNode ( ) const

Definition at line 332 of file SVFStatements.cpp.

333{
334 return getRHSVar();
335}
const ValVar * getRHSVar() const

◆ isBitCast()

bool SVF::CopyStmt::isBitCast ( ) const
inline

Definition at line 481 of file SVFStatements.h.

482 {
483 return copyKind == BITCAST;
484 }

◆ isInt2Ptr()

bool SVF::CopyStmt::isInt2Ptr ( ) const
inline

Definition at line 491 of file SVFStatements.h.

492 {
493 return copyKind == INTTOPTR;
494 }

◆ isPtr2Int()

bool SVF::CopyStmt::isPtr2Int ( ) const
inline

Definition at line 496 of file SVFStatements.h.

497 {
498 return copyKind == PTRTOINT;
499 }

◆ isSext()

bool SVF::CopyStmt::isSext ( ) const
inline

Definition at line 506 of file SVFStatements.h.

507 {
508 return copyKind == SEXT;
509 }

◆ isValueCopy()

bool SVF::CopyStmt::isValueCopy ( ) const
inline

Definition at line 486 of file SVFStatements.h.

487 {
488 return copyKind == COPYVAL;
489 }

◆ isZext()

bool SVF::CopyStmt::isZext ( ) const
inline

Definition at line 501 of file SVFStatements.h.

502 {
503 return copyKind == ZEXT;
504 }

◆ operator=()

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

place holder

◆ toString()

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

Implements SVF::AssignStmt.

Definition at line 97 of file SVFStatements.cpp.

98{
99 std::string str;
100 std::stringstream rawstr(str);
101 rawstr << "CopyStmt: [Var" << getLHSVarID() << " <-- Var" << getRHSVarID() << "]\t";
103 {
104 rawstr << "\n";
105 rawstr << getValue()->toString();
106 }
107 return rawstr.str();
108}
NodeID getRHSVarID() const
NodeID getLHSVarID() const
static const Option< bool > ShowSVFIRValue
Definition Options.h:119
const SVFVar * getValue() const
virtual const std::string toString() const
Get string representation.

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 438 of file SVFStatements.h.

Member Data Documentation

◆ copyKind

u32_t SVF::CopyStmt::copyKind
private

Definition at line 522 of file SVFStatements.h.


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