Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
SVF::SVFFunction Class Reference

#include <SVFValue.h>

Inheritance diagram for SVF::SVFFunction:
SVF::SVFValue

Public Types

typedef std::vector< constSVFBasicBlock * >::const_iterator const_iterator
 
typedef SVFLoopAndDomInfo::BBSet BBSet
 
typedef SVFLoopAndDomInfo::BBList BBList
 
typedef SVFLoopAndDomInfo::LoopBBs LoopBBs
 
- 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

 SVFFunction (const SVFType *ty, const SVFFunctionType *ft, bool declare, bool intrinsic, bool addrTaken, bool varg, SVFLoopAndDomInfo *ld)
 
 SVFFunction (void)=delete
 
virtual ~SVFFunction ()
 
const CallGraphNodegetCallGraphNode () const
 
SVFLoopAndDomInfogetLoopAndDomInfo ()
 
bool isDeclaration () const
 
bool isIntrinsic () const
 
bool hasAddressTaken () const
 
const SVFFunctionTypegetFunctionType () const
 Returns the FunctionType.
 
const SVFTypegetReturnType () const
 Returns the FunctionType.
 
const SVFFunctiongetDefFunForMultipleModule () const
 
u32_t arg_size () const
 
const SVFArgumentgetArg (u32_t idx) const
 
bool isVarArg () const
 
bool hasBasicBlock () const
 
const SVFBasicBlockgetEntryBlock () const
 
const SVFBasicBlockgetExitBB () const
 
void setExitBlock (SVFBasicBlock *bb)
 
const SVFBasicBlockfront () const
 
const SVFBasicBlockback () const
 
const_iterator begin () const
 
const_iterator end () const
 
const std::vector< const SVFBasicBlock * > & getBasicBlockList () const
 
const std::vector< const SVFBasicBlock * > & getReachableBBs () const
 
bool isUncalledFunction () const
 
bool hasReturn () const
 
void getExitBlocksOfLoop (const SVFBasicBlock *bb, BBList &exitbbs) const
 
bool hasLoopInfo (const SVFBasicBlock *bb) const
 
const LoopBBsgetLoopInfo (const SVFBasicBlock *bb) const
 
const SVFBasicBlockgetLoopHeader (const BBList &lp) const
 
bool loopContainsBB (const BBList &lp, const SVFBasicBlock *bb) const
 
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap () const
 
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap () const
 
bool isLoopHeader (const SVFBasicBlock *bb) const
 
