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

#include <SVFValue.h>

Inheritance diagram for SVF::SVFBasicBlock:
SVF::SVFValue

Public Types

typedef std::vector< const ICFGNode * >::const_iterator const_iterator
 
- Public Types inherited from SVF::SVFValue
enum  SVFValKind {
  SVFVal , SVFFunc , SVFBB , SVFInst ,
  SVFCall , SVFVCall , SVFGlob , SVFArg ,
  SVFConst , SVFConstData , SVFConstInt , SVFConstFP ,
  SVFNullPtr , SVFBlackHole , SVFMetaAsValue , SVFOther
}
 
typedef s64_t GNodeK
 

Public Member Functions

 SVFBasicBlock (const SVFType *ty, const SVFFunction *f)
 Constructor without name. More...
 
 SVFBasicBlock ()=delete
 
 ~SVFBasicBlock () override
 
const std::vector< const ICFGNode * > & getICFGNodeList () const
 
const_iterator begin () const
 
const_iterator end () const
 
const SVFFunctiongetParent () const
 
const SVFFunctiongetFunction () const
 
const ICFGNodefront () const
 
const ICFGNodeback () const
 
const std::vector< const SVFBasicBlock * > & getSuccessors () const
 
const std::vector< const SVFBasicBlock * > & getPredecessors () const
 
u32_t getNumSuccessors () const
 
u32_t getBBSuccessorPos (const SVFBasicBlock *succbb)
 
u32_t getBBSuccessorPos (const SVFBasicBlock *succbb) const
 
u32_t getBBPredecessorPos (const SVFBasicBlock *succbb)
 
u32_t getBBPredecessorPos (const SVFBasicBlock *succbb) const
 
- Public Member Functions inherited from SVF::SVFValue
 SVFValue ()=delete
 
virtual ~SVFValue ()=default
 
GNodeK getKind () const
 Get the type of this SVFValue. More...
 
const std::stringgetName () const
 
void setName (const std::string &n)
 
void setName (std::string &&n)
 
virtual const SVFTypegetType () const
 
bool isConstDataOrAggData () const
 
bool ptrInUncalledFunction () const
 
bool isblackHole () const
 
bool isNullPtr () const
 
virtual void setSourceLoc (const std::string &sourceCodeInfo)
 
virtual const std::string getSourceLoc () const
 
std::string toString () const
 Needs to be implemented by a SVF front end. More...
 

Static Public Member Functions

static bool classof (const SVFValue *node)
 

Protected Member Functions

void addICFGNode (const ICFGNode *icfgNode)
 Function where this BasicBlock is. More...
 
void addSuccBasicBlock (const SVFBasicBlock *succ)
 
void addPredBasicBlock (const SVFBasicBlock *pred)
 
- Protected Member Functions inherited from SVF::SVFValue
 SVFValue (const SVFType *ty, SVFValKind k)
 Constructor without name. More...
 
void setConstDataOrAggData ()
 
void setPtrInUncalledFunction ()
 

Private Attributes

std::vector< const ICFGNode * > allICFGNodes
 all ICFGNodes in this BasicBlock More...
 
std::vector< const SVFBasicBlock * > succBBs
 all successor BasicBlocks of this BasicBlock More...
 
std::vector< const SVFBasicBlock * > predBBs
 all predecessor BasicBlocks of this BasicBlock More...
 
const SVFFunctionfun
 

Friends

class LLVMModuleSet
 
class SVFIRWriter
 
class SVFIRReader
 
class SVFIRBuilder
 
class SVFFunction
 
class ICFGBuilder
 
class ICFG
 

Additional Inherited Members

- Protected Attributes inherited from SVF::SVFValue
const SVFTypetype
 Type of this SVFValue. More...
 
std::string name
 Short name of value for printing & debugging. More...
 
std::string sourceLoc
 

Detailed Description

Definition at line 518 of file SVFValue.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 529 of file SVFValue.h.

Constructor & Destructor Documentation

◆ SVFBasicBlock() [1/2]

SVFBasicBlock::SVFBasicBlock ( const SVFType ty,
const SVFFunction f 
)

Constructor without name.

Definition at line 199 of file SVFValue.cpp.

