1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[NewPM] Add TargetMachine method to add alias analyses

AMDGPUTargetMachine::adjustPassManager() adds some alias analyses to the
legacy PM. We need a way to do the same for the new PM in order to port
AMDGPUTargetMachine::adjustPassManager() to the new PM.

Currently the new PM adds alias analyses by creating an AAManager via
PassBuilder and overriding the AAManager a PassManager uses via
FunctionAnalysisManager::registerPass().

We will continue to respect a custom AA pipeline that specifies an exact
AA pipeline to use, but for "default" we will now add alias analyses
that backends specify. Most uses of PassManager use the "default"
AAManager created by PassBuilder::buildDefaultAAPipeline(). Backends can
override the newly added TargetMachine::registerAliasAnalyses() to add custom
alias analyses.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D93261
This commit is contained in:
Arthur Eubanks 2020-12-14 18:06:10 -08:00
parent a8fe3856d0
commit aac9763bc3
3 changed files with 12 additions and 0 deletions

View File

@ -460,6 +460,9 @@ public:
/// Build the default `AAManager` with the default alias analysis pipeline
/// registered.
///
/// This also adds target-specific alias analyses registered via
/// TargetMachine::registerAliasAnalyses().
AAManager buildDefaultAAPipeline();
/// Parse a textual pass pipeline description into a \c

View File

@ -23,6 +23,7 @@
namespace llvm {
class AAManager;
class Function;
class GlobalValue;
class MachineModuleInfoWrapperPass;
@ -322,6 +323,10 @@ public:
virtual void registerPassBuilderCallbacks(PassBuilder &,
bool DebugPassManager) {}
/// Allow the target to register alias analyses with the AAManager for use
/// with the new pass manager. Only affects the "default" AAManager.
virtual void registerAliasAnalyses(AAManager &) {}
/// Add passes to the specified pass manager to get the specified file
/// emitted. Typically this will involve several steps of code generation.
/// This method should return true if emission of this file type is not

View File

@ -1882,6 +1882,10 @@ AAManager PassBuilder::buildDefaultAAPipeline() {
// results from `GlobalsAA` through a readonly proxy.
AA.registerModuleAnalysis<GlobalsAA>();
// Add target-specific alias analyses.
if (TM)
TM->registerAliasAnalyses(AA);
return AA;
}