LLVM  16.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 
17 #include "llvm/Pass.h"
18 
19 namespace llvm {
20 
21 class Function;
22 class ScalarEvolution;
23 class SCEV;
24 
25 /// A simple alias analysis implementation that uses ScalarEvolution to answer
26 /// queries.
27 class SCEVAAResult : public AAResultBase {
28  ScalarEvolution &SE;
29 
30 public:
31  explicit SCEVAAResult(ScalarEvolution &SE) : SE(SE) {}
33 
34  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
35  AAQueryInfo &AAQI);
36 
37  bool invalidate(Function &F, const PreservedAnalyses &PA,
39 
40 private:
41  Value *GetBaseValue(const SCEV *S);
42 };
43 
44 /// Analysis pass providing a never-invalidated alias analysis result.
45 class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
47  static AnalysisKey Key;
48 
49 public:
51 
53 };
54 
55 /// Legacy wrapper pass to provide the SCEVAAResult object.
57  std::unique_ptr<SCEVAAResult> Result;
58 
59 public:
60  static char ID;
61 
63 
64  SCEVAAResult &getResult() { return *Result; }
65  const SCEVAAResult &getResult() const { return *Result; }
66 
67  bool runOnFunction(Function &F) override;
68  void getAnalysisUsage(AnalysisUsage &AU) const override;
69 };
70 
71 /// Creates an instance of \c SCEVAAWrapperPass.
72 FunctionPass *createSCEVAAWrapperPass();
73 
74 }
75 
76 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm::SCEVAA
Analysis pass providing a never-invalidated alias analysis result.
Definition: ScalarEvolutionAliasAnalysis.h:45
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::Function
Definition: Function.h:60
Pass.h
llvm::ScalarEvolution
The main scalar evolution driver.
Definition: ScalarEvolution.h:449
llvm::SCEVAAWrapperPass::SCEVAAWrapperPass
SCEVAAWrapperPass()
Definition: ScalarEvolutionAliasAnalysis.cpp:156
llvm::SCEVAA::run
SCEVAAResult run(Function &F, FunctionAnalysisManager &AM)
Definition: ScalarEvolutionAliasAnalysis.cpp:141
llvm::AliasResult
The possible results of an alias query.
Definition: AliasAnalysis.h:83
llvm::SCEVAAWrapperPass::getResult
const SCEVAAResult & getResult() const
Definition: ScalarEvolutionAliasAnalysis.h:65
F
#define F(x, y, z)
Definition: MD5.cpp:55
AliasAnalysis.h
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:187
llvm::AAQueryInfo
This class stores info we want to provide to or retain within an alias query.
Definition: AliasAnalysis.h:233
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:661
llvm::SCEV
This class represents an analyzed expression in the program.
Definition: ScalarEvolution.h:75
llvm::SCEVAAWrapperPass
Legacy wrapper pass to provide the SCEVAAResult object.
Definition: ScalarEvolutionAliasAnalysis.h:56
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:69
llvm::SCEVAAWrapperPass::getResult
SCEVAAResult & getResult()
Definition: ScalarEvolutionAliasAnalysis.h:64
llvm::SCEVAAResult::SCEVAAResult
SCEVAAResult(SCEVAAResult &&Arg)
Definition: ScalarEvolutionAliasAnalysis.h:32
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:1836
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:394
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:851
llvm::SCEVAAWrapperPass::ID
static char ID
Definition: ScalarEvolutionAliasAnalysis.h:60
llvm::SCEVAAResult::SCEVAAResult
SCEVAAResult(ScalarEvolution &SE)
Definition: ScalarEvolutionAliasAnalysis.h:31
llvm::createSCEVAAWrapperPass
FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
Definition: ScalarEvolutionAliasAnalysis.cpp:152
llvm::SCEVAAResult::invalidate
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Definition: ScalarEvolutionAliasAnalysis.cpp:132
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:160
llvm::SCEVAAResult
A simple alias analysis implementation that uses ScalarEvolution to answer queries.
Definition: ScalarEvolutionAliasAnalysis.h:27
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
llvm::SCEVAA::Result
SCEVAAResult Result
Definition: ScalarEvolutionAliasAnalysis.h:50
llvm::SCEVAAResult::alias
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI)
Definition: ScalarEvolutionAliasAnalysis.cpp:36
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:166
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::AAResultBase
A base class to help implement the function alias analysis results concept.
Definition: AliasAnalysis.h:785
llvm::MemoryLocation
Representation for a specific memory location.
Definition: MemoryLocation.h:210
llvm::codeview::PublicSymFlags::Function
@ Function