1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/include/llvm/Bytecode/WriteBytecodePass.h

35 lines
893 B
C
Raw Normal View History

2001-10-18 22:31:42 +02:00
//===- llvm/Bytecode/WriteBytecodePass.h - Bytecode Writer Pass --*- C++ -*--=//
//
// This file defines a simple pass to write the working module to a file after
// pass processing is completed.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_BYTECODE_WRITEBYTECODEPASS_H
#define LLVM_BYTECODE_WRITEBYTECODEPASS_H
#include "llvm/Pass.h"
#include "llvm/Bytecode/Writer.h"
class WriteBytecodePass : public Pass {
std::ostream *Out; // ostream to print on
2001-10-18 22:31:42 +02:00
bool DeleteStream;
public:
inline WriteBytecodePass(std::ostream *o = &std::cout, bool DS = false)
2001-10-18 22:31:42 +02:00
: Out(o), DeleteStream(DS) {
}
const char *getPassName() const { return "Bytecode Writer"; }
2001-10-18 22:31:42 +02:00
inline ~WriteBytecodePass() {
if (DeleteStream) delete Out;
}
bool run(Module &M) {
WriteBytecodeToFile(&M, *Out);
2001-10-18 22:31:42 +02:00
return false;
}
};
#endif