diff options
Diffstat (limited to 'tools/bugpoint/ExecutionDriver.cpp')
-rw-r--r-- | tools/bugpoint/ExecutionDriver.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 453833eb8d..93eef5dbc5 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -297,10 +297,36 @@ std::string BugDriver::compileSharedObject(const std::string &BytecodeFile) { return "./" + SharedObjectFile; } +/// createReferenceFile - calls compileProgram and then records the output +/// into ReferenceOutputFile. Returns true if reference file created, false +/// otherwise. Note: initializeExecutionEnvironment should be called BEFORE +/// this function. +/// +bool BugDriver::createReferenceFile(Module *M, const std::string &Filename){ + try { + compileProgram(Program); + } catch (ToolExecutionError &TEE) { + return false; + } + try { + ReferenceOutputFile = executeProgramWithCBE(Filename); + std::cout << "Reference output is: " << ReferenceOutputFile << "\n\n"; + } catch (ToolExecutionError &TEE) { + std::cerr << TEE.what(); + if (Interpreter != cbe) { + std::cerr << "*** There is a bug running the C backend. Either debug" + << " it (use the -run-cbe bugpoint option), or fix the error" + << " some other way.\n"; + } + return false; + } + return true; +} -/// diffProgram - This method executes the specified module and diffs the output -/// against the file specified by ReferenceOutputFile. If the output is -/// different, true is returned. +/// diffProgram - This method executes the specified module and diffs the +/// output against the file specified by ReferenceOutputFile. If the output +/// is different, true is returned. If there is a problem with the code +/// generator (e.g., llc crashes), this will throw an exception. /// bool BugDriver::diffProgram(const std::string &BytecodeFile, const std::string &SharedObject, |