[llvm-dev] Is there a way to pass Optimization passes to clang?
Mehdi Amini via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 4 10:21:26 PST 2015
> On Dec 4, 2015, at 10:18 AM, Phil Tomson via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
>
>
> On Wed, Dec 2, 2015 at 11:06 AM, David Chisnall <David.Chisnall at cl.cam.ac.uk <mailto:David.Chisnall at cl.cam.ac.uk>> wrote:
> On 2 Dec 2015, at 19:00, Phil Tomson <phil.a.tomson at gmail.com <mailto:phil.a.tomson at gmail.com>> wrote:
> >
> > I have a feeling this would get rather tricky given that there are several libraries linked in to the final executable as well. It would have to look something like:
> >
> > clang -c file.c -emit-llvm > opt -... > llc ... > as > ld (libs to link in)
>
> You don’t need as (llc can emit .o files).
>
> How do you get llc to emit a .o file (I seem to only be able to get it to output a .s file)?
$ llc --help | grep filetype -A 3
-filetype - Choose a file type (not all types are supported by all targets):
=asm - Emit an assembly ('.s') file
=obj - Emit a native object ('.o') file
=null - Emit nothing, for performance testing
—
Mehdi
>
> Hopefully, your build system has different CC / CXX / LD values, so the final link is separate too.
>
>
>
> > Someone above mentioned modifying PassManagerBuilder and rebuilding clang - I'd guess there's a list of optimization passes performed somewhere that PassManagerBuilder references, but I haven't been in the optimization pass area of LLVM much yet. Any pointers on that approach?
>
> You can take a look in BackendUtil.cpp for how the passes are constructed for clang. Note that it is quite complex and depends a lot on your language options...
>
> David
>
>
> _______________________________________________
> 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/20151204/ca2a2d42/attachment.html>
More information about the llvm-dev
mailing list