1 //===-- BitcodeWriterPass.h - Bitcode writing pass --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file provides a bitcode writing pass.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_BITCODE_BITCODEWRITERPASS_H
16 #define LLVM_BITCODE_BITCODEWRITERPASS_H
18 #include "llvm/ADT/StringRef.h"
24 class PreservedAnalyses;
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
29 ModulePass *createBitcodeWriterPass(raw_ostream &Str);
31 /// \brief Pass for writing a module of IR out to a bitcode file.
33 /// Note that this is intended for use with the new pass manager. To construct
34 /// a pass for the legacy pass manager, use the function above.
35 class BitcodeWriterPass {
39 /// \brief Construct a bitcode writer pass around a particular output stream.
40 explicit BitcodeWriterPass(raw_ostream &OS) : OS(OS) {}
42 /// \brief Run the bitcode writer pass, and output the module to the selected
44 PreservedAnalyses run(Module &M);
46 static StringRef name() { return "BitcodeWriterPass"; }