summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/ExecutionDriver.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-18 23:25:22 +0000
committerChris Lattner <sabre@nondot.org>2004-02-18 23:25:22 +0000
commit96d41dd43801350aa8366ceb967e8a3a49a87e1c (patch)
treeb8ff311b34fb409afb68d9cedeb798b8efaecb15 /llvm/tools/bugpoint/ExecutionDriver.cpp
parent36d48a37281ef79c8bdc73a1db0fee7e81156d51 (diff)
downloadbcm5719-llvm-96d41dd43801350aa8366ceb967e8a3a49a87e1c.tar.gz
bcm5719-llvm-96d41dd43801350aa8366ceb967e8a3a49a87e1c.zip
Add a new method for use by the code generator crash debugger.
llvm-svn: 11613
Diffstat (limited to 'llvm/tools/bugpoint/ExecutionDriver.cpp')
-rw-r--r--llvm/tools/bugpoint/ExecutionDriver.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 01f7be89e35..3d4e61058ff 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -137,6 +137,26 @@ bool BugDriver::initializeExecutionEnvironment() {
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
OpenPOWER on IntegriCloud