SVF
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SVF::PathCondAllocator Class Reference

#include <PathCondAllocator.h>

Public Types

typedef DdNode Condition
 
typedef Map< u32_t, Condition * > CondPosMap
 map a branch to its Condition More...
 
typedef Map< const BasicBlock *, CondPosMapBBCondMap
 
typedef Map< const Condition *, const Instruction *> CondToTermInstMap
 
typedef Set< const BasicBlock * > BasicBlockSet
 
typedef Map< const Function *, BasicBlockSetFunToExitBBsMap
 map a function to all its basic blocks calling program exit More...
 
typedef Map< const BasicBlock *, Condition * > BBToCondMap
 map a basic block to its condition during control-flow guard computation More...
 
typedef FIFOWorkList< const BasicBlock * > CFWorkList
 worklist for control-flow guard computation More...
 
typedef Map< u32_t, Condition * > IndexToConditionMap
 

Public Member Functions

 PathCondAllocator ()
 Constructor. More...
 
virtual ~PathCondAllocator ()
 Destructor. More...
 
void allocate (const SVFModule *module)
 Perform path allocation. More...
 
const InstructiongetCondInst (const Condition *cond) const
 Get llvm conditional expression. More...
 
DominatorTreegetDT (const Function *fun)
 Get dominators. More...
 
PostDominatorTreegetPostDT (const Function *fun)
 Get Postdominators. More...
 
LoopInfogetLoopInfo (const Function *f)
 Get LoopInfo. More...
 
void printPathCond ()
 Print out the path condition information. More...
 
ConditioncondAnd (Condition *lhs, Condition *rhs)
 Condition operations. More...
 
ConditioncondOr (Condition *lhs, Condition *rhs)
 
ConditioncondNeg (Condition *cond)
 
ConditiongetTrueCond () const
 
ConditiongetFalseCond () const
 
ConditiongetCond (u32_t i) const
 Given an index, get its condition. More...
 
NodeBS exactCondElem (Condition *cond)
 Iterator every element of the bdd. More...
 
void markForRelease (Condition *cond)
 Decrease reference counting for the bdd. More...
 
void printDbg (Condition *cond)
 Print debug information for this condition. More...
 
std::string dumpCond (Condition *cond) const
 
virtual ConditionComputeIntraVFGGuard (const BasicBlock *src, const BasicBlock *dst)
 Guard Computation for a value-flow (between two basic blocks) More...
 
virtual ConditionComputeInterCallVFGGuard (const BasicBlock *src, const BasicBlock *dst, const BasicBlock *callBB)
 
virtual ConditionComputeInterRetVFGGuard (const BasicBlock *src, const BasicBlock *dst, const BasicBlock *retBB)
 
virtual ConditiongetPHIComplementCond (const BasicBlock *BB1, const BasicBlock *BB2, const BasicBlock *BB0)
 
void clearCFCond ()
 
void setCurEvalVal (const Value *val)
 Set current value for branch condition evaluation. More...
 
const ValuegetCurEvalVal () const
 Get current value for branch condition evaluation. More...
 

Static Public Member Functions

static ConditiontrueCond ()
 
static ConditionfalseCond ()
 
static u32_t getMemUsage ()
 Statistics. More...
 
static u32_t getCondNum ()
 
static u32_t getMaxLiveCondNumber ()
 

Static Public Attributes

static u32_t totalCondNum = 0
 

Protected Attributes

BBCondMap bbConds
 map basic block to its successors/predecessors branch conditions More...
 
IndexToConditionMap indexToDDNodeMap
 

Static Protected Attributes

static BddCondManagerbddCondMgr = nullptr
 bbd manager More...
 

Private Member Functions

virtual void allocateForBB (const BasicBlock &bb)
 Allocate path condition for every basic block. More...
 
ConditioncreateNewCond (u32_t i)
 Create new BDD condition. More...
 
ConditionnewCond (const Instruction *inst)
 Allocate a new condition. More...
 
void destroy ()
 Release memory. More...
 
void setBranchCond (const BasicBlock *bb, const BasicBlock *succ, Condition *cond)
 Get/Set a branch condition, and its terminator instruction. More...
 
ConditiongetBranchCond (const BasicBlock *bb, const BasicBlock *succ) const
 Get branch condition. More...
 
ConditiongetEvalBrCond (const BasicBlock *bb, const BasicBlock *succ)
 Get a condition, evaluate the value for conditions if necessary (e.g., testNull like express) More...
 
ConditionevaluateBranchCond (const BasicBlock *bb, const BasicBlock *succ, const Value *val)
 Evaluate branch conditions. More...
 
ConditionevaluateLoopExitBranch (const BasicBlock *bb, const BasicBlock *succ)
 Evaluate loop exit branch. More...
 
ConditionevaluateTestNullLikeExpr (const BranchInst *brInst, const BasicBlock *succ, const Value *val)
 Return branch condition after evaluating test null like expression. More...
 
ConditionevaluateProgExit (const BranchInst *brInst, const BasicBlock *succ)
 Return condition when there is a branch calls program exit. More...
 
void collectBBCallingProgExit (const BasicBlock &bb)
 Collect basic block contains program exit function call. More...
 
bool isBBCallsProgExit (const BasicBlock *bb)
 
bool isEQCmp (const CmpInst *cmp) const
 Evaluate test null/not null like expressions. More...
 
bool isNECmp (const CmpInst *cmp) const
 Return true if the predicate of this compare instruction is not equal. More...
 
bool isTestNullExpr (const Value *test, const Value *val) const
 Return true if this is a test null expression. More...
 
bool isTestNotNullExpr (const Value *test, const Value *val) const
 Return true if this is a test not null expression. More...
 
bool isTestContainsNullAndTheValue (const CmpInst *cmp, const Value *val) const
 Return true if two values on the predicate are what we want. More...
 
bool setCFCond (const BasicBlock *bb, Condition *cond)
 Get/Set control-flow conditions. More...
 
ConditiongetCFCond (const BasicBlock *bb) const
 

Static Private Member Functions

static BddCondManagergetBddCondManager ()
 Used internally, not supposed to be exposed to other classes. More...
 

Private Attributes

CondToTermInstMap condToInstMap
 map a condition to its corresponding llvm instruction More...
 
PTACFInfoBuilder cfInfoBuilder
 map a function to its loop info More...
 
FunToExitBBsMap funToExitBBsMap
 map a function to all its basic blocks calling program exit More...
 
BBToCondMap bbToCondMap
 map a basic block to its path condition starting from root More...
 
const ValuecurEvalVal
 current llvm value to evaluate branch condition when computing guards More...
 

Detailed Description

PathCondAllocator allocates conditions for each basic block of a certain CFG.

Definition at line 44 of file PathCondAllocator.h.

Member Typedef Documentation

◆ BasicBlockSet

Definition at line 54 of file PathCondAllocator.h.

◆ BBCondMap

Definition at line 52 of file PathCondAllocator.h.

◆ BBToCondMap

map a basic block to its condition during control-flow guard computation

Definition at line 56 of file PathCondAllocator.h.

◆ CFWorkList

worklist for control-flow guard computation

Definition at line 57 of file PathCondAllocator.h.

◆ Condition

Definition at line 50 of file PathCondAllocator.h.

◆ CondPosMap

map a branch to its Condition

Definition at line 51 of file PathCondAllocator.h.

◆ CondToTermInstMap

Definition at line 53 of file PathCondAllocator.h.

◆ FunToExitBBsMap

map a function to all its basic blocks calling program exit

Definition at line 55 of file PathCondAllocator.h.

◆ IndexToConditionMap

Definition at line 59 of file PathCondAllocator.h.

Constructor & Destructor Documentation

◆ PathCondAllocator()

SVF::PathCondAllocator::PathCondAllocator ( )
inline

Constructor.

Definition at line 62 of file PathCondAllocator.h.

63  {
65  }
static BddCondManager * getBddCondManager()
Used internally, not supposed to be exposed to other classes.

◆ ~PathCondAllocator()

virtual SVF::PathCondAllocator::~PathCondAllocator ( )
inlinevirtual

Destructor.

Definition at line 67 of file PathCondAllocator.h.

68  {
69  destroy();
70  }
void destroy()
Release memory.

Member Function Documentation

◆ allocate()

void PathCondAllocator::allocate ( const SVFModule M)

Perform path allocation.

Allocate path condition for each branch

Definition at line 52 of file PathCondAllocator.cpp.

53 {
54  DBOUT(DGENERAL,outs() << pasMsg("path condition allocation starts\n"));
55 
56  for (SVFModule::const_iterator fit = M->begin(); fit != M->end(); ++fit)
57  {
58  const SVFFunction * func = *fit;
59  if (!SVFUtil::isExtCall(func))
60  {
61  // Allocate conditions for a program.
62  for (Function::const_iterator bit = func->getLLVMFun()->begin(), ebit = func->getLLVMFun()->end(); bit != ebit; ++bit)
63  {
64  const BasicBlock & bb = *bit;
66  allocateForBB(bb);
67  }
68  }
69  }
70 
72  printPathCond();
73 
74  DBOUT(DGENERAL,outs() << pasMsg("path condition allocation ends\n"));
75 }
virtual void allocateForBB(const BasicBlock &bb)
Allocate path condition for every basic block.
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
std::string pasMsg(std::string msg)
Print each pass/phase message by converting a string into blue string output.
Definition: SVFUtil.cpp:99
iterator begin()
Definition: SVFModule.h:134
void printPathCond()
Print out the path condition information.
raw_ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:47
#define DGENERAL
General debug flag is for each phase of a pass, it is often in a colorful output format.
Function * getLLVMFun() const
Definition: BasicTypes.h:245
iterator end()
Definition: SVFModule.h:142
void collectBBCallingProgExit(const BasicBlock &bb)
Collect basic block contains program exit function call.
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DEBUG model of each pass.
FunctionSetType::const_iterator const_iterator
Definition: SVFModule.h:49
bool isExtCall(const SVFFunction *fun)
Definition: LLVMUtil.h:64
static const llvm::cl::opt< bool > PrintPathCond
Definition: Options.h:173

◆ allocateForBB()

void PathCondAllocator::allocateForBB ( const BasicBlock bb)
privatevirtual

Allocate path condition for every basic block.

Allocate conditions for a basic block and propagate its condition to its successors.

TODO: handle BranchInst and SwitchInst individually here!!

Definition at line 80 of file PathCondAllocator.cpp.

