LLVM  13.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 private:
37  Value *GetBaseValue(const SCEV *S);
38 };
39 
40 /// Analysis pass providing a never-invalidated alias analysis result.
41 class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
43  static AnalysisKey Key;
44 
45 public:
47 
49 };
50 
51 /// Legacy wrapper pass to provide the SCEVAAResult object.
53  std::unique_ptr<SCEVAAResult> Result;
54 
55 public:
56  static char ID;
57 
59 
60  SCEVAAResult &getResult() { return *Result; }
61  const SCEVAAResult &getResult() const { return *Result; }
62 
63  bool runOnFunction(Function &F) override;
64  void getAnalysisUsage(AnalysisUsage &AU) const override;
65 };
66 
67 /// Creates an instance of \c SCEVAAWrapperPass.
68 FunctionPass *createSCEVAAWrapperPass();
69 
70 }
71 
72 #endif
llvm::SCEVAA
Analysis pass providing a never-invalidated alias analysis result.
Definition: ScalarEvolutionAliasAnalysis.h:41
llvm
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:137
llvm::SCEVAA::run
SCEVAAResult run(Function &F, FunctionAnalysisManager &AM)
Definition: ScalarEvolutionAliasAnalysis.cpp:122
llvm::AliasResult
The possible results of an alias query.
Definition: AliasAnalysis.h:81
llvm::SCEVAAWrapperPass::getResult
const SCEVAAResult & getResult() const
Definition: ScalarEvolutionAliasAnalysis.h:61
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:205
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::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:52
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:60
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:1540
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:56
llvm::SCEVAAResult::SCEVAAResult
SCEVAAResult(ScalarEvolution &SE)
Definition: ScalarEvolutionAliasAnalysis.h:30
Function.h
llvm::createSCEVAAWrapperPass
FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
Definition: ScalarEvolutionAliasAnalysis.cpp:133
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:141
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:46
llvm::SCEVAAResult::alias
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI)
Definition: ScalarEvolutionAliasAnalysis.cpp:25
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:147
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:1064
llvm::MemoryLocation
Representation for a specific memory location.
Definition: MemoryLocation.h:209