switch tools to bitcode from bytecode

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-05-06 09:32:02 +00:00
parent 73a978a753
commit 744879ea01
11 changed files with 45 additions and 115 deletions
+4 -16
View File
@@ -23,7 +23,6 @@
#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"
@@ -39,8 +38,6 @@
#include <fstream>
using namespace llvm;
static bool Bitcode = false;
namespace {
// ChildOutput - This option captures the name of the child output file that
@@ -59,12 +56,8 @@ bool BugDriver::writeProgramToFile(const std::string &Filename,
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;
}
@@ -113,11 +106,7 @@ int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
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);
@@ -161,8 +150,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
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