bool dominate (const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
 
bool postDominate (const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
 
- Public Member Functions inherited from SVF::SVFValue
 SVFValue ()=delete
 
virtual ~SVFValue ()=default
 
GNodeK getKind () const
 Get the type of this SVFValue.
 
const std::string & getName () 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.
 

Static Public Member Functions

static bool classof (const SVFValue *node)
 

Protected Member Functions

void setCallGraphNode (CallGraphNode *cgn)
 call graph node for this function
 
void addBasicBlock (const SVFBasicBlock *bb)
 attributes to be set only through Module builders e.g., LLVMModule
 
void addArgument (SVFArgument *arg)
 
void setIsUncalledFunction (bool uncalledFunction)
 
void setIsNotRet (bool notRet)
 
void setDefFunForMultipleModule (const SVFFunction *deffun)
 
- Protected Member Functions inherited from SVF::SVFValue
 SVFValue (const SVFType *ty, SVFValKind k)
 Constructor without name.
 
void setConstDataOrAggData ()
 
void setPtrInUncalledFunction ()
 

Private Attributes

bool isDecl
 
bool intrinsic
 return true if this function does not have a body
 
bool addrTaken
 return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the application code
 
bool isUncalled
 return true if this function is address-taken (for indirect call purposes)
 
bool isNotRet
 return true if this function is never called
 
bool varArg
 return true if this function never returns
 
const SVFFunctionTypefuncType
 return true if this function supports variable arguments
 
SVFLoopAndDomInfoloopAndDom
 FunctionType, which is different from the type (PointerType) of this SVFFunction.
 
const SVFFunctionrealDefFun
 the loop and dominate information
 
std::vector< const SVFBasicBlock * > allBBs
 the definition of a function across multiple modules
 
std::vector< const SVFArgument * > allArgs
 all BasicBlocks of this function
 
SVFBasicBlockexitBlock
 all formal arguments of this function
 
const CallGraphNodecallGraphNode
 a 'single' basic block having no successors and containing return instruction in a function
 

Friends

class LLVMModuleSet
 
class SVFIRWriter
 
class SVFIRReader
 
class SVFIRBuilder
 

Additional Inherited Members

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

Detailed Description

Definition at line 297 of file SVFValue.h.

Member Typedef Documentation

◆ BBList

Definition at line 307 of file SVFValue.h.

◆ BBSet

Definition at line 306 of file SVFValue.h.

◆ const_iterator

Definition at line 305 of file SVFValue.h.

◆ LoopBBs

Definition at line 308 of file SVFValue.h.

Constructor & Destructor Documentation

◆ SVFFunction() [1/2]

SVFFunction::SVFFunction ( const SVFType ty,
const SVFFunctionType ft,
bool  declare,
bool  intrinsic,
bool  addrTaken,
bool  varg,
SVFLoopAndDomInfo ld 
)

Definition at line 152 of file SVFValue.cpp.

156 addrTaken(adt), isUncalled(false), isNotRet(false), varArg(varg),
157 funcType(ft), loopAndDom(ld), realDefFun(nullptr), exitBlock(nullptr)
158{
159}
bool intrinsic
return true if this function does not have a body
Definition SVFValue.h:312
bool varArg
return true if this function never returns
Definition SVFValue.h:316
bool isUncalled
return true if this function is address-taken (for indirect call purposes)
Definition SVFValue.h:314
SVFBasicBlock * exitBlock
all formal arguments of this function
Definition SVFValue.h:322
bool addrTaken
return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the ...
Definition SVFValue.h:313
const SVFFunction * realDefFun
the loop and dominate information
Definition SVFValue.h:319
bool isNotRet
return true if this function is never called
Definition SVFValue.h:315
const SVFFunctionType * funcType
return true if this function supports variable arguments
Definition SVFValue.h:317
SVFLoopAndDomInfo * loopAndDom
FunctionType, which is different from the type (PointerType) of this SVFFunction.
Definition SVFValue.h:318
SVFValue()=delete
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ SVFFunction() [2/2]

SVF::SVFFunction::SVFFunction ( void  )
delete

◆ ~SVFFunction()

SVFFunction::~SVFFunction ( )
virtual

Definition at line 161 of file SVFValue.cpp.

162{
163 for(const SVFBasicBlock* bb : allBBs)
164 delete bb;
165 for(const SVFArgument* arg : allArgs)
166 delete arg;
167 delete loopAndDom;
168}
std::vector< const SVFArgument * > allArgs
all BasicBlocks of this function
Definition SVFValue.h:321
std::vector< const SVFBasicBlock * > allBBs
the definition of a function across multiple modules
Definition SVFValue.h:320

Member Function Documentation

◆ addArgument()

void SVF::SVFFunction::addArgument ( SVFArgument arg)
inlineprotected

Definition at line 337 of file SVFValue.h.

338 {
339 allArgs.push_back(arg);
340 }

◆ addBasicBlock()

void SVF::SVFFunction::addBasicBlock ( const SVFBasicBlock bb)
inlineprotected

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

Definition at line 332 of file SVFValue.h.

333 {
334 allBBs.push_back(bb);
335 }

◆ arg_size()

u32_t SVFFunction::arg_size ( ) const

Definition at line 170 of file SVFValue.cpp.

171{
172 return allArgs.size();
173}

◆ back()

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

Carefully! 'back' is just the last basic block of function, but not necessarily a exit basic block more refer to: https://github.com/SVF-tools/SVF/pull/1262

Definition at line 437 of file SVFValue.h.

438 {
439 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
443 return allBBs.back();
444 }
bool hasBasicBlock() const
Definition SVFValue.h:415

◆ begin()

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

Definition at line 446 of file SVFValue.h.

447 {
448 return allBBs.begin();
449 }

◆ classof()

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

Definition at line 368 of file SVFValue.h.

369 {
370 return node->getKind() == SVFFunc;
371 }

◆ dominate()

bool SVF::SVFFunction::dominate ( const SVFBasicBlock bbKey,
const SVFBasicBlock bbValue 
) const
inline

Definition at line 516 of file SVFValue.h.

517 {
519 }
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.cpp:54

◆ end()

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

Definition at line 451 of file SVFValue.h.

452 {
453 return allBBs.end();
454 }

◆ front()

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

Definition at line 432 of file SVFValue.h.

433 {
434 return getEntryBlock();
435 }
const SVFBasicBlock * getEntryBlock() const
Definition SVFValue.h:420

◆ getArg()

const SVFArgument * SVFFunction::getArg ( u32_t  idx) const

Definition at line 175 of file SVFValue.cpp.

176{
177 assert (idx < allArgs.size() && "getArg() out of range!");
178 return allArgs[idx];
179}

◆ getBasicBlockList()

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

Definition at line 456 of file SVFValue.h.

457 {
458 return allBBs;
459 }

◆ getCallGraphNode()

const CallGraphNode * SVF::SVFFunction::getCallGraphNode ( ) const
inline

Definition at line 363 of file SVFValue.h.

364 {
365 return callGraphNode;
366 }
const CallGraphNode * callGraphNode
a 'single' basic block having no successors and containing return instruction in a function
Definition SVFValue.h:323

◆ getDefFunForMultipleModule()

const SVFFunction * SVF::SVFFunction::getDefFunForMultipleModule ( ) const
inline

Definition at line 404 of file SVFValue.h.

405 {
406 if(realDefFun==nullptr)
407 return this;
408 return realDefFun;
409 }

◆ getDomFrontierMap()

const Map< const SVFBasicBlock *, BBSet > & SVF::SVFFunction::getDomFrontierMap ( ) const
inline

Definition at line 506 of file SVFValue.h.

507 {
509 }
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
Definition SVFValue.h:75

◆ getDomTreeMap()

const Map< const SVFBasicBlock *, BBSet > & SVF::SVFFunction::getDomTreeMap ( ) const
inline

Definition at line 501 of file SVFValue.h.

502 {
503 return loopAndDom->getDomTreeMap();
504 }
Map< const SVFBasicBlock *, BBSet > & getDomTreeMap()
Definition SVFValue.h:139

◆ getEntryBlock()

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

Definition at line 420 of file SVFValue.h.

421 {
422 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
423 return allBBs.front();
424 }

◆ getExitBB()

const SVFBasicBlock * SVFFunction::getExitBB ( ) const

Carefully! when you call getExitBB, you need ensure the function has return instruction more refer to: https://github.com/SVF-tools/SVF/pull/1262

Definition at line 186 of file SVFValue.cpp.

187{
188 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
189 assert(exitBlock && "must have an exitBlock");
190 return exitBlock;
191}

◆ getExitBlocksOfLoop()

void SVF::SVFFunction::getExitBlocksOfLoop ( const SVFBasicBlock bb,
BBList exitbbs 
) const
inline

Definition at line 476 of file SVFValue.h.

477 {
479 }
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
Definition SVFValue.cpp:35

◆ getFunctionType()

const SVFFunctionType * SVF::SVFFunction::getFunctionType ( ) const
inline

Returns the FunctionType.

Definition at line 393 of file SVFValue.h.

394 {
395 return funcType;
396 }

◆ getLoopAndDomInfo()

SVFLoopAndDomInfo * SVF::SVFFunction::getLoopAndDomInfo ( )
inline

Definition at line 373 of file SVFValue.h.

374 {
375 return loopAndDom;
376 }

◆ getLoopHeader()

const SVFBasicBlock * SVF::SVFFunction::getLoopHeader ( const BBList lp) const
inline

Definition at line 491 of file SVFValue.h.

492 {
493 return loopAndDom->getLoopHeader(lp);
494 }
const SVFBasicBlock * getLoopHeader(const LoopBBs &lp) const
Definition SVFValue.h:92

◆ getLoopInfo()

const LoopBBs & SVF::SVFFunction::getLoopInfo ( const SVFBasicBlock bb) const
inline

Definition at line 486 of file SVFValue.h.

487 {
488 return loopAndDom->getLoopInfo(bb);
489 }
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:28

◆ getReachableBBs()

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

Definition at line 461 of file SVFValue.h.

462 {
463 return loopAndDom->getReachableBBs();
464 }
const BBList & getReachableBBs() const
Definition SVFValue.h:155

◆ getReturnType()

const SVFType * SVF::SVFFunction::getReturnType ( ) const
inline

Returns the FunctionType.

Definition at line 399 of file SVFValue.h.

400 {
401 return funcType->getReturnType();
402 }
const SVFType * getReturnType() const
Definition SVFType.h:336

◆ hasAddressTaken()

bool SVF::SVFFunction::hasAddressTaken ( ) const
inline

Definition at line 387 of file SVFValue.h.

388 {
389 return addrTaken;
390 }

◆ hasBasicBlock()

bool SVF::SVFFunction::hasBasicBlock ( ) const
inline

Definition at line 415 of file SVFValue.h.

416 {
417 return !allBBs.empty();
418 }

◆ hasLoopInfo()

bool SVF::SVFFunction::hasLoopInfo ( const SVFBasicBlock bb) const
inline

Definition at line 481 of file SVFValue.h.

482 {
483 return loopAndDom->hasLoopInfo(bb);
484 }
bool hasLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.h:85

◆ hasReturn()

bool SVF::SVFFunction::hasReturn ( ) const
inline

Definition at line 471 of file SVFValue.h.

472 {
473 return !isNotRet;
474 }

◆ isDeclaration()

bool SVF::SVFFunction::isDeclaration ( ) const
inline

Definition at line 377 of file SVFValue.h.

378 {
379 return isDecl;
380 }

◆ isIntrinsic()

bool SVF::SVFFunction::isIntrinsic ( ) const
inline

Definition at line 382 of file SVFValue.h.

383 {
384 return intrinsic;
385 }

◆ isLoopHeader()

bool SVF::SVFFunction::isLoopHeader ( const SVFBasicBlock bb) const
inline

Definition at line 511 of file SVFValue.h.

512 {
513 return loopAndDom->isLoopHeader(bb);
514 }
bool isLoopHeader(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:141

◆ isUncalledFunction()

bool SVF::SVFFunction::isUncalledFunction ( ) const
inline

Definition at line 466 of file SVFValue.h.

467 {
468 return isUncalled;
469 }

◆ isVarArg()

bool SVFFunction::isVarArg ( ) const

Definition at line 181 of file SVFValue.cpp.

182{
183 return varArg;
184}

◆ loopContainsBB()

bool SVF::SVFFunction::loopContainsBB ( const BBList lp,
const SVFBasicBlock bb 
) const
inline

Definition at line 496 of file SVFValue.h.

497 {
498 return loopAndDom->loopContainsBB(lp,bb);
499 }
bool loopContainsBB(const LoopBBs &lp, const SVFBasicBlock *bb) const
Definition SVFValue.h:98

◆ postDominate()

bool SVF::SVFFunction::postDominate ( const SVFBasicBlock bbKey,
const SVFBasicBlock bbValue 
) const
inline

Definition at line 521 of file SVFValue.h.

522 {
524 }
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.cpp:85

◆ setCallGraphNode()

void SVF::SVFFunction::setCallGraphNode ( CallGraphNode cgn)
inlineprotected

call graph node for this function

Definition at line 326 of file SVFValue.h.

327 {
329 }

◆ setDefFunForMultipleModule()

void SVF::SVFFunction::setDefFunForMultipleModule ( const SVFFunction deffun)
inlineprotected

Definition at line 352 of file SVFValue.h.

353 {
355 }

◆ setExitBlock()

void SVFFunction::setExitBlock ( SVFBasicBlock bb)

Definition at line 193 of file SVFValue.cpp.

194{
195 assert(!exitBlock && "have already set exit Basicblock!");
196 exitBlock = bb;
197}

◆ setIsNotRet()

void SVF::SVFFunction::setIsNotRet ( bool  notRet)
inlineprotected

Definition at line 347 of file SVFValue.h.

348 {
350 }

◆ setIsUncalledFunction()

void SVF::SVFFunction::setIsUncalledFunction ( bool  uncalledFunction)
inlineprotected

Definition at line 342 of file SVFValue.h.

343 {
345 }

Friends And Related Symbol Documentation

◆ LLVMModuleSet

Definition at line 299 of file SVFValue.h.

◆ SVFIRBuilder

Definition at line 302 of file SVFValue.h.

◆ SVFIRReader

Definition at line 301 of file SVFValue.h.

◆ SVFIRWriter

Definition at line 300 of file SVFValue.h.

Member Data Documentation

◆ addrTaken

bool SVF::SVFFunction::addrTaken
private

return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the application code

Definition at line 313 of file SVFValue.h.

◆ allArgs

std::vector<const SVFArgument*> SVF::SVFFunction::allArgs
private

all BasicBlocks of this function

Definition at line 321 of file SVFValue.h.

◆ allBBs

std::vector<const SVFBasicBlock*> SVF::SVFFunction::allBBs
private

the definition of a function across multiple modules

Definition at line 320 of file SVFValue.h.

◆ callGraphNode

const CallGraphNode* SVF::SVFFunction::callGraphNode
private

a 'single' basic block having no successors and containing return instruction in a function

Definition at line 323 of file SVFValue.h.

◆ exitBlock

SVFBasicBlock* SVF::SVFFunction::exitBlock
private

all formal arguments of this function

Definition at line 322 of file SVFValue.h.

◆ funcType

const SVFFunctionType* SVF::SVFFunction::funcType
private

return true if this function supports variable arguments

Definition at line 317 of file SVFValue.h.

◆ intrinsic

bool SVF::SVFFunction::intrinsic
private

return true if this function does not have a body

Definition at line 312 of file SVFValue.h.

◆ isDecl

bool SVF::SVFFunction::isDecl
private

Definition at line 311 of file SVFValue.h.

◆ isNotRet

bool SVF::SVFFunction::isNotRet
private

return true if this function is never called

Definition at line 315 of file SVFValue.h.

◆ isUncalled

bool SVF::SVFFunction::isUncalled
private

return true if this function is address-taken (for indirect call purposes)

Definition at line 314 of file SVFValue.h.

◆ loopAndDom

SVFLoopAndDomInfo* SVF::SVFFunction::loopAndDom
private

FunctionType, which is different from the type (PointerType) of this SVFFunction.

Definition at line 318 of file SVFValue.h.

◆ realDefFun

const SVFFunction* SVF::SVFFunction::realDefFun
private

the loop and dominate information

Definition at line 319 of file SVFValue.h.

◆ varArg

bool SVF::SVFFunction::varArg
private

return true if this function never returns

Definition at line 316 of file SVFValue.h.


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