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 //===----------------------------------------------------------------------===//
11 // This program is an automated compiler debugger tool. It is used to narrow
12 // down miscompilations and crash problems to a specific pass in the compiler,
13 // and the specific Module or Function input that is causing the problem.
15 //===----------------------------------------------------------------------===//
17 #include "BugDriver.h"
18 #include "llvm/Support/PassNameParser.h"
19 #include "Support/CommandLine.h"
20 #include "Config/unistd.h"
21 #include <sys/resource.h>
23 static cl::list<std::string>
24 InputFilenames(cl::Positional, cl::OneOrMore,
25 cl::desc("<input llvm ll/bc files>"));
27 // The AnalysesList is automatically populated with registered Passes by the
30 static cl::list<const PassInfo*, bool, PassNameParser>
31 PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
33 int main(int argc, char **argv) {
34 cl::ParseCommandLineOptions(argc, argv,
35 " LLVM automatic testcase reducer. See\nhttp://"
36 "llvm.cs.uiuc.edu/docs/CommandGuide/bugpoint.html"
37 " for more information.\n");
40 if (D.addSources(InputFilenames)) return 1;
41 D.addPasses(PassList.begin(), PassList.end());
43 // Bugpoint has the ability of generating a plethora of core files, so to
44 // avoid filling up the disk, set the max core file size to 0.
46 rlim.rlim_cur = rlim.rlim_max = 0;
47 int res = setrlimit(RLIMIT_CORE, &rlim);
49 // setrlimit() may have failed, but we're not going to let that stop us
50 perror("setrlimit: RLIMIT_CORE");