[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.cpp CrashDebugger.cpp Makefile OptimizerDriver.cpp

Chris Lattner sabre at nondot.org
Sat May 5 22:47:24 PDT 2007



Changes in directory llvm/tools/bugpoint:

BugDriver.cpp updated: 1.51 -> 1.52
CrashDebugger.cpp updated: 1.57 -> 1.58
Makefile updated: 1.21 -> 1.22
OptimizerDriver.cpp updated: 1.50 -> 1.51
---
Log message:

add bitcode support


---
Diffs of the changes:  (+18 -4)

 BugDriver.cpp       |   10 +++++++++-
 CrashDebugger.cpp   |    1 -
 Makefile            |    2 +-
 OptimizerDriver.cpp |    9 ++++++++-
 4 files changed, 18 insertions(+), 4 deletions(-)


Index: llvm/tools/bugpoint/BugDriver.cpp
diff -u llvm/tools/bugpoint/BugDriver.cpp:1.51 llvm/tools/bugpoint/BugDriver.cpp:1.52
--- llvm/tools/bugpoint/BugDriver.cpp:1.51	Fri Feb 16 13:11:06 2007
+++ llvm/tools/bugpoint/BugDriver.cpp	Sun May  6 00:47:06 2007
@@ -19,13 +19,14 @@
 #include "llvm/Module.h"
 #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>
 #include <memory>
-
 using namespace llvm;
 
 // Anonymous namespace to define command line options for debugging.
@@ -77,6 +78,13 @@
   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());
+  }
+  
   if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
     std::cerr << "bugpoint: " << Err.getMessage() << "\n"; 
     Result = 0;


Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.57 llvm/tools/bugpoint/CrashDebugger.cpp:1.58
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.57	Mon Feb  5 15:19:13 2007
+++ llvm/tools/bugpoint/CrashDebugger.cpp	Sun May  6 00:47:06 2007
@@ -22,7 +22,6 @@
 #include "llvm/PassManager.h"
 #include "llvm/ValueSymbolTable.h"
 #include "llvm/Analysis/Verifier.h"
-#include "llvm/Bytecode/Writer.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Cloning.h"


Index: llvm/tools/bugpoint/Makefile
diff -u llvm/tools/bugpoint/Makefile:1.21 llvm/tools/bugpoint/Makefile:1.22
--- llvm/tools/bugpoint/Makefile:1.21	Sat Feb  3 17:15:56 2007
+++ llvm/tools/bugpoint/Makefile	Sun May  6 00:47:06 2007
@@ -11,7 +11,7 @@
 TOOLNAME = bugpoint
 
 LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \
-                   linker
+                   linker bitreader bitwriter
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common


Index: llvm/tools/bugpoint/OptimizerDriver.cpp
diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.50 llvm/tools/bugpoint/OptimizerDriver.cpp:1.51
--- llvm/tools/bugpoint/OptimizerDriver.cpp:1.50	Fri Feb 16 13:11:07 2007
+++ llvm/tools/bugpoint/OptimizerDriver.cpp	Sun May  6 00:47:06 2007
@@ -24,6 +24,7 @@
 #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 "llvm/Support/CommandLine.h"
@@ -38,6 +39,9 @@
 #include <fstream>
 using namespace llvm;
 
+static bool Bitcode = false;
+
+
 namespace {
   // ChildOutput - This option captures the name of the child output file that
   // is set up by the parent bugpoint process
@@ -110,7 +114,10 @@
 
   // Write bytecode out to disk as the last step...
   OStream L(OutFile);
-  PM.add(new WriteBytecodePass(&L));
+  if (Bitcode)
+    PM.add(CreateBitcodeWriterPass(OutFile));
+  else
+    PM.add(new WriteBytecodePass(&L));
 
   // Run all queued passes.
   PM.run(*Program);






More information about the llvm-commits mailing list