LLVM 24.0.0git
NVPTXAliasAnalysis.h
Go to the documentation of this file.
1//===-------------------- NVPTXAliasAnalysis.h ------------------*- 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 NVPTX address space based alias analysis pass.
10//===----------------------------------------------------------------------===//
11
12#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H
13#define LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H
14
16
17namespace llvm {
18
19class MemoryLocation;
20struct NVPTXOptions;
21
23 const NVPTXOptions &CLOpts;
24
25public:
26 explicit NVPTXAAResult(const NVPTXOptions &CLOpts) : CLOpts(CLOpts) {}
28 : AAResultBase(std::move(Arg)), CLOpts(Arg.CLOpts) {}
29
30 /// Handle invalidation events from the new pass manager.
31 ///
32 /// This result does not depend on the IR and so remains valid.
34 FunctionAnalysisManager::Invalidator &Inv) {
35 return false;
36 }
37
38 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
39 AAQueryInfo &AAQI, const Instruction *CtxI = nullptr);
40
42 bool IgnoreLocals);
43
45
49};
50
51/// Analysis pass providing a never-invalidated alias analysis result.
52class NVPTXAA : public AnalysisInfoMixin<NVPTXAA> {
54
55 static AnalysisKey Key;
56
57public:
59
61};
62
63/// Legacy wrapper pass to provide the NVPTXAAResult object.
65 std::unique_ptr<NVPTXAAResult> Result;
66
67public:
68 static char ID;
69
71
72 NVPTXAAResult &getResult() { return *Result; }
73 const NVPTXAAResult &getResult() const { return *Result; }
74
75 bool doInitialization(Module &M) override;
76
77 bool doFinalization(Module &M) override {
78 Result.reset();
79 return false;
80 }
81
82 void getAnalysisUsage(AnalysisUsage &AU) const override;
83};
84
85// Wrapper around ExternalAAWrapperPass so that the default
86// constructor gets the callback.
87// Note that NVPTXAA will run before BasicAA for compile time considerations.
89public:
90 static char ID;
91
94 [](Pass &P, Function &, AAResults &AAR) {
95 if (auto *WrapperPass =
96 P.getAnalysisIfAvailable<NVPTXAAWrapperPass>())
97 AAR.addAAResult(WrapperPass->getResult());
98 },
99 /*RunEarly=*/true) {}
100
101 StringRef getPassName() const override {
102 return "NVPTX Address space based Alias Analysis Wrapper";
103 }
104};
105
106ImmutablePass *createNVPTXAAWrapperPass();
107ImmutablePass *createNVPTXExternalAAWrapperPass();
108
109} // end namespace llvm
110
111#endif // LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H
#define F(x, y, z)
Definition MD5.cpp:54
#define P(N)
This class stores info we want to provide to or retain within an alias query.
AAResultBase()=default
The possible results of an alias query.
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
ImmutablePass(char &pid)
Definition Pass.h:285
static MemoryEffectsBase unknown()
Definition ModRef.h:123
Representation for a specific memory location.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
NVPTXAAResult(NVPTXAAResult &&Arg)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI=nullptr)
MemoryEffects getMemoryEffects(const Function *F)
MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI)
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events from the new pass manager.
NVPTXAAResult(const NVPTXOptions &CLOpts)
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals)
Legacy wrapper pass to provide the NVPTXAAResult object.
const NVPTXAAResult & 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 ...
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Analysis pass providing a never-invalidated alias analysis result.
NVPTXAAResult run(Function &F, AnalysisManager< Function > &AM)
NVPTXAAResult Result
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Pass interface - Implemented by all 'passes'.
Definition Pass.h:97
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
CallInst * Call
This is an optimization pass for GlobalISel generic memory operations.
ImmutablePass * createNVPTXExternalAAWrapperPass()
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
Definition ModRef.h:356
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition ModRef.h:28
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:1933
ImmutablePass * createNVPTXAAWrapperPass()
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29