LLVM 22.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"
19
20namespace llvm {
21
22class Function;
23class ScalarEvolution;
24class SCEV;
25
26/// A simple alias analysis implementation that uses ScalarEvolution to answer
27/// queries.
28class SCEVAAResult : public AAResultBase {
30
31public:
32 explicit SCEVAAResult(ScalarEvolution &SE) : SE(SE) {}
33 SCEVAAResult(SCEVAAResult &&Arg) : AAResultBase(std::move(Arg)), SE(Arg.SE) {}
34
36 const MemoryLocation &LocB, AAQueryInfo &AAQI,
37 const Instruction *CtxI);
38
40 FunctionAnalysisManager::Invalidator &Inv);
41
42private:
43 Value *GetBaseValue(const SCEV *S);
44};
45
46/// Analysis pass providing a never-invalidated alias analysis result.
47class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
49 LLVM_ABI static AnalysisKey Key;
50
51public:
53
55};
56
57/// Legacy wrapper pass to provide the SCEVAAResult object.
59 std::unique_ptr<SCEVAAResult> Result;
60
61public:
62 static char ID;
63
65
66 SCEVAAResult &getResult() { return *Result; }
67 const SCEVAAResult &getResult() const { return *Result; }
68
69 bool runOnFunction(Function &F) override;
70 void getAnalysisUsage(AnalysisUsage &AU) const override;
71};
72
73/// Creates an instance of \c SCEVAAWrapperPass.
74LLVM_ABI FunctionPass *createSCEVAAWrapperPass();
75}
76
77#endif
#define LLVM_ABI
Definition Compiler.h:213
static bool runOnFunction(Function &F, bool PostInlining)
#define F(x, y, z)
Definition MD5.cpp:55
This class stores info we want to provide to or retain within an alias query.
AAResultBase()=default
The possible results of an alias query.
Represent the analysis usage information of a pass.
FunctionPass(char &pid)
Definition Pass.h:316
Representation for a specific memory location.
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
A simple alias analysis implementation that uses ScalarEvolution to answer queries.
LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
SCEVAAResult(ScalarEvolution &SE)
LLVM_ABI AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
const SCEVAAResult & getResult() const
Analysis pass providing a never-invalidated alias analysis result.
LLVM_ABI SCEVAAResult run(Function &F, FunctionAnalysisManager &AM)
This class represents an analyzed expression in the program.
The main scalar evolution driver.
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
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:1849
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition PassManager.h:93
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29