mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-29 13:24:25 +00:00
* Move classes around
* rename constructor function * Move stuff into anonymous namespaces git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2007 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -32,6 +32,7 @@ using namespace std;
|
|||||||
|
|
||||||
using cfg::DominanceFrontier;
|
using cfg::DominanceFrontier;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
//instance of the promoter -- to keep all the local method data.
|
//instance of the promoter -- to keep all the local method data.
|
||||||
// gets re-created for each method processed
|
// gets re-created for each method processed
|
||||||
@ -67,28 +68,7 @@ class PromoteInstance
|
|||||||
operator bool () { return didchange; }
|
operator bool () { return didchange; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class PromotePass : public MethodPass {
|
} // end of anonymous namespace
|
||||||
public:
|
|
||||||
|
|
||||||
// runOnMethod - To run this pass, first we calculate the alloca instructions
|
|
||||||
// that are safe for promotion, then we promote each one.
|
|
||||||
//
|
|
||||||
virtual bool runOnMethod(Method *M)
|
|
||||||
{
|
|
||||||
PromoteInstance inst(M, getAnalysis<DominanceFrontier>());
|
|
||||||
return (bool)inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// getAnalysisUsageInfo - We need dominance frontiers
|
|
||||||
//
|
|
||||||
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
|
|
||||||
Pass::AnalysisSet &Destroyed,
|
|
||||||
Pass::AnalysisSet &Provided) {
|
|
||||||
Requires.push_back(DominanceFrontier::ID);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// findSafeAllocas - Find allocas that are safe to promote
|
// findSafeAllocas - Find allocas that are safe to promote
|
||||||
//
|
//
|
||||||
@ -127,13 +107,6 @@ void PromoteInstance::findSafeAllocas(Method *M)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// newPromoteMemoryToRegister - Provide an entry point to create this pass.
|
|
||||||
//
|
|
||||||
Pass *newPromoteMemoryToRegister() {
|
|
||||||
return new PromotePass();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PromoteInstance::PromoteMethod(Method *M, DominanceFrontier & DF) {
|
bool PromoteInstance::PromoteMethod(Method *M, DominanceFrontier & DF) {
|
||||||
// Calculate the set of safe allocas
|
// Calculate the set of safe allocas
|
||||||
findSafeAllocas(M);
|
findSafeAllocas(M);
|
||||||
@ -333,3 +306,37 @@ bool PromoteInstance::queuePhiNode(BasicBlock *bb, int i /*the alloca*/)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
class PromotePass : public MethodPass {
|
||||||
|
public:
|
||||||
|
|
||||||
|
// runOnMethod - To run this pass, first we calculate the alloca
|
||||||
|
// instructions that are safe for promotion, then we promote each one.
|
||||||
|
//
|
||||||
|
virtual bool runOnMethod(Method *M)
|
||||||
|
{
|
||||||
|
PromoteInstance inst(M, getAnalysis<DominanceFrontier>());
|
||||||
|
return (bool)inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// getAnalysisUsageInfo - We need dominance frontiers
|
||||||
|
//
|
||||||
|
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
|
||||||
|
Pass::AnalysisSet &Destroyed,
|
||||||
|
Pass::AnalysisSet &Provided) {
|
||||||
|
Requires.push_back(DominanceFrontier::ID);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// createPromoteMemoryToRegister - Provide an entry point to create this pass.
|
||||||
|
//
|
||||||
|
Pass *createPromoteMemoryToRegister() {
|
||||||
|
return new PromotePass();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user