35 static const char *
const DepTypeStr[];
38 typedef std::pair<InstTypePair, const BasicBlock *> Dep;
66 return InstTypePair(dep.
getInst(), Clobber);
68 return InstTypePair(dep.
getInst(), Def);
70 return InstTypePair(dep.
getInst(), NonFuncLocal);
72 return InstTypePair(dep.
getInst(), Unknown);
77char MemDepPrinter::ID = 0;
79 "Print MemDeps of function",
false,
true)
85 return new MemDepPrinter();
88const char *
const MemDepPrinter::DepTypeStr[]
89 = {
"Clobber",
"Def",
"NonFuncLocal",
"Unknown"};
91bool MemDepPrinter::runOnFunction(
Function &
F) {
105 Deps[Inst].insert(std::make_pair(getInstTypePair(Res),
107 }
else if (
auto *Call = dyn_cast<CallBase>(Inst)) {
111 DepSet &InstDeps = Deps[Inst];
114 InstDeps.insert(std::make_pair(getInstTypePair(Res),
I.getBB()));
118 assert( (isa<LoadInst>(Inst) || isa<StoreInst>(Inst) ||
119 isa<VAArgInst>(Inst)) &&
"Unknown memory instruction!");
122 DepSet &InstDeps = Deps[Inst];
125 InstDeps.insert(std::make_pair(getInstTypePair(Res),
I.getBB()));
137 DepSetMap::const_iterator DI = Deps.find(Inst);
138 if (DI == Deps.end())
141 const DepSet &InstDeps = DI->second;
143 for (
const auto &
I : InstDeps) {
145 DepType type =
I.first.getInt();
149 OS << DepTypeStr[type];
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
print Print MemDeps of function
print must be executed print the must be executed context for all instructions
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
AnalysisUsage & addRequiredTransitive()
LLVM Basic Block Representation.
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
bool mayWriteToMemory() const LLVM_READONLY
Return true if this instruction may modify memory.
bool mayReadFromMemory() const LLVM_READONLY
Return true if this instruction may read memory.
A memory dependence query can return one of three different answers.
bool isClobber() const
Tests if this MemDepResult represents a query that is an instruction clobber dependency.
bool isNonLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the block,...
bool isNonFuncLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the function.
bool isDef() const
Tests if this MemDepResult represents a query that is an instruction definition dependency.
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.
Provides a lazy, caching interface for making common memory aliasing information queries,...
std::vector< NonLocalDepEntry > NonLocalDepInfo
MemDepResult getDependency(Instruction *QueryInst)
Returns the instruction on which a memory operation depends.
const NonLocalDepInfo & getNonLocalCallDependency(CallBase *QueryCall)
Perform a full dependency query for the specified call, returning the set of blocks that the value is...
void getNonLocalPointerDependency(Instruction *QueryInst, SmallVectorImpl< NonLocalDepResult > &Result)
Perform a full dependency query for an access to the QueryInst's specified memory location,...
A wrapper analysis pass for the legacy pass manager that exposes a MemoryDepnedenceResults instance.
A Module instance is used to store all the information related to an LLVM module.
This is an entry in the NonLocalDepInfo cache.
This is a result from a NonLocal dependence query.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual void releaseMemory()
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
PointerIntPair - This class implements a pair of a pointer and small integer.
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 print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
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.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
void initializeMemDepPrinterPass(PassRegistry &)
FunctionPass * createMemDepPrinter()