diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-06 09:32:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-06 09:32:02 +0000 |
commit | 744879ea01779a48f898a801c847677b0bfa824a (patch) | |
tree | 1602b46ba1a9012436d5bb3b17e1109080394cfd /tools/bugpoint | |
parent | 73a978a753f66003fb8959af40549ca18b612cd1 (diff) | |
download | external_llvm-744879ea01779a48f898a801c847677b0bfa824a.zip external_llvm-744879ea01779a48f898a801c847677b0bfa824a.tar.gz external_llvm-744879ea01779a48f898a801c847677b0bfa824a.tar.bz2 |
switch tools to bitcode from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r-- | tools/bugpoint/BugDriver.cpp | 17 | ||||
-rw-r--r-- | tools/bugpoint/Makefile | 2 | ||||
-rw-r--r-- | tools/bugpoint/OptimizerDriver.cpp | 20 |
3 files changed, 11 insertions, 28 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index fe29080..00dfc32 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -20,9 +20,7 @@ #include "llvm/Pass.h" #include "llvm/Assembly/Parser.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compressor.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/MemoryBuffer.h" #include <iostream> @@ -75,16 +73,13 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, /// return it, or return null if not possible. /// Module *llvm::ParseInputFile(const std::string &InputFilename) { - ParseError Err; - Module *Result = ParseBytecodeFile(InputFilename, - Compressor::decompressToNewBuffer); - if (!Result) { - std::auto_ptr<MemoryBuffer> Buffer( - MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size())); - if (Buffer.get()) - Result = ParseBitcodeFile(Buffer.get()); - } + std::auto_ptr<MemoryBuffer> Buffer( + MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size())); + Module *Result = 0; + if (Buffer.get()) + Result = ParseBitcodeFile(Buffer.get()); + ParseError Err; if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) { std::cerr << "bugpoint: " << Err.getMessage() << "\n"; Result = 0; diff --git a/tools/bugpoint/Makefile b/tools/bugpoint/Makefile index 1174148..6d8d7a0 100644 --- a/tools/bugpoint/Makefile +++ b/tools/bugpoint/Makefile @@ -10,7 +10,7 @@ LEVEL = ../.. TOOLNAME = bugpoint -LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \ +LINK_COMPONENTS := asmparser instrumentation scalaropts ipo \ linker bitreader bitwriter REQUIRES_EH := 1 diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index e5435ed..5f031dc 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -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 |