Index: tools/bugpoint/BugDriver.cpp =================================================================== --- tools/bugpoint/BugDriver.cpp +++ tools/bugpoint/BugDriver.cpp @@ -42,6 +42,8 @@ errs() << "Failed to delete temp file " << toString(std::move(E)) << '\n'; } +extern cl::OptionCategory ExecutionOptions; + // Anonymous namespace to define command line options for debugging. // namespace { @@ -51,6 +53,7 @@ // source. // cl::opt OutputFile("output", + cl::cat(ExecutionOptions), cl::desc("Specify a reference program output " "(for miscompilation detection)")); } Index: tools/bugpoint/CrashDebugger.cpp =================================================================== --- tools/bugpoint/CrashDebugger.cpp +++ tools/bugpoint/CrashDebugger.cpp @@ -37,31 +37,41 @@ using namespace llvm; namespace { +cl::OptionCategory CrashDebuggerOptions("CrashDebugger Options", ""); cl::opt KeepMain("keep-main", + cl::cat(CrashDebuggerOptions), cl::desc("Force function reduction to keep main"), cl::init(false)); cl::opt NoGlobalRM("disable-global-remove", + cl::cat(CrashDebuggerOptions), cl::desc("Do not remove global variables"), cl::init(false)); cl::opt ReplaceFuncsWithNull( "replace-funcs-with-null", + cl::cat(CrashDebuggerOptions), cl::desc("When stubbing functions, replace all uses will null"), cl::init(false)); cl::opt DontReducePassList("disable-pass-list-reduction", + cl::cat(CrashDebuggerOptions), cl::desc("Skip pass list reduction steps"), cl::init(false)); cl::opt NoNamedMDRM("disable-namedmd-remove", + cl::cat(CrashDebuggerOptions), cl::desc("Do not remove global named metadata"), cl::init(false)); cl::opt NoStripDebugInfo("disable-strip-debuginfo", + cl::cat(CrashDebuggerOptions), cl::desc("Do not strip debug info metadata"), cl::init(false)); -cl::opt NoStripDebugTypeInfo("disable-strip-debug-types", - cl::desc("Do not strip debug type info metadata"), - cl::init(false)); +cl::opt NoStripDebugTypeInfo( + "disable-strip-debug-types", + cl::cat(CrashDebuggerOptions), + cl::desc("Do not strip debug type info metadata"), + cl::init(false)); cl::opt VerboseErrors("verbose-errors", + cl::cat(CrashDebuggerOptions), cl::desc("Print the output of crashing program"), cl::init(false)); } Index: tools/bugpoint/ExecutionDriver.cpp =================================================================== --- tools/bugpoint/ExecutionDriver.cpp +++ tools/bugpoint/ExecutionDriver.cpp @@ -24,6 +24,8 @@ using namespace llvm; +cl::OptionCategory ExecutionOptions("Execution Options", ""); + namespace { // OutputType - Allow the user to specify the way code should be run, to test // for miscompilation. @@ -40,13 +42,16 @@ }; cl::opt AbsTolerance("abs-tolerance", + cl::cat(ExecutionOptions), cl::desc("Absolute error tolerated"), cl::init(0.0)); cl::opt RelTolerance("rel-tolerance", + cl::cat(ExecutionOptions), cl::desc("Relative error tolerated"), cl::init(0.0)); cl::opt InterpreterSel( + cl::cat(ExecutionOptions), cl::desc("Specify the \"test\" i.e. suspect back-end:"), cl::values(clEnumValN(AutoPick, "auto", "Use best guess"), clEnumValN(RunLLI, "run-int", "Execute with the interpreter"), @@ -64,6 +69,7 @@ cl::init(AutoPick)); cl::opt SafeInterpreterSel( + cl::cat(ExecutionOptions), cl::desc("Specify \"safe\" i.e. known-good backend:"), cl::values(clEnumValN(AutoPick, "safe-auto", "Use best guess"), clEnumValN(RunLLC, "safe-run-llc", "Compile with LLC"), @@ -73,32 +79,38 @@ cl::init(AutoPick)); cl::opt SafeInterpreterPath( - "safe-path", cl::desc("Specify the path to the \"safe\" backend program"), + "safe-path", cl::cat(ExecutionOptions), + cl::desc("Specify the path to the \"safe\" backend program"), cl::init("")); cl::opt AppendProgramExitCode( - "append-exit-code", + "append-exit-code", cl::cat(ExecutionOptions), cl::desc("Append the exit code to the output so it gets diff'd too"), cl::init(false)); cl::opt InputFile("input", cl::init("/dev/null"), + cl::cat(ExecutionOptions), cl::desc("Filename to pipe in as stdin (default: /dev/null)")); cl::list - AdditionalSOs("additional-so", cl::desc("Additional shared objects to load " - "into executing programs")); + AdditionalSOs("additional-so", cl::cat(ExecutionOptions), + cl::desc("Additional shared objects to load " + "into executing programs")); cl::list AdditionalLinkerArgs( - "Xlinker", cl::desc("Additional arguments to pass to the linker")); + "Xlinker", cl::cat(ExecutionOptions), + cl::desc("Additional arguments to pass to the linker")); cl::opt CustomCompileCommand( "compile-command", cl::init("llc"), + cl::cat(ExecutionOptions), cl::desc("Command to compile the bitcode (use with -compile-custom) " "(default: llc)")); cl::opt CustomExecCommand( "exec-command", cl::init("simulate"), + cl::cat(ExecutionOptions), cl::desc("Command to execute the bitcode (use with -run-custom) " "(default: simulate)")); } @@ -107,27 +119,33 @@ // Anything specified after the --args option are taken as arguments to the // program being debugged. cl::list InputArgv("args", cl::Positional, + cl::cat(ExecutionOptions), cl::desc("..."), cl::ZeroOrMore, cl::PositionalEatsArgs); cl::opt OutputPrefix("output-prefix", cl::init("bugpoint"), + cl::cat(ExecutionOptions), cl::desc("Prefix to use for outputs (default: 'bugpoint')")); } namespace { cl::list ToolArgv("tool-args", cl::Positional, + cl::cat(ExecutionOptions), cl::desc("..."), cl::ZeroOrMore, cl::PositionalEatsArgs); cl::list SafeToolArgv("safe-tool-args", cl::Positional, + cl::cat(ExecutionOptions), cl::desc("..."), cl::ZeroOrMore, cl::PositionalEatsArgs); cl::opt CCBinary("gcc", cl::init(""), + cl::cat(ExecutionOptions), cl::desc("The gcc binary to use.")); cl::list CCToolArgv("gcc-tool-args", cl::Positional, + cl::cat(ExecutionOptions), cl::desc("..."), cl::ZeroOrMore, cl::PositionalEatsArgs); } Index: tools/bugpoint/ExtractFunction.cpp =================================================================== --- tools/bugpoint/ExtractFunction.cpp +++ tools/bugpoint/ExtractFunction.cpp @@ -41,11 +41,14 @@ extern cl::opt OutputPrefix; } // End llvm namespace +extern cl::OptionCategory MiscDebuggerOptions; + namespace { -cl::opt NoDCE("disable-dce", +cl::opt NoDCE("disable-dce", cl::cat(MiscDebuggerOptions), cl::desc("Do not use the -dce pass to reduce testcases")); cl::opt NoSCFG("disable-simplifycfg", cl::location(DisableSimplifyCFG), + cl::cat(MiscDebuggerOptions), cl::desc("Do not use the -simplifycfg pass to reduce testcases")); Function *globalInitUsesExternalBA(GlobalVariable *GV) { Index: tools/bugpoint/Miscompilation.cpp =================================================================== --- tools/bugpoint/Miscompilation.cpp +++ tools/bugpoint/Miscompilation.cpp @@ -34,13 +34,17 @@ extern cl::list InputArgv; } // end namespace llvm +cl::OptionCategory MiscDebuggerOptions("MiscompilationDebugger Options", ""); + namespace { static llvm::cl::opt DisableLoopExtraction( "disable-loop-extraction", + cl::cat(MiscDebuggerOptions), cl::desc("Don't extract loops when searching for miscompilations"), cl::init(false)); static llvm::cl::opt DisableBlockExtraction( "disable-block-extraction", + cl::cat(MiscDebuggerOptions), cl::desc("Don't extract blocks when searching for miscompilations"), cl::init(false)); Index: tools/bugpoint/OptimizerDriver.cpp =================================================================== --- tools/bugpoint/OptimizerDriver.cpp +++ tools/bugpoint/OptimizerDriver.cpp @@ -38,13 +38,17 @@ extern cl::opt OutputPrefix; } +extern cl::OptionCategory ExecutionOptions; + static cl::opt PreserveBitcodeUseListOrder( "preserve-bc-uselistorder", + cl::cat(ExecutionOptions), cl::desc("Preserve use-list order when writing LLVM bitcode."), cl::init(true), cl::Hidden); static cl::opt OptCmd("opt-command", cl::init(""), + cl::cat(ExecutionOptions), cl::desc("Path to opt. (default: search path " "for 'opt'.)")); @@ -113,9 +117,11 @@ cl::opt SilencePasses( "silence-passes", + cl::cat(ExecutionOptions), cl::desc("Suppress output of running passes (both stdout and stderr)")); static cl::list OptArgs("opt-args", cl::Positional, + cl::cat(ExecutionOptions), cl::desc("..."), cl::ZeroOrMore, cl::PositionalEatsArgs); Index: tools/bugpoint/ToolRunner.cpp =================================================================== --- tools/bugpoint/ToolRunner.cpp +++ tools/bugpoint/ToolRunner.cpp @@ -26,27 +26,35 @@ #define DEBUG_TYPE "toolrunner" +extern cl::OptionCategory ExecutionOptions; + namespace llvm { cl::opt SaveTemps("save-temps", cl::init(false), + cl::cat(ExecutionOptions), cl::desc("Save temporary files")); } namespace { cl::opt RemoteClient("remote-client", + cl::cat(ExecutionOptions), cl::desc("Remote execution client (rsh/ssh)")); cl::opt RemoteHost("remote-host", + cl::cat(ExecutionOptions), cl::desc("Remote execution (rsh/ssh) host")); cl::opt RemotePort("remote-port", + cl::cat(ExecutionOptions), cl::desc("Remote execution (rsh/ssh) port")); cl::opt RemoteUser("remote-user", + cl::cat(ExecutionOptions), cl::desc("Remote execution (rsh/ssh) user id")); cl::opt RemoteExtra("remote-extra-options", + cl::cat(ExecutionOptions), cl::desc("Remote execution (rsh/ssh) extra options")); } Index: tools/bugpoint/bugpoint.cpp =================================================================== --- tools/bugpoint/bugpoint.cpp +++ tools/bugpoint/bugpoint.cpp @@ -36,27 +36,33 @@ using namespace llvm; +cl::OptionCategory BugpointOptions("Bugpoint Options", ""); static cl::opt - FindBugs("find-bugs", cl::desc("Run many different optimization sequences " - "on program to find bugs"), + FindBugs("find-bugs", cl::cat(BugpointOptions), + cl::desc("Run many different optimization sequences " + "on program to find bugs"), cl::init(false)); static cl::list InputFilenames(cl::Positional, cl::OneOrMore, + cl::cat(BugpointOptions), cl::desc("")); static cl::opt TimeoutValue( - "timeout", cl::init(300), cl::value_desc("seconds"), + "timeout", cl::cat(BugpointOptions), + cl::init(300), cl::value_desc("seconds"), cl::desc("Number of seconds program is allowed to run before it " "is killed (default is 300s), 0 disables timeout")); static cl::opt MemoryLimit( - "mlimit", cl::init(-1), cl::value_desc("MBytes"), + "mlimit", cl::cat(BugpointOptions), + cl::init(-1), cl::value_desc("MBytes"), cl::desc("Maximum amount of memory to use. 0 disables check. Defaults to " "400MB (800MB under valgrind, 0 with sanitizers).")); static cl::opt UseValgrind("enable-valgrind", + cl::cat(BugpointOptions), cl::desc("Run optimizations through valgrind")); // The AnalysesList is automatically populated with registered Passes by the @@ -66,25 +72,29 @@ PassList(cl::desc("Passes available:"), cl::ZeroOrMore); static cl::opt - StandardLinkOpts("std-link-opts", + StandardLinkOpts("std-link-opts", cl::cat(BugpointOptions), cl::desc("Include the standard link time optimizations")); static cl::opt - OptLevelO1("O1", cl::desc("Optimization level 1. Identical to 'opt -O1'")); + OptLevelO1("O1", cl::cat(BugpointOptions), + cl::desc("Optimization level 1. Identical to 'opt -O1'")); static cl::opt - OptLevelO2("O2", cl::desc("Optimization level 2. Identical to 'opt -O2'")); + OptLevelO2("O2", cl::cat(BugpointOptions), + cl::desc("Optimization level 2. Identical to 'opt -O2'")); static cl::opt OptLevelOs( - "Os", + "Os", cl::cat(BugpointOptions), cl::desc( "Like -O2 with extra optimizations for size. Similar to clang -Os")); static cl::opt - OptLevelO3("O3", cl::desc("Optimization level 3. Identical to 'opt -O3'")); + OptLevelO3("O3", cl::cat(BugpointOptions), + cl::desc("Optimization level 3. Identical to 'opt -O3'")); static cl::opt - OverrideTriple("mtriple", cl::desc("Override target triple for module")); + OverrideTriple("mtriple", cl::cat(BugpointOptions), + cl::desc("Override target triple for module")); /// BugpointIsInterrupted - Set to true when the user presses ctrl-c. bool llvm::BugpointIsInterrupted = false;