[llvm] r176977 - Make LTO codegen use a PassManager, rather than a FunctionPassManager, for the
Lang Hames
lhames at gmail.com
Wed Mar 13 14:31:37 PDT 2013
In the long run I'd like to make this type safe. I feel like there should
be a way to do it, but I'm not familiar enough with the infrastructure to
be sure yet.
- Lang.
On Wed, Mar 13, 2013 at 2:30 PM, Lang Hames <lhames at gmail.com> wrote:
> That's the plan - I'm looking at that at the moment.
>
> - Lang.
>
>
> On Wed, Mar 13, 2013 at 2:29 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Wed, Mar 13, 2013 at 2:18 PM, Lang Hames <lhames at gmail.com> wrote:
>> > Author: lhames
>> > Date: Wed Mar 13 16:18:46 2013
>> > New Revision: 176977
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=176977&view=rev
>> > Log:
>> > Make LTO codegen use a PassManager, rather than a FunctionPassManager,
>> for the
>> > codegen passes. This brings it in to line with clang and llc's codegen
>> setup,
>> > and tidies up the code.
>> >
>> > If I understand correctly, adding ModulePasses to a FunctionPassManager
>> is
>> > bogus. It only seems to explode if an added ModulePass depends on a
>> > FunctionPass though, which might be why this code has survived so long.
>>
>> Worth putting in some asserts (or whatever else) to make this fail faster?
>>
>> >
>> > Fixes <rdar://problem/13386816>.
>> >
>> >
>> > Modified:
>> > llvm/trunk/tools/lto/LTOCodeGenerator.cpp
>> >
>> > Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=176977&r1=176976&r2=176977&view=diff
>> >
>> ==============================================================================
>> > --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
>> > +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Mar 13 16:18:46 2013
>> > @@ -390,14 +390,14 @@ bool LTOCodeGenerator::generateObjectFil
>> > // Make sure everything is still good.
>> > passes.add(createVerifierPass());
>> >
>> > - FunctionPassManager *codeGenPasses = new
>> FunctionPassManager(mergedModule);
>> > + PassManager codeGenPasses;
>> >
>> > - codeGenPasses->add(new DataLayout(*_target->getDataLayout()));
>> > - _target->addAnalysisPasses(*codeGenPasses);
>> > + codeGenPasses.add(new DataLayout(*_target->getDataLayout()));
>> > + _target->addAnalysisPasses(codeGenPasses);
>> >
>> > formatted_raw_ostream Out(out);
>> >
>> > - if (_target->addPassesToEmitFile(*codeGenPasses, Out,
>> > + if (_target->addPassesToEmitFile(codeGenPasses, Out,
>> > TargetMachine::CGFT_ObjectFile)) {
>> > errMsg = "target file type not supported";
>> > return true;
>> > @@ -407,15 +407,7 @@ bool LTOCodeGenerator::generateObjectFil
>> > passes.run(*mergedModule);
>> >
>> > // Run the code generator, and write assembly file
>> > - codeGenPasses->doInitialization();
>> > -
>> > - for (Module::iterator
>> > - it = mergedModule->begin(), e = mergedModule->end(); it != e;
>> ++it)
>> > - if (!it->isDeclaration())
>> > - codeGenPasses->run(*it);
>> > -
>> > - codeGenPasses->doFinalization();
>> > - delete codeGenPasses;
>> > + codeGenPasses.run(*mergedModule);
>> >
>> > return false; // success
>> > }
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130313/f7d3180e/attachment.html>
More information about the llvm-commits
mailing list