1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Consistently use ModuleAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

llvm-svn: 278078
This commit is contained in:
Sean Silva 2016-08-09 00:28:38 +00:00
parent 11e71061b1
commit beb273cb73
33 changed files with 37 additions and 37 deletions

View File

@ -315,7 +315,7 @@ class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
public:
explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
/// \brief The \c ModulePass which wraps up a \c CallGraph and the logic to

View File

@ -125,7 +125,7 @@ class GlobalsAA : public AnalysisInfoMixin<GlobalsAA> {
public:
typedef GlobalsAAResult Result;
GlobalsAAResult run(Module &M, AnalysisManager<Module> &AM);
GlobalsAAResult run(Module &M, ModuleAnalysisManager &AM);
};
/// Legacy wrapper pass to provide the GlobalsAAResult object.

View File

@ -105,7 +105,7 @@ class ProfileSummaryPrinterPass
public:
explicit ProfileSummaryPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
} // end namespace llvm

View File

@ -21,7 +21,7 @@ namespace llvm {
class GCOVProfilerPass : public PassInfoMixin<GCOVProfilerPass> {
public:
GCOVProfilerPass(const GCOVOptions &Options = GCOVOptions::getDefault()) : GCOVOpts(Options) { }
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
private:
GCOVOptions GCOVOpts;

View File

@ -21,7 +21,7 @@
namespace llvm {
class CrossDSOCFIPass : public PassInfoMixin<CrossDSOCFIPass> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
}
#endif // LLVM_TRANSFORMS_IPO_CROSSDSOCFI_H

View File

@ -50,7 +50,7 @@ Pass *createPostOrderFunctionAttrsLegacyPass();
class ReversePostOrderFunctionAttrsPass
: public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
}

View File

@ -69,7 +69,7 @@ class FunctionImportPass : public PassInfoMixin<FunctionImportPass> {
public:
FunctionImportPass(const ModuleSummaryIndex *Index = nullptr)
: Index(Index) {}
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
private:
const ModuleSummaryIndex *Index;

View File

@ -24,7 +24,7 @@ namespace llvm {
/// Optimize globals that never have their address taken.
class GlobalOptPass : public PassInfoMixin<GlobalOptPass> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
}

View File

@ -24,7 +24,7 @@ namespace llvm {
/// A pass which infers function attributes from the names and signatures of
/// function declarations in a module.
struct InferFunctionAttrsPass : PassInfoMixin<InferFunctionAttrsPass> {
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
/// Create a legacy pass manager instance of a pass to infer function

View File

@ -63,7 +63,7 @@ public:
/// internalizing a function (by removing any edge from the "external node")
bool internalizeModule(Module &TheModule, CallGraph *CG = nullptr);
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
/// Helper function to internalize functions and variables in a Module.

View File

@ -205,7 +205,7 @@ struct ByteArrayBuilder {
class LowerTypeTestsPass : public PassInfoMixin<LowerTypeTestsPass> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
} // end namespace llvm

View File

@ -28,7 +28,7 @@ namespace llvm {
/// Pass to perform interprocedural constant propagation.
class IPSCCPPass : public PassInfoMixin<IPSCCPPass> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
}
#endif // LLVM_TRANSFORMS_IPO_SCCP_H

View File

@ -29,7 +29,7 @@ public:
InstrProfiling() {}
InstrProfiling(const InstrProfOptions &Options) : Options(Options) {}
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
bool run(Module &M);
private:

View File

@ -22,13 +22,13 @@ namespace llvm {
/// The instrumentation (profile-instr-gen) pass for IR based PGO.
class PGOInstrumentationGen : public PassInfoMixin<PGOInstrumentationGen> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
/// The profile annotation (profile-instr-use) pass for IR based PGO.
class PGOInstrumentationUse : public PassInfoMixin<PGOInstrumentationUse> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
PGOInstrumentationUse(std::string Filename = "");
private:
@ -39,7 +39,7 @@ private:
class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
public:
PGOIndirectCallPromotion(bool IsInLTO = false) : InLTO(IsInLTO) {}
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
private:
bool InLTO;
};

View File

@ -20,7 +20,7 @@ namespace llvm {
/// The sample profiler data loader pass.
class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
public:
PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
} // End llvm namespace

View File

@ -261,7 +261,7 @@ void CallGraphNode::replaceCallEdge(CallSite CS,
char CallGraphAnalysis::PassID;
PreservedAnalyses CallGraphPrinterPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
AM.getResult<CallGraphAnalysis>(M).print(OS);
return PreservedAnalyses::all();
}

View File

@ -939,7 +939,7 @@ GlobalsAAResult::analyzeModule(Module &M, const TargetLibraryInfo &TLI,
char GlobalsAA::PassID;
GlobalsAAResult GlobalsAA::run(Module &M, AnalysisManager<Module> &AM) {
GlobalsAAResult GlobalsAA::run(Module &M, ModuleAnalysisManager &AM) {
return GlobalsAAResult::analyzeModule(M,
AM.getResult<TargetLibraryAnalysis>(M),
AM.getResult<CallGraphAnalysis>(M));

View File

@ -148,7 +148,7 @@ ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M,
// FIXME: This only tests isHotFunction and isColdFunction and not the
// isHotCount and isColdCount calls.
PreservedAnalyses ProfileSummaryPrinterPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
ProfileSummaryInfo &PSI = AM.getResult<ProfileSummaryAnalysis>(M);
OS << "Functions in " << M.getName() << " with hot/cold annotations: \n";

View File

@ -26,7 +26,7 @@ PrintModulePass::PrintModulePass(raw_ostream &OS, const std::string &Banner,
: OS(OS), Banner(Banner),
ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
PreservedAnalyses PrintModulePass::run(Module &M, AnalysisManager<Module> &) {
PreservedAnalyses PrintModulePass::run(Module &M, ModuleAnalysisManager &) {
OS << Banner;
if (llvm::isFunctionInPrintList("*"))
M.print(OS, nullptr, ShouldPreserveUseListOrder);

View File

@ -135,7 +135,7 @@ namespace {
/// \brief No-op module pass which does nothing.
struct NoOpModulePass {
PreservedAnalyses run(Module &M, AnalysisManager<Module> &) {
PreservedAnalyses run(Module &M, ModuleAnalysisManager &) {
return PreservedAnalyses::all();
}
static StringRef name() { return "NoOpModulePass"; }
@ -148,7 +148,7 @@ class NoOpModuleAnalysis : public AnalysisInfoMixin<NoOpModuleAnalysis> {
public:
struct Result {};
Result run(Module &, AnalysisManager<Module> &) { return Result(); }
Result run(Module &, ModuleAnalysisManager &) { return Result(); }
static StringRef name() { return "NoOpModuleAnalysis"; }
};

View File

@ -155,7 +155,7 @@ bool CrossDSOCFI::runOnModule(Module &M) {
return true;
}
PreservedAnalyses CrossDSOCFIPass::run(Module &M, AnalysisManager<Module> &AM) {
PreservedAnalyses CrossDSOCFIPass::run(Module &M, ModuleAnalysisManager &AM) {
CrossDSOCFI Impl;
bool Changed = Impl.runOnModule(M);
if (!Changed)

View File

@ -1267,7 +1267,7 @@ bool ReversePostOrderFunctionAttrsLegacyPass::runOnModule(Module &M) {
}
PreservedAnalyses
ReversePostOrderFunctionAttrsPass::run(Module &M, AnalysisManager<Module> &AM) {
ReversePostOrderFunctionAttrsPass::run(Module &M, ModuleAnalysisManager &AM) {
auto &CG = AM.getResult<CallGraphAnalysis>(M);
bool Changed = deduceFunctionAttributeInRPO(M, CG);

View File

@ -785,7 +785,7 @@ public:
} // anonymous namespace
PreservedAnalyses FunctionImportPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
if (!doImportingForModule(M, Index))
return PreservedAnalyses::all();

View File

@ -2565,7 +2565,7 @@ static bool optimizeGlobalsInModule(
return Changed;
}
PreservedAnalyses GlobalOptPass::run(Module &M, AnalysisManager<Module> &AM) {
PreservedAnalyses GlobalOptPass::run(Module &M, ModuleAnalysisManager &AM) {
auto &DL = M.getDataLayout();
auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
auto &FAM =

View File

@ -34,7 +34,7 @@ static bool inferAllPrototypeAttributes(Module &M,
}
PreservedAnalyses InferFunctionAttrsPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
if (!inferAllPrototypeAttributes(M, TLI))

View File

@ -239,7 +239,7 @@ bool InternalizePass::internalizeModule(Module &M, CallGraph *CG) {
InternalizePass::InternalizePass() : MustPreserveGV(PreserveAPIList()) {}
PreservedAnalyses InternalizePass::run(Module &M, AnalysisManager<Module> &AM) {
PreservedAnalyses InternalizePass::run(Module &M, ModuleAnalysisManager &AM) {
if (!internalizeModule(M, AM.getCachedResult<CallGraphAnalysis>(M)))
return PreservedAnalyses::all();

View File

@ -1061,7 +1061,7 @@ bool LowerTypeTests::runOnModule(Module &M) {
}
PreservedAnalyses LowerTypeTestsPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
LowerTypeTests Impl;
init(&Impl, M);
bool Changed = Impl.lower();

View File

@ -1253,7 +1253,7 @@ bool SampleProfileLoader::runOnFunction(Function &F) {
}
PreservedAnalyses SampleProfileLoaderPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
SampleProfileLoader SampleLoader(SampleProfileFile);

View File

@ -453,7 +453,7 @@ bool GCOVProfiler::runOnModule(Module &M) {
}
PreservedAnalyses GCOVProfilerPass::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
GCOVProfiler Profiler(GCOVOpts);

View File

@ -653,7 +653,7 @@ bool PGOIndirectCallPromotionLegacyPass::runOnModule(Module &M) {
return promoteIndirectCalls(M, InLTO | ICPLTOMode);
}
PreservedAnalyses PGOIndirectCallPromotion::run(Module &M, AnalysisManager<Module> &AM) {
PreservedAnalyses PGOIndirectCallPromotion::run(Module &M, ModuleAnalysisManager &AM) {
if (!promoteIndirectCalls(M, InLTO | ICPLTOMode))
return PreservedAnalyses::all();

View File

@ -66,7 +66,7 @@ public:
} // anonymous namespace
PreservedAnalyses InstrProfiling::run(Module &M, AnalysisManager<Module> &AM) {
PreservedAnalyses InstrProfiling::run(Module &M, ModuleAnalysisManager &AM) {
if (!run(M))
return PreservedAnalyses::all();

View File

@ -964,7 +964,7 @@ bool PGOInstrumentationGenLegacyPass::runOnModule(Module &M) {
}
PreservedAnalyses PGOInstrumentationGen::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
auto LookupBPI = [&FAM](Function &F) {
@ -1056,7 +1056,7 @@ PGOInstrumentationUse::PGOInstrumentationUse(std::string Filename)
}
PreservedAnalyses PGOInstrumentationUse::run(Module &M,
AnalysisManager<Module> &AM) {
ModuleAnalysisManager &AM) {
auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
auto LookupBPI = [&FAM](Function &F) {

View File

@ -1941,7 +1941,7 @@ static bool runIPSCCP(Module &M, const DataLayout &DL,
return MadeChanges;
}
PreservedAnalyses IPSCCPPass::run(Module &M, AnalysisManager<Module> &AM) {
PreservedAnalyses IPSCCPPass::run(Module &M, ModuleAnalysisManager &AM) {
const DataLayout &DL = M.getDataLayout();
auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
if (!runIPSCCP(M, DL, &TLI))