[PATCH] D129873: [clang-offload-bundler] Library-ize ClangOffloadBundler

Jacob Lambert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 15 09:09:07 PDT 2022


lamb-j created this revision.
Herald added a subscriber: mgorny.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a project: All.
lamb-j requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

Lifting the core functionalities of the clang-offload-bundler into a
user-facing library/API. This will allow online and JIT compilers to
bundle and unbundle files without spawning a new process.

This patch lifts the classes and functions used to implement 
the clang-offload-bundler into a separate OffloadBundler.cpp,
and defines three top-level API functions in OfflaodBundler.h.

  BundleFiles()
  UnbundleFiles()
  UnbundleArchives()

This patch also introduces a Config class that locally stores the
previously global cl::opt options and arrays to allow users to call
the APIs in a multi-threaded context, and introduces an
OffloadBundler class to encapsulate the top-level API functions.

We also  lift the BundlerExecutable variable, which is specific
to the clang-offload-bundler tool, from the API, and replace
its use with an ObjcopyPath variable. This variable must be set
in order to internally call llvm-objcopy.

Finally, we move the API files from
clang/tools/clang-offload-bundler into clang/lib/Driver and
clang/include/clang/Driver.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129873

Files:
  clang/include/clang/Driver/OffloadBundler.h
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/OffloadBundler.cpp
  clang/tools/clang-offload-bundler/CMakeLists.txt
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129873.445010.patch
Type: text/x-patch
Size: 98083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220715/77fb7d7d/attachment-0001.bin>


More information about the cfe-commits mailing list