mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Add a new "AutoDebugCrashes" option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12396 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a75766a6c1
commit
0a00256900
@ -192,8 +192,11 @@ public:
|
|||||||
|
|
||||||
/// runPassesOn - Carefully run the specified set of pass on the specified
|
/// runPassesOn - Carefully run the specified set of pass on the specified
|
||||||
/// module, returning the transformed module on success, or a null pointer on
|
/// module, returning the transformed module on success, or a null pointer on
|
||||||
/// failure.
|
/// failure. If AutoDebugCrashes is set to true, then bugpoint will
|
||||||
Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes);
|
/// automatically attempt to track down a crashing pass if one exists, and
|
||||||
|
/// this method will never return null.
|
||||||
|
Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes,
|
||||||
|
bool AutoDebugCrashes = false);
|
||||||
|
|
||||||
/// runPasses - Run the specified passes on Program, outputting a bytecode
|
/// runPasses - Run the specified passes on Program, outputting a bytecode
|
||||||
/// file and writting the filename into OutputFile if successful. If the
|
/// file and writting the filename into OutputFile if successful. If the
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "BugDriver.h"
|
#include "BugDriver.h"
|
||||||
|
#include "llvm/Module.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Bytecode/WriteBytecodePass.h"
|
#include "llvm/Bytecode/WriteBytecodePass.h"
|
||||||
@ -166,11 +167,20 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
|
|||||||
/// module, returning the transformed module on success, or a null pointer on
|
/// module, returning the transformed module on success, or a null pointer on
|
||||||
/// failure.
|
/// failure.
|
||||||
Module *BugDriver::runPassesOn(Module *M,
|
Module *BugDriver::runPassesOn(Module *M,
|
||||||
const std::vector<const PassInfo*> &Passes) {
|
const std::vector<const PassInfo*> &Passes,
|
||||||
|
bool AutoDebugCrashes) {
|
||||||
Module *OldProgram = swapProgramIn(M);
|
Module *OldProgram = swapProgramIn(M);
|
||||||
std::string BytecodeResult;
|
std::string BytecodeResult;
|
||||||
if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/))
|
if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/)) {
|
||||||
|
if (AutoDebugCrashes) {
|
||||||
|
std::cerr << " Error running this sequence of passes"
|
||||||
|
<< " on the input program!\n";
|
||||||
|
delete OldProgram;
|
||||||
|
EmitProgressBytecode("pass-error", false);
|
||||||
|
exit(debugOptimizerCrash());
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Restore the current program.
|
// Restore the current program.
|
||||||
swapProgramIn(OldProgram);
|
swapProgramIn(OldProgram);
|
||||||
|
Loading…
Reference in New Issue
Block a user