LLVM  8.0.1
ScalarEvolutionAliasAnalysis.h
Go to the documentation of this file.
1 //===- ScalarEvolutionAliasAnalysis.h - SCEV-based AA -----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// This is the interface for a SCEV-based alias analysis.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
15 #define LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
16 
19 #include "llvm/IR/Function.h"
20 #include "llvm/IR/Module.h"
21 #include "llvm/Pass.h"
22 
23 namespace llvm {
24 
25 /// A simple alias analysis implementation that uses ScalarEvolution to answer
26 /// queries.
27 class SCEVAAResult : public AAResultBase<SCEVAAResult> {
28  ScalarEvolution &SE;
29 
30 public:
31  explicit SCEVAAResult(ScalarEvolution &SE) : AAResultBase(), SE(SE) {}
33 
34  AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB);
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.
69 
70 }
71 
72 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
The main scalar evolution driver.
const SCEVAAResult & getResult() const
F(f)
Definition: BitVector.h:938
A simple alias analysis implementation that uses ScalarEvolution to answer queries.
A CRTP-driven "mixin" base class to help implement the function alias analysis results concept...
Key
PAL metadata keys.
FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
AliasResult
The possible results of an alias query.
Definition: AliasAnalysis.h:78
static bool runOnFunction(Function &F, bool PostInlining)
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:383
Represent the analysis usage information of a pass.
SCEVAAResult(ScalarEvolution &SE)
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:285
Analysis pass providing a never-invalidated alias analysis result.
Representation for a specific memory location.
Legacy wrapper pass to provide the SCEVAAResult object.
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
Module.h This file contains the declarations for the Module class.
amdgpu Simplify well known AMD library false Value Value * Arg
This class represents an analyzed expression in the program.
LLVM Value Representation.
Definition: Value.h:73
A container for analyses that lazily runs them and caches their results.
SCEVAAResult(SCEVAAResult &&Arg)
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:71