Move defClobbersUseOrDef to being a protected member of a class since we don't want anyone else using it

llvm-svn: 296838
This commit is contained in:
Daniel Berlin 2017-03-02 23:06:46 +00:00
parent feaf9ff5ee
commit dcb004fdf1
3 changed files with 16 additions and 8 deletions

View File

@ -711,6 +711,18 @@ private:
unsigned NextID;
};
// Internal MemorySSA utils, for use by MemorySSA classes and walkers
class MemorySSAUtil
{
protected:
friend class MemorySSAWalker;
friend class GVNHoist;
// This function should not be used by new passes.
static bool defClobbersUseOrDef(MemoryDef *MD, const MemoryUseOrDef *MU,
AliasAnalysis &AA);
};
// This pass does eager building and then printing of MemorySSA. It is used by
// the tests to be able to build, dump, and verify Memory SSA.
class MemorySSAPrinterLegacyPass : public FunctionPass {
@ -1045,10 +1057,6 @@ inline upward_defs_iterator upward_defs_begin(const MemoryAccessPair &Pair) {
inline upward_defs_iterator upward_defs_end() { return upward_defs_iterator(); }
// Return true when MD may alias MU, return false otherwise.
bool defClobbersUseOrDef(MemoryDef *MD, const MemoryUseOrDef *MU,
AliasAnalysis &AA);
} // end namespace llvm
#endif // LLVM_TRANSFORMS_UTILS_MEMORYSSA_H

View File

@ -61,7 +61,7 @@ static cl::opt<int>
cl::desc("Maximum length of dependent chains to hoist "
"(default = 10, unlimited = -1)"));
namespace {
namespace llvm {
// Provides a sorting function based on the execution order of two instructions.
struct SortByDFSIn {
@ -363,7 +363,7 @@ private:
ReachedNewPt = true;
}
}
if (defClobbersUseOrDef(Def, MU, *AA))
if (MemorySSAUtil::defClobbersUseOrDef(Def, MU, *AA))
return true;
}

View File

@ -269,8 +269,8 @@ static bool instructionClobbersQuery(MemoryDef *MD, const MemoryUseOrDef *MU,
}
// Return true when MD may alias MU, return false otherwise.
bool defClobbersUseOrDef(MemoryDef *MD, const MemoryUseOrDef *MU,
AliasAnalysis &AA) {
bool MemorySSAUtil::defClobbersUseOrDef(MemoryDef *MD, const MemoryUseOrDef *MU,
AliasAnalysis &AA) {
return instructionClobbersQuery(MD, MU, MemoryLocOrCall(MU), AA);
}
}