[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-dev
Subject: Re: [LLVMdev] addPassesToEmit(Whole)File changes?
From: Marcel Weiher <marcel () metaobject ! com>
Date: 2007-01-22 7:40:04
Message-ID: 54F5B373-8B78-440C-8BD6-88998066E222 () metaobject ! com
[Download RAW message or body]
On Jan 21, 2007, at 20:41 , Chris Lattner wrote:
> On Sun, 21 Jan 2007, Marcel Weiher wrote:
>> [troubles with 1.9 changes]
>
> Right, you want to use addPassesToEmitFile if you want the native code
> generators to work.
Ahh...thanks for the quick response! Sad that the nice high-level
functionality is gone and I now have to do it manually.
> The proper incantations can be found in tools/llc/llc.cpp.
OK, I guess I should look more at the tools. Had been looking mostly
at the examples, but those only take you so far.
> You should do something like this:
>
> // Build up all of the passes that we want to do to the module.
> FunctionPassManager Passes(new
> ExistingModuleProvider(M.get()));
> Passes.add(new TargetData(*Target.getTargetData()));
>
> // Ask the target to add backend passes as necessary.
> if (Target.addPassesToEmitFile(Passes, *Out, FileType, Fast)) {
> std::cerr << argv[0] << ": target does not support
> generation of this"
> << " file type!\n";
> if (Out != &std::cout) delete Out;
> // And the Out file is empty and useless, so remove it now.
> sys::Path(OutputFilename).eraseFromDisk();
> return 1;
> }
>
> Passes.doInitialization();
>
> // Run our queue of passes all at once now, efficiently.
> for (Module::iterator I = mod.begin(), E = mod.end(); I != E;
> ++I)
> if (!I->isExternal())
> Passes.run(*I);
>
> Passes.doFinalization();
>
> The doInitialization/doFinalization methods handle the global data.
Ahh, OK. Thanks again for the help!
Marcel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic