mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
1) Remove old AnalysisResolver.
2) Rename AnalysisResolver_New as AnalysisResolver git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b31b2dea6
commit
cde53d3c1e
@ -49,7 +49,7 @@ template<class Trait> class PassManagerT;
|
||||
class BasicBlockPassManager;
|
||||
class FunctionPassManagerT;
|
||||
class ModulePassManager;
|
||||
class AnalysisResolver_New;
|
||||
class AnalysisResolver;
|
||||
|
||||
// AnalysisID - Use the PassInfo to identify a pass...
|
||||
typedef const PassInfo* AnalysisID;
|
||||
@ -60,7 +60,7 @@ typedef const PassInfo* AnalysisID;
|
||||
/// constrained passes described below.
|
||||
///
|
||||
class Pass {
|
||||
AnalysisResolver_New *Resolver_New; // Used to resolve analysis
|
||||
AnalysisResolver *Resolver; // Used to resolve analysis
|
||||
const PassInfo *PassInfoCache;
|
||||
|
||||
// AnalysisImpls - This keeps track of which passes implement the interfaces
|
||||
@ -71,7 +71,7 @@ class Pass {
|
||||
void operator=(const Pass&); // DO NOT IMPLEMENT
|
||||
Pass(const Pass &); // DO NOT IMPLEMENT
|
||||
public:
|
||||
Pass() : Resolver_New(0), PassInfoCache(0) {}
|
||||
Pass() : Resolver(0), PassInfoCache(0) {}
|
||||
virtual ~Pass() {} // Destructor is virtual so we can be subclassed
|
||||
|
||||
/// getPassName - Return a nice clean name for a pass. This usually
|
||||
@ -104,9 +104,9 @@ public:
|
||||
void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); }
|
||||
void dump() const; // dump - call print(std::cerr, 0);
|
||||
|
||||
// Access AnalysisResolver_New
|
||||
inline void setResolver(AnalysisResolver_New *AR) { Resolver_New = AR; }
|
||||
inline AnalysisResolver_New *getResolver() { return Resolver_New; }
|
||||
// Access AnalysisResolver
|
||||
inline void setResolver(AnalysisResolver *AR) { Resolver = AR; }
|
||||
inline AnalysisResolver *getResolver() { return Resolver; }
|
||||
|
||||
/// getAnalysisUsage - This function should be overriden by passes that need
|
||||
/// analysis information to do their job. If a pass specifies that it uses a
|
||||
|
@ -106,12 +106,12 @@ public:
|
||||
// the pass.
|
||||
//
|
||||
class PMDataManager;
|
||||
class AnalysisResolver_New {
|
||||
class AnalysisResolver {
|
||||
private:
|
||||
AnalysisResolver_New(); // DO NOT IMPLEMENT
|
||||
AnalysisResolver(); // DO NOT IMPLEMENT
|
||||
|
||||
public:
|
||||
AnalysisResolver_New(PMDataManager &P) : PM(P) { }
|
||||
AnalysisResolver(PMDataManager &P) : PM(P) { }
|
||||
|
||||
inline PMDataManager &getPMDataManager() { return PM; }
|
||||
|
||||
@ -137,7 +137,7 @@ public:
|
||||
|
||||
// AnalysisImpls - This keeps track of which passes implements the interfaces
|
||||
// that are required by the current pass (to implement getAnalysis()).
|
||||
// NOTE : Remove AnalysisImpls from class Pass, when AnalysisResolver_New
|
||||
// NOTE : Remove AnalysisImpls from class Pass, when AnalysisResolver
|
||||
// replaces AnalysisResolver
|
||||
std::vector<std::pair<const PassInfo*, Pass*> > AnalysisImpls;
|
||||
|
||||
@ -146,37 +146,6 @@ private:
|
||||
PMDataManager &PM;
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AnalysisResolver - Simple interface implemented by PassManager objects that
|
||||
// is used to pull analysis information out of them.
|
||||
//
|
||||
struct AnalysisResolver {
|
||||
virtual ~AnalysisResolver();
|
||||
virtual Pass *getAnalysisOrNullUp(AnalysisID ID) const = 0;
|
||||
virtual Pass *getAnalysisOrNullDown(AnalysisID ID) const = 0;
|
||||
virtual void addPass(ImmutablePass *IP, AnalysisUsage &AU) = 0;
|
||||
Pass *getAnalysis(AnalysisID ID) const {
|
||||
Pass *Result = getAnalysisOrNullUp(ID);
|
||||
assert(Result && "Pass has an incorrect analysis uses set!");
|
||||
return Result;
|
||||
}
|
||||
|
||||
// getAnalysisToUpdate - Return an analysis result or null if it doesn't exist
|
||||
Pass *getAnalysisToUpdate(AnalysisID ID) const {
|
||||
return getAnalysisOrNullUp(ID);
|
||||
}
|
||||
|
||||
// Methods for introspecting into pass manager objects...
|
||||
virtual unsigned getDepth() const = 0;
|
||||
virtual unsigned getNumContainedPasses() const = 0;
|
||||
virtual const Pass *getContainedPass(unsigned N) const = 0;
|
||||
|
||||
virtual void markPassUsed(AnalysisID P, Pass *User) = 0;
|
||||
|
||||
void startPass(Pass *P) {}
|
||||
void endPass(Pass *P) {}
|
||||
};
|
||||
|
||||
/// 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
|
||||
@ -187,12 +156,12 @@ struct AnalysisResolver {
|
||||
///
|
||||
template<typename AnalysisType>
|
||||
AnalysisType *Pass::getAnalysisToUpdate() const {
|
||||
assert(Resolver_New && "Pass not resident in a PassManager object!");
|
||||
assert(Resolver && "Pass not resident in a PassManager object!");
|
||||
|
||||
const PassInfo *PI = getClassPassInfo<AnalysisType>();
|
||||
if (PI == 0) return 0;
|
||||
return dynamic_cast<AnalysisType*>
|
||||
(Resolver_New->getAnalysisToUpdate(PI, true));
|
||||
(Resolver->getAnalysisToUpdate(PI, true));
|
||||
}
|
||||
|
||||
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
|
||||
@ -201,7 +170,7 @@ AnalysisType *Pass::getAnalysisToUpdate() const {
|
||||
///
|
||||
template<typename AnalysisType>
|
||||
AnalysisType &Pass::getAnalysis() const {
|
||||
assert(Resolver_New &&"Pass has not been inserted into a PassManager object!");
|
||||
assert(Resolver &&"Pass has not been inserted into a PassManager object!");
|
||||
|
||||
return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>());
|
||||
}
|
||||
@ -209,11 +178,11 @@ AnalysisType &Pass::getAnalysis() const {
|
||||
template<typename AnalysisType>
|
||||
AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
|
||||
assert(PI && "getAnalysis for unregistered pass!");
|
||||
assert(Resolver_New&&"Pass has not been inserted into a PassManager object!");
|
||||
assert(Resolver&&"Pass has not been inserted into a PassManager object!");
|
||||
// PI *must* appear in AnalysisImpls. Because the number of passes used
|
||||
// should be a small number, we just do a linear search over a (dense)
|
||||
// vector.
|
||||
Pass *ResultPass = Resolver_New->findImplPass(PI);
|
||||
Pass *ResultPass = Resolver->findImplPass(PI);
|
||||
assert (ResultPass &&
|
||||
"getAnalysis*() called on an analysis that was not "
|
||||
"'required' by pass!");
|
||||
|
@ -22,13 +22,6 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AnalysisResolver Class Implementation
|
||||
//
|
||||
|
||||
AnalysisResolver::~AnalysisResolver() {
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Pass Implementation
|
||||
//
|
||||
@ -37,7 +30,7 @@ AnalysisResolver::~AnalysisResolver() {
|
||||
ModulePass::~ModulePass() { }
|
||||
|
||||
bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
|
||||
return Resolver_New->getAnalysisToUpdate(AnalysisID, true) != 0;
|
||||
return Resolver->getAnalysisToUpdate(AnalysisID, true) != 0;
|
||||
}
|
||||
|
||||
// dumpPassStructure - Implement the -debug-passes=Structure option
|
||||
|
@ -463,7 +463,7 @@ public:
|
||||
|
||||
// P is a immutable pass and it will be managed by this
|
||||
// top level manager. Set up analysis resolver to connect them.
|
||||
AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
|
||||
AnalysisResolver *AR = new AnalysisResolver(*this);
|
||||
P->setResolver(AR);
|
||||
initializeAnalysisImpl(P);
|
||||
addImmutablePass(IP);
|
||||
@ -571,7 +571,7 @@ public:
|
||||
|
||||
// P is a immutable pass and it will be managed by this
|
||||
// top level manager. Set up analysis resolver to connect them.
|
||||
AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
|
||||
AnalysisResolver *AR = new AnalysisResolver(*this);
|
||||
P->setResolver(AR);
|
||||
initializeAnalysisImpl(P);
|
||||
addImmutablePass(IP);
|
||||
@ -873,7 +873,7 @@ void PMDataManager::addPassToManager(Pass *P,
|
||||
|
||||
// This manager is going to manage pass P. Set up analysis resolver
|
||||
// to connect them.
|
||||
AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
|
||||
AnalysisResolver *AR = new AnalysisResolver(*this);
|
||||
P->setResolver(AR);
|
||||
|
||||
if (ProcessAnalysis) {
|
||||
@ -956,7 +956,7 @@ void PMDataManager::initializeAnalysisImpl(Pass *P) {
|
||||
Pass *Impl = findAnalysisPass(*I, true);
|
||||
if (Impl == 0)
|
||||
assert(0 && "Analysis used but not available!");
|
||||
AnalysisResolver_New *AR = P->getResolver();
|
||||
AnalysisResolver *AR = P->getResolver();
|
||||
AR->addAnalysisImplsPair(*I, Impl);
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P,
|
||||
//===----------------------------------------------------------------------===//
|
||||
// NOTE: Is this the right place to define this method ?
|
||||
// getAnalysisToUpdate - Return an analysis result or null if it doesn't exist
|
||||
Pass *AnalysisResolver_New::getAnalysisToUpdate(AnalysisID ID, bool dir) const {
|
||||
Pass *AnalysisResolver::getAnalysisToUpdate(AnalysisID ID, bool dir) const {
|
||||
return PM.findAnalysisPass(ID, dir);
|
||||
}
|
||||
|
||||
@ -1154,7 +1154,7 @@ FunctionPassManager::FunctionPassManager(ModuleProvider *P) {
|
||||
FPM->setTopLevelManager(FPM);
|
||||
|
||||
PMDataManager *PMD = dynamic_cast<PMDataManager *>(FPM);
|
||||
AnalysisResolver_New *AR = new AnalysisResolver_New(*PMD);
|
||||
AnalysisResolver *AR = new AnalysisResolver(*PMD);
|
||||
FPM->setResolver(AR);
|
||||
|
||||
MP = P;
|
||||
@ -1213,7 +1213,7 @@ bool FunctionPassManagerImpl::addPass(Pass *P) {
|
||||
|
||||
// This top level manager is going to manage activeManager.
|
||||
// Set up analysis resolver to connect them.
|
||||
AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
|
||||
AnalysisResolver *AR = new AnalysisResolver(*this);
|
||||
activeManager->setResolver(AR);
|
||||
|
||||
addPassManager(activeManager);
|
||||
@ -1520,7 +1520,7 @@ bool PassManagerImpl::addPass(Pass *P) {
|
||||
|
||||
// This top level manager is going to manage activeManager.
|
||||
// Set up analysis resolver to connect them.
|
||||
AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
|
||||
AnalysisResolver *AR = new AnalysisResolver(*this);
|
||||
activeManager->setResolver(AR);
|
||||
|
||||
addPassManager(activeManager);
|
||||
|
Loading…
Reference in New Issue
Block a user