From 0590f4264010a852dc22c9afa16a7df4d004c19a Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 11 Jan 2013 15:29:34 -0800 Subject: Replace DepLibs bitcode record with metadata It keeps the same Module interface as the existing/old deplibs feature, but populates the library list from the metadata after reading the bitcode/LL into the Module. Keeping the same module interface will allow us to keep the existing uses (e.g. in the gold plugin) as they are. Internally it still uses the LibraryList variable, but uses it basically as a cache backed by the metadata. BUG= Review URL: https://codereview.chromium.org/11615013 --- lib/Bitcode/Reader/BitcodeReader.cpp | 4 ++++ lib/Bitcode/Writer/BitcodeWriter.cpp | 3 +++ 2 files changed, 7 insertions(+) (limited to 'lib/Bitcode') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 6098c1d61c..95650c5260 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2999,6 +2999,8 @@ Module *llvm::getLazyBitcodeModule(MemoryBuffer *Buffer, R->materializeForwardReferencedFunctions(); + M->convertMetadataToLibraryList(); // @LOCALMOD + return M; } @@ -3020,6 +3022,8 @@ Module *llvm::getStreamedBitcodeModule(const std::string &name, R->materializeForwardReferencedFunctions(); + M->convertMetadataToLibraryList(); // @LOCALMOD + return M; } diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index ffe95d8f27..4ee63c486e 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1942,6 +1942,9 @@ void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out) { SmallVector Buffer; Buffer.reserve(256*1024); + // Convert Deplib info to metadata + M->convertLibraryListToMetadata(); // @LOCALMOD + // If this is darwin or another generic macho target, reserve space for the // header. Triple TT(M->getTargetTriple()); -- cgit v1.2.3-70-g09d2