forked from OSchip/llvm-project
Add a new method for use by the code generator crash debugger.
llvm-svn: 11613
This commit is contained in:
parent
36d48a3728
commit
96d41dd438
|
@ -127,6 +127,12 @@ public:
|
|||
/// 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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue