LLVM  3.7.0
BitcodeWriterPass.h
Go to the documentation of this file.
1 //===-- BitcodeWriterPass.h - Bitcode writing pass --------------*- 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 /// \file
10 ///
11 /// This file provides a bitcode writing pass.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_BITCODE_BITCODEWRITERPASS_H
16 #define LLVM_BITCODE_BITCODEWRITERPASS_H
17 
18 #include "llvm/ADT/StringRef.h"
19 
20 namespace llvm {
21 class Module;
22 class ModulePass;
23 class raw_ostream;
24 class PreservedAnalyses;
25 
26 /// \brief Create and return a pass that writes the module to the specified
27 /// ostream. Note that this pass is designed for use with the legacy pass
28 /// manager.
29 ///
30 /// If \c ShouldPreserveUseListOrder, encode use-list order so it can be
31 /// reproduced when deserialized.
32 ModulePass *createBitcodeWriterPass(raw_ostream &Str,
33  bool ShouldPreserveUseListOrder = false);
34 
35 /// \brief Pass for writing a module of IR out to a bitcode file.
36 ///
37 /// Note that this is intended for use with the new pass manager. To construct
38 /// a pass for the legacy pass manager, use the function above.
40  raw_ostream &OS;
41  bool ShouldPreserveUseListOrder;
42 
43 public:
44  /// \brief Construct a bitcode writer pass around a particular output stream.
45  ///
46  /// If \c ShouldPreserveUseListOrder, encode use-list order so it can be
47  /// reproduced when deserialized.
49  bool ShouldPreserveUseListOrder = false)
50  : OS(OS), ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
51 
52  /// \brief Run the bitcode writer pass, and output the module to the selected
53  /// output stream.
55 
56  static StringRef name() { return "BitcodeWriterPass"; }
57 };
58 
59 }
60 
61 #endif
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:114
ModulePass * createBitcodeWriterPass(raw_ostream &Str, bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified ostream.
BitcodeWriterPass(raw_ostream &OS, bool ShouldPreserveUseListOrder=false)
Construct a bitcode writer pass around a particular output stream.
An abstract set of preserved analyses following a transformation pass run.
Definition: PassManager.h:69
Pass for writing a module of IR out to a bitcode file.
static StringRef name()
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
PreservedAnalyses run(Module &M)
Run the bitcode writer pass, and output the module to the selected output stream. ...