34 static const char *
const DepTypeStr[];
37 typedef std::pair<InstTypePair, const BasicBlock *> Dep;
57 void releaseMemory()
override {
65 return InstTypePair(dep.
getInst(), Clobber);
69 return InstTypePair(dep.
getInst(), NonFuncLocal);
73 static InstTypePair getInstTypePair(
const Instruction* inst, DepType
type) {
74 return InstTypePair(inst, type);
81 "Print MemDeps of function",
false,
true)
87 return new MemDepPrinter();
90 const char *
const MemDepPrinter::DepTypeStr[]
91 = {
"Clobber",
"Def",
"NonFuncLocal",
"Unknown"};
107 Deps[Inst].insert(std::make_pair(getInstTypePair(Res),
108 static_cast<BasicBlock *>(
nullptr)));
109 }
else if (
auto CS =
CallSite(Inst)) {
113 DepSet &InstDeps = Deps[Inst];
116 InstDeps.insert(std::make_pair(getInstTypePair(Res),
I.getBB()));
120 assert( (isa<LoadInst>(Inst) || isa<StoreInst>(Inst) ||
121 isa<VAArgInst>(Inst)) &&
"Unknown memory instruction!");
124 DepSet &InstDeps = Deps[Inst];
127 InstDeps.insert(std::make_pair(getInstTypePair(Res),
I.getBB()));
139 DepSetMap::const_iterator DI = Deps.find(Inst);
140 if (DI == Deps.end())
143 const DepSet &InstDeps = DI->second;
145 for (
const auto &
I : InstDeps) {
147 DepType
type =
I.first.getInt();
151 OS << DepTypeStr[type];
Provides a lazy, caching interface for making common memory aliasing information queries, backed by LLVM's alias analysis passes.
void initializeMemDepPrinterPass(PassRegistry &)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Compute iterated dominance frontiers using a linear time algorithm.
A Module instance is used to store all the information related to an LLVM module. ...
bool isNonLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the block...
bool mayWriteToMemory() const
Return true if this instruction may modify memory.
block Block Frequency true
#define INITIALIZE_PASS_DEPENDENCY(depName)
bool isDef() const
Tests if this MemDepResult represents a query that is an instruction definition dependency.
bool isClobber() const
Tests if this MemDepResult represents a query that is an instruction clobber dependency.
void getNonLocalPointerDependency(Instruction *QueryInst, SmallVectorImpl< NonLocalDepResult > &Result)
Perform a full dependency query for an access to the QueryInst's specified memory location...
INITIALIZE_PASS_BEGIN(MemDepPrinter, "print-memdeps", "Print MemDeps of function", false, true) INITIALIZE_PASS_END(MemDepPrinter
static bool runOnFunction(Function &F, bool PostInlining)
const NonLocalDepInfo & getNonLocalCallDependency(CallSite QueryCS)
Perform a full dependency query for the specified call, returning the set of blocks that the value is...
FunctionPass * createMemDepPrinter()
LLVM Basic Block Representation.
PointerIntPair - This class implements a pair of a pointer and small integer.
This is a result from a NonLocal dependence query.
Represent the analysis usage information of a pass.
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
FunctionPass class - This class is used to implement most global optimizations.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
A wrapper analysis pass for the legacy pass manager that exposes a MemoryDepnedenceResults instance...
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
A memory dependence query can return one of three different answers.
A SetVector that performs no allocations if smaller than a certain size.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void setPreservesAll()
Set by analyses that do not transform their input at all.
bool isNonFuncLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the function...
std::vector< NonLocalDepEntry > NonLocalDepInfo
bool isUnknown() const
Tests if this MemDepResult represents a query which cannot and/or will not be computed.
Instruction * getInst() const
If this is a normal dependency, returns the instruction that is depended on.
bool mayReadFromMemory() const
Return true if this instruction may read memory.
AnalysisUsage & addRequiredTransitive()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
print Print MemDeps of function
inst_range instructions(Function *F)
This is an entry in the NonLocalDepInfo cache.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
MemDepResult getDependency(Instruction *QueryInst)
Returns the instruction on which a memory operation depends.