30#ifndef INCLUDE_SVFIR_SVFVALUE_H_
31#define INCLUDE_SVFIR_SVFVALUE_H_
56 typedef std::vector<const SVFBasicBlock*>
BBList;
94 assert(!
lp.empty() &&
"this is not a loop, empty basic block");
100 return std::find(
lp.begin(),
lp.end(), bb) !=
lp.end();
320 std::vector<const SVFBasicBlock*>
allBBs;
683 std::vector<const SVFValue*>
args;
741 return SVFUtil::dyn_cast<SVFFunction>(
calledVal);
1035template <
typename F,
typename S>
1038 o <<
"<" <<
var.first <<
", " <<
var.second <<
">";
bool isArgOfUncalledFunction() const
static bool classof(const SVFValue *node)
const SVFFunction * getParent() const
SVFArgument(const SVFType *ty, const SVFFunction *fun, u32_t argNo, bool uncalled)
static bool classof(const SVFValue *node)
const SVFFunction * getParent() const
const SVFFunction * getFunction() const
const std::vector< const ICFGNode * > & getICFGNodeList() const
void addPredBasicBlock(const SVFBasicBlock *pred)
const std::vector< const SVFBasicBlock * > & getSuccessors() const
const std::vector< const SVFBasicBlock * > & getPredecessors() const
u32_t getBBPredecessorPos(const SVFBasicBlock *succbb)
void addICFGNode(const ICFGNode *icfgNode)
Function where this BasicBlock is.
const ICFGNode * front() const
std::vector< const SVFBasicBlock * > succBBs
all successor BasicBlocks of this BasicBlock
std::vector< constICFGNode * >::const_iterator const_iterator
std::vector< const ICFGNode * > allICFGNodes
all ICFGNodes in this BasicBlock
const_iterator end() const
u32_t getBBSuccessorPos(const SVFBasicBlock *succbb)
~SVFBasicBlock() override
void addSuccBasicBlock(const SVFBasicBlock *succ)
const_iterator begin() const
u32_t getNumSuccessors() const
std::vector< const SVFBasicBlock * > predBBs
all predecessor BasicBlocks of this BasicBlock
const ICFGNode * back() const
SVFBlackHoleValue()=delete
static bool classof(const SVFValue *node)
static bool classof(const SVFConstantData *node)
SVFBlackHoleValue(const SVFType *ty)
const SVFValue * calledVal
static bool classof(const SVFValue *node)
SVFCallInst(const SVFType *ty, const SVFBasicBlock *b, bool va, bool tm, SVFValKind k=SVFCall)
void setCalledOperand(const SVFValue *v)
const SVFValue * getCalledOperand() const
static bool classof(const SVFInstruction *node)
const SVFFunction * getCaller() const
u32_t getNumArgOperands() const
void addArgument(const SVFValue *a)
attributes to be set only through Module builders e.g., LLVMModule
const SVFValue * getArgOperand(u32_t i) const
const SVFFunction * getCalledFunction() const
std::vector< const SVFValue * > args
SVFConstantData(const SVFType *ty, SVFValKind k=SVFConstData)
static bool classof(const SVFValue *node)
static bool classof(const SVFConstantData *node)
static bool classof(const SVFConstantData *node)
static bool classof(const SVFValue *node)
SVFConstantFP(const SVFType *ty, double d)
double getFPValue() const
SVFConstantInt(const SVFType *ty, u64_t z, s64_t s)
static bool classof(const SVFValue *node)
s64_t getSExtValue() const
u64_t getZExtValue() const
static bool classof(const SVFConstantData *node)
SVFConstantNullPtr(const SVFType *ty)
static bool classof(const SVFConstantData *node)
static bool classof(const SVFValue *node)
SVFConstantNullPtr()=delete
SVFConstant(const SVFType *ty, SVFValKind k=SVFConst)
static bool classof(const SVFValue *node)
const SVFType * getReturnType() const
bool intrinsic
return true if this function does not have a body
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
static bool classof(const SVFValue *node)
void addBasicBlock(const SVFBasicBlock *bb)
attributes to be set only through Module builders e.g., LLVMModule
const SVFArgument * getArg(u32_t idx) const
bool varArg
return true if this function never returns
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
bool loopContainsBB(const BBList &lp, const SVFBasicBlock *bb) const
bool isUncalled
return true if this function is address-taken (for indirect call purposes)
void setCallGraphNode(CallGraphNode *cgn)
call graph node for this function
const_iterator end() const
SVFBasicBlock * exitBlock
all formal arguments of this function
void setIsUncalledFunction(bool uncalledFunction)
bool addrTaken
return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the ...
const std::vector< const SVFBasicBlock * > & getReachableBBs() const
const std::vector< const SVFBasicBlock * > & getBasicBlockList() const
const_iterator begin() const
SVFLoopAndDomInfo * getLoopAndDomInfo()
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
std::vector< const SVFArgument * > allArgs
all BasicBlocks of this function
const CallGraphNode * getCallGraphNode() const
std::vector< constSVFBasicBlock * >::const_iterator const_iterator
const SVFBasicBlock * getEntryBlock() const
bool hasAddressTaken() const
const SVFFunction * realDefFun
the loop and dominate information
bool isUncalledFunction() const
SVFLoopAndDomInfo::LoopBBs LoopBBs
bool hasBasicBlock() const
const SVFType * getReturnType() const
Returns the FunctionType.
const SVFFunctionType * getFunctionType() const
Returns the FunctionType.
std::vector< const SVFBasicBlock * > allBBs
the definition of a function across multiple modules
const CallGraphNode * callGraphNode
a 'single' basic block having no successors and containing return instruction in a function
void setIsNotRet(bool notRet)
bool isDeclaration() const
const SVFFunction * getDefFunForMultipleModule() const
void setExitBlock(SVFBasicBlock *bb)
const SVFBasicBlock * back() const
const SVFBasicBlock * getExitBB() const
bool isNotRet
return true if this function is never called
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
SVFLoopAndDomInfo::BBList BBList
const SVFFunctionType * funcType
return true if this function supports variable arguments
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
const SVFBasicBlock * front() const
void addArgument(SVFArgument *arg)
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
SVFLoopAndDomInfo::BBSet BBSet
bool hasLoopInfo(const SVFBasicBlock *bb) const
SVFLoopAndDomInfo * loopAndDom
FunctionType, which is different from the type (PointerType) of this SVFFunction.
void setDefFunForMultipleModule(const SVFFunction *deffun)
const SVFBasicBlock * getLoopHeader(const BBList &lp) const
bool isLoopHeader(const SVFBasicBlock *bb) const
SVFGlobalValue(const SVFType *ty)
const SVFValue * getDefGlobalForMultipleModule() const
const SVFValue * realDefGlobal
static bool classof(const SVFConstant *node)
static bool classof(const SVFValue *node)
void setDefGlobalForMultipleModule(const SVFValue *defg)
the definition of a function across multiple modules
SVFGlobalValue(std::string &&name, const SVFType *ty)
const SVFFunction * getFunction() const
static bool classof(const SVFValue *node)
bool ret
return true if this is a terminator instruction
SVFInstruction(void)=delete
bool terminator
The BasicBlock where this Instruction resides.
const SVFBasicBlock * getParent() const
const Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap() const
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
Map< const SVFBasicBlock *, BBSet > & getDomTreeMap()
std::vector< const SVFBasicBlock * > BBList
Map< const SVFBasicBlock *, BBSet > dtBBsMap
map a BasicBlock to BasicBlocks it Dominates
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
bool isLoopHeader(const SVFBasicBlock *bb) const
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
const SVFBasicBlock * findNearestCommonPDominator(const SVFBasicBlock *A, const SVFBasicBlock *B) const
find nearest common post dominator of two basic blocks
Map< const SVFBasicBlock *, BBSet > pdtBBsMap
map a BasicBlock to BasicBlocks it PostDominates
const Map< const SVFBasicBlock *, u32_t > & getBBPDomLevel() const
const BBList & getReachableBBs() const
Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap()
Map< const SVFBasicBlock *, u32_t > bb2PdomLevel
map a BasicBlock to its level in pdom tree, used in findNearestCommonPDominator
const Map< const SVFBasicBlock *, const SVFBasicBlock * > & getBB2PIdom() const
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap()
bool isUnreachable(const SVFBasicBlock *bb) const
const SVFBasicBlock * getLoopHeader(const LoopBBs &lp) const
virtual ~SVFLoopAndDomInfo()
Map< const SVFBasicBlock *, const SVFBasicBlock * > bb2PIdom
map a BasicBlock to its immediate dominator in pdom tree, used in findNearestCommonPDominator
bool hasLoopInfo(const SVFBasicBlock *bb) const
void setReachableBBs(BBList &bbs)
Set< const SVFBasicBlock * > BBSet
Map< const SVFBasicBlock *, LoopBBs > bb2LoopMap
map a BasicBlock (if it is in a loop) to all the BasicBlocks in this loop
bool loopContainsBB(const LoopBBs &lp, const SVFBasicBlock *bb) const
Map< const SVFBasicBlock *, BBSet > dfBBsMap
map a BasicBlock to its Dominate Frontier BasicBlocks
void addToBB2LoopMap(const SVFBasicBlock *bb, const SVFBasicBlock *loopBB)
Map< const SVFBasicBlock *, const SVFBasicBlock * > & getBB2PIdom()
BBList reachableBBs
reachable BasicBlocks from the function entry.
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Map< const SVFBasicBlock *, u32_t > & getBBPDomLevel()
SVFOtherValue(const SVFType *ty, SVFValKind k=SVFValue::SVFOther)
static bool classof(const SVFValue *node)
void setName(std::string &&n)
GNodeK getKind() const
Get the type of this SVFValue.
bool ptrInUncalledFunction() const
std::string toString() const
Needs to be implemented by a SVF front end.
SVFValue(const SVFType *ty, SVFValKind k)
Constructor without name.
virtual void setSourceLoc(const std::string &sourceCodeInfo)
const std::string & getName() const
virtual const SVFType * getType() const
virtual const std::string getSourceLoc() const
void setName(const std::string &n)
friend OutStream & operator<<(OutStream &os, const SVFValue &value)
Overloading operator << for dumping ICFG node ID.
virtual ~SVFValue()=default
bool ptrInUncalledFun
true if this pointer is in an uncalled function
std::string name
Short name of value for printing & debugging.
void setPtrInUncalledFunction()
bool isConstDataOrAggData() const
GNodeK kind
used for classof
bool constDataOrAggData
true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate
const SVFType * type
Type of this SVFValue.
void setConstDataOrAggData()
llvm::IRBuilder IRBuilder
std::string dumpLLVMValue(const SVFValue *svfValue)
IntervalValue operator<<(const IntervalValue &lhs, const IntervalValue &rhs)
Left binary shift of IntervalValues.