LLVM 19.0.0git
ScopedNoAliasAA.h
Go to the documentation of this file.
1//===- ScopedNoAliasAA.h - Scoped No-Alias Alias Analysis -------*- 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//
9/// \file
10/// This is the interface for a metadata-based scoped no-alias analysis.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_ANALYSIS_SCOPEDNOALIASAA_H
15#define LLVM_ANALYSIS_SCOPEDNOALIASAA_H
16
18#include "llvm/IR/PassManager.h"
19#include "llvm/Pass.h"
20#include <memory>
21
22namespace llvm {
23
24class Function;
25class MDNode;
26class MemoryLocation;
27
28/// A simple AA result which uses scoped-noalias metadata to answer queries.
30public:
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);
41 ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
42 AAQueryInfo &AAQI);
43 ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2,
44 AAQueryInfo &AAQI);
45
46private:
47 bool mayAliasInScopes(const MDNode *Scopes, const MDNode *NoAlias) const;
48};
49
50/// Analysis pass providing a never-invalidated alias analysis result.
51class ScopedNoAliasAA : public AnalysisInfoMixin<ScopedNoAliasAA> {
53
54 static AnalysisKey Key;
55
56public:
58
60};
61
62/// Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
64 std::unique_ptr<ScopedNoAliasAAResult> Result;
65
66public:
67 static char ID;
68
70
71 ScopedNoAliasAAResult &getResult() { return *Result; }
72 const ScopedNoAliasAAResult &getResult() const { return *Result; }
73
74 bool doInitialization(Module &M) override;
75 bool doFinalization(Module &M) override;
76 void getAnalysisUsage(AnalysisUsage &AU) const override;
77};
78
79//===--------------------------------------------------------------------===//
80//
81// createScopedNoAliasAAWrapperPass - This pass implements metadata-based
82// scoped noalias analysis.
83//
85
86} // end namespace llvm
87
88#endif // LLVM_ANALYSIS_SCOPEDNOALIASAA_H
#define F(x, y, z)
Definition: MD5.cpp:55
This header defines various interfaces for pass management in LLVM.
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.
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.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1461
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:282
Metadata node.
Definition: Metadata.h:1067
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
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
A simple AA result which uses scoped-noalias metadata to answer queries.
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
Handle invalidation events from the new pass manager.
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
ScopedNoAliasAAResult & getResult()
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...
const ScopedNoAliasAAResult & getResult() const
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Analysis pass providing a never-invalidated alias analysis result.
ScopedNoAliasAAResult run(Function &F, FunctionAnalysisManager &AM)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ImmutablePass * createScopedNoAliasAAWrapperPass()
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition: ModRef.h:27
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