1 //===- llvm/Bytecode/WriteBytecodePass.h - Bytecode Writer Pass --*- C++ -*--=//
3 // This file defines a simple pass to write the working module to a file after
4 // pass processing is completed.
6 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_BYTECODE_WRITEBYTECODEPASS_H
9 #define LLVM_BYTECODE_WRITEBYTECODEPASS_H
11 #include "llvm/Pass.h"
12 #include "llvm/Bytecode/Writer.h"
15 class WriteBytecodePass : public Pass {
16 std::ostream *Out; // ostream to print on
19 inline WriteBytecodePass(std::ostream *o = &std::cout, bool DS = false)
20 : Out(o), DeleteStream(DS) {
23 const char *getPassName() const { return "Bytecode Writer"; }
25 inline ~WriteBytecodePass() {
26 if (DeleteStream) delete Out;
30 WriteBytecodeToFile(&M, *Out);