LLVM 19.0.0git
AMDGPUAliasAnalysis.h
Go to the documentation of this file.
1//===- AMDGPUAliasAnalysis --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This is the AMGPU address space based alias analysis pass.
10//===----------------------------------------------------------------------===//
11
12#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUALIASANALYSIS_H
13#define LLVM_LIB_TARGET_AMDGPU_AMDGPUALIASANALYSIS_H
14
16
17namespace llvm {
18
19class DataLayout;
20class MemoryLocation;
21
22/// A simple AA result that uses TBAA metadata to answer queries.
24 const DataLayout &DL;
25
26public:
27 explicit AMDGPUAAResult(const DataLayout &DL) : DL(DL) {}
29 : AAResultBase(std::move(Arg)), DL(Arg.DL) {}
30
31 /// Handle invalidation events from the new pass manager.
32 ///
33 /// By definition, this result is stateless and so remains valid.
36 return false;
37 }
38
39 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
40 AAQueryInfo &AAQI, const Instruction *CtxI);
42 bool IgnoreLocals);
43};
44
45/// Analysis pass providing a never-invalidated alias analysis result.
46class AMDGPUAA : public AnalysisInfoMixin<AMDGPUAA> {
48
49 static AnalysisKey Key;
50
51public:
53
55 return AMDGPUAAResult(F.getParent()->getDataLayout());
56 }
57};
58
59/// Legacy wrapper pass to provide the AMDGPUAAResult object.
61 std::unique_ptr<AMDGPUAAResult> Result;
62
63public:
64 static char ID;
65
67
68 AMDGPUAAResult &getResult() { return *Result; }
69 const AMDGPUAAResult &getResult() const { return *Result; }
70
71 bool doInitialization(Module &M) override {
72 Result.reset(new AMDGPUAAResult(M.getDataLayout()));
73 return false;
74 }
75
76 bool doFinalization(Module &M) override {
77 Result.reset();
78 return false;
79 }
80
81 void getAnalysisUsage(AnalysisUsage &AU) const override;
82};
83
84// Wrapper around ExternalAAWrapperPass so that the default constructor gets the
85// callback.
87public:
88 static char ID;
89
91 [](Pass &P, Function &, AAResults &AAR) {
92 if (auto *WrapperPass = P.getAnalysisIfAvailable<AMDGPUAAWrapperPass>())
93 AAR.addAAResult(WrapperPass->getResult());
94 }) {}
95};
96
97} // end namespace llvm
98
99#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUALIASANALYSIS_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define F(x, y, z)
Definition: MD5.cpp:55
#define P(N)
This class stores info we want to provide to or retain within an alias query.
A base class to help implement the function alias analysis results concept.
A simple AA result that uses TBAA metadata to answer queries.
AMDGPUAAResult(const DataLayout &DL)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
AMDGPUAAResult(AMDGPUAAResult &&Arg)
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals)
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events from the new pass manager.
Legacy wrapper pass to provide the AMDGPUAAResult object.
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
AMDGPUAAResult & getResult()
const AMDGPUAAResult & getResult() const
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
Analysis pass providing a never-invalidated alias analysis result.
AMDGPUAAResult run(Function &F, AnalysisManager< Function > &AM)
The possible results of an alias query.
Definition: AliasAnalysis.h:81
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:387
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:348
Represent the analysis usage information of a pass.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:282
Representation for a specific memory location.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition: ModRef.h:27
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1858
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:114
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:26
A wrapper pass for external alias analyses.