LLVM 22.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;
20
22public:
25
26 /// Handle invalidation events from the new pass manager.
27 ///
28 /// By definition, this result is stateless and so remains valid.
31 return false;
32 }
33
34 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
35 AAQueryInfo &AAQI, const Instruction *CtxI = nullptr);
36
38 bool IgnoreLocals);
39
41
44 }
45};
46
47/// Analysis pass providing a never-invalidated alias analysis result.
48class NVPTXAA : public AnalysisInfoMixin<NVPTXAA> {
50
51 static AnalysisKey Key;
52
53public:
55
57 return NVPTXAAResult();
58 }
59};
60
61/// Legacy wrapper pass to provide the NVPTXAAResult object.
63 std::unique_ptr<NVPTXAAResult> Result;
64
65public:
66 static char ID;
67
69
70 NVPTXAAResult &getResult() { return *Result; }
71 const NVPTXAAResult &getResult() const { return *Result; }
72
73 bool doInitialization(Module &M) override {
74 Result.reset(new NVPTXAAResult());
75 return false;
76 }
77
78 bool doFinalization(Module &M) override {
79 Result.reset();
80 return false;
81 }
82
83 void getAnalysisUsage(AnalysisUsage &AU) const override;
84};
85
86// Wrapper around ExternalAAWrapperPass so that the default
87// constructor gets the callback.
88// Note that NVPTXAA will run before BasicAA for compile time considerations.
90public:
91 static char ID;
92
95 [](Pass &P, Function &, AAResults &AAR) {
96 if (auto *WrapperPass =
97 P.getAnalysisIfAvailable<NVPTXAAWrapperPass>())
98 AAR.addAAResult(WrapperPass->getResult());
99 },
100 /*RunEarly=*/true) {}
101
102 StringRef getPassName() const override {
103 return "NVPTX Address space based Alias Analysis Wrapper";
104 }
105};
106
107ImmutablePass *createNVPTXAAWrapperPass();
108ImmutablePass *createNVPTXExternalAAWrapperPass();
109
110} // end namespace llvm
111
112#endif // LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H
#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 private abstract base class describing the concept of an individual alias analysis implementation.
The possible results of an alias query.
Definition: AliasAnalysis.h:78
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:294
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
Represent the analysis usage information of a pass.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1116
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:285
static MemoryEffectsBase unknown()
Create MemoryEffectsBase that can read and write any memory.
Definition: ModRef.h:115
Representation for a specific memory location.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
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.
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals)
Legacy wrapper pass to provide the NVPTXAAResult object.
NVPTXAAResult & getResult()
const NVPTXAAResult & getResult() const
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
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)
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:99
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ImmutablePass * createNVPTXExternalAAWrapperPass()
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:1886
ImmutablePass * createNVPTXAAWrapperPass()
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:93
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:29
A wrapper pass for external alias analyses.