llvm.org GIT mirror llvm / 998051a
Using addPassesToEmitWholeFile is not a good idea here. Use FunctionPassManager to do the job. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30160 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 13 years ago
1 changed file(s) with 14 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
281281 // Make sure everything is still good.
282282 Passes.add(createVerifierPass());
283283
284 Target.addPassesToEmitWholeFile(Passes, Out, TargetMachine::AssemblyFile, true);
284 FunctionPassManager *CodeGenPasses =
285 new FunctionPassManager(new ExistingModuleProvider(M));
286
287 CodeGenPasses->add(new TargetData(*Target.getTargetData()));
288 Target.addPassesToEmitFile(*CodeGenPasses, Out, TargetMachine::AssemblyFile,
289 true);
285290
286291 // Run our queue of passes all at once now, efficiently.
287292 Passes.run(*M);
293
294 // Run the code generator, if present.
295 CodeGenPasses->doInitialization();
296 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
297 if (!I->isExternal())
298 CodeGenPasses->run(*I);
299 }
300 CodeGenPasses->doFinalization();
288301
289302 return LTO_OPT_SUCCESS;
290303 }