Go to the documentation of this file.
35 static const char *
const DepTypeStr[];
38 typedef std::pair<InstTypePair, const BasicBlock *> Dep;
58 void releaseMemory()
override {
66 return InstTypePair(dep.
getInst(), Clobber);
70 return InstTypePair(dep.
getInst(), NonFuncLocal);
72 return InstTypePair(dep.
getInst(), Unknown);
79 "Print MemDeps of function",
false,
true)
85 return new MemDepPrinter();
88 const char *
const MemDepPrinter::DepTypeStr[]
89 = {
"Clobber",
"Def",
"NonFuncLocal",
"Unknown"};
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];
This is an optimization pass for GlobalISel generic memory operations.
This is an entry in the NonLocalDepInfo cache.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A memory dependence query can return one of three different answers.
INITIALIZE_PASS_BEGIN(MemDepPrinter, "print-memdeps", "Print MemDeps of function", false, true) INITIALIZE_PASS_END(MemDepPrinter
LLVM Basic Block Representation.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Represent the analysis usage information of a pass.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is a result from a NonLocal dependence query.
bool mayWriteToMemory() const
Return true if this instruction may modify memory.
bool isNonFuncLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the function.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Instruction * getInst() const
If this is a normal dependency, returns the instruction that is depended on.
inst_range instructions(Function *F)
AMD64 Optimization Manual has some nice information about optimizing integer multiplication by a constant How much of it applies to Intel s X86 implementation There are definite trade offs to xmm0 cvttss2siq rdx jb L3 subss xmm0 rax cvttss2siq rdx xorq rdx rax ret instead of xmm1 cvttss2siq rcx movaps xmm2 subss xmm2 cvttss2siq rax rdx xorq rax ucomiss xmm0 cmovb rax ret Seems like the jb branch has high likelihood of being taken It would have saved a few instructions It s not possible to reference and DH registers in an instruction requiring REX prefix divb and mulb both produce results in AH If isel emits a CopyFromReg which gets turned into a movb and that can be allocated a r8b r15b To get around isel emits a CopyFromReg from AX and then right shift it down by and truncate it It s not pretty but it works We need some register allocation magic to make the hack go which would often require a callee saved register Callees usually need to keep this value live for most of their body so it doesn t add a significant burden on them We currently implement this in however this is suboptimal because it means that it would be quite awkward to implement the optimization for callers A better implementation would be to relax the LLVM IR rules for sret arguments to allow a function with an sret argument to have a non void return type
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
bool isClobber() const
Tests if this MemDepResult represents a query that is an instruction clobber dependency.
const NonLocalDepInfo & getNonLocalCallDependency(CallBase *QueryCall)
Perform a full dependency query for the specified call, returning the set of blocks that the value is...
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
A Module instance is used to store all the information related to an LLVM module.
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.
MemDepResult getDependency(Instruction *QueryInst)
Returns the instruction on which a memory operation depends.
bool mayReadFromMemory() const
Return true if this instruction may read memory.
void initializeMemDepPrinterPass(PassRegistry &)
static bool runOnFunction(Function &F, bool PostInlining)
Provides a lazy, caching interface for making common memory aliasing information queries,...
void setPreservesAll()
Set by analyses that do not transform their input at all.
A wrapper analysis pass for the legacy pass manager that exposes a MemoryDepnedenceResults instance.
void getNonLocalPointerDependency(Instruction *QueryInst, SmallVectorImpl< NonLocalDepResult > &Result)
Perform a full dependency query for an access to the QueryInst's specified memory location,...
PointerIntPair - This class implements a pair of a pointer and small integer.
std::vector< NonLocalDepEntry > NonLocalDepInfo
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
FunctionPass * createMemDepPrinter()
AnalysisUsage & addRequiredTransitive()
A SetVector that performs no allocations if smaller than a certain size.
FunctionPass class - This class is used to implement most global optimizations.
bool isUnknown() const
Tests if this MemDepResult represents a query which cannot and/or will not be computed.
bool isNonLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the block,...
Add support for conditional and other related patterns Instead of
bool isDef() const
Tests if this MemDepResult represents a query that is an instruction definition dependency.