#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
-#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/FileUtilities.h"
#include <fstream>
using namespace llvm;
-static bool Bitcode = false;
-
namespace {
// ChildOutput - This option captures the name of the child output file that
std::ios::binary;
std::ofstream Out(Filename.c_str(), io_mode);
if (!Out.good()) return true;
- try {
- OStream L(Out);
- WriteBytecodeToFile(M ? M : Program, L, /*compression=*/false);
- } catch (...) {
- return true;
- }
+
+ WriteBitcodeToFile(M, Out);
return false;
}
PM.add(createVerifierPass());
// Write bytecode out to disk as the last step...
- OStream L(OutFile);
- if (Bitcode)
- PM.add(CreateBitcodeWriterPass(OutFile));
- else
- PM.add(new WriteBytecodePass(&L));
+ PM.add(CreateBitcodeWriterPass(OutFile));
// Run all queued passes.
PM.run(*Program);
cerr << "Error opening bytecode file: " << inputFilename << "\n";
return(1);
}
- OStream L(InFile);
- WriteBytecodeToFile(Program,L,false);
+ WriteBitcodeToFile(Program, InFile);
InFile.close();
// setup the child process' arguments