[PATCH] D146776: [llvm] Preliminary fat-lto-objects support
Paul Kirth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 17:54:39 PDT 2023
paulkirth created this revision.
paulkirth added reviewers: phosek, tejohnson, MaskRay, alexander-shaposhnikov.
Herald added subscribers: hiraditya, inglorion.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fat LTO objects contain both LTO compatible IR, as well as generated
object code. This allows users to defer the choice of whether to use LTO
or not to link-time. This is a feature available in GCC for some time,
and makes the existing -ffat-lto-objects flag functional in the same
way as GCC's.
Within LLVM, we add a new EmbedBitcodePass that serializes the module to
the object file, and expose a new pass pipeline for compiling fat
objects. The new pipeline initially runs the selected (Thin)LTOPrelink
pipeline, after which it will serialize the module into a `.llvm.lto`
section of an ELF file. When compiling for (Thin)LTO, this normally the
point at which the compiler would emit a object file containing the
bitcode and metadata.
After that point we use the PerModuleDefaultPipeline to optimize the
module as close as we can to a normal compilation pipleine used at e.g.,
`-O2` or `-O3`. We generate standard object files at the end of this
pipeline, which contain machine code. This finalized output will also
contain the previously mentioned `.llvm.lto` section containing the
bitcode.
Original RFC: https://discourse.llvm.org/t/rfc-ffat-lto-objects-support/63977
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146776
Files:
llvm/include/llvm/Bitcode/EmbedBitcodePass.h
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/Bitcode/Writer/CMakeLists.txt
llvm/lib/Bitcode/Writer/EmbedBitcodePass.cpp
llvm/lib/Object/ObjectFile.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/lib/Passes/PassRegistry.def
llvm/test/Bitcode/embed-multiple.ll
llvm/test/Bitcode/embed-unsupported-object-format.ll
llvm/test/Bitcode/embed.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146776.507930.patch
Type: text/x-patch
Size: 11206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230324/04d426aa/attachment.bin>
More information about the llvm-commits
mailing list