1 //===- bugpoint.cpp - The LLVM Bugpoint utility ---------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This program is an automated compiler debugger tool. It is used to narrow
11 // down miscompilations and crash problems to a specific pass in the compiler,
12 // and the specific Module or Function input that is causing the problem.
14 //===----------------------------------------------------------------------===//
16 #include "BugDriver.h"
17 #include "llvm/Support/PassNameParser.h"
18 #include "Support/CommandLine.h"
19 #include "Config/unistd.h"
20 #include <sys/resource.h>
24 static cl::list<std::string>
25 InputFilenames(cl::Positional, cl::OneOrMore,
26 cl::desc("<input llvm ll/bc files>"));
28 // The AnalysesList is automatically populated with registered Passes by the
31 static cl::list<const PassInfo*, bool, PassNameParser>
32 PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
34 int main(int argc, char **argv) {
35 cl::ParseCommandLineOptions(argc, argv,
36 " LLVM automatic testcase reducer. See\nhttp://"
37 "llvm.cs.uiuc.edu/docs/CommandGuide/bugpoint.html"
38 " for more information.\n");
41 if (D.addSources(InputFilenames)) return 1;
42 D.addPasses(PassList.begin(), PassList.end());
44 // Bugpoint has the ability of generating a plethora of core files, so to
45 // avoid filling up the disk, set the max core file size to 0.
47 rlim.rlim_cur = rlim.rlim_max = 0;
48 int res = setrlimit(RLIMIT_CORE, &rlim);
50 // setrlimit() may have failed, but we're not going to let that stop us
51 perror("setrlimit: RLIMIT_CORE");