IRgen: Change CodeGenPasses to be a PassManager, so it can have CallGraphSCC or

Module. Patch by Mike Gist!

llvm-svn: 114171
This commit is contained in:
Daniel Dunbar 2010-09-17 07:35:16 +00:00
parent 386fe51f64
commit 195fa00399
1 changed files with 5 additions and 11 deletions

View File

@ -42,14 +42,14 @@ class EmitAssemblyHelper {
Timer CodeGenerationTime;
mutable FunctionPassManager *CodeGenPasses;
mutable PassManager *CodeGenPasses;
mutable PassManager *PerModulePasses;
mutable FunctionPassManager *PerFunctionPasses;
private:
FunctionPassManager *getCodeGenPasses() const {
PassManager *getCodeGenPasses() const {
if (!CodeGenPasses) {
CodeGenPasses = new FunctionPassManager(TheModule);
CodeGenPasses = new PassManager();
CodeGenPasses->add(new TargetData(TheModule));
}
return CodeGenPasses;
@ -248,7 +248,7 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
TM->setMCRelaxAll(true);
// Create the code generator passes.
FunctionPassManager *PM = getCodeGenPasses();
PassManager *PM = getCodeGenPasses();
CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
switch (CodeGenOpts.OptimizationLevel) {
@ -320,13 +320,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action, raw_ostream *OS) {
if (CodeGenPasses) {
PrettyStackTraceString CrashInfo("Code generation");
CodeGenPasses->doInitialization();
for (Module::iterator I = TheModule->begin(),
E = TheModule->end(); I != E; ++I)
if (!I->isDeclaration())
CodeGenPasses->run(*I);
CodeGenPasses->doFinalization();
CodeGenPasses->run(*TheModule);
}
}