#include <MTAAnnotator.h>
MTA annotation
Definition at line 23 of file MTAAnnotator.h.
◆ InstSet
◆ MTAAnnotator()
SVF::MTAAnnotator::MTAAnnotator |
( |
| ) |
|
|
inline |
◆ ~MTAAnnotator()
virtual SVF::MTAAnnotator::~MTAAnnotator |
( |
| ) |
|
|
inlinevirtual |
◆ annotateDRCheck()
void MTAAnnotator::annotateDRCheck |
( |
Instruction * |
inst | ) |
|
Annotation.
memcpy and memset is not annotated
Definition at line 18 of file MTAAnnotator.cpp.
21 std::stringstream rawstr(str);
25 if (
StoreInst* st = SVFUtil::dyn_cast<StoreInst>(inst))
28 addMDTag(inst, st->getPointerOperand(), rawstr.str());
30 else if (
LoadInst* ld = SVFUtil::dyn_cast<LoadInst>(inst))
33 addMDTag(inst, ld->getPointerOperand(), rawstr.str());
void addMDTag(Instruction *inst, std::string str)
Simple add/remove meta data information.
llvm::StoreInst StoreInst
◆ collectLoadStoreInst()
void MTAAnnotator::collectLoadStoreInst |
( |
SVFModule * |
mod | ) |
|
Collect all load and store instruction.
Definition at line 37 of file MTAAnnotator.cpp.
42 for (Module::const_iterator
F = M.begin(), E = M.end();
F != E; ++
F)
49 if (SVFUtil::isa<LoadInst>(inst))
53 else if (SVFUtil::isa<StoreInst>(inst))
static LLVMModuleSet * getLLVMModuleSet()
bool isMemset(const Instruction *I)
Check if Function "F" is memset.
bool isMemcpy(const Instruction *I)
Check if Function "F" is memcpy.
bool isExtCall(const SVFFunction *fun)
llvm::const_inst_iterator const_inst_iterator
llvm::Instruction Instruction
◆ getLoadOperand()
Definition at line 92 of file MTAAnnotator.cpp.
94 if (
const LoadInst* ld = SVFUtil::dyn_cast<LoadInst>(inst))
96 return ld->getPointerOperand();
100 return inst->getOperand(1);
◆ getStoreOperand()
Get operand of store and load.
Definition at line 74 of file MTAAnnotator.cpp.
76 if (
const StoreInst* st = SVFUtil::dyn_cast<StoreInst>(inst))
78 return st->getPointerOperand();
82 return inst->getOperand(0);
86 return inst->getOperand(0);
◆ initialize()
Initialize.
Definition at line 107 of file MTAAnnotator.cpp.
TCT * getTCT() const
Get Thread Creation Tree.
void collectLoadStoreInst(SVFModule *mod)
Collect all load and store instruction.
static const Option< u32_t > AnnoFlag
SVFModule * getModule() const
Module.
PointerAnalysis * getPTA() const
Get PTA.
◆ isMemcpy()
bool SVF::MTAAnnotator::isMemcpy |
( |
const Instruction * |
I | ) |
|
|
inline |
Check if Function "F" is memcpy.
Definition at line 81 of file MTAAnnotator.h.
85 return F &&
F->getName().find(
"llvm.memcpy") != std::string::npos;
SVFInstruction * getSVFInstruction(const Instruction *inst) const
const SVFFunction * getCallee(const CallSite cs)
Return callee of a callsite. Return null if this is an indirect call.
◆ isMemset()
bool SVF::MTAAnnotator::isMemset |
( |
const Instruction * |
I | ) |
|
|
inline |
Check if Function "F" is memset.
Definition at line 73 of file MTAAnnotator.h.
77 return F &&
F->getName().find(
"llvm.memset") != std::string::npos;
◆ performAnnotate()
void MTAAnnotator::performAnnotate |
( |
| ) |
|
Perform annotation.
Definition at line 281 of file MTAAnnotator.cpp.
285 for (InstSet::iterator it =
storeset.begin(), eit =
storeset.end(); it != eit; ++it)
289 for (InstSet::iterator it =
loadset.begin(), eit =
loadset.end(); it != eit; ++it)
void annotateDRCheck(Instruction *inst)
Annotation.
◆ pruneAliasMHP()
Prune candidate instructions that non-mhp and non-alias with others.
if it1 == it2, mhp analysis will annotate it1 that locates in loop or recursion. but alias analysis fails to determine whether it1 is in loop or recursion, that means all store instructions will be annotated by alias analysis to guarantee sound.
Definition at line 202 of file MTAAnnotator.cpp.
208 if (!AnnoMHP && !AnnoAlias)
214 for (InstSet::iterator it1 =
storeset.begin(), eit1 =
storeset.end(); it1 != eit1; ++it1)
217 for (InstSet::iterator it2 = it1, eit2 =
storeset.end(); it2 != eit2; ++it2)
223 if(!pta->
alias(v1, v2))
230 needannost.insert(*it1);
231 needannost.insert(*it2);
239 needannost.insert(*it1);
240 needannost.insert(*it2);
243 for (InstSet::iterator it2 =
loadset.begin(), eit2 =
loadset.end(); it2 != eit2; ++it2)
249 if(!pta->
alias(v1,v2))
256 needannost.insert(*it1);
257 needannold.insert(*it2);
262 needannost.insert(*it1);
263 needannold.insert(*it2);
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
SVFValue * getSVFValue(const Value *value)
bool isProtectedByCommonLock(const SVFInstruction *i1, const SVFInstruction *i2)
virtual bool mayHappenInParallel(const SVFInstruction *i1, const SVFInstruction *i2)
Interface to query whether two instructions may happen-in-parallel.
static const u32_t ANNO_ALIAS
const Value * getLoadOperand(const Instruction *inst)
const Value * getStoreOperand(const Instruction *inst)
Get operand of store and load.
static const u32_t ANNO_MHP
Constant INTERLEV_FLAG values.
Set< const Instruction * > InstSet
virtual AliasResult alias(const SVFValue *V1, const SVFValue *V2)=0
Interface exposed to users of our pointer analysis, given Value infos.
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()
◆ pruneThreadLocal()
Prune candidate instructions that are thread local.
find fork arguments' objects
find global pointer-to objects
find all non-local objects that are transitively pointed by global and fork arguments.
compute all store and load instructions that may operate a non-local object.
Definition at line 116 of file MTAAnnotator.cpp.
129 for (SVFStmt::SVFStmtSetTy::const_iterator it = forkedges.begin(), eit = forkedges.end(); it != eit; ++it)
138 for (SVFIR::SVFStmtSet::const_iterator it = globaledges.begin(), eit = globaledges.end(); it != eit; ++it)
148 while (!worklist.
empty())
151 nonlocalobjs.
set(obj);
156 if (!nonlocalobjs.
test(*pit))
162 if (!nonlocalobjs.
test(*pit))
170 for (InstSet::iterator it =
storeset.begin(), eit =
storeset.end(); it != eit; ++it)
175 if (nonlocalobjs.
test(*pit))
177 needannost.insert(*it);
183 for (InstSet::iterator it =
loadset.begin(), eit =
loadset.end(); it != eit; ++it)
188 if (nonlocalobjs.
test(*pit))
190 needannold.insert(*it);
GEdgeKind getEdgeKind() const
NodeID getSrcID() const
get methods of the components
Set< const SVFStmt * > SVFStmtSet
NodeID getValueNode(const SVFValue *V)
static const u32_t ANNO_LOCAL
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
bool empty() const
Returns true if set is empty.
void reset(u32_t n)
Removes n from the set.
const_iterator end() const
void set(u32_t n)
Inserts n in the set.
const_iterator begin() const
bool test(u32_t n) const
Returns true if n is in this set.
SVFStmtSet & getGlobalSVFStmtSet()
Get global PAGEdges (not in a procedure)
SVFStmt::SVFStmtSetTy & getPTASVFStmtSet(SVFStmt::PEDGEK kind)
Get PTA edges set according to its kind.
NodeBS & getAllFieldsObjVars(const MemObj *obj)
Get all fields of an object.
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
◆ ANNO_ALIAS
const u32_t SVF::MTAAnnotator::ANNO_ALIAS = 0x02 |
|
static |
◆ ANNO_LOCAL
const u32_t SVF::MTAAnnotator::ANNO_LOCAL = 0x01 |
|
static |
◆ ANNO_MHP
const u32_t SVF::MTAAnnotator::ANNO_MHP = 0x04 |
|
static |
◆ loadset
◆ lsa
◆ mhp
MHP* SVF::MTAAnnotator::mhp |
|
private |
◆ numOfAliasLd
u32_t SVF::MTAAnnotator::numOfAliasLd |
◆ numOfAliasSt
u32_t SVF::MTAAnnotator::numOfAliasSt |
◆ numOfAllLd
u32_t SVF::MTAAnnotator::numOfAllLd |
◆ numOfAllSt
u32_t SVF::MTAAnnotator::numOfAllSt |
◆ numOfAnnotatedLd
u32_t SVF::MTAAnnotator::numOfAnnotatedLd |
◆ numOfAnnotatedSt
u32_t SVF::MTAAnnotator::numOfAnnotatedSt |
◆ numOfMHPLd
u32_t SVF::MTAAnnotator::numOfMHPLd |
◆ numOfMHPSt
u32_t SVF::MTAAnnotator::numOfMHPSt |
◆ numOfNonLocalLd
u32_t SVF::MTAAnnotator::numOfNonLocalLd |
◆ numOfNonLocalSt
u32_t SVF::MTAAnnotator::numOfNonLocalSt |
◆ storeset
InstSet SVF::MTAAnnotator::storeset |
|
private |
The documentation for this class was generated from the following files: