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;
411 assert(
hasBasicBlock() &&
"function does not have any Basicblock, external function?");
428 assert(
hasBasicBlock() &&
"function does not have any Basicblock, external function?");
672 std::vector<const SVFValue*>
args;
713 assert(i <
arg_size() &&
"out of bound access of the argument");
730 return SVFUtil::dyn_cast<SVFFunction>(
calledVal);
772 assert(
vCallVtblPtr &&
"virtual call does not have a vtblptr? set it first");
777 assert(
virtualFunIdx >=0 &&
"virtual function idx is less than 0? not set yet?");
1084 template <
typename F,
typename S>
1087 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)
std::vector< const ICFGNode * >::const_iterator const_iterator
void addPredBasicBlock(const SVFBasicBlock *pred)
const std::vector< const ICFGNode * > & getICFGNodeList() const
u32_t getBBPredecessorPos(const SVFBasicBlock *succbb)
const std::vector< const SVFBasicBlock * > & getSuccessors() const
void addICFGNode(const ICFGNode *icfgNode)
Function where this BasicBlock is.
std::vector< const SVFBasicBlock * > succBBs
all successor BasicBlocks of this BasicBlock
std::vector< const ICFGNode * > allICFGNodes
all ICFGNodes in this BasicBlock
const ICFGNode * front() const
const_iterator end() const
u32_t getBBSuccessorPos(const SVFBasicBlock *succbb)
~SVFBasicBlock() override
void addSuccBasicBlock(const SVFBasicBlock *succ)
const std::vector< const SVFBasicBlock * > & getPredecessors() const
const_iterator begin() const
const ICFGNode * back() const
const SVFFunction * getFunction() const
u32_t getNumSuccessors() const
std::vector< const SVFBasicBlock * > predBBs
all predecessor BasicBlocks of this BasicBlock
const SVFFunction * getParent() const
SVFBlackHoleValue()=delete
static bool classof(const SVFValue *node)
static bool classof(const SVFConstantData *node)
SVFBlackHoleValue(const SVFType *ty)
const SVFValue * calledVal
const SVFValue * getArgOperand(u32_t i) const
static bool classof(const SVFValue *node)
const SVFValue * getCalledOperand() const
SVFCallInst(const SVFType *ty, const SVFBasicBlock *b, bool va, bool tm, SVFValKind k=SVFCall)
void setCalledOperand(const SVFValue *v)
const SVFFunction * getCaller() const
static bool classof(const SVFInstruction *node)
const SVFFunction * getCalledFunction() const
u32_t getNumArgOperands() const
void addArgument(const SVFValue *a)
attributes to be set only through Module builders e.g., LLVMModule
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)
a 'single' basic block having no successors and containing return instruction in a function
const SVFArgument * getArg(u32_t idx) const
bool varArg
return true if this function never returns
bool loopContainsBB(const BBList &lp, const SVFBasicBlock *bb) const
bool isUncalled
return true if this function is address-taken (for indirect call purposes)
const_iterator end() const
SVFBasicBlock * exitBlock
all formal arguments of this function
void setIsUncalledFunction(bool uncalledFunction)
const SVFBasicBlock * front() const
bool addrTaken
return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the ...
const_iterator begin() const
SVFLoopAndDomInfo * getLoopAndDomInfo()
const SVFBasicBlock * back() const
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
std::vector< const SVFArgument * > allArgs
all BasicBlocks of this function
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
bool hasAddressTaken() const
const SVFFunctionType * getFunctionType() const
Returns the FunctionType.
const SVFBasicBlock * getLoopHeader(const BBList &lp) const
const SVFFunction * realDefFun
the loop and dominate information
const SVFBasicBlock * getEntryBlock() const
const SVFFunction * getDefFunForMultipleModule() const
bool isUncalledFunction() const
SVFLoopAndDomInfo::LoopBBs LoopBBs
const std::vector< const SVFBasicBlock * > & getBasicBlockList() const
const std::vector< const SVFBasicBlock * > & getReachableBBs() const
bool hasBasicBlock() const
std::vector< const SVFBasicBlock * > allBBs
the definition of a function across multiple modules
void setIsNotRet(bool notRet)
std::vector< const SVFBasicBlock * >::const_iterator const_iterator
bool isDeclaration() const
void setExitBlock(SVFBasicBlock *bb)
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
void addArgument(SVFArgument *arg)
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 SVFType * getReturnType() const
Returns the FunctionType.
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
bool isLoopHeader(const SVFBasicBlock *bb) const
SVFGlobalValue(const SVFType *ty)
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
const SVFValue * getDefGlobalForMultipleModule() const
SVFGlobalValue(std::string &&name, const SVFType *ty)
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 SVFFunction * getFunction() const
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
Map< const SVFBasicBlock *, const SVFBasicBlock * > & getBB2PIdom()
Map< const SVFBasicBlock *, u32_t > & getBBPDomLevel()
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
Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap()
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
Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap()
Map< const SVFBasicBlock *, u32_t > bb2PdomLevel
map a BasicBlock to its level in pdom tree, used in findNearestCommonPDominator
const BBList & getReachableBBs() const
bool isUnreachable(const SVFBasicBlock *bb) 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
const Map< const SVFBasicBlock *, u32_t > & getBBPDomLevel() const
const SVFBasicBlock * getLoopHeader(const LoopBBs &lp) const
void setReachableBBs(BBList &bbs)
const Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap() const
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
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
const Map< const SVFBasicBlock *, const SVFBasicBlock * > & getBB2PIdom() const
void addToBB2LoopMap(const SVFBasicBlock *bb, const SVFBasicBlock *loopBB)
BBList reachableBBs
reachable BasicBlocks from the function entry.
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
SVFOtherValue(const SVFType *ty, SVFValKind k=SVFValue::SVFOther)
static bool classof(const SVFValue *node)
virtual const SVFType * getType() const
void setName(std::string &&n)
const std::string & getName() const
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)
virtual const std::string getSourceLoc() const
void setName(const std::string &n)
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
friend OutStream & operator<<(OutStream &os, const SVFValue &value)
Overloading operator << for dumping ICFG node ID.
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()
const std::string & getFunNameOfVirtualCall() const
const SVFValue * getVtablePtr() const
static bool classof(const SVFCallInst *node)
static bool classof(const SVFValue *node)
std::string funNameOfVcall
virtual function index of the virtual table(s) at a virtual call
SVFVirtualCallInst(const SVFType *ty, const SVFBasicBlock *b, bool vararg, bool tm)
const SVFValue * vCallVtblPtr
void setFunIdxInVtable(s32_t idx)
the function name of this virtual call
void setVtablePtr(const SVFValue *vptr)
static bool classof(const SVFInstruction *node)
s32_t getFunIdxInVtable() const
void setFunNameOfVirtualCall(const std::string &name)
s32_t virtualFunIdx
virtual table pointer
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
SVF::GraphPrinter GraphPrinter
LLVM Aliases and constants.
std::string dumpLLVMValue(const SVFValue *svfValue)
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
IntervalValue operator<<(const IntervalValue &lhs, const IntervalValue &rhs)
Left binary shift of IntervalValues.