[LLVMdev] PassManager vs FunctionPassManager

Devang Patel dpatel at apple.com
Wed Jun 27 11:26:58 PDT 2007


On Jun 25, 2007, at 3:01 PM, Dan Gohman wrote:

> On Thu, Jun 21, 2007 at 04:37:14PM -0700, Devang Patel wrote:
>>
>> On Jun 21, 2007, at 4:13 PM, Dan Gohman wrote:
>>
>>> Right now, addPassesToEmitFile requires a FunctionPassManager. If  
>>> I'm
>>> working with code that uses a plain PassManager and want it to
>>> generate
>>> code, are there any options better than doing this:
>>
>> That's what FPPassManager does (include/llvm/PassManagers.h) .
>> Function pass manager itself is a module level pass.
>> FunctionPassManager is external stand alone interface hence it does
>> not derive from ModulePass.
>
> To be clear, I'm specifically talking about addPassesToEmitFile and
> other functions in include/llvm/Target/TargetMachine.h which, as
> currently written, require an actual FunctionPassManager. It doesn't
> look like FPPassManager is immediately useful here.
>
> Looking at this some more, I'm wondering if it would make sense to
> add a run(Module &) method to FunctionPassManager, for this purpose.

That is not  a good idea. The only reason FunctionPassManger exist
is that its user does not want to know that Modules exist somewhere. It
is available mainly for JIT who wants to process Functions on demand.

Instead add new method addPassesToEmitFIle in TargetMachine
that uses FPPassManager for your needs.

-
Devang



More information about the llvm-dev mailing list