LLVM  9.0.0svn
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 
35 private:
36  Value *GetBaseValue(const SCEV *S);
37 };
38 
39 /// Analysis pass providing a never-invalidated alias analysis result.
40 class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
42  static AnalysisKey Key;
43 
44 public:
46 
48 };
49 
50 /// Legacy wrapper pass to provide the SCEVAAResult object.
52  std::unique_ptr<SCEVAAResult> Result;
53 
54 public:
55  static char ID;
56 
58 
59  SCEVAAResult &getResult() { return *Result; }
60  const SCEVAAResult &getResult() const { return *Result; }
61 
62  bool runOnFunction(Function &F) override;
63  void getAnalysisUsage(AnalysisUsage &AU) const override;
64 };
65 
66 /// Creates an instance of \c SCEVAAWrapperPass.
68 
69 }
70 
71 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
The main scalar evolution driver.
const SCEVAAResult & getResult() const
F(f)
Definition: BitVector.h:937
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:77
static bool runOnFunction(Function &F, bool PostInlining)
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:382
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:284
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
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.
This class represents an analyzed expression in the program.
LLVM Value Representation.
Definition: Value.h:72
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:70