mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-07 11:08:46 +00:00
Copy initializeAnalysisImpl() implementation from PassManagerT.
Update LastUser to recursively walk required transitive set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0d1bb1322c
commit
2f42ed6b0b
@ -72,7 +72,7 @@ public:
|
|||||||
// successfully use the getAnalysis() method to retrieve the
|
// successfully use the getAnalysis() method to retrieve the
|
||||||
// implementations it needs.
|
// implementations it needs.
|
||||||
//
|
//
|
||||||
inline void initializeAnalysisImpl(Pass *P) { /* TODO : Implement */ }
|
void initializeAnalysisImpl(Pass *P);
|
||||||
|
|
||||||
inline std::vector<Pass *>::iterator passVectorBegin() {
|
inline std::vector<Pass *>::iterator passVectorBegin() {
|
||||||
return PassVector.begin();
|
return PassVector.begin();
|
||||||
@ -82,7 +82,23 @@ public:
|
|||||||
return PassVector.end();
|
return PassVector.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setLastUser(Pass *P, Pass *LU) { LastUser[P] = LU; }
|
inline void setLastUser(Pass *P, Pass *LU) {
|
||||||
|
LastUser[P] = LU;
|
||||||
|
// TODO : Check if pass P is available.
|
||||||
|
|
||||||
|
// Prolong live range of analyses that are needed after an analysis pass
|
||||||
|
// is destroyed, for querying by subsequent passes
|
||||||
|
AnalysisUsage AnUsage;
|
||||||
|
P->getAnalysisUsage(AnUsage);
|
||||||
|
const std::vector<AnalysisID> &IDs = AnUsage.getRequiredTransitiveSet();
|
||||||
|
for (std::vector<AnalysisID>::const_iterator I = IDs.begin(),
|
||||||
|
E = IDs.end(); I != E; ++I) {
|
||||||
|
Pass *AnalysisPass = getAnalysisPass(*I); // getAnalysisPassFromManager(*I);
|
||||||
|
assert (AnalysisPass && "Analysis pass is not available");
|
||||||
|
setLastUser(AnalysisPass, LU);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Analysis required by the passes managed by this manager. This information
|
// Analysis required by the passes managed by this manager. This information
|
||||||
@ -258,6 +274,8 @@ void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) {
|
|||||||
// FIXME: What about duplicates ?
|
// FIXME: What about duplicates ?
|
||||||
RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(),
|
RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(),
|
||||||
RequiredSet.end());
|
RequiredSet.end());
|
||||||
|
|
||||||
|
initializeAnalysisImpl(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Augement AvailableAnalysis by adding analysis made available by pass P.
|
/// Augement AvailableAnalysis by adding analysis made available by pass P.
|
||||||
@ -329,6 +347,25 @@ void CommonPassManagerImpl::addPassToManager (Pass *P,
|
|||||||
PassVector.push_back(P);
|
PassVector.push_back(P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All Required analyses should be available to the pass as it runs! Here
|
||||||
|
// we fill in the AnalysisImpls member of the pass so that it can
|
||||||
|
// successfully use the getAnalysis() method to retrieve the
|
||||||
|
// implementations it needs.
|
||||||
|
//
|
||||||
|
void CommonPassManagerImpl::initializeAnalysisImpl(Pass *P) {
|
||||||
|
AnalysisUsage AnUsage;
|
||||||
|
P->getAnalysisUsage(AnUsage);
|
||||||
|
|
||||||
|
for (std::vector<const PassInfo *>::const_iterator
|
||||||
|
I = AnUsage.getRequiredSet().begin(),
|
||||||
|
E = AnUsage.getRequiredSet().end(); I != E; ++I) {
|
||||||
|
Pass *Impl = getAnalysisPass(*I);
|
||||||
|
if (Impl == 0)
|
||||||
|
assert(0 && "Analysis used but not available!");
|
||||||
|
// TODO: P->AnalysisImpls.push_back(std::make_pair(*I, Impl));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// BasicBlockPassManager implementation
|
/// BasicBlockPassManager implementation
|
||||||
|
|
||||||
/// Add pass P into PassVector and return true. If this pass is not
|
/// Add pass P into PassVector and return true. If this pass is not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user