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
This commit is contained in:
Daniel Dunbar 2009-09-07 19:26:11 +00:00
parent 59e8efdd59
commit 68ccdaa849
4 changed files with 23 additions and 11 deletions

View File

@ -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);

View File

@ -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";

View File

@ -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;

View File

@ -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";