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

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


bhavani krishnan wrote:
> Thanks John! My pass is registered only in 1 cpp file. It registers and executes fine without the EE.
>
> I only get the Pass registered multiple times error when I try to link to the EE by using LINK_COMPONENTS=engine in the Makefile. Without that line in the Makefile, my pass gets registered fine but it is not able to create EE(Error reading Symbol). So, how do I link LLVMExecutionEngine.o without causing the multiple registration error.
>   
Just to make sure we've covered all the obvious stuff, are you sure that 
the name of your pass (the name you use when you execute it with the opt 
command) is unique?  Is the class name of your pass unique?

-- John T.

> thanks,
> Bhavani
>
> --- On Mon, 10/27/08, John Criswell <criswell at cs.uiuc.edu> wrote:
>
>   
>> From: John Criswell <criswell at cs.uiuc.edu>
>> Subject: Re: [LLVMdev] Is it possible to use EE within optimization pass?
>> To: "bhavi63 at yahoo.com" <bhavi63 at yahoo.com>, "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
>> Date: Monday, October 27, 2008, 3:01 PM
>> 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