200  : SVFValue(ty, SVFValue::SVFBB), fun(f)
201 {
202 }
const SVFFunction * fun
Definition: SVFValue.h:535
SVFValue()=delete

◆ SVFBasicBlock() [2/2]

SVF::SVFBasicBlock::SVFBasicBlock ( )
delete

◆ ~SVFBasicBlock()

SVFBasicBlock::~SVFBasicBlock ( )
override

Definition at line 204 of file SVFValue.cpp.

205 {
206 
207 }

Member Function Documentation

◆ addICFGNode()

void SVF::SVFBasicBlock::addICFGNode ( const ICFGNode icfgNode)
inlineprotected

Function where this BasicBlock is.

attributes to be set only through Module builders e.g., LLVMModule

Definition at line 540 of file SVFValue.h.

541  {
542  assert(std::find(getICFGNodeList().begin(), getICFGNodeList().end(),
543  icfgNode) == getICFGNodeList().end() && "duplicated icfgnode");
544  allICFGNodes.push_back(icfgNode);
545  }
const std::vector< const ICFGNode * > & getICFGNodeList() const
Definition: SVFValue.h:569
std::vector< const ICFGNode * > allICFGNodes
all ICFGNodes in this BasicBlock
Definition: SVFValue.h:532
const_iterator end() const
Definition: SVFValue.h:579
const_iterator begin() const
Definition: SVFValue.h:574

◆ addPredBasicBlock()

void SVF::SVFBasicBlock::addPredBasicBlock ( const SVFBasicBlock pred)
inlineprotected

Definition at line 552 of file SVFValue.h.

553  {
554  predBBs.push_back(pred);
555  }
std::vector< const SVFBasicBlock * > predBBs
all predecessor BasicBlocks of this BasicBlock
Definition: SVFValue.h:534

◆ addSuccBasicBlock()

void SVF::SVFBasicBlock::addSuccBasicBlock ( const SVFBasicBlock succ)
inlineprotected

Definition at line 547 of file SVFValue.h.

548  {
549  succBBs.push_back(succ);
550  }
std::vector< const SVFBasicBlock * > succBBs
all successor BasicBlocks of this BasicBlock
Definition: SVFValue.h:533

◆ back()

const ICFGNode* SVF::SVFBasicBlock::back ( ) const
inline

Definition at line 600 of file SVFValue.h.

601  {
602  assert(!allICFGNodes.empty() && "bb empty?");
603  return allICFGNodes.back();
604  }

◆ begin()

const_iterator SVF::SVFBasicBlock::begin ( ) const
inline

Definition at line 574 of file SVFValue.h.

575  {
576  return allICFGNodes.begin();
577  }

◆ classof()

static bool SVF::SVFBasicBlock::classof ( const SVFValue node)
inlinestatic

Definition at line 564 of file SVFValue.h.

565  {
566  return node->getKind() == SVFBB;
567  }

◆ end()

const_iterator SVF::SVFBasicBlock::end ( ) const
inline

Definition at line 579 of file SVFValue.h.

580  {
581  return allICFGNodes.end();
582  }

◆ front()

const ICFGNode* SVF::SVFBasicBlock::front ( ) const
inline

Definition at line 594 of file SVFValue.h.

595  {
596  assert(!allICFGNodes.empty() && "bb empty?");
597  return allICFGNodes.front();
598  }

◆ getBBPredecessorPos() [1/2]

u32_t SVFBasicBlock::getBBPredecessorPos ( const SVFBasicBlock succbb)

Return a position index from current bb to it successor bb

Definition at line 241 of file SVFValue.cpp.

242 {
243  u32_t pos = 0;
244  for (const SVFBasicBlock* PredBB : succbb->getPredecessors())
245  {
246  if(PredBB == this)
247  return pos;
248  ++pos;
249  }
250  assert(false && "Didn't find predecessor edge?");
251  return pos;
252 }
unsigned u32_t
Definition: CommandLine.h:18
const std::vector< const SVFBasicBlock * > & getPredecessors() const
Definition: SVFValue.h:611

◆ getBBPredecessorPos() [2/2]

u32_t SVFBasicBlock::getBBPredecessorPos ( const SVFBasicBlock succbb) const