81 {
82 
83  u32_t succ_number = getBBSuccessorNum(&bb);
84 
85  // if successor number greater than 1, allocate new decision variable for successors
86  if(succ_number > 1)
87  {
88 
89  //allocate log2(num_succ) decision variables
90  double num = log(succ_number)/log(2);
91  u32_t bit_num = (u32_t)ceil(num);
92  u32_t succ_index = 0;
93  std::vector<Condition*> condVec;
94  for(u32_t i = 0 ; i < bit_num; i++)
95  {
96  condVec.push_back(newCond(bb.getTerminator()));
97  }
98 
99  // iterate each successor
100  for (succ_const_iterator succ_it = succ_begin(&bb);
101  succ_it != succ_end(&bb);
102  succ_it++, succ_index++)
103  {
104 
105  const BasicBlock* succ = *succ_it;
106 
107  Condition* path_cond = getTrueCond();
108 
110 
111  // for each successor decide its bit representation
112  // decide whether each bit of succ_index is 1 or 0, if (three successor) succ_index is 000 then use C1^C2^C3
113  // if 001 use C1^C2^negC3
114  for(u32_t j = 0 ; j < bit_num; j++)
115  {
116  //test each bit of this successor's index (binary representation)
117  u32_t tool = 0x01 << j;
118  if(tool & succ_index)
119  {
120  path_cond = condAnd(path_cond, condVec.at(j));
121  }
122  else
123  {
124  path_cond = condAnd(path_cond, (condNeg(condVec.at(j))));
125  }
126  }
127  setBranchCond(&bb,succ,path_cond);
128  }
129 
130  }
131 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
Condition * getTrueCond() const
llvm::succ_const_iterator succ_const_iterator
Definition: BasicTypes.h:205
unsigned u32_t
Definition: SVFBasicTypes.h:75
Condition * newCond(const Instruction *inst)
Allocate a new condition.
void setBranchCond(const BasicBlock *bb, const BasicBlock *succ, Condition *cond)
Get/Set a branch condition, and its terminator instruction.
Condition * condAnd(Condition *lhs, Condition *rhs)
Condition operations.
Condition * condNeg(Condition *cond)
u32_t getBBSuccessorNum(const BasicBlock *BB)
Get num of BB&#39;s successors.
Definition: LLVMUtil.cpp:332

◆ clearCFCond()

void SVF::PathCondAllocator::clearCFCond ( )
inline

Definition at line 186 of file PathCondAllocator.h.

187  {
188  bbToCondMap.clear();
189  }
BBToCondMap bbToCondMap
map a basic block to its path condition starting from root

◆ collectBBCallingProgExit()

void PathCondAllocator::collectBBCallingProgExit ( const BasicBlock bb)
private

Collect basic block contains program exit function call.

Whether this basic block contains program exit function call

Definition at line 359 of file PathCondAllocator.cpp.

360 {
361 
362  for(BasicBlock::const_iterator it = bb.begin(), eit = bb.end(); it!=eit; it++)
363  {
364  const Instruction* inst = &*it;
365  if(SVFUtil::isa<CallInst>(inst) || SVFUtil::isa<InvokeInst>(inst))
366  if(SVFUtil::isProgExitCall(inst))
367  {
368  funToExitBBsMap[bb.getParent()].insert(&bb);
369  }
370  }
371 }
FunToExitBBsMap funToExitBBsMap
map a function to all its basic blocks calling program exit
bool isProgExitCall(const CallSite cs)
Definition: LLVMUtil.h:459
llvm::Instruction Instruction
Definition: BasicTypes.h:79

◆ ComputeInterCallVFGGuard()

PathCondAllocator::Condition * PathCondAllocator::ComputeInterCallVFGGuard ( const BasicBlock srcBB,
const BasicBlock dstBB,
const BasicBlock callBB 
)
virtual

Compute calling inter-procedural guards between two SVFGNodes (from caller to callee) src –c1–> callBB –true–> funEntryBB –c2–> dst the InterCallVFGGuard is c1 ^ c2

Definition at line 418 of file PathCondAllocator.cpp.

419 {
420  const BasicBlock* funEntryBB = &dstBB->getParent()->getEntryBlock();
421 
422  Condition* c1 = ComputeIntraVFGGuard(srcBB,callBB);
423  setCFCond(funEntryBB,condOr(getCFCond(funEntryBB),getCFCond(callBB)));
424  Condition* c2 = ComputeIntraVFGGuard(funEntryBB,dstBB);
425  return condAnd(c1,c2);
426 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
bool setCFCond(const BasicBlock *bb, Condition *cond)
Get/Set control-flow conditions.
Condition * condOr(Condition *lhs, Condition *rhs)
Condition * condAnd(Condition *lhs, Condition *rhs)
Condition operations.
Condition * getCFCond(const BasicBlock *bb) const
virtual Condition * ComputeIntraVFGGuard(const BasicBlock *src, const BasicBlock *dst)
Guard Computation for a value-flow (between two basic blocks)

◆ ComputeInterRetVFGGuard()

PathCondAllocator::Condition * PathCondAllocator::ComputeInterRetVFGGuard ( const BasicBlock srcBB,
const BasicBlock dstBB,
const BasicBlock retBB 
)
virtual

Compute return inter-procedural guards between two SVFGNodes (from callee to caller) src –c1–> funExitBB –true–> retBB –c2–> dst the InterRetVFGGuard is c1 ^ c2

Definition at line 433 of file PathCondAllocator.cpp.

434 {
435  const BasicBlock* funExitBB = getFunExitBB(srcBB->getParent());
436 
437  Condition* c1 = ComputeIntraVFGGuard(srcBB,funExitBB);
438  setCFCond(retBB,condOr(getCFCond(retBB),getCFCond(funExitBB)));
439  Condition* c2 = ComputeIntraVFGGuard(retBB,dstBB);
440  return condAnd(c1,c2);
441 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
bool setCFCond(const BasicBlock *bb, Condition *cond)
Get/Set control-flow conditions.
Condition * condOr(Condition *lhs, Condition *rhs)
const BasicBlock * getFunExitBB(const Function *fun)
Definition: LLVMUtil.h:494
Condition * condAnd(Condition *lhs, Condition *rhs)
Condition operations.
Condition * getCFCond(const BasicBlock *bb) const
virtual Condition * ComputeIntraVFGGuard(const BasicBlock *src, const BasicBlock *dst)
Guard Computation for a value-flow (between two basic blocks)

◆ ComputeIntraVFGGuard()

PathCondAllocator::Condition * PathCondAllocator::ComputeIntraVFGGuard ( const BasicBlock srcBB,
const BasicBlock dstBB 
)
virtual

Guard Computation for a value-flow (between two basic blocks)

Compute intra-procedural guards between two SVFGNodes (inside same function)

if the dstBB is the eligible loop exit of the current basic block we can early terminate the computation

calculate the branch condition if succ post dominate bb, then we get brCond quicker by using postDT note that we assume loop exit always post dominate loop bodys which means loops are approximated only once.

Definition at line 446 of file PathCondAllocator.cpp.

447 {
448 
449  assert(srcBB->getParent() == dstBB->getParent() && "two basic blocks are not in the same function??");
450 
451  PostDominatorTree* postDT = getPostDT(srcBB->getParent());
452  if(postDT->dominates(dstBB,srcBB))
453  return getTrueCond();
454 
455  CFWorkList worklist;
456  worklist.push(srcBB);
457  setCFCond(srcBB,getTrueCond());
458 
459  while(!worklist.empty())
460  {
461  const BasicBlock* bb = worklist.pop();
462  Condition* cond = getCFCond(bb);
463 
466  if(Condition* loopExitCond = evaluateLoopExitBranch(bb,dstBB))
467  return condAnd(cond, loopExitCond);
468 
469 
470  for (succ_const_iterator succ_it = succ_begin(bb);
471  succ_it != succ_end(bb); succ_it++)
472  {
473  const BasicBlock* succ = *succ_it;
478  Condition* brCond;
479  if(postDT->dominates(succ,bb))
480  brCond = getTrueCond();
481  else
482  brCond = getEvalBrCond(bb, succ);
483 
484  DBOUT(DSaber, outs() << " bb (" << bb->getName() <<
485  ") --> " << "succ_bb (" << succ->getName() << ") condition: " << brCond << "\n");
486  Condition* succPathCond = condAnd(cond, brCond);
487  if(setCFCond(succ, condOr(getCFCond(succ), succPathCond)))
488  worklist.push(succ);
489  }
490  }
491 
492  DBOUT(DSaber, outs() << " src_bb (" << srcBB->getName() <<
493  ") --> " << "dst_bb (" << dstBB->getName() << ") condition: " << getCFCond(dstBB) << "\n");
494 
495  return getCFCond(dstBB);
496 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
Condition * getEvalBrCond(const BasicBlock *bb, const BasicBlock *succ)
Get a condition, evaluate the value for conditions if necessary (e.g., testNull like express) ...
#define assert(ex)
Definition: util.h:141
Condition * getTrueCond() const
bool setCFCond(const BasicBlock *bb, Condition *cond)
Get/Set control-flow conditions.
PostDominatorTree * getPostDT(const Function *fun)
Get Postdominators.
Condition * evaluateLoopExitBranch(const BasicBlock *bb, const BasicBlock *succ)
Evaluate loop exit branch.
Condition * condOr(Condition *lhs, Condition *rhs)
llvm::succ_const_iterator succ_const_iterator
Definition: BasicTypes.h:205
#define DSaber
llvm::PostDominatorTree PostDominatorTree
Definition: BasicTypes.h:194
Condition * condAnd(Condition *lhs, Condition *rhs)
Condition operations.
raw_ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:47
FIFOWorkList< const BasicBlock * > CFWorkList
worklist for control-flow guard computation
Condition * getCFCond(const BasicBlock *bb) const
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DEBUG model of each pass.

◆ condAnd()

Condition* SVF::PathCondAllocator::condAnd ( Condition lhs,
Condition rhs 
)
inline

Condition operations.

Definition at line 126 of file PathCondAllocator.h.

127  {
128  return bddCondMgr->AND(lhs,rhs);
129  }
DdNode * AND(DdNode *lhs, DdNode *rhs)
Operations on conditions.
Definition: Conditions.cpp:40
static BddCondManager * bddCondMgr
bbd manager

◆ condNeg()

Condition* SVF::PathCondAllocator::condNeg ( Condition cond)
inline

Definition at line 134 of file PathCondAllocator.h.

135  {
136  return bddCondMgr->NEG(cond);
137  }
static BddCondManager * bddCondMgr
bbd manager
DdNode * NEG(DdNode *lhs)
Definition: Conditions.cpp:93

◆ condOr()

Condition* SVF::PathCondAllocator::condOr ( Condition lhs,
Condition rhs 
)
inline

Definition at line 130 of file PathCondAllocator.h.

131  {
132  return bddCondMgr->OR(lhs,rhs);
133  }
static BddCondManager * bddCondMgr
bbd manager
DdNode * OR(DdNode *lhs, DdNode *rhs)
Definition: Conditions.cpp:68

◆ createNewCond()

Condition* SVF::PathCondAllocator::createNewCond ( u32_t  i)
inlineprivate

Create new BDD condition.

Definition at line 278 of file PathCondAllocator.h.

279  {
280  assert(indexToDDNodeMap.find(i)==indexToDDNodeMap.end() && "This should be fresh index to create new BDD");
281  Condition* d = bddCondMgr->Cudd_bdd(i);
282  indexToDDNodeMap[i] = d;
283  return d;
284  }
#define assert(ex)
Definition: util.h:141
IndexToConditionMap indexToDDNodeMap
static BddCondManager * bddCondMgr
bbd manager
DdNode * Cudd_bdd(u32_t i)
Definition: Conditions.h:59

◆ destroy()

void PathCondAllocator::destroy ( )
private

Release memory.

Release memory

Definition at line 502 of file PathCondAllocator.cpp.

503 {
504  delete bddCondMgr;
505  bddCondMgr = nullptr;
506 }
static BddCondManager * bddCondMgr
bbd manager

◆ dumpCond()

std::string SVF::PathCondAllocator::dumpCond ( Condition cond) const
inline

Definition at line 170 of file PathCondAllocator.h.

171  {
172  return bddCondMgr->dumpStr(cond);
173  }
static BddCondManager * bddCondMgr
bbd manager
std::string dumpStr(DdNode *lhs) const
Definition: Conditions.cpp:163

◆ evaluateBranchCond()

PathCondAllocator::Condition * PathCondAllocator::evaluateBranchCond ( const BasicBlock bb,
const BasicBlock succ,
const Value val 
)
private

Evaluate branch conditions.

Evaluate the branch condtion

(1) Evaluate a branch when it reaches a program exit (2) Evaluate a branch when it is loop exit branch (3) Evaluate a branch when it is a test null like condition

Definition at line 285 of file PathCondAllocator.cpp.

286 {
287  if(getBBSuccessorNum(bb) == 1)
288  {
289  assert(bb->getTerminator()->getSuccessor(0) == succ && "not the unique successor?");
290  return getTrueCond();
291  }
292 
293  if(const BranchInst* brInst = SVFUtil::dyn_cast<BranchInst>(bb->getTerminator()))
294  {
295  assert(brInst->getNumSuccessors() == 2 && "not a two successors branch??");
296  const BasicBlock* succ1 = brInst->getSuccessor(0);
297  const BasicBlock* succ2 = brInst->getSuccessor(1);
298  assert((succ1 == succ || succ2 == succ) && "not a successor??");
299 
300  Condition* evalLoopExit = evaluateLoopExitBranch(bb,succ);
301  if(evalLoopExit)
302  return evalLoopExit;
303 
304  Condition* evalProgExit = evaluateProgExit(brInst,succ);
305  if(evalProgExit)
306  return evalProgExit;
307 
308  Condition* evalTestNullLike = evaluateTestNullLikeExpr(brInst,succ,val);
309  if(evalTestNullLike)
310  return evalTestNullLike;
311 
312  }
313  return getBranchCond(bb, succ);
314 }
Condition * getBranchCond(const BasicBlock *bb, const BasicBlock *succ) const
Get branch condition.
llvm::BranchInst BranchInst
Definition: BasicTypes.h:157
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
Condition * evaluateTestNullLikeExpr(const BranchInst *brInst, const BasicBlock *succ, const Value *val)
Return branch condition after evaluating test null like expression.
#define assert(ex)
Definition: util.h:141
Condition * getTrueCond() const
Condition * evaluateLoopExitBranch(const BasicBlock *bb, const BasicBlock *succ)
Evaluate loop exit branch.
Condition * evaluateProgExit(const BranchInst *brInst, const BasicBlock *succ)
Return condition when there is a branch calls program exit.
u32_t getBBSuccessorNum(const BasicBlock *BB)
Get num of BB&#39;s successors.
Definition: LLVMUtil.cpp:332

◆ evaluateLoopExitBranch()

PathCondAllocator::Condition * PathCondAllocator::evaluateLoopExitBranch ( const BasicBlock bb,
const BasicBlock dst 
)
private

Evaluate loop exit branch.

Evaluate loop exit branch to be true if bb is loop header and succ is the only exit basic block outside the loop (excluding exit bbs which call program exit) for all other case, we conservatively evaluate false for now

exclude exit bb which calls program exit

if the dst dominate all other loop exit bbs, then dst can certainly be reached

Definition at line 245 of file PathCondAllocator.cpp.

246 {
247  const Function* fun = bb->getParent();
248  assert(fun==dst->getParent() && "two basic blocks should be in the same function");
249 
250  const LoopInfo* loopInfo = getLoopInfo(fun);
251  if(loopInfo->isLoopHeader(const_cast<BasicBlock*>(bb)))
252  {
253  const Loop *loop = loopInfo->getLoopFor(bb);
254  SmallBBVector exitbbs;
255  Set<BasicBlock*> filteredbbs;
256  loop->getExitBlocks(exitbbs);
258  while(!exitbbs.empty())
259  {
260  BasicBlock* eb = exitbbs.pop_back_val();
261  if(isBBCallsProgExit(eb) == false)
262  filteredbbs.insert(eb);
263  }
264 
266  bool allPDT = true;
267  PostDominatorTree* pdt = getPostDT(fun);
268  for(Set<BasicBlock*>::const_iterator it = filteredbbs.begin(), eit = filteredbbs.end(); it!=eit; ++it)
269  {
270  if(pdt->dominates(dst,*it) == false)
271  allPDT =false;
272  }
273 
274  if(allPDT)
275  return getTrueCond();
276  }
277  return nullptr;
278 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
#define assert(ex)
Definition: util.h:141
Condition * getTrueCond() const
PostDominatorTree * getPostDT(const Function *fun)
Get Postdominators.
llvm::LoopInfo LoopInfo
Definition: BasicTypes.h:89
llvm::PostDominatorTree PostDominatorTree
Definition: BasicTypes.h:194
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition: SVFBasicTypes.h:93
llvm::Function Function
Definition: BasicTypes.h:76
llvm::Loop Loop
Definition: BasicTypes.h:88
llvm::SmallVector< BasicBlock *, 8 > SmallBBVector
Definition: BasicTypes.h:117
LoopInfo * getLoopInfo(const Function *f)
Get LoopInfo.
bool isBBCallsProgExit(const BasicBlock *bb)

◆ evaluateProgExit()

PathCondAllocator::Condition * PathCondAllocator::evaluateProgExit ( const BranchInst brInst,
const BasicBlock succ 
)
private

Return condition when there is a branch calls program exit.

Evaluate condition for program exit (e.g., exit(0))

then branch calls program exit

else branch calls program exit

no branch call program exit

Definition at line 201 of file PathCondAllocator.cpp.

202 {
203  const BasicBlock* succ1 = brInst->getSuccessor(0);
204  const BasicBlock* succ2 = brInst->getSuccessor(1);
205 
206  bool branch1 = isBBCallsProgExit(succ1);
207  bool branch2 = isBBCallsProgExit(succ2);
208 
210  if(branch1 == true && branch2 == false)
211  {
212  // succ is then branch
213  if(succ1 == succ)
214  return getFalseCond();
215  // succ is else branch
216  else
217  return getTrueCond();
218  }
220  else if(branch1 == false && branch2 == true)
221  {
222  // succ is else branch
223  if(succ2 == succ)
224  return getFalseCond();
225  // succ is then branch
226  else
227  return getTrueCond();
228  }
229  // two branches both call program exit
230  else if(branch1 == true && branch2 == true)
231  {
232  return getFalseCond();
233  }
235  else
236  return nullptr;
237 
238 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
Condition * getTrueCond() const
Condition * getFalseCond() const
bool isBBCallsProgExit(const BasicBlock *bb)

◆ evaluateTestNullLikeExpr()

PathCondAllocator::Condition * PathCondAllocator::evaluateTestNullLikeExpr ( const BranchInst brInst,
const BasicBlock succ,
const Value val 
)
private

Return branch condition after evaluating test null like expression.

Evaluate null like expression for source-sink related bug detection in SABER

Definition at line 171 of file PathCondAllocator.cpp.

172 {
173 
174  const BasicBlock* succ1 = brInst->getSuccessor(0);
175 
176  if(isTestNullExpr(brInst->getCondition(),val))
177  {
178  // succ is then branch
179  if(succ1 == succ)
180  return getFalseCond();
181  // succ is else branch
182  else
183  return getTrueCond();
184  }
185  if(isTestNotNullExpr(brInst->getCondition(),val))
186  {
187  // succ is then branch
188  if(succ1 == succ)
189  return getTrueCond();
190  // succ is else branch
191  else
192  return getFalseCond();
193  }
194 
195  return nullptr;
196 }
bool isTestNullExpr(const Value *test, const Value *val) const
Return true if this is a test null expression.
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
Condition * getTrueCond() const
Condition * getFalseCond() const
bool isTestNotNullExpr(const Value *test, const Value *val) const
Return true if this is a test not null expression.

◆ exactCondElem()

NodeBS SVF::PathCondAllocator::exactCondElem ( Condition cond)
inline

Iterator every element of the bdd.

Definition at line 154 of file PathCondAllocator.h.

155  {
156  NodeBS elems;
157  bddCondMgr->BddSupport(cond,elems);
158  return elems;
159  }
void BddSupport(DdNode *f, NodeBS &support) const
Definition: Conditions.cpp:134
static BddCondManager * bddCondMgr
bbd manager
llvm::SparseBitVector NodeBS
Definition: SVFBasicTypes.h:87

◆ falseCond()

static Condition* SVF::PathCondAllocator::falseCond ( )
inlinestatic

Definition at line 76 of file PathCondAllocator.h.

77  {
78  return getBddCondManager()->getFalseCond();
79  }
static BddCondManager * getBddCondManager()
Used internally, not supposed to be exposed to other classes.
DdNode * getFalseCond() const
Definition: Conditions.h:72

◆ getBddCondManager()

static BddCondManager* SVF::PathCondAllocator::getBddCondManager ( )
inlinestaticprivate

Used internally, not supposed to be exposed to other classes.

Definition at line 295 of file PathCondAllocator.h.

296  {
297  if(bddCondMgr==nullptr)
298  bddCondMgr = new BddCondManager();
299  return bddCondMgr;
300  }
static BddCondManager * bddCondMgr
bbd manager

◆ getBranchCond()

PathCondAllocator::Condition * PathCondAllocator::getBranchCond ( const BasicBlock bb,
const BasicBlock succ 
) const
private

Get branch condition.

Get a branch condition

Definition at line 136 of file PathCondAllocator.cpp.

137 {
138  u32_t pos = getBBSuccessorPos(bb,succ);
139  if(getBBSuccessorNum(bb) == 1)
140  return getTrueCond();
141  else
142  {
143  BBCondMap::const_iterator it = bbConds.find(bb);
144  assert(it!=bbConds.end() && "basic block does not have branch and conditions??");
145  CondPosMap::const_iterator cit = it->second.find(pos);
146  assert(cit!=it->second.end() && "no condition on the branch??");
147  return cit->second;
148  }
149 }
#define assert(ex)
Definition: util.h:141
Condition * getTrueCond() const
u32_t getBBSuccessorPos(const BasicBlock *BB, const BasicBlock *Succ)
Get basic block successor position.
Definition: LLVMUtil.cpp:300
unsigned u32_t
Definition: SVFBasicTypes.h:75
BBCondMap bbConds
map basic block to its successors/predecessors branch conditions
u32_t getBBSuccessorNum(const BasicBlock *BB)
Get num of BB&#39;s successors.
Definition: LLVMUtil.cpp:332

◆ getCFCond()

Condition* SVF::PathCondAllocator::getCFCond ( const BasicBlock bb) const
inlineprivate

Definition at line 266 of file PathCondAllocator.h.

267  {
268  BBToCondMap::const_iterator it = bbToCondMap.find(bb);
269  if(it==bbToCondMap.end())
270  {
271  return getFalseCond();
272  }
273  return it->second;
274  }
Condition * getFalseCond() const
BBToCondMap bbToCondMap
map a basic block to its path condition starting from root

◆ getCond()

Condition* SVF::PathCondAllocator::getCond ( u32_t  i) const
inline

Given an index, get its condition.

Definition at line 147 of file PathCondAllocator.h.

148  {
149  IndexToConditionMap::const_iterator it = indexToDDNodeMap.find(i);
150  assert(it!=indexToDDNodeMap.end() && "condition not found!");
151  return it->second;
152  }
#define assert(ex)
Definition: util.h:141
IndexToConditionMap indexToDDNodeMap

◆ getCondInst()

const Instruction* SVF::PathCondAllocator::getCondInst ( const Condition cond) const
inline

Get llvm conditional expression.

Definition at line 101 of file PathCondAllocator.h.

102  {
103  CondToTermInstMap::const_iterator it = condToInstMap.find(cond);
104  assert(it!=condToInstMap.end() && "this should be a fresh condition");
105  return it->second;
106  }
#define assert(ex)
Definition: util.h:141
CondToTermInstMap condToInstMap
map a condition to its corresponding llvm instruction

◆ getCondNum()

static u32_t SVF::PathCondAllocator::getCondNum ( )
inlinestatic

Definition at line 87 of file PathCondAllocator.h.

88  {
89  return getBddCondManager()->getCondNumber();
90  }
u32_t getCondNumber()
Definition: Conditions.h:81
static BddCondManager * getBddCondManager()
Used internally, not supposed to be exposed to other classes.

◆ getCurEvalVal()

const Value* SVF::PathCondAllocator::getCurEvalVal ( ) const
inline

Get current value for branch condition evaluation.

Definition at line 196 of file PathCondAllocator.h.

197  {
198  return curEvalVal;
199  }
const Value * curEvalVal
current llvm value to evaluate branch condition when computing guards

◆ getDT()

DominatorTree* SVF::PathCondAllocator::getDT ( const Function fun)
inline

Get dominators.

Definition at line 109 of file PathCondAllocator.h.

110  {
111  return cfInfoBuilder.getDT(fun);
112  }
PTACFInfoBuilder cfInfoBuilder
map a function to its loop info
DominatorTree * getDT(const Function *f)
Get dominator tree of a function.

◆ getEvalBrCond()

Condition* SVF::PathCondAllocator::getEvalBrCond ( const BasicBlock bb,
const BasicBlock succ 
)
inlineprivate

Get a condition, evaluate the value for conditions if necessary (e.g., testNull like express)

Definition at line 217 of file PathCondAllocator.h.

218  {
219  if(const Value* val = getCurEvalVal())
220  return evaluateBranchCond(bb, succ, val);
221  else
222  return getBranchCond(bb,succ);
223  }
Condition * getBranchCond(const BasicBlock *bb, const BasicBlock *succ) const
Get branch condition.
Condition * evaluateBranchCond(const BasicBlock *bb, const BasicBlock *succ, const Value *val)
Evaluate branch conditions.
const Value * getCurEvalVal() const
Get current value for branch condition evaluation.
llvm::Value Value
Definition: BasicTypes.h:78

◆ getFalseCond()

Condition* SVF::PathCondAllocator::getFalseCond ( ) const
inline

Definition at line 142 of file PathCondAllocator.h.

143  {
144  return bddCondMgr->getFalseCond();
145  }
static BddCondManager * bddCondMgr
bbd manager
DdNode * getFalseCond() const
Definition: Conditions.h:72

◆ getLoopInfo()

LoopInfo* SVF::PathCondAllocator::getLoopInfo ( const Function f)
inline

Get LoopInfo.

Definition at line 119 of file PathCondAllocator.h.

120  {
121  return cfInfoBuilder.getLoopInfo(f);
122  }
LoopInfo * getLoopInfo(const Function *f)
Get loop info of a function.
PTACFInfoBuilder cfInfoBuilder
map a function to its loop info

◆ getMaxLiveCondNumber()

static u32_t SVF::PathCondAllocator::getMaxLiveCondNumber ( )
inlinestatic

Definition at line 91 of file PathCondAllocator.h.

92  {
94  }
static BddCondManager * getBddCondManager()
Used internally, not supposed to be exposed to other classes.
u32_t getMaxLiveCondNumber()
Definition: Conditions.h:85

◆ getMemUsage()

static u32_t SVF::PathCondAllocator::getMemUsage ( )
inlinestatic

Statistics.

Definition at line 83 of file PathCondAllocator.h.

84  {
86  }
u32_t getBDDMemUsage()
Definition: Conditions.h:77
static BddCondManager * getBddCondManager()
Used internally, not supposed to be exposed to other classes.

◆ getPHIComplementCond()

PathCondAllocator::Condition * PathCondAllocator::getPHIComplementCond ( const BasicBlock BB1,
const BasicBlock BB2,
const BasicBlock BB0 
)
virtual

Get complement condition (from B1 to B0) according to a complementBB (BB2) at a phi e.g., B0: dstBB; B1:incomingBB; B2:complementBB

Get complement phi condition e.g., B0: dstBB; B1:incomingBB; B2:complementBB Assume B0 (phi node) is the successor of both B1 and B2. If B1 dominates B2, and B0 not dominate B2 then condition from B1–>B0 = neg(B1–>B2)^(B1–>B0)

avoid both BB0 and BB1 dominate BB2 (e.g., while loop), then BB2 is not necessaryly a complement BB

Definition at line 398 of file PathCondAllocator.cpp.

399 {
400  assert(BB1 && BB2 && "expect nullptr BB here!");
401 
402  DominatorTree* dt = getDT(BB1->getParent());
404  if(dt->dominates(BB1,BB2) && !dt->dominates(BB0,BB2))
405  {
406  Condition* cond = ComputeIntraVFGGuard(BB1,BB2);
407  return condNeg(cond);
408  }
409 
410  return trueCond();
411 }
#define assert(ex)
Definition: util.h:141
DominatorTree * getDT(const Function *fun)
Get dominators.
static Condition * trueCond()
llvm::DominatorTree DominatorTree
Definition: BasicTypes.h:193
Condition * condNeg(Condition *cond)
virtual Condition * ComputeIntraVFGGuard(const BasicBlock *src, const BasicBlock *dst)
Guard Computation for a value-flow (between two basic blocks)

◆ getPostDT()

PostDominatorTree* SVF::PathCondAllocator::getPostDT ( const Function fun)
inline

Get Postdominators.

Definition at line 114 of file PathCondAllocator.h.

115  {
116  return cfInfoBuilder.getPostDT(fun);
117  }
PostDominatorTree * getPostDT(const Function *f)
Get post dominator tree of a function.
PTACFInfoBuilder cfInfoBuilder
map a function to its loop info

◆ getTrueCond()

Condition* SVF::PathCondAllocator::getTrueCond ( ) const
inline

Definition at line 138 of file PathCondAllocator.h.

139  {
140  return bddCondMgr->getTrueCond();
141  }
DdNode * getTrueCond() const
Definition: Conditions.h:68
static BddCondManager * bddCondMgr
bbd manager

◆ isBBCallsProgExit()

bool PathCondAllocator::isBBCallsProgExit ( const BasicBlock bb)
private

Whether this basic block contains program exit function call

Definition at line 376 of file PathCondAllocator.cpp.

377 {
378  const Function* fun = bb->getParent();
379  FunToExitBBsMap::const_iterator it = funToExitBBsMap.find(fun);
380  if(it!=funToExitBBsMap.end())
381  {
382  PostDominatorTree* pdt = getPostDT(fun);
383  for(BasicBlockSet::const_iterator bit = it->second.begin(), ebit= it->second.end(); bit!=ebit; bit++)
384  {
385  if(pdt->dominates(*bit,bb))
386  return true;
387  }
388  }
389  return false;
390 }
PostDominatorTree * getPostDT(const Function *fun)
Get Postdominators.
FunToExitBBsMap funToExitBBsMap
map a function to all its basic blocks calling program exit
llvm::PostDominatorTree PostDominatorTree
Definition: BasicTypes.h:194
llvm::Function Function
Definition: BasicTypes.h:76

◆ isEQCmp()

bool PathCondAllocator::isEQCmp ( const CmpInst cmp) const
private

Evaluate test null/not null like expressions.

Return true if the predicate of this compare instruction is equal

Definition at line 316 of file PathCondAllocator.cpp.

317 {
318  return (cmp->getPredicate() == CmpInst::ICMP_EQ);
319 }

◆ isNECmp()

bool PathCondAllocator::isNECmp ( const CmpInst cmp) const
private

Return true if the predicate of this compare instruction is not equal.

Definition at line 321 of file PathCondAllocator.cpp.

322 {
323  return (cmp->getPredicate() == CmpInst::ICMP_NE);
324 }

◆ isTestContainsNullAndTheValue()

bool PathCondAllocator::isTestContainsNullAndTheValue ( const CmpInst cmp,
const Value val 
) const
private

Return true if two values on the predicate are what we want.

Definition at line 344 of file PathCondAllocator.cpp.

345 {
346 
347  const Value* op0 = cmp->getOperand(0);
348  const Value* op1 = cmp->getOperand(1);
349  if((op0 == val && SVFUtil::isa<ConstantPointerNull>(op1))
350  || (op1 == val && SVFUtil::isa<ConstantPointerNull>(op0)) )
351  return true;
352 
353  return false;
354 }
llvm::Value Value
Definition: BasicTypes.h:78

◆ isTestNotNullExpr()

bool PathCondAllocator::isTestNotNullExpr ( const Value test,
const Value val 
) const
private

Return true if this is a test not null expression.

Definition at line 335 of file PathCondAllocator.cpp.

336 {
337  if(const CmpInst* cmp = SVFUtil::dyn_cast<CmpInst>(test))
338  {
339  return isTestContainsNullAndTheValue(cmp,val) && isNECmp(cmp);
340  }
341  return false;
342 }
bool isTestContainsNullAndTheValue(const CmpInst *cmp, const Value *val) const
Return true if two values on the predicate are what we want.
bool isNECmp(const CmpInst *cmp) const
Return true if the predicate of this compare instruction is not equal.
llvm::CmpInst CmpInst
Definition: BasicTypes.h:156

◆ isTestNullExpr()

bool PathCondAllocator::isTestNullExpr ( const Value test,
const Value val 
) const
private

Return true if this is a test null expression.

Definition at line 326 of file PathCondAllocator.cpp.

327 {
328  if(const CmpInst* cmp = SVFUtil::dyn_cast<CmpInst>(test))
329  {
330  return isTestContainsNullAndTheValue(cmp,val) && isEQCmp(cmp);
331  }
332  return false;
333 }
bool isTestContainsNullAndTheValue(const CmpInst *cmp, const Value *val) const
Return true if two values on the predicate are what we want.
bool isEQCmp(const CmpInst *cmp) const
Evaluate test null/not null like expressions.
llvm::CmpInst CmpInst
Definition: BasicTypes.h:156

◆ markForRelease()

void SVF::PathCondAllocator::markForRelease ( Condition cond)
inline

Decrease reference counting for the bdd.

Definition at line 161 of file PathCondAllocator.h.

162  {
163  bddCondMgr->markForRelease(cond);
164  }
static BddCondManager * bddCondMgr
bbd manager
void markForRelease(DdNode *cond)
Definition: Conditions.h:89

◆ newCond()

Condition* SVF::PathCondAllocator::newCond ( const Instruction inst)
inlineprivate

Allocate a new condition.

Definition at line 286 of file PathCondAllocator.h.

287  {
289  assert(condToInstMap.find(cond)==condToInstMap.end() && "this should be a fresh condition");
290  condToInstMap[cond] = inst;
291  return cond;
292  }
#define assert(ex)
Definition: util.h:141
CondToTermInstMap condToInstMap
map a condition to its corresponding llvm instruction
Condition * createNewCond(u32_t i)
Create new BDD condition.

◆ printDbg()

void SVF::PathCondAllocator::printDbg ( Condition cond)
inline

Print debug information for this condition.

Definition at line 166 of file PathCondAllocator.h.

167  {
168  bddCondMgr->printDbg(cond);
169  }
static BddCondManager * bddCondMgr
bbd manager
void printDbg(DdNode *d)
Definition: Conditions.h:114

◆ printPathCond()

void PathCondAllocator::printPathCond ( )

Print out the path condition information.

Print path conditions

Definition at line 511 of file PathCondAllocator.cpp.

512 {
513 
514  outs() << "print path condition\n";
515 
516  for(BBCondMap::const_iterator it = bbConds.begin(), eit = bbConds.end(); it!=eit; ++it)
517  {
518  const BasicBlock* bb = it->first;
519  for(CondPosMap::const_iterator cit = it->second.begin(), ecit = it->second.end(); cit!=ecit; ++cit)
520  {
521  u32_t i=0;
522  for (const BasicBlock *succ: successors(bb))
523  {
524  if (i == cit->first)
525  {
526  Condition* cond = cit->second;
527  outs() << bb->getName() << "-->" << succ->getName() << ":";
528  outs() << dumpCond(cond) << "\n";
529  break;
530  }
531  i++;
532  }
533  }
534  }
535 }
llvm::BasicBlock BasicBlock
Definition: BasicTypes.h:77
unsigned u32_t
Definition: SVFBasicTypes.h:75
BBCondMap bbConds
map basic block to its successors/predecessors branch conditions
raw_ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:47
std::string dumpCond(Condition *cond) const

◆ setBranchCond()

void PathCondAllocator::setBranchCond ( const BasicBlock bb,
const BasicBlock succ,
Condition cond 
)
private

Get/Set a branch condition, and its terminator instruction.

Set branch condition

Set a branch condition

we only care about basic blocks have more than one successor

FIXME: llvm getNumSuccessors allows duplicated block in the successors, it makes this assertion fail In this case we may waste a condition allocation, because the overwrite of the previous cond

Definition at line 154 of file PathCondAllocator.cpp.

155 {
157  assert(getBBSuccessorNum(bb) > 1 && "not more than one successor??");
158  u32_t pos = getBBSuccessorPos(bb,succ);
159  CondPosMap& condPosMap = bbConds[bb];
160 
163  //assert(condPosMap.find(pos) == condPosMap.end() && "this branch has already been set ");
164 
165  condPosMap[pos] = cond;
166 }
#define assert(ex)
Definition: util.h:141
u32_t getBBSuccessorPos(const BasicBlock *BB, const BasicBlock *Succ)
Get basic block successor position.
Definition: LLVMUtil.cpp:300
unsigned u32_t
Definition: SVFBasicTypes.h:75
BBCondMap bbConds
map basic block to its successors/predecessors branch conditions
Map< u32_t, Condition * > CondPosMap
map a branch to its Condition
u32_t getBBSuccessorNum(const BasicBlock *BB)
Get num of BB&#39;s successors.
Definition: LLVMUtil.cpp:332

◆ setCFCond()

bool SVF::PathCondAllocator::setCFCond ( const BasicBlock bb,
Condition cond 
)
inlineprivate

Get/Set control-flow conditions.

Definition at line 257 of file PathCondAllocator.h.

258  {
259  BBToCondMap::iterator it = bbToCondMap.find(bb);
260  if(it!=bbToCondMap.end() && it->second == cond)
261  return false;
262 
263  bbToCondMap[bb] = cond;
264  return true;
265  }
BBToCondMap bbToCondMap
map a basic block to its path condition starting from root

◆ setCurEvalVal()

void SVF::PathCondAllocator::setCurEvalVal ( const Value val)
inline

Set current value for branch condition evaluation.

Definition at line 191 of file PathCondAllocator.h.

192  {
193  curEvalVal = val;
194  }
const Value * curEvalVal
current llvm value to evaluate branch condition when computing guards

◆ trueCond()

static Condition* SVF::PathCondAllocator::trueCond ( )
inlinestatic

Definition at line 71 of file PathCondAllocator.h.

72  {
73  return getBddCondManager()->getTrueCond();
74  }
DdNode * getTrueCond() const
Definition: Conditions.h:68
static BddCondManager * getBddCondManager()
Used internally, not supposed to be exposed to other classes.

Member Data Documentation

◆ bbConds

BBCondMap SVF::PathCondAllocator::bbConds
protected

map basic block to its successors/predecessors branch conditions

Definition at line 313 of file PathCondAllocator.h.

◆ bbToCondMap

BBToCondMap SVF::PathCondAllocator::bbToCondMap
private

map a basic block to its path condition starting from root

Definition at line 308 of file PathCondAllocator.h.

◆ bddCondMgr

BddCondManager * PathCondAllocator::bddCondMgr = nullptr
staticprotected

bbd manager

Definition at line 312 of file PathCondAllocator.h.

◆ cfInfoBuilder

PTACFInfoBuilder SVF::PathCondAllocator::cfInfoBuilder
private

map a function to its loop info

Definition at line 306 of file PathCondAllocator.h.

◆ condToInstMap

CondToTermInstMap SVF::PathCondAllocator::condToInstMap
private

map a condition to its corresponding llvm instruction

Definition at line 305 of file PathCondAllocator.h.

◆ curEvalVal

const Value* SVF::PathCondAllocator::curEvalVal
private

current llvm value to evaluate branch condition when computing guards

Definition at line 309 of file PathCondAllocator.h.

◆ funToExitBBsMap

FunToExitBBsMap SVF::PathCondAllocator::funToExitBBsMap
private

map a function to all its basic blocks calling program exit

Definition at line 307 of file PathCondAllocator.h.

◆ indexToDDNodeMap

IndexToConditionMap SVF::PathCondAllocator::indexToDDNodeMap
protected

Definition at line 314 of file PathCondAllocator.h.

◆ totalCondNum

u32_t PathCondAllocator::totalCondNum = 0
static

Definition at line 48 of file PathCondAllocator.h.


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