From db2f237956122fb54b45c988ed9cffeee48e17f9 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 17 Sep 2010 07:35:16 +0000 Subject: IRgen: Change CodeGenPasses to be a PassManager, so it can have CallGraphSCC or Module. Patch by Mike Gist! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114171 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'lib/CodeGen/BackendUtil.cpp') diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 69efe438cc..82b4b50b6a 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -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); } } -- cgit v1.2.3-18-g5258