[PATCH] D55080: [ThinLTO] Out-of-process CodeGenerator for legacy C API

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 29 14:56:10 PST 2018


steven_wu created this revision.
steven_wu added reviewers: dang, tejohnson, mehdi_amini, kromanova, dmikulin.
Herald added subscribers: jfb, dexonsmith, mgrang, jkorous, eraman, inglorion, mgorny.

Add an out-of-process ThinLTOCodeGenerator for legacy C API. Instead of
spawning threads and run codegen inside libLTO, OutOfProcess
CodeGenerator constructs clang invocations and uses "clang -fthinlto-index="
option to generate object files. The goal of this design is to enable
libLTO ThinLTOCodeGenerator to expose more information to the build
system so the build system can manage the system resource better.

The other goals/benefits for this design are:

- No linker change is needed using this model. libLTO is in charge of

constructing the job, waiting for the completion and handing back the results
to linker with the exact same API.

- Although this patch only comes with a proof-of-concept out-of-process

code generator which invokes clang locally, it can be easily extended. It
provides a ThinLTOCodegenManager abstraction, which provides customization
points to adapt to any protocol or system.

- It is currenlty using a cl::opt to switch between different ThinLTO

codegen mode which means user can easily toggle between different codegen
models.

Based on patch by Daniel Grumberg


Repository:
  rL LLVM

https://reviews.llvm.org/D55080

Files:
  include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
  include/llvm/LTO/legacy/ThinLTOOutOfProcessCodeGenerator.h
  lib/LTO/CMakeLists.txt
  lib/LTO/ThinLTOCodeGenerator.cpp
  lib/LTO/ThinLTOOutOfProcessCodeGenerator.cpp
  tools/lto/lto.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55080.175972.patch
Type: text/x-patch
Size: 59084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181129/d2b8f8ba/attachment.bin>


More information about the llvm-commits mailing list