LCOV - code coverage report
Current view: top level - include/llvm/Bitcode - BitcodeWriter.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2017-04-17 02:46:17 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- llvm/Bitcode/BitcodeWriter.h - Bitcode writers ----*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This header defines interfaces to write LLVM bitcode files/streams.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_BITCODE_BITCODEWRITER_H
      15             : #define LLVM_BITCODE_BITCODEWRITER_H
      16             : 
      17             : #include "llvm/IR/ModuleSummaryIndex.h"
      18             : #include <string>
      19             : 
      20             : namespace llvm {
      21             :   class BitstreamWriter;
      22             :   class Module;
      23             :   class raw_ostream;
      24             : 
      25        3228 :   class BitcodeWriter {
      26             :     SmallVectorImpl<char> &Buffer;
      27             :     std::unique_ptr<BitstreamWriter> Stream;
      28             : 
      29             :    public:
      30             :     /// Create a BitcodeWriter that writes to Buffer.
      31             :     BitcodeWriter(SmallVectorImpl<char> &Buffer);
      32             : 
      33             :     ~BitcodeWriter();
      34             : 
      35             :     /// Write the specified module to the buffer specified at construction time.
      36             :     ///
      37             :     /// If \c ShouldPreserveUseListOrder, encode the use-list order for each \a
      38             :     /// Value in \c M.  These will be reconstructed exactly when \a M is
      39             :     /// deserialized.
      40             :     ///
      41             :     /// If \c Index is supplied, the bitcode will contain the summary index
      42             :     /// (currently for use in ThinLTO optimization).
      43             :     ///
      44             :     /// \p GenerateHash enables hashing the Module and including the hash in the
      45             :     /// bitcode (currently for use in ThinLTO incremental build).
      46             :     ///
      47             :     /// If \p ModHash is non-null, when GenerateHash is true, the resulting
      48             :     /// hash is written into ModHash. When GenerateHash is false, that value
      49             :     /// is used as the hash instead of computing from the generated bitcode.
      50             :     /// Can be used to produce the same module hash for a minimized bitcode
      51             :     /// used just for the thin link as in the regular full bitcode that will
      52             :     /// be used in the backend.
      53             :     void writeModule(const Module *M, bool ShouldPreserveUseListOrder = false,
      54             :                      const ModuleSummaryIndex *Index = nullptr,
      55             :                      bool GenerateHash = false, ModuleHash *ModHash = nullptr);
      56             :   };
      57             : 
      58             :   /// \brief Write the specified module to the specified raw output stream.
      59             :   ///
      60             :   /// For streams where it matters, the given stream should be in "binary"
      61             :   /// mode.
      62             :   ///
      63             :   /// If \c ShouldPreserveUseListOrder, encode the use-list order for each \a
      64             :   /// Value in \c M.  These will be reconstructed exactly when \a M is
      65             :   /// deserialized.
      66             :   ///
      67             :   /// If \c Index is supplied, the bitcode will contain the summary index
      68             :   /// (currently for use in ThinLTO optimization).
      69             :   ///
      70             :   /// \p GenerateHash enables hashing the Module and including the hash in the
      71             :   /// bitcode (currently for use in ThinLTO incremental build).
      72             :   ///
      73             :   /// If \p ModHash is non-null, when GenerateHash is true, the resulting
      74             :   /// hash is written into ModHash. When GenerateHash is false, that value
      75             :   /// is used as the hash instead of computing from the generated bitcode.
      76             :   /// Can be used to produce the same module hash for a minimized bitcode
      77             :   /// used just for the thin link as in the regular full bitcode that will
      78             :   /// be used in the backend.
      79             :   void WriteBitcodeToFile(const Module *M, raw_ostream &Out,
      80             :                           bool ShouldPreserveUseListOrder = false,
      81             :                           const ModuleSummaryIndex *Index = nullptr,
      82             :                           bool GenerateHash = false,
      83             :                           ModuleHash *ModHash = nullptr);
      84             : 
      85             :   /// Write the specified module summary index to the given raw output stream,
      86             :   /// where it will be written in a new bitcode block. This is used when
      87             :   /// writing the combined index file for ThinLTO. When writing a subset of the
      88             :   /// index for a distributed backend, provide the \p ModuleToSummariesForIndex
      89             :   /// map.
      90             :   void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out,
      91             :                         const std::map<std::string, GVSummaryMapTy>
      92             :                             *ModuleToSummariesForIndex = nullptr);
      93             : } // End llvm namespace
      94             : 
      95             : #endif

Generated by: LCOV version 1.13