aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-07 19:26:11 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-07 19:26:11 +0000
commit68ccdaa84909108c42417a8091c771598e26456e (patch)
treeadac575e8da48fbf52512ad9079cba7580225a24 /tools/bugpoint
parent59e8efdd5938172e4907afc60d45dbd9cd67c6e1 (diff)
downloadexternal_llvm-68ccdaa84909108c42417a8091c771598e26456e.zip
external_llvm-68ccdaa84909108c42417a8091c771598e26456e.tar.gz
external_llvm-68ccdaa84909108c42417a8091c771598e26456e.tar.bz2
Add -output-prefix option to bugpoint (to change the default output name).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp10
-rw-r--r--tools/bugpoint/ExtractFunction.cpp3
-rw-r--r--tools/bugpoint/Miscompilation.cpp12
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp9
4 files changed, 23 insertions, 11 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp
index 72b9717..feda331 100644
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -100,6 +100,10 @@ namespace llvm {
cl::list<std::string>
InputArgv("args", cl::Positional, cl::desc("<program arguments>..."),
cl::ZeroOrMore, cl::PositionalEatsArgs);
+
+ cl::opt<std::string>
+ OutputPrefix("output-prefix", cl::init("bugpoint"),
+ cl::desc("Prefix to use for outputs (default: 'bugpoint')"));
}
namespace {
@@ -274,7 +278,7 @@ bool BugDriver::initializeExecutionEnvironment() {
///
void BugDriver::compileProgram(Module *M) {
// Emit the program to a bitcode file...
- sys::Path BitcodeFile ("bugpoint-test-program.bc");
+ sys::Path BitcodeFile (OutputPrefix + "-test-program.bc");
std::string ErrMsg;
if (BitcodeFile.makeUnique(true,&ErrMsg)) {
errs() << ToolName << ": Error making unique filename: " << ErrMsg
@@ -310,7 +314,7 @@ std::string BugDriver::executeProgram(std::string OutputFile,
std::string ErrMsg;
if (BitcodeFile.empty()) {
// Emit the program to a bitcode file...
- sys::Path uniqueFilename("bugpoint-test-program.bc");
+ sys::Path uniqueFilename(OutputPrefix + "-test-program.bc");
if (uniqueFilename.makeUnique(true, &ErrMsg)) {
errs() << ToolName << ": Error making unique filename: "
<< ErrMsg << "!\n";
@@ -330,7 +334,7 @@ std::string BugDriver::executeProgram(std::string OutputFile,
sys::Path BitcodePath (BitcodeFile);
FileRemover BitcodeFileRemover(BitcodePath, CreatedBitcode && !SaveTemps);
- if (OutputFile.empty()) OutputFile = "bugpoint-execution-output";
+ if (OutputFile.empty()) OutputFile = OutputPrefix + "-execution-output";
// Check to see if this is a valid output filename...
sys::Path uniqueFile(OutputFile);
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index a54f51b..df9277c 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -37,6 +37,7 @@ using namespace llvm;
namespace llvm {
bool DisableSimplifyCFG = false;
+ extern cl::opt<std::string> OutputPrefix;
} // End llvm namespace
namespace {
@@ -324,7 +325,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
Module *M) {
char *ExtraArg = NULL;
- sys::Path uniqueFilename("bugpoint-extractblocks");
+ sys::Path uniqueFilename(OutputPrefix + "-extractblocks");
std::string ErrMsg;
if (uniqueFilename.createTemporaryFileOnDisk(true, &ErrMsg)) {
outs() << "*** Basic Block extraction failed!\n";
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 57a4fc7..e1aeaf8 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -30,6 +30,7 @@
using namespace llvm;
namespace llvm {
+ extern cl::opt<std::string> OutputPrefix;
extern cl::list<std::string> InputArgv;
}
@@ -301,12 +302,15 @@ static bool ExtractLoops(BugDriver &BD,
<< " Please report a bug!\n";
errs() << " Continuing on with un-loop-extracted version.\n";
- BD.writeProgramToFile("bugpoint-loop-extract-fail-tno.bc", ToNotOptimize);
- BD.writeProgramToFile("bugpoint-loop-extract-fail-to.bc", ToOptimize);
- BD.writeProgramToFile("bugpoint-loop-extract-fail-to-le.bc",
+ BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-tno.bc",
+ ToNotOptimize);
+ BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to.bc",
+ ToOptimize);
+ BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to-le.bc",
ToOptimizeLoopExtracted);
- errs() << "Please submit the bugpoint-loop-extract-fail-*.bc files.\n";
+ errs() << "Please submit the "
+ << OutputPrefix << "-loop-extract-fail-*.bc files.\n";
delete ToOptimize;
delete ToNotOptimize;
delete ToOptimizeLoopExtracted;
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 5afb220..9f712e0 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -37,6 +37,9 @@
#include <fstream>
using namespace llvm;
+namespace llvm {
+ extern cl::opt<std::string> OutputPrefix;
+}
namespace {
// ChildOutput - This option captures the name of the child output file that
@@ -68,7 +71,7 @@ void BugDriver::EmitProgressBitcode(const std::string &ID, bool NoFlyer) {
// Output the input to the current pass to a bitcode file, emit a message
// telling the user how to reproduce it: opt -foo blah.bc
//
- std::string Filename = "bugpoint-" + ID + ".bc";
+ std::string Filename = OutputPrefix + "-" + ID + ".bc";
if (writeProgramToFile(Filename)) {
errs() << "Error opening file '" << Filename << "' for writing!\n";
return;
@@ -129,7 +132,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
const char * const *ExtraArgs) const {
// setup the output file name
outs().flush();
- sys::Path uniqueFilename("bugpoint-output.bc");
+ sys::Path uniqueFilename(OutputPrefix + "-output.bc");
std::string ErrMsg;
if (uniqueFilename.makeUnique(true, &ErrMsg)) {
errs() << getToolName() << ": Error making unique filename: "
@@ -139,7 +142,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
OutputFilename = uniqueFilename.str();
// set up the input file name
- sys::Path inputFilename("bugpoint-input.bc");
+ sys::Path inputFilename(OutputPrefix + "-input.bc");
if (inputFilename.makeUnique(true, &ErrMsg)) {
errs() << getToolName() << ": Error making unique filename: "
<< ErrMsg << "\n";