37using namespace SVFUtil;
53 for (Module::const_iterator
F =
M.begin(),
E =
M.end();
F !=
E; ++
F)
56 if (fun->isDeclaration())
66 for (Module::const_iterator
F =
M.begin(),
E =
M.end();
F !=
E; ++
F)
69 if (fun->isDeclaration())
87 for (
const auto& bb: *fun)
89 for (
const auto& inst: bb)
131 for (
const auto& bb : *fun)
138 worklist.
push(&bb.front());
149 while (!worklist.
empty())
153 if (SVFUtil::isa<ReturnInst>(inst))
184 if (
const BranchInst*
br = SVFUtil::dyn_cast<BranchInst>(inst))
187 if(
br->isConditional())
192 else if (
const SwitchInst*
si = SVFUtil::dyn_cast<SwitchInst>(inst))
218 for (
const auto& bb : *
f)
220 for (
const auto& inst : bb)
222 if (SVFUtil::isa<ReturnInst>(&inst))
242 const CallBase*
cb = SVFUtil::dyn_cast<CallBase>(inst);
252 calledFunc = SVFUtil::dyn_cast<SVFFunction>(
345 assert (node==
nullptr &&
"no IntraICFGNode for this instruction?");
347 llvmModuleSet()->getSVFBasicBlock(inst->getParent()), SVFUtil::isa<ReturnInst>(inst));
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
bool push(const Data &data)
ICFGNode * getICFGNode(const Instruction *inst)
FunEntryICFGNode * addFunEntryBlock(const Function *fun)
void connectGlobalToProgEntry()
FunEntryICFGNode * getFunEntryICFGNode(const Function *fun)
get a function entry node
FunExitICFGNode * getFunExitICFGNode(const Function *fun)
get a function exit node
IntraICFGNode * addIntraBlockICFGNode(const Instruction *inst)
Add and get IntraBlock ICFGNode.
CallICFGNode * getCallICFGNode(const Instruction *cs)
get a call node
std::vector< const Instruction * > InstVec
LLVMModuleSet * llvmModuleSet()
void processUnreachableFromEntry(const Function *fun, WorkList &worklist)
InterICFGNode * addInterBlockICFGNode(const Instruction *inst)
Add/Get an inter block ICFGNode.
bool hasICFGNode(const Instruction *inst)
void processFunBody(WorkList &worklist)
GlobalICFGNode * getGlobalICFGNode() const
void checkICFGNodesVisited(const Function *fun)
void processFunEntry(const Function *fun, WorkList &worklist)
FunExitICFGNode * addFunExitBlock(const Function *fun)
ICFGNode * addBlockICFGNode(const Instruction *inst)
Add/Get a basic block ICFGNode.
RetICFGNode * getRetICFGNode(const Instruction *cs)
get a return node
void addICFGInterEdges(const Instruction *cs, const Function *callee)
Create edges between ICFG nodes across functions.
void processFunExit(const Function *fun)
bool addICFGEdge(ICFGEdge *edge)
Add ICFG edge, only used by addIntraEdge, addCallEdge, addRetEdge etc.
virtual RetICFGNode * addRetICFGNode(CallICFGNode *call)
virtual FunEntryICFGNode * addFunEntryICFGNode(const SVFFunction *svfFunc)
virtual CallICFGNode * addCallICFGNode(const SVFBasicBlock *bb, const SVFType *ty, const SVFFunction *calledFunc, bool isVararg, bool isvcall, s32_t vcallIdx, const std::string &funNameOfVcall)
virtual IntraICFGNode * addIntraICFGNode(const SVFBasicBlock *bb, bool isRet)
ICFGEdge * addCallEdge(ICFGNode *srcNode, ICFGNode *dstNode)
ICFGEdge * addRetEdge(ICFGNode *srcNode, ICFGNode *dstNode)
ICFGEdge * addConditionalIntraEdge(ICFGNode *srcNode, ICFGNode *dstNode, s64_t branchCondVal)
virtual FunExitICFGNode * addFunExitICFGNode(const SVFFunction *svfFunc)
ICFGEdge * addIntraEdge(ICFGNode *srcNode, ICFGNode *dstNode)
Add intraprocedural and interprocedural control-flow edges.
IntraICFGNode * getIntraBlock(const Instruction *inst)
void addInstructionMap(const Instruction *inst, SVFInstruction *svfInst)
SVFBasicBlock * getSVFBasicBlock(const BasicBlock *bb) const
SVFFunction * getSVFFunction(const Function *fun) const
const std::vector< std::reference_wrapper< Module > > & getLLVMModules() const
FunToFunEntryNodeMapTy FunToFunEntryNodeMap
map a function to its FunExitICFGNode
FunToFunExitNodeMapTy FunToFunExitNodeMap
map a function to its FunEntryICFGNode
SVFLoopAndDomInfo * getLoopAndDomInfo()
const SVFFunctionType * getFunctionType() const
Returns the FunctionType.
bool isIntrinsicInst(const Instruction *inst)
Return true if it is an intrinsic instruction.
bool isCallSite(const Instruction *inst)
Whether an instruction is a call or invoke instruction.
void getNextInsts(const Instruction *curInst, std::vector< const Instruction * > &instList)
Get the next instructions following control flow.
const Function * getProgEntryFunction(Module &module)
Get program entry function from module.
const Function * getCallee(const CallBase *cs)
bool isNonInstricCallSite(const Instruction *inst)
Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls.
bool isExtCall(const SVFFunction *fun)
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
std::ostream & outs()
Overwrite llvm::outs()
std::string getFunNameOfVCallSite(const CallBase *cs)
s32_t getVCallIdx(const CallBase *cs)
bool isVirtualCallSite(const CallBase *cs)
llvm::BasicBlock BasicBlock
llvm::SwitchInst SwitchInst
llvm::Instruction Instruction
llvm::IRBuilder IRBuilder
llvm::BranchInst BranchInst
llvm::ConstantInt ConstantInt