[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.h ExecutionDriver.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 18 17:33:54 PST 2004


Changes in directory llvm/tools/bugpoint:

BugDriver.h updated: 1.29 -> 1.30
ExecutionDriver.cpp updated: 1.37 -> 1.38

---
Log message:

Add a new method for use by the code generator crash debugger.


---
Diffs of the changes:  (+26 -0)

Index: llvm/tools/bugpoint/BugDriver.h
diff -u llvm/tools/bugpoint/BugDriver.h:1.29 llvm/tools/bugpoint/BugDriver.h:1.30
--- llvm/tools/bugpoint/BugDriver.h:1.29	Wed Feb 18 15:50:26 2004
+++ llvm/tools/bugpoint/BugDriver.h	Wed Feb 18 17:25:22 2004
@@ -127,6 +127,12 @@
   /// the specified one as the current program.
   void setNewProgram(Module *M);
 
+  /// compileProgram - Try to compile the specified module, throwing an
+  /// exception if an error occurs, or returning normally if not.  This is used
+  /// for code generation crash testing.
+  ///
+  void compileProgram(Module *M);
+
   /// executeProgram - This method runs "Program", capturing the output of the
   /// program to a file, returning the filename of the file.  A recommended
   /// filename may be optionally specified.  If there is a problem with the code


Index: llvm/tools/bugpoint/ExecutionDriver.cpp
diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.37 llvm/tools/bugpoint/ExecutionDriver.cpp:1.38
--- llvm/tools/bugpoint/ExecutionDriver.cpp:1.37	Wed Feb 18 16:01:21 2004
+++ llvm/tools/bugpoint/ExecutionDriver.cpp	Wed Feb 18 17:25:22 2004
@@ -137,6 +137,26 @@
   return Interpreter == 0;
 }
 
+/// compileProgram - Try to compile the specified module, throwing an exception
+/// if an error occurs, or returning normally if not.  This is used for code
+/// generation crash testing.
+///
+void BugDriver::compileProgram(Module *M) {
+  // Emit the program to a bytecode file...
+  std::string BytecodeFile = getUniqueFilename("bugpoint-test-program.bc");
+  if (writeProgramToFile(BytecodeFile, M)) {
+    std::cerr << ToolName << ": Error emitting bytecode to file '"
+              << BytecodeFile << "'!\n";
+    exit(1);
+  }
+
+    // Remove the temporary bytecode file when we are done.
+  FileRemover BytecodeFileRemover(BytecodeFile);
+
+  // Actually compile the program!
+  Interpreter->compileProgram(BytecodeFile);
+}
+
 
 /// executeProgram - This method runs "Program", capturing the output of the
 /// program to a file, returning the filename of the file.  A recommended





More information about the llvm-commits mailing list