2002-11-20 23:28:10 +01:00
|
|
|
//===- BugDriver.cpp - Top-Level BugPoint class implementation ------------===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 19:47:21 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:44:31 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 19:47:21 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-11-20 23:28:10 +01:00
|
|
|
//
|
|
|
|
// This class contains all of the shared state and information that is used by
|
|
|
|
// the BugPoint tool to track down errors in optimizations. This class is the
|
|
|
|
// main driver class that invokes all sub-functionality.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "BugDriver.h"
|
2006-06-07 00:30:59 +02:00
|
|
|
#include "ToolRunner.h"
|
2004-11-15 00:00:08 +01:00
|
|
|
#include "llvm/Linker.h"
|
2002-11-20 23:28:10 +01:00
|
|
|
#include "llvm/Module.h"
|
2003-08-07 23:19:30 +02:00
|
|
|
#include "llvm/Pass.h"
|
2009-09-03 18:32:58 +02:00
|
|
|
#include "llvm/Support/IRReader.h"
|
2004-09-02 00:55:40 +02:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
#include "llvm/Support/FileUtilities.h"
|
2009-07-03 00:46:18 +02:00
|
|
|
#include "llvm/Support/SourceMgr.h"
|
2009-01-02 08:01:27 +01:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2010-11-29 19:16:10 +01:00
|
|
|
#include "llvm/Support/Host.h"
|
2002-11-20 23:28:10 +01:00
|
|
|
#include <memory>
|
2003-11-11 23:41:34 +01:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-08-18 05:35:57 +02:00
|
|
|
namespace llvm {
|
|
|
|
Triple TargetTriple;
|
|
|
|
}
|
|
|
|
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
// Anonymous namespace to define command line options for debugging.
|
|
|
|
//
|
|
|
|
namespace {
|
|
|
|
// Output - The user can specify a file containing the expected output of the
|
|
|
|
// program. If this filename is set, it is used as the reference diff source,
|
|
|
|
// otherwise the raw input run through an interpreter is used as the reference
|
|
|
|
// source.
|
|
|
|
//
|
2005-04-22 02:00:37 +02:00
|
|
|
cl::opt<std::string>
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
OutputFile("output", cl::desc("Specify a reference program output "
|
|
|
|
"(for miscompilation detection)"));
|
|
|
|
}
|
|
|
|
|
2004-02-18 22:24:48 +01:00
|
|
|
/// setNewProgram - If we reduce or update the program somehow, call this method
|
|
|
|
/// to update bugdriver with it. This deletes the old module and sets the
|
|
|
|
/// specified one as the current program.
|
|
|
|
void BugDriver::setNewProgram(Module *M) {
|
|
|
|
delete Program;
|
|
|
|
Program = M;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-24 19:02:17 +02:00
|
|
|
/// getPassesString - Turn a list of passes into a string which indicates the
|
|
|
|
/// command line options that must be passed to add the passes.
|
|
|
|
///
|
2010-08-08 05:55:08 +02:00
|
|
|
std::string llvm::getPassesString(const std::vector<std::string> &Passes) {
|
2003-04-24 19:02:17 +02:00
|
|
|
std::string Result;
|
|
|
|
for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
|
|
|
|
if (i) Result += " ";
|
|
|
|
Result += "-";
|
2010-08-08 05:55:08 +02:00
|
|
|
Result += Passes[i];
|
2003-04-24 19:02:17 +02:00
|
|
|
}
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2010-08-08 01:03:21 +02:00
|
|
|
BugDriver::BugDriver(const char *toolname, bool find_bugs,
|
2010-03-19 01:09:28 +01:00
|
|
|
unsigned timeout, unsigned memlimit, bool use_valgrind,
|
2009-07-02 01:13:44 +02:00
|
|
|
LLVMContext& ctxt)
|
2009-07-01 18:58:40 +02:00
|
|
|
: Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile),
|
2008-12-08 05:02:47 +01:00
|
|
|
Program(0), Interpreter(0), SafeInterpreter(0), gcc(0),
|
2011-03-31 15:06:39 +02:00
|
|
|
run_find_bugs(find_bugs), Timeout(timeout),
|
2010-03-19 01:09:28 +01:00
|
|
|
MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
|
2010-03-22 06:23:37 +01:00
|
|
|
BugDriver::~BugDriver() {
|
|
|
|
delete Program;
|
|
|
|
}
|
|
|
|
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
|
2007-07-04 23:55:50 +02:00
|
|
|
/// ParseInputFile - Given a bitcode or assembly input filename, parse and
|
2002-11-20 23:28:10 +01:00
|
|
|
/// return it, or return null if not possible.
|
|
|
|
///
|
2009-07-01 23:22:36 +02:00
|
|
|
Module *llvm::ParseInputFile(const std::string &Filename,
|
2009-07-02 01:13:44 +02:00
|
|
|
LLVMContext& Ctxt) {
|
2009-07-03 00:46:18 +02:00
|
|
|
SMDiagnostic Err;
|
2009-09-03 18:32:58 +02:00
|
|
|
Module *Result = ParseIRFile(Filename, Err, Ctxt);
|
|
|
|
if (!Result)
|
2011-10-16 06:47:35 +02:00
|
|
|
Err.print("bugpoint", errs());
|
2009-09-03 18:32:58 +02:00
|
|
|
|
2009-08-18 05:35:57 +02:00
|
|
|
// If we don't have an override triple, use the first one to configure
|
|
|
|
// bugpoint, or use the host triple if none provided.
|
|
|
|
if (Result) {
|
|
|
|
if (TargetTriple.getTriple().empty()) {
|
|
|
|
Triple TheTriple(Result->getTargetTriple());
|
|
|
|
|
|
|
|
if (TheTriple.getTriple().empty())
|
2011-11-01 22:32:20 +01:00
|
|
|
TheTriple.setTriple(sys::getDefaultTargetTriple());
|
2011-03-31 15:06:39 +02:00
|
|
|
|
2009-08-18 05:35:57 +02:00
|
|
|
TargetTriple.setTriple(TheTriple.getTriple());
|
|
|
|
}
|
|
|
|
|
|
|
|
Result->setTargetTriple(TargetTriple.getTriple()); // override the triple
|
|
|
|
}
|
2002-11-20 23:28:10 +01:00
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This method takes the specified list of LLVM input files, attempts to load
|
2007-07-04 23:55:50 +02:00
|
|
|
// them, either as assembly or bitcode, then link them together. It returns
|
|
|
|
// true on failure (if, for example, an input bitcode file could not be
|
2003-05-23 07:34:32 +02:00
|
|
|
// parsed), and false on success.
|
2002-11-20 23:28:10 +01:00
|
|
|
//
|
|
|
|
bool BugDriver::addSources(const std::vector<std::string> &Filenames) {
|
|
|
|
assert(Program == 0 && "Cannot call addSources multiple times!");
|
|
|
|
assert(!Filenames.empty() && "Must specify at least on input filename!");
|
|
|
|
|
2010-04-12 07:08:25 +02:00
|
|
|
// Load the first input file.
|
|
|
|
Program = ParseInputFile(Filenames[0], Context);
|
|
|
|
if (Program == 0) return true;
|
2011-03-31 15:06:39 +02:00
|
|
|
|
2010-08-08 01:03:21 +02:00
|
|
|
outs() << "Read input file : '" << Filenames[0] << "'\n";
|
2006-05-14 21:15:56 +02:00
|
|
|
|
2010-04-12 07:08:25 +02:00
|
|
|
for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
|
|
|
|
std::auto_ptr<Module> M(ParseInputFile(Filenames[i], Context));
|
|
|
|
if (M.get() == 0) return true;
|
2006-05-14 21:15:56 +02:00
|
|
|
|
2010-08-08 01:03:21 +02:00
|
|
|
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
|
2010-04-12 07:08:25 +02:00
|
|
|
std::string ErrorMessage;
|
2011-10-11 02:24:54 +02:00
|
|
|
if (Linker::LinkModules(Program, M.get(), Linker::DestroySource,
|
|
|
|
&ErrorMessage)) {
|
2010-04-12 07:08:25 +02:00
|
|
|
errs() << ToolName << ": error linking in '" << Filenames[i] << "': "
|
|
|
|
<< ErrorMessage << '\n';
|
|
|
|
return true;
|
2002-11-20 23:28:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-08 01:03:21 +02:00
|
|
|
outs() << "*** All input ok\n";
|
2002-11-20 23:28:10 +01:00
|
|
|
|
|
|
|
// All input files read successfully!
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// run - The top level method that is invoked after all of the instance
|
|
|
|
/// variables are set up from command line arguments.
|
|
|
|
///
|
2010-04-12 07:08:25 +02:00
|
|
|
bool BugDriver::run(std::string &ErrMsg) {
|
2006-08-15 18:40:49 +02:00
|
|
|
if (run_find_bugs) {
|
|
|
|
// Rearrange the passes and apply them to the program. Repeat this process
|
|
|
|
// until the user kills the program or we find a bug.
|
2010-04-12 07:08:25 +02:00
|
|
|
return runManyPasses(PassesToRun, ErrMsg);
|
2006-08-15 18:40:49 +02:00
|
|
|
}
|
2005-12-22 21:02:55 +01:00
|
|
|
|
2011-03-31 15:06:39 +02:00
|
|
|
// If we're not running as a child, the first thing that we must do is
|
|
|
|
// determine what the problem is. Does the optimization series crash the
|
|
|
|
// compiler, or does it produce illegal code? We make the top-level
|
|
|
|
// decision by trying to run all of the passes on the the input program,
|
|
|
|
// which should generate a bitcode file. If it does generate a bitcode
|
|
|
|
// file, then we know the compiler didn't crash, so try to diagnose a
|
2005-12-22 21:02:55 +01:00
|
|
|
// miscompilation.
|
2003-10-13 23:04:26 +02:00
|
|
|
if (!PassesToRun.empty()) {
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "Running selected passes on program to test for crash: ";
|
2010-08-05 04:16:32 +02:00
|
|
|
if (runPasses(Program, PassesToRun))
|
2004-02-18 22:02:04 +01:00
|
|
|
return debugOptimizerCrash();
|
2003-10-13 23:04:26 +02:00
|
|
|
}
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
|
2007-07-04 23:55:50 +02:00
|
|
|
// Set up the execution environment, selecting a method to run LLVM bitcode.
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
if (initializeExecutionEnvironment()) return true;
|
|
|
|
|
2004-02-19 18:03:49 +01:00
|
|
|
// Test to see if we have a code generator crash.
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "Running the code generator to test for a crash: ";
|
2010-04-12 07:08:25 +02:00
|
|
|
std::string Error;
|
|
|
|
compileProgram(Program, &Error);
|
|
|
|
if (!Error.empty()) {
|
|
|
|
outs() << Error;
|
|
|
|
return debugCodeGeneratorCrash(ErrMsg);
|
2004-02-19 18:03:49 +01:00
|
|
|
}
|
2010-04-12 07:08:25 +02:00
|
|
|
outs() << '\n';
|
2004-02-19 18:03:49 +01:00
|
|
|
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
// Run the raw input to see where we are coming from. If a reference output
|
|
|
|
// was specified, make sure that the raw output matches it. If not, it's a
|
|
|
|
// problem in the front-end or the code generator.
|
|
|
|
//
|
2003-08-22 20:57:43 +02:00
|
|
|
bool CreatedOutput = false;
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
if (ReferenceOutputFile.empty()) {
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "Generating reference output from raw program: ";
|
2010-04-12 07:08:25 +02:00
|
|
|
if (!createReferenceFile(Program)) {
|
|
|
|
return debugCodeGeneratorCrash(ErrMsg);
|
2004-02-18 22:02:04 +01:00
|
|
|
}
|
2006-08-15 18:40:49 +02:00
|
|
|
CreatedOutput = true;
|
2003-10-14 22:52:55 +02:00
|
|
|
}
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
|
2003-10-14 22:52:55 +02:00
|
|
|
// Make sure the reference output file gets deleted on exit from this
|
|
|
|
// function, if appropriate.
|
2004-12-20 20:16:12 +01:00
|
|
|
sys::Path ROF(ReferenceOutputFile);
|
2011-03-31 15:04:19 +02:00
|
|
|
FileRemover RemoverInstance(ROF.str(), CreatedOutput && !SaveTemps);
|
2003-10-14 22:52:55 +02:00
|
|
|
|
|
|
|
// Diff the output of the raw program against the reference output. If it
|
2011-03-31 15:06:39 +02:00
|
|
|
// matches, then we assume there is a miscompilation bug and try to
|
2006-08-15 18:40:49 +02:00
|
|
|
// diagnose it.
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "*** Checking the code generator...\n";
|
2010-07-30 16:19:00 +02:00
|
|
|
bool Diff = diffProgram(Program, "", "", false, &Error);
|
2010-04-12 07:08:25 +02:00
|
|
|
if (!Error.empty()) {
|
|
|
|
errs() << Error;
|
|
|
|
return debugCodeGeneratorCrash(ErrMsg);
|
|
|
|
}
|
|
|
|
if (!Diff) {
|
|
|
|
outs() << "\n*** Output matches: Debugging miscompilation!\n";
|
|
|
|
debugMiscompilation(&Error);
|
|
|
|
if (!Error.empty()) {
|
|
|
|
errs() << Error;
|
|
|
|
return debugCodeGeneratorCrash(ErrMsg);
|
2004-02-18 22:02:04 +01:00
|
|
|
}
|
2010-04-12 07:08:25 +02:00
|
|
|
return false;
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
}
|
|
|
|
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "\n*** Input program does not match reference diff!\n";
|
|
|
|
outs() << "Debugging code generator problem!\n";
|
2010-04-12 07:08:25 +02:00
|
|
|
bool Failure = debugCodeGenerator(&Error);
|
|
|
|
if (!Error.empty()) {
|
|
|
|
errs() << Error;
|
|
|
|
return debugCodeGeneratorCrash(ErrMsg);
|
2004-02-19 18:03:49 +01:00
|
|
|
}
|
2010-04-12 07:08:25 +02:00
|
|
|
return Failure;
|
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.
llvm-svn: 7293
2003-07-24 20:17:43 +02:00
|
|
|
}
|
|
|
|
|
2004-03-14 21:50:42 +01:00
|
|
|
void llvm::PrintFunctionList(const std::vector<Function*> &Funcs) {
|
|
|
|
unsigned NumPrint = Funcs.size();
|
|
|
|
if (NumPrint > 10) NumPrint = 10;
|
|
|
|
for (unsigned i = 0; i != NumPrint; ++i)
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << " " << Funcs[i]->getName();
|
2004-03-14 21:50:42 +01:00
|
|
|
if (NumPrint < Funcs.size())
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "... <" << Funcs.size() << " total>";
|
|
|
|
outs().flush();
|
2002-11-20 23:28:10 +01:00
|
|
|
}
|
2006-10-25 20:36:14 +02:00
|
|
|
|
|
|
|
void llvm::PrintGlobalVariableList(const std::vector<GlobalVariable*> &GVs) {
|
|
|
|
unsigned NumPrint = GVs.size();
|
|
|
|
if (NumPrint > 10) NumPrint = 10;
|
|
|
|
for (unsigned i = 0; i != NumPrint; ++i)
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << " " << GVs[i]->getName();
|
2006-10-25 20:36:14 +02:00
|
|
|
if (NumPrint < GVs.size())
|
2009-07-16 17:30:09 +02:00
|
|
|
outs() << "... <" << GVs.size() << " total>";
|
|
|
|
outs().flush();
|
2006-10-25 20:36:14 +02:00
|
|
|
}
|