[PATCH] D26384: IR, Bitcode: Change bitcode reader to no longer own its memory buffer.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 20:34:24 PST 2016


pcc created this revision.
pcc added reviewers: dexonsmith, mehdi_amini.
pcc added a subscriber: llvm-commits.

Unique ownership is just one possible ownership pattern for the memory buffer
underlying the bitcode reader. In practice, as this patch shows, ownership can
often reside at a higher level. With the upcoming change to allow multiple
modules in a single bitcode file, it will no longer be appropriate for
modules to generally have unique ownership of their memory buffer.

The C API exposes the ownership relation via the LLVMGetBitcodeModuleInContext
and LLVMGetBitcodeModuleInContext2 functions, so we still need some way for
the module to own the memory buffer. This patch does so by adding an owned
memory buffer field to Module, and using it in a few other places where it
is convenient.


https://reviews.llvm.org/D26384

Files:
  clang/lib/CodeGen/CodeGenAction.cpp
  llvm/include/llvm/Bitcode/ReaderWriter.h
  llvm/include/llvm/IR/Module.h
  llvm/lib/Bitcode/Reader/BitReader.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IRReader/IRReader.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/LTO/LTOModule.cpp
  llvm/lib/Object/IRObjectFile.cpp
  llvm/tools/llvm-dis/llvm-dis.cpp
  llvm/unittests/Bitcode/BitReaderTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26384.77140.patch
Type: text/x-patch
Size: 23622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161108/91d3ed3f/attachment.bin>


More information about the llvm-commits mailing list