33 static const char *
const DepTypeStr[];
36 typedef std::pair<InstTypePair, const BasicBlock *> Dep;
56 void releaseMemory()
override {
64 return InstTypePair(dep.
getInst(), Clobber);
68 return InstTypePair(dep.
getInst(), NonFuncLocal);
72 static InstTypePair getInstTypePair(
const Instruction* inst, DepType
type) {
73 return InstTypePair(inst, type);
80 "Print MemDeps of function",
false,
true)
86 return new MemDepPrinter();
89 const char *
const MemDepPrinter::DepTypeStr[]
90 = {
"Clobber",
"Def",
"NonFuncLocal",
"Unknown"};
106 Deps[Inst].insert(std::make_pair(getInstTypePair(Res),
107 static_cast<BasicBlock *>(
nullptr)));
108 }
else if (
auto *Call = dyn_cast<CallBase>(Inst)) {
112 DepSet &InstDeps = Deps[Inst];
115 InstDeps.insert(std::make_pair(getInstTypePair(Res),
I.getBB()));
119 assert( (isa<LoadInst>(Inst) || isa<StoreInst>(Inst) ||
120 isa<VAArgInst>(Inst)) &&
"Unknown memory instruction!");
123 DepSet &InstDeps = Deps[Inst];
126 InstDeps.insert(std::make_pair(getInstTypePair(Res),
I.getBB()));
138 DepSetMap::const_iterator DI = Deps.find(Inst);
139 if (DI == Deps.end())
142 const DepSet &InstDeps = DI->second;
144 for (
const auto &
I : InstDeps) {
146 DepType
type =
I.first.getInt();
150 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...
This class represents lattice values for constants.
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)
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())
const NonLocalDepInfo & getNonLocalCallDependency(CallBase *QueryCall)
Perform a full dependency query for the specified call, returning the set of blocks that the value is...
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.