[llvm-dev] [LTO] Bypass the integrated assembler ...

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 9 09:53:14 PDT 2016


> On Aug 9, 2016, at 9:24 AM, Kevin Choi via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> -Wl,--plugin=LLVMgold.so,--plugin-opt=emit-llvm

This is totally Gold specific. The fact that he mentions using LTOCodeGenerator makes me think that he does not use Gold.

> 
> http://llvm.org/docs/CommandGuide/opt.html <http://llvm.org/docs/CommandGuide/opt.html>
> http://llvm.org/docs/CommandGuide/llc.html <http://llvm.org/docs/CommandGuide/llc.html>
> 
> "The llc command compiles LLVM source inputs into assembly language for a specified architecture."
> 
> On 9 August 2016 at 04:16, Umesh Kalappa via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
> Hi Guys ,
> 
> We enabled the LTO on our code base and found that LTO uses the
> integrated/builtin assembler to emit the final optimized code .O
> (FileType= CGFT_ObjectFile) .
> 
> Can we bypass this semantic ,for something like you emit .S  file
> (FileType=CGFT_AssemblyFile),
> 
> Then we pass this  .S file to our native assembler and  the linker
> .....any switch/ options  do so ?
> 
> i.e  something like as we have   "-no-integrated-as" for clang driver .
> 
> Currently ,we thought of hacking the LTOCodeGenerator.cpp for the same .
> 
> The bottom-line is that ,we need to use our native assembler ,not the builtin .
> 
> Any thoughts on this ?

Unfortunately there is no “ready-to-use” way, clang has a driver that can dump intermediate file (here the .s) and invoke a chain of commands. The linker plugin is not designed this way, it is invoked by the linker and given the input bitcode will produce one or multiple object files for the linker.
What you want to do could be achieved by hacking the LTOCodeGenerator and do something like use posix_spawn and pipes to invoke your assembler.
Otherwise you can also do something like what Kevin had in mind: ask LTOCodeGenerator to produce the bitcode before the backend and exit the linker process at this point, then run llc on it to get the assembly, assemble it, and re-invoke the linker. This is probably less convenient if you need to integrate with a build system.

— 
Mehdi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160809/1f9de679/attachment.html>


More information about the llvm-dev mailing list