[RISCV] Add shrinkwrap test cases showing gaps in current impl
[llvm-project.git] / llvm / lib / Target / NVPTX / NVPTXAliasAnalysis.h
blob2d204979eb6cef4769883b1505ed7d61076229ea
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 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H
13 #define LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H
15 #include "llvm/Analysis/AliasAnalysis.h"
17 namespace llvm {
19 class MemoryLocation;
21 class NVPTXAAResult : public AAResultBase {
22 public:
23 NVPTXAAResult() {}
24 NVPTXAAResult(NVPTXAAResult &&Arg) : AAResultBase(std::move(Arg)) {}
26 /// Handle invalidation events from the new pass manager.
27 ///
28 /// By definition, this result is stateless and so remains valid.
29 bool invalidate(Function &, const PreservedAnalyses &,
30 FunctionAnalysisManager::Invalidator &Inv) {
31 return false;
34 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
35 AAQueryInfo &AAQI, const Instruction *CtxI = nullptr);
37 ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI,
38 bool IgnoreLocals);
41 /// Analysis pass providing a never-invalidated alias analysis result.
42 class NVPTXAA : public AnalysisInfoMixin<NVPTXAA> {
43 friend AnalysisInfoMixin<NVPTXAA>;
45 static AnalysisKey Key;
47 public:
48 using Result = NVPTXAAResult;
50 NVPTXAAResult run(Function &F, AnalysisManager<Function> &AM) {
51 return NVPTXAAResult();
55 /// Legacy wrapper pass to provide the NVPTXAAResult object.
56 class NVPTXAAWrapperPass : public ImmutablePass {
57 std::unique_ptr<NVPTXAAResult> Result;
59 public:
60 static char ID;
62 NVPTXAAWrapperPass();
64 NVPTXAAResult &getResult() { return *Result; }
65 const NVPTXAAResult &getResult() const { return *Result; }
67 bool doInitialization(Module &M) override {
68 Result.reset(new NVPTXAAResult());
69 return false;
72 bool doFinalization(Module &M) override {
73 Result.reset();
74 return false;
77 void getAnalysisUsage(AnalysisUsage &AU) const override;
80 // Wrapper around ExternalAAWrapperPass so that the default
81 // constructor gets the callback.
82 class NVPTXExternalAAWrapper : public ExternalAAWrapperPass {
83 public:
84 static char ID;
86 NVPTXExternalAAWrapper()
87 : ExternalAAWrapperPass([](Pass &P, Function &, AAResults &AAR) {
88 if (auto *WrapperPass =
89 P.getAnalysisIfAvailable<NVPTXAAWrapperPass>())
90 AAR.addAAResult(WrapperPass->getResult());
91 }) {}
94 ImmutablePass *createNVPTXAAWrapperPass();
95 void initializeNVPTXAAWrapperPassPass(PassRegistry &);
96 ImmutablePass *createNVPTXExternalAAWrapperPass();
97 void initializeNVPTXExternalAAWrapperPass(PassRegistry &);
99 } // end namespace llvm
101 #endif // LLVM_LIB_TARGET_NVPTX_NVPTXALIASANALYSIS_H