[ModuleUtils] Move EmbedBufferInModule to LLVMTransformsUtils
authorFangrui Song <i@maskray.me>
Tue, 1 Feb 2022 00:33:56 +0000 (16:33 -0800)
committerFangrui Song <i@maskray.me>
Tue, 1 Feb 2022 00:33:57 +0000 (16:33 -0800)
commit85dfe19b36ba6e9657612e072c9183ce168fdbbc
tree492c5666b7f5bef20fbef64113e33ff27f8277ac
parent4a780aa13ee5e1c8268de54ef946200a270127b9
[ModuleUtils] Move EmbedBufferInModule to LLVMTransformsUtils

D116542 adds EmbedBufferInModule which introduces a layer violation
(https://llvm.org/docs/CodingStandards.html#library-layering).
See 2d5f857a1eaf5f7a806d12953c79b96ed8952da8 for detail.

EmbedBufferInModule does not use BitcodeWriter functionality and should be moved
LLVMTransformsUtils. While here, change the function case to the prevailing
convention.

It seems that EmbedBufferInModule just follows the steps of
EmbedBitcodeInModule. EmbedBitcodeInModule calls WriteBitcodeToFile but has IR
update operations which ideally should be refactored to another library.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D118666
clang/lib/CodeGen/BackendUtil.cpp
llvm/include/llvm/Bitcode/BitcodeWriter.h
llvm/include/llvm/Transforms/Utils/ModuleUtils.h
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/Transforms/Utils/ModuleUtils.cpp
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel