[LLVMdev] Is it possible to use EE within optimization pass?

John Criswell criswell at cs.uiuc.edu
Mon Oct 27 08:01:08 PDT 2008


bhavani krishnan wrote:
> Hi all,
>
> I am repeating my question from yesterday coz I need to find a solution to this ASAP. 
>
> How do I link the executionengine to an optimization pass. If I use LINK_COMPONENTS=engine in the Makefile, I get the Pass registered multiple times error. And if i dont use anything, it is not able to load the EE. It gives error loading symbol error. So,
> 1. Is it possible to use the EE within an optimization pass?
> 2. If it is possible, how do I do it?
>   
I have a hunch that I know what your problem is.

You said that your pass is getting registered twice.  Are you sure that 
your RegisterPass declaration is only being called once?  A common error 
is to put the RegisterPass<MyPass> Foo variable inside a header file 
that gets included by multiple .cpp files implementing your pass (I'm 
assuming you've written a custom pass here).  This will cause your pass 
to get registered multiple times, which will make the LLVM pass manager 
unhappy.

I believe this is because the RegisterPass<> constructor does pass 
registration, so if it's declared multiple times, it registers the pass 
multiple times.

To fix it, put RegisterPass<YourPassName> inside one of the .cpp files 
implementing your pass.

Regarding your more specific questions, I suspect that EE can be used 
with the Pass Manager to run optimization passes, but that's just a 
guess on my part; I have never done it myself.  I suspect the issue is 
just getting the right libraries listed in LINK_COMPONENTS and making 
sure your pass isn't registered twice.

Please let us know if the RegisterPass thing is the problem and whether 
the solution above fixes it.

Regards,

-- John T.


> Please help me out here!
> Thanks,
> Bhavani
>
>
>
>       
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list