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
61 bool PreservesAll =
false;
75 template<
class PassClass>
81 template<
class PassClass>
90 pushUnique(Preserved,
ID);
94 pushUnique(Preserved, &
ID);
98 template<
class PassClass>
100 pushUnique(Preserved, &PassClass::ID);
109 pushUnique(Used,
ID);
113 pushUnique(Used, &
ID);
117 template<
class PassClass>
119 pushUnique(Used, &PassClass::ID);
147 return RequiredTransitive;
167 Pass *ResultPass =
nullptr;
168 for (
const auto &AnalysisImpl : AnalysisImpls) {
169 if (AnalysisImpl.first == PI) {
170 ResultPass = AnalysisImpl.second;
184 std::pair<AnalysisID, Pass*> pir = std::make_pair(PI,
P);
185 AnalysisImpls.push_back(pir);
190 AnalysisImpls.clear();
199 std::vector<std::pair<AnalysisID, Pass *>> AnalysisImpls;
212template<
typename AnalysisType>
216 const void *PI = &AnalysisType::ID;
217 return (AnalysisType *)
Resolver->getAnalysisIfAvailable(PI);
223template<
typename AnalysisType>
225 assert(
Resolver &&
"Pass has not been inserted into a PassManager object!");
226 return getAnalysisID<AnalysisType>(&AnalysisType::ID);
229template<
typename AnalysisType>
231 assert(PI &&
"getAnalysis for unregistered pass!");
232 assert(
Resolver&&
"Pass has not been inserted into a PassManager object!");
238 "getAnalysis*() called on an analysis that was not "
239 "'required' by pass!");
240 return *(AnalysisType *)ResultPass;
248template <
typename AnalysisType>
250 assert(
Resolver &&
"Pass has not been inserted into a PassManager object!");
252 return getAnalysisID<AnalysisType>(&AnalysisType::ID,
F, Changed);
255template <
typename AnalysisType>
257 assert(PI &&
"getAnalysis for unregistered pass!");
258 assert(
Resolver &&
"Pass has not been inserted into a PassManager object!");
264 std::tie(ResultPass, LocalChanged) =
Resolver->findImplPass(
this, PI,
F);
266 assert(ResultPass &&
"Unable to find requested analysis info");
268 *Changed |= LocalChanged;
271 "A pass trigged a code update but the update status is lost");
272 return *(AnalysisType *)ResultPass;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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
LLVM_ABI Pass * getAnalysisIfAvailable(AnalysisID ID) const
Return analysis result or null if it doesn't exist.
Represent the analysis usage information of a pass.
LLVM_ABI AnalysisUsage & addRequiredID(const void *ID)
const VectorType & getRequiredSet() const
LLVM_ABI 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.
LLVM_ABI 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'.
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.