projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert r110396 to fix buildbots.
[oota-llvm.git]
/
include
/
llvm
/
PassAnalysisSupport.h
diff --git
a/include/llvm/PassAnalysisSupport.h
b/include/llvm/PassAnalysisSupport.h
index a99a1ae8711818bdd20dbcf4565823c24a0741a1..977d4f4e30d32894c5b8159f23f8259914cf566c 100644
(file)
--- a/
include/llvm/PassAnalysisSupport.h
+++ b/
include/llvm/PassAnalysisSupport.h
@@
-49,37
+49,34
@@
public:
// addRequired - Add the specified ID to the required set of the usage info
// for a pass.
//
// addRequired - Add the specified ID to the required set of the usage info
// for a pass.
//
- AnalysisUsage &addRequiredID(const void *ID);
- AnalysisUsage &addRequiredID(char &ID);
+ AnalysisUsage &addRequiredID(AnalysisID ID);
template<class PassClass>
AnalysisUsage &addRequired() {
template<class PassClass>
AnalysisUsage &addRequired() {
- return addRequiredID(Pass
Class::ID
);
+ return addRequiredID(Pass
::getClassPassInfo<PassClass>()
);
}
}
- AnalysisUsage &addRequiredTransitiveID(
char &
ID);
+ AnalysisUsage &addRequiredTransitiveID(
AnalysisID
ID);
template<class PassClass>
AnalysisUsage &addRequiredTransitive() {
template<class PassClass>
AnalysisUsage &addRequiredTransitive() {
- return addRequiredTransitiveID(PassClass::ID);
+ AnalysisID ID = Pass::getClassPassInfo<PassClass>();
+ return addRequiredTransitiveID(ID);
}
// addPreserved - Add the specified ID to the set of analyses preserved by
// this pass
//
}
// addPreserved - Add the specified ID to the set of analyses preserved by
// this pass
//
- AnalysisUsage &addPreservedID(
const void *
ID) {
+ AnalysisUsage &addPreservedID(
AnalysisID
ID) {
Preserved.push_back(ID);
return *this;
}
Preserved.push_back(ID);
return *this;
}
- AnalysisUsage &addPreservedID(char &ID) {
- Preserved.push_back(&ID);
- return *this;
- }
// addPreserved - Add the specified Pass class to the set of analyses
// preserved by this pass.
//
template<class PassClass>
AnalysisUsage &addPreserved() {
// addPreserved - Add the specified Pass class to the set of analyses
// preserved by this pass.
//
template<class PassClass>
AnalysisUsage &addPreserved() {
- Preserved.push_back(&PassClass::ID);
+ assert(Pass::getClassPassInfo<PassClass>() && "Pass class not registered!");
+ Preserved.push_back(Pass::getClassPassInfo<PassClass>());
return *this;
}
return *this;
}
@@
-88,7
+85,12
@@
public:
// This can be useful when a pass is trivially preserved, but may not be
// linked in. Be careful about spelling!
//
// This can be useful when a pass is trivially preserved, but may not be
// linked in. Be careful about spelling!
//
- AnalysisUsage &addPreserved(StringRef Arg);
+ AnalysisUsage &addPreserved(StringRef Arg) {
+ const PassInfo *PI = Pass::lookupPassInfo(Arg);
+ // If the pass exists, preserve it. Otherwise silently do nothing.
+ if (PI) Preserved.push_back(PI);
+ return *this;
+ }
// setPreservesAll - Set by analyses that do not transform their input at all
void setPreservesAll() { PreservesAll = true; }
// setPreservesAll - Set by analyses that do not transform their input at all
void setPreservesAll() { PreservesAll = true; }
@@
-128,7
+130,7
@@
public:
inline PMDataManager &getPMDataManager() { return PM; }
// Find pass that is implementing PI.
inline PMDataManager &getPMDataManager() { return PM; }
// Find pass that is implementing PI.
- Pass *findImplPass(
AnalysisID
PI) {
+ Pass *findImplPass(
const PassInfo *
PI) {
Pass *ResultPass = 0;
for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) {
if (AnalysisImpls[i].first == PI) {
Pass *ResultPass = 0;
for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) {
if (AnalysisImpls[i].first == PI) {
@@
-140,10
+142,10
@@
public:
}
// Find pass that is implementing PI. Initialize pass for Function F.
}
// Find pass that is implementing PI. Initialize pass for Function F.
- Pass *findImplPass(Pass *P,
AnalysisID
PI, Function &F);
+ Pass *findImplPass(Pass *P,
const PassInfo *
PI, Function &F);
- void addAnalysisImplsPair(
AnalysisID
PI, Pass *P) {
- std::pair<
AnalysisID
, Pass*> pir = std::make_pair(PI,P);
+ void addAnalysisImplsPair(
const PassInfo *
PI, Pass *P) {
+ std::pair<
const PassInfo*
, Pass*> pir = std::make_pair(PI,P);
AnalysisImpls.push_back(pir);
}
AnalysisImpls.push_back(pir);
}
@@
-158,7
+160,7
@@
public:
// AnalysisImpls - This keeps track of which passes implements the interfaces
// that are required by the current pass (to implement getAnalysis()).
// AnalysisImpls - This keeps track of which passes implements the interfaces
// that are required by the current pass (to implement getAnalysis()).
- std::vector<std::pair<
AnalysisID
, Pass*> > AnalysisImpls;
+ std::vector<std::pair<
const PassInfo*
, Pass*> > AnalysisImpls;
private:
// PassManager that is used to resolve analysis info
private:
// PassManager that is used to resolve analysis info
@@
-177,7
+179,8
@@
template<typename AnalysisType>
AnalysisType *Pass::getAnalysisIfAvailable() const {
assert(Resolver && "Pass not resident in a PassManager object!");
AnalysisType *Pass::getAnalysisIfAvailable() const {
assert(Resolver && "Pass not resident in a PassManager object!");
- const void *PI = &AnalysisType::ID;
+ const PassInfo *PI = getClassPassInfo<AnalysisType>();
+ if (PI == 0) return 0;
Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true);
if (ResultPass == 0) return 0;
Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true);
if (ResultPass == 0) return 0;
@@
-196,11
+199,11
@@
AnalysisType *Pass::getAnalysisIfAvailable() const {
template<typename AnalysisType>
AnalysisType &Pass::getAnalysis() const {
assert(Resolver && "Pass has not been inserted into a PassManager object!");
template<typename AnalysisType>
AnalysisType &Pass::getAnalysis() const {
assert(Resolver && "Pass has not been inserted into a PassManager object!");
- return getAnalysisID<AnalysisType>(
&AnalysisType::ID
);
+ return getAnalysisID<AnalysisType>(
getClassPassInfo<AnalysisType>()
);
}
template<typename AnalysisType>
}
template<typename AnalysisType>
-AnalysisType &Pass::getAnalysisID(
AnalysisID
PI) const {
+AnalysisType &Pass::getAnalysisID(
const PassInfo *
PI) const {
assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver&&"Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used
assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver&&"Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used
@@
-226,11
+229,11
@@
template<typename AnalysisType>
AnalysisType &Pass::getAnalysis(Function &F) {
assert(Resolver &&"Pass has not been inserted into a PassManager object!");
AnalysisType &Pass::getAnalysis(Function &F) {
assert(Resolver &&"Pass has not been inserted into a PassManager object!");
- return getAnalysisID<AnalysisType>(
&AnalysisType::ID
, F);
+ return getAnalysisID<AnalysisType>(
getClassPassInfo<AnalysisType>()
, F);
}
template<typename AnalysisType>
}
template<typename AnalysisType>
-AnalysisType &Pass::getAnalysisID(
AnalysisID
PI, Function &F) {
+AnalysisType &Pass::getAnalysisID(
const PassInfo *
PI, Function &F) {
assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver && "Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used
assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver && "Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used