Definition at line 253 of file SVFValue.cpp.

254 {
255  u32_t pos = 0;
256  for (const SVFBasicBlock* PredBB : succbb->getPredecessors())
257  {
258  if(PredBB == this)
259  return pos;
260  ++pos;
261  }
262  assert(false && "Didn't find predecessor edge?");
263  return pos;
264 }

◆ getBBSuccessorPos() [1/2]

u32_t SVFBasicBlock::getBBSuccessorPos ( const SVFBasicBlock Succ)

Get position of a successor basic block

Definition at line 212 of file SVFValue.cpp.

213 {
214  u32_t i = 0;
215  for (const SVFBasicBlock* SuccBB: succBBs)
216  {
217  if (SuccBB == Succ)
218  return i;
219  i++;
220  }
221  assert(false && "Didn't find successor edge?");
222  return 0;
223 }

◆ getBBSuccessorPos() [2/2]

u32_t SVFBasicBlock::getBBSuccessorPos ( const SVFBasicBlock succbb) const

Definition at line 225 of file SVFValue.cpp.

226 {
227  u32_t i = 0;
228  for (const SVFBasicBlock* SuccBB: succBBs)
229  {
230  if (SuccBB == Succ)
231  return i;
232  i++;
233  }
234  assert(false && "Didn't find successor edge?");
235  return 0;
236 }

◆ getFunction()

const SVFFunction* SVF::SVFBasicBlock::getFunction ( ) const
inline

Definition at line 589 of file SVFValue.h.

590  {
591  return fun;
592  }

◆ getICFGNodeList()

const std::vector<const ICFGNode*>& SVF::SVFBasicBlock::getICFGNodeList ( ) const
inline

Definition at line 569 of file SVFValue.h.

570  {
571  return allICFGNodes;
572  }

◆ getNumSuccessors()

u32_t SVF::SVFBasicBlock::getNumSuccessors ( ) const
inline

Definition at line 615 of file SVFValue.h.

616  {
617  return succBBs.size();
618  }

◆ getParent()

const SVFFunction* SVF::SVFBasicBlock::getParent ( ) const
inline

Definition at line 584 of file SVFValue.h.

585  {
586  return fun;
587  }

◆ getPredecessors()

const std::vector<const SVFBasicBlock*>& SVF::SVFBasicBlock::getPredecessors ( ) const
inline

Definition at line 611 of file SVFValue.h.

612  {
613  return predBBs;
614  }

◆ getSuccessors()

const std::vector<const SVFBasicBlock*>& SVF::SVFBasicBlock::getSuccessors ( ) const
inline

Definition at line 606 of file SVFValue.h.

607  {
608  return succBBs;
609  }

Friends And Related Function Documentation

◆ ICFG

friend class ICFG
friend

Definition at line 526 of file SVFValue.h.

◆ ICFGBuilder

friend class ICFGBuilder
friend

Definition at line 525 of file SVFValue.h.

◆ LLVMModuleSet

friend class LLVMModuleSet
friend

Definition at line 520 of file SVFValue.h.

◆ SVFFunction

friend class SVFFunction
friend

Definition at line 524 of file SVFValue.h.

◆ SVFIRBuilder

friend class SVFIRBuilder
friend

Definition at line 523 of file SVFValue.h.

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 522 of file SVFValue.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 521 of file SVFValue.h.

Member Data Documentation

◆ allICFGNodes

std::vector<const ICFGNode*> SVF::SVFBasicBlock::allICFGNodes
private

all ICFGNodes in this BasicBlock

Definition at line 532 of file SVFValue.h.

◆ fun

const SVFFunction* SVF::SVFBasicBlock::fun
private

Definition at line 535 of file SVFValue.h.

◆ predBBs

std::vector<const SVFBasicBlock*> SVF::SVFBasicBlock::predBBs
private

all predecessor BasicBlocks of this BasicBlock

Definition at line 534 of file SVFValue.h.

◆ succBBs

std::vector<const SVFBasicBlock*> SVF::SVFBasicBlock::succBBs
private

all successor BasicBlocks of this BasicBlock

Definition at line 533 of file SVFValue.h.


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