19 #ifndef LLVM_PASSANALYSISSUPPORT_H
20 #define LLVM_PASSANALYSISSUPPORT_H
43 VectorType Required, RequiredTransitive, Preserved;
53 template<
class PassClass>
59 template<
class PassClass>
78 template<
class PassClass>
108 return RequiredTransitive;
130 Pass *ResultPass =
nullptr;
131 for (
unsigned i = 0; i < AnalysisImpls.size() ; ++i) {
132 if (AnalysisImpls[i].first == PI) {
133 ResultPass = AnalysisImpls[i].second;
146 std::pair<AnalysisID, Pass*> pir = std::make_pair(PI,P);
147 AnalysisImpls.push_back(pir);
152 AnalysisImpls.clear();
161 std::vector<std::pair<AnalysisID, Pass*> > AnalysisImpls;
175 template<
typename AnalysisType>
177 assert(Resolver &&
"Pass not resident in a PassManager object!");
182 if (!ResultPass)
return nullptr;
195 template<
typename AnalysisType>
197 assert(Resolver &&
"Pass has not been inserted into a PassManager object!");
201 template<
typename AnalysisType>
203 assert(PI &&
"getAnalysis for unregistered pass!");
204 assert(Resolver&&
"Pass has not been inserted into a PassManager object!");
209 assert (ResultPass &&
210 "getAnalysis*() called on an analysis that was not "
211 "'required' by pass!");
224 template<
typename AnalysisType>
226 assert(Resolver &&
"Pass has not been inserted into a PassManager object!");
231 template<
typename AnalysisType>
233 assert(PI &&
"getAnalysis for unregistered pass!");
234 assert(Resolver &&
"Pass has not been inserted into a PassManager object!");
239 assert(ResultPass &&
"Unable to find requested analysis info");
Pass interface - Implemented by all 'passes'.
void push_back(const T &Elt)
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
AnalysisType & getAnalysisID(AnalysisID PI) const
const VectorType & getPreservedSet() const
AnalysisUsage & addRequired()
AnalysisType * getAnalysisIfAvailable() const
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information tha...
AnalysisUsage & addPreservedID(char &ID)
Pass * getAnalysisIfAvailable(AnalysisID ID, bool Direction) const
Return analysis result or null if it doesn't exist.
AnalysisUsage & addPreservedID(const void *ID)
AnalysisResolver(PMDataManager &P)
const VectorType & getRequiredTransitiveSet() const
Represent the analysis usage information of a pass.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
AnalysisUsage & addRequiredID(const void *ID)
bool getPreservesAll() const
Determine whether a pass said it does not transform its input at all.
SmallVector< AnalysisID, 32 > VectorType
void addAnalysisImplsPair(AnalysisID PI, Pass *P)
void setPreservesCFG()
This function should be called by the pass, iff they do not:
void clearAnalysisImpls()
Clear cache that is used to connect a pass to the the analysis (PassInfo).
Pass * findImplPass(AnalysisID PI)
Find pass that is implementing PI.
void setPreservesAll()
Set by analyses that do not transform their input at all.
const VectorType & getRequiredSet() const
PMDataManager & getPMDataManager()
AnalysisUsage & addRequiredTransitiveID(char &ID)
AnalysisUsage & addRequiredTransitive()
PMDataManager provides the common place to manage the analysis data used by pass managers.
virtual void * getAdjustedAnalysisPointer(AnalysisID ID)
getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through...
StringRef - Represent a constant reference to a string, i.e.