18#if !defined(LLVM_PASS_H) || defined(LLVM_PASSANALYSISSUPPORT_H)
19#error "Do not include <PassAnalysisSupport.h>; include <Pass.h> instead"
22#ifndef LLVM_PASSANALYSISSUPPORT_H
23#define LLVM_PASSANALYSISSUPPORT_H
60 bool PreservesAll =
false;
74 template<
class PassClass>
80 template<
class PassClass>
89 pushUnique(Preserved,
ID);
93 pushUnique(Preserved, &
ID);
97 template<
class PassClass>
99 pushUnique(Preserved, &PassClass::ID);
108 pushUnique(Used,
ID);
112 pushUnique(Used, &
ID);
116 template<
class PassClass>
118 pushUnique(Used, &PassClass::ID);
146 return RequiredTransitive;
166 Pass *ResultPass =
nullptr;
167 for (
const auto &AnalysisImpl : AnalysisImpls) {
168 if (AnalysisImpl.first == PI) {
169 ResultPass = AnalysisImpl.second;
182 std::pair<AnalysisID, Pass*> pir = std::make_pair(PI,
P);
183 AnalysisImpls.push_back(pir);
188 AnalysisImpls.clear();
197 std::vector<std::pair<AnalysisID, Pass *>> AnalysisImpls;
210template<
typename AnalysisType>
214 const void *PI = &AnalysisType::ID;
216 Pass *ResultPass =
Resolver->getAnalysisIfAvailable(PI);
217 if (!ResultPass)
return nullptr;
229template<
typename AnalysisType>
231 assert(
Resolver &&
"Pass has not been inserted into a PassManager object!");
232 return getAnalysisID<AnalysisType>(&AnalysisType::ID);
235template<
typename AnalysisType>
237 assert(PI &&
"getAnalysis for unregistered pass!");
238 assert(
Resolver&&
"Pass has not been inserted into a PassManager object!");
244 "getAnalysis*() called on an analysis that was not "
245 "'required' by pass!");
259template <
typename AnalysisType>
261 assert(
Resolver &&
"Pass has not been inserted into a PassManager object!");
263 return getAnalysisID<AnalysisType>(&AnalysisType::ID,
F, Changed);
266template <
typename AnalysisType>
268 assert(PI &&
"getAnalysis for unregistered pass!");
269 assert(
Resolver &&
"Pass has not been inserted into a PassManager object!");
275 std::tie(ResultPass, LocalChanged) =
Resolver->findImplPass(
this, PI,
F);
277 assert(ResultPass &&
"Unable to find requested analysis info");
279 *Changed |= LocalChanged;
282 "A pass trigged a code update but the update status is lost");
aarch64 AArch64 CCMP Pass
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...
void addAnalysisImplsPair(AnalysisID PI, Pass *P)
Pass * findImplPass(AnalysisID PI)
Find pass that is implementing PI.
PMDataManager & getPMDataManager()
AnalysisResolver(PMDataManager &P)
void clearAnalysisImpls()
Clear cache that is used to connect a pass to the analysis (PassInfo).
AnalysisResolver()=delete
Pass * getAnalysisIfAvailable(AnalysisID ID) const
Return analysis result or null if it doesn't exist.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequiredID(const void *ID)
const VectorType & getRequiredSet() const
AnalysisUsage & addRequiredTransitiveID(char &ID)
AnalysisUsage & addPreservedID(char &ID)
AnalysisUsage & addPreservedID(const void *ID)
AnalysisUsage & addUsedIfAvailableID(const void *ID)
AnalysisUsage & addUsedIfAvailableID(char &ID)
const VectorType & getRequiredTransitiveSet() const
AnalysisUsage & addUsedIfAvailable()
Add the specified Pass class to the set of analyses used by this pass.
const VectorType & getUsedSet() const
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
void setPreservesAll()
Set by analyses that do not transform their input at all.
bool getPreservesAll() const
Determine whether a pass said it does not transform its input at all.
const VectorType & getPreservedSet() const
AnalysisUsage & addRequiredTransitive()
PMDataManager provides the common place to manage the analysis data used by pass managers.
Pass interface - Implemented by all 'passes'.
virtual void * getAdjustedAnalysisPointer(AnalysisID ID)
getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through...
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
AnalysisType & getAnalysisID(AnalysisID PI) const
AnalysisType * getAnalysisIfAvailable() const
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information tha...
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.