mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-25 23:45:36 +00:00
[PM] Add support for building a default AA pipeline to the PassBuilder.
Pretty boring and lame as-is but necessary. This is definitely a place we'll end up with extension hooks longer term. =] Differential Revision: https://reviews.llvm.org/D28076 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290449 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
096850a402
commit
759dd39154
@ -224,6 +224,10 @@ public:
|
|||||||
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level,
|
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level,
|
||||||
bool DebugLogging = false);
|
bool DebugLogging = false);
|
||||||
|
|
||||||
|
/// Build the default `AAManager` with the default alias analysis pipeline
|
||||||
|
/// registered.
|
||||||
|
AAManager buildDefaultAAPipeline();
|
||||||
|
|
||||||
/// \brief Parse a textual pass pipeline description into a \c ModulePassManager.
|
/// \brief Parse a textual pass pipeline description into a \c ModulePassManager.
|
||||||
///
|
///
|
||||||
/// The format of the textual pass pipeline description looks something like:
|
/// The format of the textual pass pipeline description looks something like:
|
||||||
|
@ -544,6 +544,33 @@ ModulePassManager PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
|
|||||||
return MPM;
|
return MPM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AAManager PassBuilder::buildDefaultAAPipeline() {
|
||||||
|
AAManager AA;
|
||||||
|
|
||||||
|
// The order in which these are registered determines their priority when
|
||||||
|
// being queried.
|
||||||
|
|
||||||
|
// First we register the basic alias analysis that provides the majority of
|
||||||
|
// per-function local AA logic. This is a stateless, on-demand local set of
|
||||||
|
// AA techniques.
|
||||||
|
AA.registerFunctionAnalysis<BasicAA>();
|
||||||
|
|
||||||
|
// Next we query fast, specialized alias analyses that wrap IR-embedded
|
||||||
|
// information about aliasing.
|
||||||
|
AA.registerFunctionAnalysis<ScopedNoAliasAA>();
|
||||||
|
AA.registerFunctionAnalysis<TypeBasedAA>();
|
||||||
|
|
||||||
|
// Add support for querying global aliasing information when available.
|
||||||
|
// Because this is a module analysis this will use any cached analysis state
|
||||||
|
// available but isn't enough to cause it to be available.
|
||||||
|
// FIXME: Enable once the invalidation logic supports this.
|
||||||
|
#if 0
|
||||||
|
AA.registerModuleAnalysis<GlobalsAA>();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return AA;
|
||||||
|
}
|
||||||
|
|
||||||
static Optional<int> parseRepeatPassName(StringRef Name) {
|
static Optional<int> parseRepeatPassName(StringRef Name) {
|
||||||
if (!Name.consume_front("repeat<") || !Name.consume_back(">"))
|
if (!Name.consume_front("repeat<") || !Name.consume_back(">"))
|
||||||
return None;
|
return None;
|
||||||
@ -1084,6 +1111,13 @@ bool PassBuilder::parsePassPipeline(ModulePassManager &MPM,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PassBuilder::parseAAPipeline(AAManager &AA, StringRef PipelineText) {
|
bool PassBuilder::parseAAPipeline(AAManager &AA, StringRef PipelineText) {
|
||||||
|
// If the pipeline just consists of the word 'default' just replace the AA
|
||||||
|
// manager with our default one.
|
||||||
|
if (PipelineText == "default") {
|
||||||
|
AA = buildDefaultAAPipeline();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
while (!PipelineText.empty()) {
|
while (!PipelineText.empty()) {
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
std::tie(Name, PipelineText) = PipelineText.split(',');
|
std::tie(Name, PipelineText) = PipelineText.split(',');
|
||||||
|
@ -311,6 +311,17 @@
|
|||||||
; CHECK-AA: Running analysis: BasicAA
|
; CHECK-AA: Running analysis: BasicAA
|
||||||
; CHECK-AA: Finished llvm::Module pass manager run
|
; CHECK-AA: Finished llvm::Module pass manager run
|
||||||
|
|
||||||
|
; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
|
||||||
|
; RUN: -passes='require<aa>' -aa-pipeline='default' \
|
||||||
|
; RUN: | FileCheck %s --check-prefix=CHECK-AA-DEFAULT
|
||||||
|
; CHECK-AA-DEFAULT: Starting llvm::Module pass manager run
|
||||||
|
; CHECK-AA-DEFAULT: Running pass: RequireAnalysisPass
|
||||||
|
; CHECK-AA-DEFAULT: Running analysis: AAManager
|
||||||
|
; CHECK-AA-DEFAULT: Running analysis: BasicAA
|
||||||
|
; CHECK-AA-DEFAULT: Running analysis: ScopedNoAliasAA
|
||||||
|
; CHECK-AA-DEFAULT: Running analysis: TypeBasedAA
|
||||||
|
; CHECK-AA-DEFAULT: Finished llvm::Module pass manager run
|
||||||
|
|
||||||
; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
|
; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
|
||||||
; RUN: -passes='require<memdep>' \
|
; RUN: -passes='require<memdep>' \
|
||||||
; RUN: | FileCheck %s --check-prefix=CHECK-MEMDEP
|
; RUN: | FileCheck %s --check-prefix=CHECK-MEMDEP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user