[llvm-dev] big module for a project

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 11 20:08:36 PST 2016


> On Mar 11, 2016, at 7:24 PM, Yuxi Chen via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi John,
> 
> One more question, I try to use libLTO,  and try example ON http://llvm.org/docs/GoldPlugin.html. <http://llvm.org/docs/GoldPlugin.html.>
> For the example, it directly generates executable, what I want is a .o file(which I can use llvm-dis to see the bitcode). Maybe I misinterpret your solution. 

It depends what you want to do on the bitcode. I think the idea is to generate your own libLTO that includes your pass(es) as part of the LTO pipeline.

-- 
Mehdi



> 
> Or you want to say if I follow the instruction like http://llvm.org/docs/GoldPlugin.html. <http://llvm.org/docs/GoldPlugin.html.> After ./configure&&make&&make ckeck, I can get one module, containing as many functions as possible.
> 
> Best,
> Yuxi
> From: John Criswell [jtcriswel at gmail.com]
> Sent: Friday, March 11, 2016 11:26 AM
> To: Yuxi Chen; llvm-dev at lists.llvm.org
> Cc: llvmdev-bounces at cs.uiuc.edu; llvmdev at cs.uiuc.edu
> Subject: Re: [llvm-dev] big module for a project
> 
> Dear Yuxi,
> 
> There are three general ways to do this (two of which have already been mentioned).
> 
> First, you can change the Makefiles to emit bitcode and then use llvm-link to link all the bitcode files together into a big bitcode file.  You can then run the opt program on this large bitcode file.
> 
> Second, you can use some third-party tools (for lack of a better term) that will get you a single bitcode file with fewer changes to the Makefiles.  I'm not very familiar with these, but I think others have commented on them.
> 
> Third, you can add your analysis pass to the libLTO library and use LLVM's link-time optimization framework to run your analysis.  Documentation libLTO can be found athttp://llvm.org/docs/LinkTimeOptimization.html <http://llvm.org/docs/LinkTimeOptimization.html> and http://llvm.org/docs/GoldPlugin.html <http://llvm.org/docs/GoldPlugin.html>.  LLVM's LTO infrastructure is designed to be transparent (i.e., you shouldn't have to modify Makefiles to use it), though some programs' Makefiles are more...complaint than others.
> 
> I've used the libLTO approach for large programs with reasonable success.  However, some of the other third-party approaches have been reported to work well, so you might try looking at those.
> 
> Regards,
> 
> John Criswell
> 
> On 3/10/16 9:54 PM, Yuxi Chen via llvm-dev wrote:
>> Hi All,
>> 
>> I am using clang to compile Mysql source code. Because I want to do some inter-procedural analysis, hopefully, I want to get a .o(bitcode) file(a module) containing all possible function declarations and definitions. Is it possible to do that ? Or you guys have some suggestions?
>> 
>> To be clear, like Mysql, there is a mysqld routine, which is a major routine. I want to mysqld.o(which is generated by clang) to contain all possible function declarations and definitions. So when I do some analysis, I just need load one module, which is mysqld.o, instead of all .o files. 
>> 
>> 
>> Best,
>> Yuxi
>> 
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
> 
> 
> -- 
> John Criswell
> Assistant Professor
> Department of Computer Science, University of Rochester
> http://www.cs.rochester.edu/u/criswell <http://www.cs.rochester.edu/u/criswell>_______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160311/dd6d6782/attachment-0001.html>


More information about the llvm-dev mailing list