2003-10-20 17:57:13 +00:00
|
|
|
//===- bugpoint.cpp - The LLVM Bugpoint utility ---------------------------===//
|
2003-10-20 17:47:21 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2002-11-20 22:28:10 +00:00
|
|
|
//
|
|
|
|
// This program is an automated compiler debugger tool. It is used to narrow
|
|
|
|
// down miscompilations and crash problems to a specific pass in the compiler,
|
|
|
|
// and the specific Module or Function input that is causing the problem.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "BugDriver.h"
|
|
|
|
#include "llvm/Support/PassNameParser.h"
|
2003-08-07 21:19:30 +00:00
|
|
|
#include "Support/CommandLine.h"
|
2003-09-12 20:42:57 +00:00
|
|
|
#include "Config/unistd.h"
|
|
|
|
#include <sys/resource.h>
|
2002-11-20 22:28:10 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2002-11-20 22:28:10 +00:00
|
|
|
static cl::list<std::string>
|
|
|
|
InputFilenames(cl::Positional, cl::OneOrMore,
|
|
|
|
cl::desc("<input llvm ll/bc files>"));
|
|
|
|
|
|
|
|
// The AnalysesList is automatically populated with registered Passes by the
|
|
|
|
// PassNameParser.
|
|
|
|
//
|
|
|
|
static cl::list<const PassInfo*, bool, PassNameParser>
|
Major addition to bugpoint: ability to debug code generators (LLC and LLI).
The C backend is assumed correct and is used to generate shared objects to be
loaded by the other two code generators.
LLC debugging should be functional now, LLI needs a few more additions to work,
the major one is renaming of external functions to call the JIT lazy function
resolver.
Bugpoint now has a command-line switch -mode with options 'compile' and
'codegen' to debug appropriate portions of tools.
ExecutionDriver.cpp: Added implementations of AbstractInterpreter for LLC and
GCC, broke out common code within other tools, and added ability to generate C
code with CBE individually, without executing the program, and the GCC tool can
generate executables shared objects or executables.
If no reference output is specified to Bugpoint, it will be generated with CBE,
because it is already assumed to be correct for the purposes of debugging using
this method. As a result, many functions now accept as an optional parameter a
shared object to be loaded in, if specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7293 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 18:17:43 +00:00
|
|
|
PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
|
2002-11-20 22:28:10 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2003-10-18 21:55:35 +00:00
|
|
|
cl::ParseCommandLineOptions(argc, argv,
|
|
|
|
" LLVM automatic testcase reducer. See\nhttp://"
|
|
|
|
"llvm.cs.uiuc.edu/docs/CommandGuide/bugpoint.html"
|
|
|
|
" for more information.\n");
|
2002-11-20 22:28:10 +00:00
|
|
|
|
|
|
|
BugDriver D(argv[0]);
|
|
|
|
if (D.addSources(InputFilenames)) return 1;
|
|
|
|
D.addPasses(PassList.begin(), PassList.end());
|
|
|
|
|
2003-09-12 20:42:57 +00:00
|
|
|
// Bugpoint has the ability of generating a plethora of core files, so to
|
|
|
|
// avoid filling up the disk, set the max core file size to 0.
|
|
|
|
struct rlimit rlim;
|
|
|
|
rlim.rlim_cur = rlim.rlim_max = 0;
|
|
|
|
int res = setrlimit(RLIMIT_CORE, &rlim);
|
|
|
|
if (res < 0) {
|
|
|
|
// setrlimit() may have failed, but we're not going to let that stop us
|
|
|
|
perror("setrlimit: RLIMIT_CORE");
|
|
|
|
}
|
|
|
|
|
2002-11-20 22:28:10 +00:00
|
|
|
return D.run();
|
|
|
|
}
|