mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-12 06:06:32 +00:00
- Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's. - Pass::getAnalysis<> now no longer takes an optional argument git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c6b227ecc4
commit
5791bb70b1
@ -114,9 +114,15 @@ protected:
|
||||
// getAnalysisUsage function.
|
||||
//
|
||||
template<typename AnalysisType>
|
||||
AnalysisType &getAnalysis(AnalysisID AID = AnalysisType::ID) {
|
||||
AnalysisType &getAnalysis() {
|
||||
assert(Resolver && "Pass not resident in a PassManager object!");
|
||||
return *(AnalysisType*)Resolver->getAnalysis(AID);
|
||||
return *(AnalysisType*)Resolver->getAnalysis(AnalysisType::ID);
|
||||
}
|
||||
|
||||
template<typename AnalysisType>
|
||||
AnalysisType &getAnalysisID(const PassInfo *PI) {
|
||||
assert(Resolver && "Pass not resident in a PassManager object!");
|
||||
return *(AnalysisType*)Resolver->getAnalysis(PI);
|
||||
}
|
||||
|
||||
// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
|
||||
@ -126,9 +132,9 @@ protected:
|
||||
// provide the capability to update an analysis that exists.
|
||||
//
|
||||
template<typename AnalysisType>
|
||||
AnalysisType *getAnalysisToUpdate(AnalysisID AID = AnalysisType::ID) {
|
||||
AnalysisType *getAnalysisToUpdate() {
|
||||
assert(Resolver && "Pass not resident in a PassManager object!");
|
||||
return (AnalysisType*)Resolver->getAnalysisToUpdate(AID);
|
||||
return (AnalysisType*)Resolver->getAnalysisToUpdate(AnalysisType::ID);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,28 +30,38 @@ class AnalysisUsage {
|
||||
public:
|
||||
AnalysisUsage() : PreservesAll(false) {}
|
||||
|
||||
// addRequires - Add the specified ID to the required set of the usage info
|
||||
// addRequired - Add the specified ID to the required set of the usage info
|
||||
// for a pass.
|
||||
//
|
||||
AnalysisUsage &addRequired(AnalysisID ID) {
|
||||
AnalysisUsage &addRequiredID(AnalysisID ID) {
|
||||
Required.push_back(ID);
|
||||
return *this;
|
||||
}
|
||||
template<class PassClass>
|
||||
AnalysisUsage &addRequired() {
|
||||
Required.push_back(PassClass::ID);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// addPreserves - Add the specified ID to the set of analyses preserved by
|
||||
// addPreserved - Add the specified ID to the set of analyses preserved by
|
||||
// this pass
|
||||
//
|
||||
AnalysisUsage &addPreserved(AnalysisID ID) {
|
||||
AnalysisUsage &addPreservedID(AnalysisID ID) {
|
||||
Preserved.push_back(ID);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// PreservesAll - Set by analyses that do not transform their input at all
|
||||
template<class PassClass>
|
||||
AnalysisUsage &addPreserved() {
|
||||
Preserved.push_back(PassClass::ID);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// setPreservesAll - Set by analyses that do not transform their input at all
|
||||
void setPreservesAll() { PreservesAll = true; }
|
||||
bool preservesAll() const { return PreservesAll; }
|
||||
|
||||
// preservesCFG - This function should be called to by the pass, iff they do
|
||||
// not:
|
||||
// preservesCFG - This function should be called by the pass, iff they do not:
|
||||
//
|
||||
// 1. Add or remove basic blocks from the function
|
||||
// 2. Modify terminator instructions in any way.
|
||||
|
Loading…
Reference in New Issue
Block a user