1 //===- llvm/Bytecode/WriteBytecodePass.h - Bytecode Writer Pass -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a simple pass to write the working module to a file after
11 // pass processing is completed.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_BYTECODE_WRITEBYTECODEPASS_H
16 #define LLVM_BYTECODE_WRITEBYTECODEPASS_H
18 #include "llvm/Pass.h"
19 #include "llvm/Bytecode/Writer.h"
24 class WriteBytecodePass : public Pass {
25 std::ostream *Out; // ostream to print on
28 WriteBytecodePass() : Out(&std::cout), DeleteStream(false) {}
29 WriteBytecodePass(std::ostream *o, bool DS = false)
30 : Out(o), DeleteStream(DS) {
33 inline ~WriteBytecodePass() {
34 if (DeleteStream) delete Out;
38 WriteBytecodeToFile(&M, *Out);
43 } // End llvm namespace