summaryrefslogtreecommitdiff
path: root/include/llvm/Bitcode/BitcodeWriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Bitcode/BitcodeWriter.h')
-rw-r--r--include/llvm/Bitcode/BitcodeWriter.h42
1 files changed, 35 insertions, 7 deletions
diff --git a/include/llvm/Bitcode/BitcodeWriter.h b/include/llvm/Bitcode/BitcodeWriter.h
index f8b7fb341e88..c78077525c8b 100644
--- a/include/llvm/Bitcode/BitcodeWriter.h
+++ b/include/llvm/Bitcode/BitcodeWriter.h
@@ -1,4 +1,4 @@
-//===-- llvm/Bitcode/BitcodeWriter.h - Bitcode writers ----*- C++ -*-===//
+//===- llvm/Bitcode/BitcodeWriter.h - Bitcode writers -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,14 +14,20 @@
#ifndef LLVM_BITCODE_BITCODEWRITER_H
#define LLVM_BITCODE_BITCODEWRITER_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/MC/StringTableBuilder.h"
+#include "llvm/Support/Allocator.h"
+#include <map>
+#include <memory>
#include <string>
+#include <vector>
namespace llvm {
- class BitstreamWriter;
- class Module;
- class raw_ostream;
+
+class BitstreamWriter;
+class Module;
+class raw_ostream;
class BitcodeWriter {
SmallVectorImpl<char> &Buffer;
@@ -39,7 +45,7 @@ namespace llvm {
std::vector<Module *> Mods;
- public:
+ public:
/// Create a BitcodeWriter that writes to Buffer.
BitcodeWriter(SmallVectorImpl<char> &Buffer);
@@ -84,6 +90,16 @@ namespace llvm {
const ModuleSummaryIndex *Index = nullptr,
bool GenerateHash = false, ModuleHash *ModHash = nullptr);
+ /// Write the specified thin link bitcode file (i.e., the minimized bitcode
+ /// file) to the buffer specified at construction time. The thin link
+ /// bitcode file is used for thin link, and it only contains the necessary
+ /// information for thin link.
+ ///
+ /// ModHash is for use in ThinLTO incremental build, generated while the
+ /// IR bitcode file writing.
+ void writeThinLinkBitcode(const Module *M, const ModuleSummaryIndex &Index,
+ const ModuleHash &ModHash);
+
void writeIndex(
const ModuleSummaryIndex *Index,
const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex);
@@ -116,6 +132,17 @@ namespace llvm {
bool GenerateHash = false,
ModuleHash *ModHash = nullptr);
+ /// Write the specified thin link bitcode file (i.e., the minimized bitcode
+ /// file) to the given raw output stream, where it will be written in a new
+ /// bitcode block. The thin link bitcode file is used for thin link, and it
+ /// only contains the necessary information for thin link.
+ ///
+ /// ModHash is for use in ThinLTO incremental build, generated while the IR
+ /// bitcode file writing.
+ void WriteThinLinkBitcodeToFile(const Module *M, raw_ostream &Out,
+ const ModuleSummaryIndex &Index,
+ const ModuleHash &ModHash);
+
/// Write the specified module summary index to the given raw output stream,
/// where it will be written in a new bitcode block. This is used when
/// writing the combined index file for ThinLTO. When writing a subset of the
@@ -124,6 +151,7 @@ namespace llvm {
void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out,
const std::map<std::string, GVSummaryMapTy>
*ModuleToSummariesForIndex = nullptr);
-} // End llvm namespace
-#endif
+} // end namespace llvm
+
+#endif // LLVM_BITCODE_BITCODEWRITER_H