Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.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"
21#include <memory>
22
23namespace llvm {
24
25class Function;
26class MDNode;
27class MemoryLocation;
28
29/// A simple AA result which uses scoped-noalias metadata to answer queries.
31public:
32 /// Handle invalidation events from the new pass manager.
33 ///
34 /// By definition, this result is stateless and so remains valid.
36 FunctionAnalysisManager::Invalidator &) {
37 return false;
38 }
39
41 const MemoryLocation &LocB, AAQueryInfo &AAQI,
42 const Instruction *CtxI);
44 const MemoryLocation &Loc,
45 AAQueryInfo &AAQI);
47 const CallBase *Call2, AAQueryInfo &AAQI);
48
49 LLVM_ABI void
50 collectScopedDomains(const MDNode *NoAlias,
51 SmallPtrSetImpl<const MDNode *> &Domains) const;
52
53private:
54 bool mayAliasInScopes(const MDNode *Scopes, const MDNode *NoAlias) const;
55};
56
57/// Analysis pass providing a never-invalidated alias analysis result.
68
69/// Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
71 std::unique_ptr<ScopedNoAliasAAResult> Result;
72
73public:
74 static char ID;
75
77
78 ScopedNoAliasAAResult &getResult() { return *Result; }
79 const ScopedNoAliasAAResult &getResult() const { return *Result; }
80
81 bool doInitialization(Module &M) override;
82 bool doFinalization(Module &M) override;
83 void getAnalysisUsage(AnalysisUsage &AU) const override;
84};
85
86//===--------------------------------------------------------------------===//
87//
88// createScopedNoAliasAAWrapperPass - This pass implements metadata-based
89// scoped noalias analysis.
90//
92
93} // end namespace llvm
94
95#endif // LLVM_ANALYSIS_SCOPEDNOALIASAA_H
#define LLVM_ABI
Definition Compiler.h:213
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:55
This class stores info we want to provide to or retain within an alias query.
AAResultBase()=default
The possible results of an alias query.
Represent the analysis usage information of a pass.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition Pass.h:285
ImmutablePass(char &pid)
Definition Pass.h:287
Metadata node.
Definition Metadata.h:1077
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
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
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.
LLVM_ABI void collectScopedDomains(const MDNode *NoAlias, SmallPtrSetImpl< const MDNode * > &Domains) const
Collect the set of scoped domains relevant to the noalias scopes.
LLVM_ABI ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
ScopedNoAliasAAResult & getResult()
const ScopedNoAliasAAResult & getResult() const
Analysis pass providing a never-invalidated alias analysis result.
LLVM_ABI ScopedNoAliasAAResult run(Function &F, FunctionAnalysisManager &AM)
ScopedNoAliasAAResult Result
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
CallInst * Call
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI ImmutablePass * createScopedNoAliasAAWrapperPass()
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition ModRef.h:28
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
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