summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-06-27 23:50:11 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-06-27 23:50:11 +0000
commit92648c25a451bbb547ea22a88481bef9526d727b (patch)
treefb9efa637d2f2fcaf4e9b1c78a0780244e251e98 /llvm/include
parent53ed867da88baf0beb48038183f4b8a125c700b9 (diff)
downloadbcm5719-llvm-92648c25a451bbb547ea22a88481bef9526d727b.tar.gz
bcm5719-llvm-92648c25a451bbb547ea22a88481bef9526d727b.zip
Bitcode: Write the irsymtab to disk.
Differential Revision: https://reviews.llvm.org/D33973 llvm-svn: 306487
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Bitcode/BitcodeWriter.h20
-rw-r--r--llvm/include/llvm/Bitcode/LLVMBitCodes.h8
2 files changed, 25 insertions, 3 deletions
diff --git a/llvm/include/llvm/Bitcode/BitcodeWriter.h b/llvm/include/llvm/Bitcode/BitcodeWriter.h
index 7c3c4b2e0cb..f8b7fb341e8 100644
--- a/llvm/include/llvm/Bitcode/BitcodeWriter.h
+++ b/llvm/include/llvm/Bitcode/BitcodeWriter.h
@@ -28,18 +28,34 @@ namespace llvm {
std::unique_ptr<BitstreamWriter> Stream;
StringTableBuilder StrtabBuilder{StringTableBuilder::RAW};
- bool WroteStrtab = false;
+
+ // Owns any strings created by the irsymtab writer until we create the
+ // string table.
+ BumpPtrAllocator Alloc;
+
+ bool WroteStrtab = false, WroteSymtab = false;
void writeBlob(unsigned Block, unsigned Record, StringRef Blob);
+ std::vector<Module *> Mods;
+
public:
/// Create a BitcodeWriter that writes to Buffer.
BitcodeWriter(SmallVectorImpl<char> &Buffer);
~BitcodeWriter();
+ /// Attempt to write a symbol table to the bitcode file. This must be called
+ /// at most once after all modules have been written.
+ ///
+ /// A reader does not require a symbol table to interpret a bitcode file;
+ /// the symbol table is needed only to improve link-time performance. So
+ /// this function may decide not to write a symbol table. It may so decide
+ /// if, for example, the target is unregistered or the IR is malformed.
+ void writeSymtab();
+
/// Write the bitcode file's string table. This must be called exactly once
- /// after all modules have been written.
+ /// after all modules and the optional symbol table have been written.
void writeStrtab();
/// Copy the string table for another module into this bitcode file. This
diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
index 4e3e177cac8..5435e48ff42 100644
--- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -22,7 +22,7 @@
namespace llvm {
namespace bitc {
-// The only top-level block types are MODULE, IDENTIFICATION and STRTAB.
+// The only top-level block types are MODULE, IDENTIFICATION, STRTAB and SYMTAB.
enum BlockIDs {
// Blocks
MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID,
@@ -57,6 +57,8 @@ enum BlockIDs {
STRTAB_BLOCK_ID,
FULL_LTO_GLOBALVAL_SUMMARY_BLOCK_ID,
+
+ SYMTAB_BLOCK_ID,
};
/// Identification block contains a string that describes the producer details,
@@ -571,6 +573,10 @@ enum StrtabCodes {
STRTAB_BLOB = 1,
};
+enum SymtabCodes {
+ SYMTAB_BLOB = 1,
+};
+
} // End bitc namespace
} // End llvm namespace
OpenPOWER on IntegriCloud