LLVM  14.0.0git
ScalarEvolutionAliasAnalysis.h
Go to the documentation of this file.
1 //===- ScalarEvolutionAliasAnalysis.h - SCEV-based AA -----------*- 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 interface for a SCEV-based alias analysis.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
14 #define LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
15 
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/Module.h"
20 #include "llvm/Pass.h"
21 
22 namespace llvm {
23 
24 /// A simple alias analysis implementation that uses ScalarEvolution to answer
25 /// queries.
26 class SCEVAAResult : public AAResultBase<SCEVAAResult> {
27  ScalarEvolution &SE;
28 
29 public:
30  explicit SCEVAAResult(ScalarEvolution &SE) : AAResultBase(), SE(SE) {}
32 
33  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
34  AAQueryInfo &AAQI);
35 
36  bool invalidate(Function &F, const PreservedAnalyses &PA,
38 
39 private:
40  Value *GetBaseValue(const SCEV *S);
41 };
42 
43 /// Analysis pass providing a never-invalidated alias analysis result.
44 class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
46  static AnalysisKey Key;
47 
48 public:
50 
52 };
53 
54 /// Legacy wrapper pass to provide the SCEVAAResult object.
56  std::unique_ptr<SCEVAAResult> Result;
57 
58 public:
59  static char ID;
60 
62 
63  SCEVAAResult &getResult() { return *Result; }
64  const SCEVAAResult &getResult() const { return *Result; }
65 
66  bool runOnFunction(Function &F) override;
67  void getAnalysisUsage(AnalysisUsage &AU) const override;
68 };
69 
70 /// Creates an instance of \c SCEVAAWrapperPass.
71 FunctionPass *createSCEVAAWrapperPass();
72 
73 }
74 
75 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::SCEVAA
Analysis pass providing a never-invalidated alias analysis result.
Definition: ScalarEvolutionAliasAnalysis.h:44
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::Function
Definition: Function.h:61
Pass.h
llvm::ScalarEvolution
The main scalar evolution driver.
Definition: ScalarEvolution.h:443
Module.h
llvm::SCEVAAWrapperPass::SCEVAAWrapperPass
SCEVAAWrapperPass()
Definition: ScalarEvolutionAliasAnalysis.cpp:147
llvm::SCEVAA::run
SCEVAAResult run(Function &F, FunctionAnalysisManager &AM)
Definition: ScalarEvolutionAliasAnalysis.cpp:132
llvm::AliasResult
The possible results of an alias query.
Definition: AliasAnalysis.h:81
llvm::SCEVAAWrapperPass::getResult
const SCEVAAResult & getResult() const
Definition: ScalarEvolutionAliasAnalysis.h:64
F
#define F(x, y, z)
Definition: MD5.cpp:56
AliasAnalysis.h
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
llvm::AAQueryInfo
This class stores info we want to provide to or retain within an alias query.
Definition: AliasAnalysis.h:414
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:656
llvm::SCEV
This class represents an analyzed expression in the program.
Definition: ScalarEvolution.h:78
llvm::SCEVAAWrapperPass
Legacy wrapper pass to provide the SCEVAAResult object.
Definition: ScalarEvolutionAliasAnalysis.h:55
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:72
llvm::SCEVAAWrapperPass::getResult
SCEVAAResult & getResult()
Definition: ScalarEvolutionAliasAnalysis.h:63
llvm::SCEVAAResult::SCEVAAResult
SCEVAAResult(SCEVAAResult &&Arg)
Definition: ScalarEvolutionAliasAnalysis.h:31
llvm::move
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:1605
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:391
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
std
Definition: BitVector.h:838
llvm::SCEVAAWrapperPass::ID
static char ID
Definition: ScalarEvolutionAliasAnalysis.h:59
llvm::SCEVAAResult::SCEVAAResult
SCEVAAResult(ScalarEvolution &SE)
Definition: ScalarEvolutionAliasAnalysis.h:30
Function.h
llvm::createSCEVAAWrapperPass
FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
Definition: ScalarEvolutionAliasAnalysis.cpp:143
llvm::SCEVAAResult::invalidate
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Definition: ScalarEvolutionAliasAnalysis.cpp:123
llvm::SCEVAAWrapperPass::runOnFunction
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
Definition: ScalarEvolutionAliasAnalysis.cpp:151
ScalarEvolutionExpressions.h
llvm::SCEVAAResult
A simple alias analysis implementation that uses ScalarEvolution to answer queries.
Definition: ScalarEvolutionAliasAnalysis.h:26
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
llvm::SCEVAA::Result
SCEVAAResult Result
Definition: ScalarEvolutionAliasAnalysis.h:49
llvm::SCEVAAResult::alias
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI)
Definition: ScalarEvolutionAliasAnalysis.cpp:26
llvm::SCEVAAWrapperPass::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: ScalarEvolutionAliasAnalysis.cpp:157
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::AAResultBase
A CRTP-driven "mixin" base class to help implement the function alias analysis results concept.
Definition: AliasAnalysis.h:1076
llvm::MemoryLocation
Representation for a specific memory location.
Definition: MemoryLocation.h:209