summaryrefslogtreecommitdiffstats
path: root/tools/bugpoint/bugpoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bugpoint/bugpoint.cpp')
-rw-r--r--tools/bugpoint/bugpoint.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp
index 79cf563..f9c9e18 100644
--- a/tools/bugpoint/bugpoint.cpp
+++ b/tools/bugpoint/bugpoint.cpp
@@ -23,10 +23,14 @@
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/StandardPasses.h"
-#include "llvm/System/Process.h"
-#include "llvm/System/Signals.h"
-#include "llvm/System/Valgrind.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/Valgrind.h"
#include "llvm/LinkAllVMCore.h"
+
+//Enable this macro to debug bugpoint itself.
+//#define DEBUG_BUGPOINT 1
+
using namespace llvm;
static cl::opt<bool>
@@ -71,9 +75,11 @@ OverrideTriple("mtriple", cl::desc("Override target triple for module"));
/// BugpointIsInterrupted - Set to true when the user presses ctrl-c.
bool llvm::BugpointIsInterrupted = false;
+#ifndef DEBUG_BUGPOINT
static void BugpointInterruptFunction() {
BugpointIsInterrupted = true;
}
+#endif
// Hack to capture a pass list.
namespace {
@@ -91,14 +97,31 @@ namespace {
}
int main(int argc, char **argv) {
+#ifndef DEBUG_BUGPOINT
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+#endif
+
+ // Initialize passes
+ PassRegistry &Registry = *PassRegistry::getPassRegistry();
+ initializeCore(Registry);
+ initializeScalarOpts(Registry);
+ initializeIPO(Registry);
+ initializeAnalysis(Registry);
+ initializeIPA(Registry);
+ initializeTransformUtils(Registry);
+ initializeInstCombine(Registry);
+ initializeInstrumentation(Registry);
+ initializeTarget(Registry);
+
cl::ParseCommandLineOptions(argc, argv,
"LLVM automatic testcase reducer. See\nhttp://"
"llvm.org/cmds/bugpoint.html"
" for more information.\n");
+#ifndef DEBUG_BUGPOINT
sys::SetInterruptFunction(BugpointInterruptFunction);
+#endif
LLVMContext& Context = getGlobalContext();
// If we have an override, set it and then track the triple we want Modules
@@ -147,7 +170,9 @@ int main(int argc, char **argv) {
// Bugpoint has the ability of generating a plethora of core files, so to
// avoid filling up the disk, we prevent it
+#ifndef DEBUG_BUGPOINT
sys::Process::PreventCoreFiles();
+#endif
std::string Error;
bool Failure = D.run(Error);
OpenPOWER on IntegriCloud