Add a opt-args option that can be used to pass arguments to every opt

invocation. Fixes PR7793:

bugpoint -debug test.ll --opt-args -unroll-count=4

llvm-svn: 110555
This commit is contained in:
Rafael Espindola 2010-08-08 22:14:20 +00:00
parent 9350d51518
commit fb1f29acf9
2 changed files with 10 additions and 0 deletions

View File

@ -67,6 +67,10 @@ tool.
Pass all arguments specified after B<--gcc-tool-args> to the invocation of Pass all arguments specified after B<--gcc-tool-args> to the invocation of
B<gcc>. B<gcc>.
=item B<--opt-args> I<opt args>
Pass all arguments specified after B<--opt-args> to the invocation of B<opt>.
=item B<--disable-{dce,simplifycfg}> =item B<--disable-{dce,simplifycfg}>
Do not run the specified passes to clean up and reduce the size of the test Do not run the specified passes to clean up and reduce the size of the test

View File

@ -88,6 +88,10 @@ void BugDriver::EmitProgressBitcode(const Module *M,
cl::opt<bool> SilencePasses("silence-passes", cl::desc("Suppress output of running passes (both stdout and stderr)")); cl::opt<bool> SilencePasses("silence-passes", cl::desc("Suppress output of running passes (both stdout and stderr)"));
static cl::list<std::string> OptArgs("opt-args", cl::Positional,
cl::desc("<opt arguments>..."),
cl::ZeroOrMore, cl::PositionalEatsArgs);
/// runPasses - Run the specified passes on Program, outputting a bitcode file /// runPasses - Run the specified passes on Program, outputting a bitcode file
/// and writing the filename into OutputFile if successful. If the /// and writing the filename into OutputFile if successful. If the
/// optimizations fail for some reason (optimizer crashes), return true, /// optimizations fail for some reason (optimizer crashes), return true,
@ -154,6 +158,8 @@ bool BugDriver::runPasses(Module *Program,
Args.push_back("-o"); Args.push_back("-o");
Args.push_back(OutputFilename.c_str()); Args.push_back(OutputFilename.c_str());
for (unsigned i = 0, e = OptArgs.size(); i != e; ++i)
Args.push_back(OptArgs[i].c_str());
std::vector<std::string> pass_args; std::vector<std::string> pass_args;
for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) { for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) {
pass_args.push_back( std::string("-load")); pass_args.push_back( std::string("-load"));