mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Make getAnalysisToUpdate<AnalysisType>() public so that transformation APIs
can update analysis information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3584 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
480e2efb2e
commit
f9bbe214fd
@ -125,6 +125,22 @@ public:
|
|||||||
// or null if it is not known.
|
// or null if it is not known.
|
||||||
static const PassInfo *lookupPassInfo(const std::type_info &TI);
|
static const PassInfo *lookupPassInfo(const std::type_info &TI);
|
||||||
|
|
||||||
|
/// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
|
||||||
|
/// to get to the analysis information that might be around that needs to be
|
||||||
|
/// updated. This is different than getAnalysis in that it can fail (ie the
|
||||||
|
/// analysis results haven't been computed), so should only be used if you
|
||||||
|
/// provide the capability to update an analysis that exists. This method is
|
||||||
|
/// often used by transformation APIs to update analysis results for a pass
|
||||||
|
/// automatically as the transform is performed.
|
||||||
|
///
|
||||||
|
template<typename AnalysisType>
|
||||||
|
AnalysisType *getAnalysisToUpdate() const {
|
||||||
|
assert(Resolver && "Pass not resident in a PassManager object!");
|
||||||
|
const PassInfo *PI = getClassPassInfo<AnalysisType>();
|
||||||
|
if (PI == 0) return 0;
|
||||||
|
return dynamic_cast<AnalysisType*>(Resolver->getAnalysisToUpdate(PI));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
|
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
|
||||||
@ -167,21 +183,6 @@ protected:
|
|||||||
return *Result;
|
return *Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
|
|
||||||
/// to get to the analysis information that might be around that needs to be
|
|
||||||
/// updated. This is different than getAnalysis in that it can fail (ie the
|
|
||||||
/// analysis results haven't been computed), so should only be used if you
|
|
||||||
/// provide the capability to update an analysis that exists.
|
|
||||||
///
|
|
||||||
template<typename AnalysisType>
|
|
||||||
AnalysisType *getAnalysisToUpdate() const {
|
|
||||||
assert(Resolver && "Pass not resident in a PassManager object!");
|
|
||||||
const PassInfo *PI = getClassPassInfo<AnalysisType>();
|
|
||||||
if (PI == 0) return 0;
|
|
||||||
return dynamic_cast<AnalysisType*>(Resolver->getAnalysisToUpdate(PI));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PassManagerT<Module>;
|
friend class PassManagerT<Module>;
|
||||||
friend class PassManagerT<Function>;
|
friend class PassManagerT<Function>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user