summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-22 02:10:13 +0000
committerChris Lattner <sabre@nondot.org>2002-07-22 02:10:13 +0000
commit5ff62e90d0bc321206023897edc1e2691cb0fbb6 (patch)
treef9dd91f41ef5858a217a9b871d0e3d8fe089da99
parent50e3f88d38d93edcec9047322da8ed43aefc9e3d (diff)
downloadllvm-5ff62e90d0bc321206023897edc1e2691cb0fbb6.tar.gz
llvm-5ff62e90d0bc321206023897edc1e2691cb0fbb6.tar.bz2
llvm-5ff62e90d0bc321206023897edc1e2691cb0fbb6.tar.xz
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2985 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp16
-rw-r--r--lib/CodeGen/InstrSched/InstrScheduling.cpp17
-rw-r--r--lib/CodeGen/InstrSelection/InstrSelection.cpp14
-rw-r--r--lib/CodeGen/RegAlloc/PhyRegAlloc.cpp12
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp21
-rw-r--r--lib/Support/Statistic.cpp12
-rw-r--r--lib/Target/SparcV9/InstrSched/InstrScheduling.cpp17
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrSelection.cpp14
-rw-r--r--lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp16
-rw-r--r--lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp12
-rw-r--r--lib/Transforms/IPO/OldPoolAllocate.cpp13
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp14
-rw-r--r--lib/Transforms/LevelRaise.cpp29
-rw-r--r--lib/VMCore/Pass.cpp31
-rw-r--r--support/lib/Support/Statistic.cpp12
-rw-r--r--support/lib/Support/StatisticReporter.cpp12
-rw-r--r--tools/as/as.cpp16
-rw-r--r--tools/dis/dis.cpp23
-rw-r--r--tools/extract/extract.cpp13
-rw-r--r--tools/gccas/gccas.cpp27
-rw-r--r--tools/gccld/gccld.cpp34
-rw-r--r--tools/link/link.cpp30
-rw-r--r--tools/llc/llc.cpp29
-rw-r--r--tools/lli/lli.cpp42
-rw-r--r--tools/llvm-as/as.cpp16
-rw-r--r--tools/llvm-as/llvm-as.cpp16
-rw-r--r--tools/llvm-dis/dis.cpp23
-rw-r--r--tools/llvm-dis/llvm-dis.cpp23
-rw-r--r--tools/llvm-extract/llvm-extract.cpp13
-rw-r--r--tools/llvm-link/llvm-link.cpp30
-rw-r--r--tools/opt/opt.cpp30
31 files changed, 425 insertions, 202 deletions
diff --git a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
index 774bdc7cd7..b080ec2f3e 100644
--- a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
@@ -19,12 +19,16 @@ AnalysisID FunctionLiveVarInfo::ID(AnalysisID::create<FunctionLiveVarInfo>());
LiveVarDebugLevel_t DEBUG_LV;
-static cl::Enum<LiveVarDebugLevel_t> DEBUG_LV_opt(DEBUG_LV, "dlivevar", cl::Hidden,
- "enable live-variable debugging information",
- clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
- clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
- clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after every machine instrn"),
- clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"), 0);
+static cl::opt<LiveVarDebugLevel_t, true>
+DEBUG_LV_opt("dlivevar", cl::Hidden, cl::location(DEBUG_LV),
+ cl::desc("enable live-variable debugging information"),
+ cl::values(
+clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
+clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
+clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after "
+ "every machine instrn"),
+clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"),
+ 0));
diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp
index 6ea37247d0..1d4c18058f 100644
--- a/lib/CodeGen/InstrSched/InstrScheduling.cpp
+++ b/lib/CodeGen/InstrSched/InstrScheduling.cpp
@@ -21,13 +21,16 @@ using std::vector;
SchedDebugLevel_t SchedDebugLevel;
-static cl::Enum<enum SchedDebugLevel_t> Opt(SchedDebugLevel,"dsched",cl::Hidden,
- "enable instruction scheduling debugging information",
- clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
- clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
- clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
- clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
- clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"), 0);
+static cl::opt<SchedDebugLevel_t, true>
+SDL_opt("dsched", cl::Hidden, cl::location(SchedDebugLevel),
+ cl::desc("enable instruction scheduling debugging information"),
+ cl::values(
+ clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
+ clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
+ clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
+ clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
+ clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"),
+ 0));
//************************* Internal Data Types *****************************/
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp
index d61feb4797..86e54d0b16 100644
--- a/lib/CodeGen/InstrSelection/InstrSelection.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp
@@ -26,7 +26,6 @@
#include "llvm/Function.h"
#include "llvm/iPHINode.h"
#include "Support/CommandLine.h"
-#include <iostream>
using std::cerr;
using std::vector;
@@ -40,13 +39,18 @@ enum SelectDebugLevel_t {
Select_DebugBurgTrees,
};
+
// Enable Debug Options to be specified on the command line
-cl::Enum<enum SelectDebugLevel_t> SelectDebugLevel("dselect", cl::Hidden,
- "enable instruction selection debugging information",
+static cl::opt<SelectDebugLevel_t>
+SelectDebugLevel("dselect", cl::Hidden,
+ cl::desc("enable instruction selection debugging information"),
+ cl::values(
clEnumValN(Select_NoDebugInfo, "n", "disable debug output"),
clEnumValN(Select_PrintMachineCode, "y", "print generated machine code"),
- clEnumValN(Select_DebugInstTrees, "i", "print debugging info for instruction selection "),
- clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"), 0);
+ clEnumValN(Select_DebugInstTrees, "i",
+ "print debugging info for instruction selection"),
+ clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"),
+ 0));
//******************** Forward Function Declarations ***********************/
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
index ef4156147c..a192310686 100644
--- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
@@ -19,25 +19,25 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/MachineFrameInfo.h"
-#include "llvm/BasicBlock.h"
#include "llvm/Function.h"
#include "llvm/Type.h"
#include "llvm/iOther.h"
#include "llvm/CodeGen/RegAllocCommon.h"
#include "Support/CommandLine.h"
#include "Support/STLExtras.h"
-#include <iostream>
#include <math.h>
using std::cerr;
using std::vector;
RegAllocDebugLevel_t DEBUG_RA;
-static cl::Enum<RegAllocDebugLevel_t> DEBUG_RA_c(DEBUG_RA, "dregalloc",
- cl::Hidden,
- "enable register allocation debugging information",
+static cl::opt<RegAllocDebugLevel_t, true>
+DRA_opt("dregalloc", cl::Hidden, cl::location(DEBUG_RA),
+ cl::desc("enable register allocation debugging information"),
+ cl::values(
clEnumValN(RA_DEBUG_None , "n", "disable debug output"),
clEnumValN(RA_DEBUG_Normal , "y", "enable debug output"),
- clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"), 0);
+ clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"),
+ 0));
//----------------------------------------------------------------------------
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index 68379f4e16..b2eb378b40 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -24,10 +24,18 @@ using std::vector;
using std::cout;
using std::cerr;
-cl::Flag QuietMode ("quiet" , "Do not emit any non-program output");
-cl::Alias QuietModeA("q" , "Alias for -quiet", cl::NoFlags, QuietMode);
-cl::Flag ArrayChecksEnabled("array-checks", "Enable array bound checks");
-cl::Flag AbortOnExceptions("abort-on-exception", "Halt execution on a machine exception");
+static cl::opt<bool>
+QuietMode("quiet", cl::desc("Do not emit any non-program output"));
+
+static cl::alias
+QuietModeA("q", cl::desc("Alias for -quiet"), cl::aliasopt(QuietMode));
+
+static cl::opt<bool>
+ArrayChecksEnabled("array-checks", cl::desc("Enable array bound checks"));
+
+static cl::opt<bool>
+AbortOnExceptions("abort-on-exception",
+ cl::desc("Halt execution on a machine exception"));
// Create a TargetData structure to handle memory addressing and size/alignment
// computations
@@ -37,8 +45,9 @@ CachedWriter CW; // Object to accelerate printing of LLVM
#ifdef PROFILE_STRUCTURE_FIELDS
-static cl::Flag ProfileStructureFields("profilestructfields",
- "Profile Structure Field Accesses");
+static cl::opt<bool>
+ProfileStructureFields("profilestructfields",
+ cl::desc("Profile Structure Field Accesses"));
#include <map>
static std::map<const StructType *, vector<unsigned> > FieldAccessCounts;
#endif
diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp
index 249955beeb..a6b2dbdef6 100644
--- a/lib/Support/Statistic.cpp
+++ b/lib/Support/Statistic.cpp
@@ -20,8 +20,16 @@
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
-static cl::Flag Enabled("stats", "Enable statistics output from program");
-static cl::Flag Debug(DebugFlag, "debug", "Enable debug output", cl::Hidden);
+// -stats - Command line option to cause transformations to emit stats about
+// what they did.
+//
+static cl::opt<bool>
+Enabled("stats", cl::desc("Enable statistics output from program"));
+
+// -debug - Command line option to enable the DEBUG statements in the passes.
+static cl::opt<bool, true>
+Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
+ cl::location(DebugFlag));
// Print information when destroyed, iff command line option is specified
void StatisticBase::destroy() const {
diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
index 6ea37247d0..1d4c18058f 100644
--- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
+++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
@@ -21,13 +21,16 @@ using std::vector;
SchedDebugLevel_t SchedDebugLevel;
-static cl::Enum<enum SchedDebugLevel_t> Opt(SchedDebugLevel,"dsched",cl::Hidden,
- "enable instruction scheduling debugging information",
- clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
- clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
- clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
- clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
- clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"), 0);
+static cl::opt<SchedDebugLevel_t, true>
+SDL_opt("dsched", cl::Hidden, cl::location(SchedDebugLevel),
+ cl::desc("enable instruction scheduling debugging information"),
+ cl::values(
+ clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
+ clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
+ clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
+ clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
+ clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"),
+ 0));
//************************* Internal Data Types *****************************/
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
index d61feb4797..86e54d0b16 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
@@ -26,7 +26,6 @@
#include "llvm/Function.h"
#include "llvm/iPHINode.h"
#include "Support/CommandLine.h"
-#include <iostream>
using std::cerr;
using std::vector;
@@ -40,13 +39,18 @@ enum SelectDebugLevel_t {
Select_DebugBurgTrees,
};
+
// Enable Debug Options to be specified on the command line
-cl::Enum<enum SelectDebugLevel_t> SelectDebugLevel("dselect", cl::Hidden,
- "enable instruction selection debugging information",
+static cl::opt<SelectDebugLevel_t>
+SelectDebugLevel("dselect", cl::Hidden,
+ cl::desc("enable instruction selection debugging information"),
+ cl::values(
clEnumValN(Select_NoDebugInfo, "n", "disable debug output"),
clEnumValN(Select_PrintMachineCode, "y", "print generated machine code"),
- clEnumValN(Select_DebugInstTrees, "i", "print debugging info for instruction selection "),
- clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"), 0);
+ clEnumValN(Select_DebugInstTrees, "i",
+ "print debugging info for instruction selection"),
+ clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"),
+ 0));
//******************** Forward Function Declarations ***********************/
diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
index 774bdc7cd7..b080ec2f3e 100644
--- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
@@ -19,12 +19,16 @@ AnalysisID FunctionLiveVarInfo::ID(AnalysisID::create<FunctionLiveVarInfo>());
LiveVarDebugLevel_t DEBUG_LV;
-static cl::Enum<LiveVarDebugLevel_t> DEBUG_LV_opt(DEBUG_LV, "dlivevar", cl::Hidden,
- "enable live-variable debugging information",
- clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
- clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
- clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after every machine instrn"),
- clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"), 0);
+static cl::opt<LiveVarDebugLevel_t, true>
+DEBUG_LV_opt("dlivevar", cl::Hidden, cl::location(DEBUG_LV),
+ cl::desc("enable live-variable debugging information"),
+ cl::values(
+clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
+clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
+clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after "
+ "every machine instrn"),
+clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"),
+ 0));
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
index ef4156147c..a192310686 100644
--- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
@@ -19,25 +19,25 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/MachineFrameInfo.h"
-#include "llvm/BasicBlock.h"
#include "llvm/Function.h"
#include "llvm/Type.h"
#include "llvm/iOther.h"
#include "llvm/CodeGen/RegAllocCommon.h"
#include "Support/CommandLine.h"
#include "Support/STLExtras.h"
-#include <iostream>
#include <math.h>
using std::cerr;
using std::vector;
RegAllocDebugLevel_t DEBUG_RA;
-static cl::Enum<RegAllocDebugLevel_t> DEBUG_RA_c(DEBUG_RA, "dregalloc",
- cl::Hidden,
- "enable register allocation debugging information",
+static cl::opt<RegAllocDebugLevel_t, true>
+DRA_opt("dregalloc", cl::Hidden, cl::location(DEBUG_RA),
+ cl::desc("enable register allocation debugging information"),
+ cl::values(
clEnumValN(RA_DEBUG_None , "n", "disable debug output"),
clEnumValN(RA_DEBUG_Normal , "y", "enable debug output"),
- clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"), 0);
+ clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"),
+ 0));
//----------------------------------------------------------------------------
diff --git a/lib/Transforms/IPO/OldPoolAllocate.cpp b/lib/Transforms/IPO/OldPoolAllocate.cpp
index 50f21e2397..eb463b8e13 100644
--- a/lib/Transforms/IPO/OldPoolAllocate.cpp
+++ b/lib/Transforms/IPO/OldPoolAllocate.cpp
@@ -52,13 +52,18 @@ enum PtrSize {
Ptr8bits, Ptr16bits, Ptr32bits
};
-static cl::Enum<enum PtrSize> ReqPointerSize("ptrsize", 0,
- "Set pointer size for -poolalloc pass",
+static cl::opt<PtrSize>
+ReqPointerSize("poolalloc-ptr-size",
+ cl::desc("Set pointer size for -poolalloc pass"),
+ cl::values(
clEnumValN(Ptr32bits, "32", "Use 32 bit indices for pointers"),
clEnumValN(Ptr16bits, "16", "Use 16 bit indices for pointers"),
- clEnumValN(Ptr8bits , "8", "Use 8 bit indices for pointers"), 0);
+ clEnumValN(Ptr8bits , "8", "Use 8 bit indices for pointers"),
+ 0));
-static cl::Flag DisableRLE("no-pool-load-elim", "Disable pool load elimination after poolalloc pass", cl::Hidden);
+static cl::opt<bool>
+DisableRLE("no-pool-load-elim", cl::Hidden,
+ cl::desc("Disable pool load elimination after poolalloc pass"));
const Type *POINTERTYPE;
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index 57230c6b77..3d5ff45ccf 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -12,8 +12,6 @@
#include "llvm/iMemory.h"
#include "llvm/iTerminators.h"
#include "llvm/iOther.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/Function.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Assembly/Writer.h"
@@ -24,11 +22,13 @@
using std::vector;
using std::string;
-static cl::Flag DisablePtrHashing("tracedisablehashdisable",
- "Disable pointer hashing", cl::NoFlags);
+static cl::opt<bool>
+DisablePtrHashing("tracedisablehashdisable", cl::Hidden,
+ cl::desc("Disable pointer hashing"));
-static cl::StringList TraceFuncName ("tracefunc", "trace only specific funct"
- "ions", cl::NoFlags);
+static cl::list<string>
+TraceFuncName("tracefunc", cl::desc("trace only specific functions"),
+ cl::value_desc("function"));
// We trace a particular function if no functions to trace were specified
@@ -37,7 +37,7 @@ static cl::StringList TraceFuncName ("tracefunc", "trace only specific funct"
inline bool
TraceThisFunction(Function* func)
{
- if (TraceFuncName.getNumOccurances() == 0)
+ if (TraceFuncName.size() == 0)
return true;
return std::find(TraceFuncName.begin(), TraceFuncName.end(), func->getName())
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index 7e27c5f7f0..b4d1755544 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -26,17 +26,24 @@ using std::cerr;
// raising pass to start at instruction "foo", which is immensely useful for
// debugging!
//
-static cl::String StartInst("raise-start-inst", "Start raise pass at the "
- "instruction with the specified name", cl::Hidden);
-
-static Statistic<> NumLoadStorePeepholes("raise\t\t- Number of load/store "
- "peepholes");
-static Statistic<> NumGEPInstFormed("raise\t\t- Number of other "
- "getelementptr's formed");
-static Statistic<> NumExprTreesConv("raise\t\t- Number of expression trees"
- " converted");
-static Statistic<> NumCastOfCast("raise\t\t- Number of cast-of-self removed");
-static Statistic<> NumDCEorCP("raise\t\t- Number of insts DCEd or constprop'd");
+static cl::opt<std::string>
+StartInst("raise-start-inst", cl::Hidden, cl::value_desc("inst name"),
+ cl::desc("Start raise pass at the instruction with the specified name"));
+
+static Statistic<>
+NumLoadStorePeepholes("raise\t\t- Number of load/store peepholes");
+
+static Statistic<>
+NumGEPInstFormed("raise\t\t- Number of other getelementptr's formed");
+
+static Statistic<>
+NumExprTreesConv("raise\t\t- Number of expression trees converted");
+
+static Statistic<>
+NumCastOfCast("raise\t\t- Number of cast-of-self removed");
+
+static Statistic<>
+NumDCEorCP("raise\t\t- Number of insts DCEd or constprop'd");
#define PRINT_PEEPHOLE(ID, NUM, I) \
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index db2614e452..4b29371fff 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -81,8 +81,9 @@ bool PassManager::run(Module &M) { return PM->run(M); }
// amount of time each pass takes to execute. This only happens with
// -time-passes is enabled on the command line.
//
-static cl::Flag EnableTiming("time-passes", "Time each pass, printing elapsed"
- " time for each on exit");
+static cl::opt<bool>
+EnableTiming("time-passes",
+ cl::desc("Time each pass, printing elapsed time for each on exit"));
static double getTime() {
struct timeval T;
@@ -143,24 +144,28 @@ TimingInfo::~TimingInfo() {
// Different debug levels that can be enabled...
enum PassDebugLevel {
- None, PassStructure, PassExecutions, PassDetails
+ None, Structure, Executions, Details
};
-static cl::Enum<enum PassDebugLevel> PassDebugging("debug-pass", cl::Hidden,
- "Print PassManager debugging information",
- clEnumVal(None , "disable debug output"),
- clEnumVal(PassStructure , "print pass structure before run()"),
- clEnumVal(PassExecutions, "print pass name before it is executed"),
- clEnumVal(PassDetails , "print pass details when it is executed"), 0);
+static cl::opt<enum PassDebugLevel>
+PassDebugging("debug-pass", cl::Hidden,
+ cl::desc("Print PassManager debugging information"),
+ cl::values(
+ clEnumVal(None , "disable debug output"),
+ // TODO: add option to print out pass names "PassOptions"
+ clEnumVal(Structure , "print pass structure before run()"),
+ clEnumVal(Executions, "print pass name before it is executed"),
+ clEnumVal(Details , "print pass details when it is executed"),
+ 0));
void PMDebug::PrintPassStructure(Pass *P) {
- if (PassDebugging >= PassStructure)
+ if (PassDebugging >= Structure)
P->dumpPassStructure();
}
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Annotable *V) {
- if (PassDebugging >= PassExecutions) {
+ if (PassDebugging >= Executions) {
std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
<< P->getPassName();
if (V) {
@@ -181,7 +186,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
Pass *P, const std::vector<AnalysisID> &Set){
- if (PassDebugging >= PassDetails && !Set.empty()) {
+ if (PassDebugging >= Details && !Set.empty()) {
std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
for (unsigned i = 0; i != Set.size(); ++i) {
Pass *P = Set[i].createPass(); // Good thing this is just debug code...
@@ -192,7 +197,7 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
}
}
-// dumpPassStructure - Implement the -debug-passes=PassStructure option
+// dumpPassStructure - Implement the -debug-passes=Structure option
void Pass::dumpPassStructure(unsigned Offset = 0) {
std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
}
diff --git a/support/lib/Support/Statistic.cpp b/support/lib/Support/Statistic.cpp
index 249955beeb..a6b2dbdef6 100644
--- a/support/lib/Support/Statistic.cpp
+++ b/support/lib/Support/Statistic.cpp
@@ -20,8 +20,16 @@
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
-static cl::Flag Enabled("stats", "Enable statistics output from program");
-static cl::Flag Debug(DebugFlag, "debug", "Enable debug output", cl::Hidden);
+// -stats - Command line option to cause transformations to emit stats about
+// what they did.
+//
+static cl::opt<bool>
+Enabled("stats", cl::desc("Enable statistics output from program"));
+
+// -debug - Command line option to enable the DEBUG statements in the passes.
+static cl::opt<bool, true>
+Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
+ cl::location(DebugFlag));
// Print information when destroyed, iff command line option is specified
void StatisticBase::destroy() const {
diff --git a/support/lib/Support/StatisticReporter.cpp b/support/lib/Support/StatisticReporter.cpp
index 249955beeb..a6b2dbdef6 100644
--- a/support/lib/Support/StatisticReporter.cpp
+++ b/support/lib/Support/StatisticReporter.cpp
@@ -20,8 +20,16 @@
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
-static cl::Flag Enabled("stats", "Enable statistics output from program");
-static cl::Flag Debug(DebugFlag, "debug", "Enable debug output", cl::Hidden);
+// -stats - Command line option to cause transformations to emit stats about
+// what they did.
+//
+static cl::opt<bool>
+Enabled("stats", cl::desc("Enable statistics output from program"));
+
+// -debug - Command line option to enable the DEBUG statements in the passes.
+static cl::opt<bool, true>
+Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
+ cl::location(DebugFlag));
// Print information when destroyed, iff command line option is specified
void StatisticBase::destroy() const {
diff --git a/tools/as/as.cpp b/tools/as/as.cpp
index a956203e64..c66dd598b9 100644
--- a/tools/as/as.cpp
+++ b/tools/as/as.cpp
@@ -18,10 +18,18 @@
#include <memory>
using std::cerr;
-cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false);
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
diff --git a/tools/dis/dis.cpp b/tools/dis/dis.cpp
index eb9a3a39ed..361564c8e5 100644
--- a/tools/dis/dis.cpp
+++ b/tools/dis/dis.cpp
@@ -27,13 +27,22 @@ enum OutputMode {
c, // Generate C code
};
-cl::String InputFilename ("", "Load <arg> file, print as assembly", 0, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
- clEnumVal(llvm, "Output LLVM assembly"),
- clEnumVal(c , "Output C code for program"),
- 0);
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<enum OutputMode>
+WriteMode(cl::desc("Specify the output format:"),
+ cl::values(
+ clEnumVal(llvm, "Output LLVM assembly"),
+ clEnumVal(c , "Output C code for program"),
+ 0));
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
diff --git a/tools/extract/extract.cpp b/tools/extract/extract.cpp
index d1680c0967..4730f54250 100644
--- a/tools/extract/extract.cpp
+++ b/tools/extract/extract.cpp
@@ -18,8 +18,17 @@
#include "Support/CommandLine.h"
#include <memory>
-static cl::String InputFilename("", "Specify input bytecode file", 0, "-");
-static cl::String ExtractFunc("func", "Specify function to extract", 0, "main");
+// InputFilename - The filename to read from.
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
+ cl::init("-"), cl::value_desc("filename"));
+
+
+// ExtractFunc - The function to extract from the module... defaults to main.
+static cl::opt<string>
+ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
+ cl::value_desc("function"));
+
struct FunctionExtractorPass : public Pass {
const char *getPassName() const { return "Function Extractor"; }
diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp
index 634d08c851..fbb8f77afc 100644
--- a/tools/gccas/gccas.cpp
+++ b/tools/gccas/gccas.cpp
@@ -23,14 +23,25 @@
#include <fstream>
using std::cerr;
-static cl::String InputFilename ("", "Parse <arg> file, compile to bytecode",
- cl::Required, "");
-static cl::String OutputFilename ("o", "Override output filename");
-static cl::Int RunNPasses ("stopAfterNPasses", "Only run the first N "
- "passes of gccas", cl::Hidden);
-static cl::Flag StopAtLevelRaise("stopraise", "Stop optimization before "
- "level raise", cl::Hidden);
-static cl::Flag Verify ("verify", "Verify each pass result");
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input llvm assembly>"), cl::Required);
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<int>
+RunNPasses("stopAfterNPasses",
+ cl::desc("Only run the first N passes of gccas"), cl::Hidden,
+ cl::value_desc("# passes"));
+
+static cl::opt<bool>
+StopAtLevelRaise("stopraise", cl::desc("Stop optimization before level raise"),
+ cl::Hidden);
+
+static cl::opt<bool>
+Verify("verify", cl::desc("Verify each pass result"));
+
static inline void addPass(PassManager &PM, Pass *P) {
static int NumPassesCreated = 0;
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index 919884419d..e5db8849dd 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -33,13 +33,28 @@
#include <sys/stat.h>
using std::cerr;
-cl::StringList InputFilenames("", "Load <arg> files, linking them together",
- cl::OneOrMore);
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags,"a.out");
-cl::Flag Verbose ("v", "Print information about actions taken");
-cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
-cl::StringList Libraries ("l", "Specify libraries to link to", cl::ZeroOrMore);
-cl::Flag Strip ("s", "Strip symbol info from executable");
+static cl::list<string>
+InputFilenames(cl::Positional, cl::desc("<input bytecode files>"),
+ cl::OneOrMore);
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"), cl::init("a.out"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Verbose("v", cl::desc("Print information about actions taken"));
+
+static cl::list<string>
+LibPaths("L", cl::desc("Specify a library search path"), cl::Prefix,
+ cl::value_desc("directory"));
+
+static cl::list<string>
+Libraries("l", cl::desc("Specify libraries to link to"), cl::Prefix,
+ cl::value_desc("library prefix"));
+
+static cl::opt<bool>
+Strip("s", cl::desc("Strip symbol info from executable"));
+
// FileExists - Return true if the specified string is an openable file...
static inline bool FileExists(const std::string &FN) {
@@ -83,10 +98,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
int main(int argc, char **argv) {
- cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n",
- cl::EnableSingleLetterArgValue |
- cl::DisableSingleLetterArgGrouping);
- assert(InputFilenames.size() > 0 && "OneOrMore is not working");
+ cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
unsigned BaseArg = 0;
std::string ErrorMessage;
diff --git a/tools/link/link.cpp b/tools/link/link.cpp
index 28499f1988..e2ab02e92d 100644
--- a/tools/link/link.cpp
+++ b/tools/link/link.cpp
@@ -22,13 +22,25 @@
using std::cerr;
-cl::StringList InputFilenames("", "Load <arg> files, linking them together",
- cl::OneOrMore);
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "-");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::Flag Verbose ("v", "Print information about actions taken");
-cl::Flag DumpAsm ("d", "Print assembly as linked", cl::Hidden, false);
-cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
+static cl::list<std::string>
+InputFilenames(cl::Positional, cl::OneOrMore,
+ cl::desc("Load <arg> files, linking them together"));
+
+static cl::opt<std::string>
+OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+Verbose("v", cl::desc("Print information about actions taken"));
+
+static cl::opt<bool>
+DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
+
+static cl::list<std::string>
+LibPaths("L", cl::desc("Specify a library search path"), cl::ZeroOrMore,
+ cl::value_desc("directory"), cl::Prefix);
// FileExists - Return true if the specified string is an openable file...
static inline bool FileExists(const std::string &FN) {
@@ -74,9 +86,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
int main(int argc, char **argv) {
- cl::ParseCommandLineOptions(argc, argv, " llvm linker\n",
- cl::EnableSingleLetterArgValue |
- cl::DisableSingleLetterArgGrouping);
+ cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
unsigned BaseArg = 0;
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 3e1dfbcae1..785f0a624c 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -24,22 +24,33 @@
using std::string;
using std::cerr;
-static cl::String InputFilename ("", "Input filename", cl::NoFlags, "-");
-static cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
-static cl::Flag Force ("f", "Overwrite output files");
-static cl::Flag DumpAsm ("d", "Print bytecode before native code generation", cl::Hidden);
-static cl::String TraceLibPath ("tracelibpath", "Path to libinstr for trace code", cl::Hidden, "");
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
+
+static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+DumpAsm("d", cl::desc("Print bytecode before native code generation"),
+ cl::Hidden);
+
+static cl::opt<string>
+TraceLibPath("tracelibpath", cl::desc("Path to libinstr for trace code"),
+ cl::value_desc("directory"), cl::Hidden);
enum TraceLevel {
TraceOff, TraceFunctions, TraceBasicBlocks
};
-static cl::Enum<enum TraceLevel> TraceValues("trace", cl::NoFlags,
- "Trace values through functions or basic blocks",
+static cl::opt<TraceLevel>
+TraceValues("trace", cl::desc("Trace values through functions or basic blocks"),
+ cl::values(
clEnumValN(TraceOff , "off", "Disable trace code"),
clEnumValN(TraceFunctions , "function", "Trace each function"),
- clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"), 0);
-
+ clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"),
+ 0));
// GetFileNameRoot - Helper function to get the basename of a filename...
static inline string GetFileNameRoot(const string &InputFilename) {
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index f4145c169c..dc35194546 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -10,12 +10,27 @@
#include "Interpreter.h"
#include "Support/CommandLine.h"
-cl::StringList InputArgv("" , "Input command line", cl::ConsumeAfter);
-cl::String MainFunction ("f" , "Function to execute", cl::NoFlags, "main");
-cl::Flag DebugMode ("debug" , "Start program in debugger");
-cl::Alias DebugModeA ("d" , "Alias for -debug", cl::NoFlags, DebugMode);
-cl::Flag TraceMode ("trace" , "Enable Tracing");
-cl::Flag ProfileMode ("profile", "Enable Profiling [unimp]");
+static cl::opt<string>
+InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
+
+static cl::list<std::string>
+InputArgv(cl::ConsumeAfter, cl::desc("<program arguments>..."));
+
+static cl::opt<string>
+MainFunction ("f", cl::desc("Function to execute"), cl::init("main"),
+ cl::value_desc("function name"));
+
+static cl::opt<bool>
+DebugMode("debug", cl::desc("Start program in debugger"));
+
+static cl::alias
+DebugModeA("d", cl::desc("Alias for -debug"), cl::aliasopt(DebugMode));
+
+static cl::opt<bool>
+TraceMode("trace", cl::desc("Enable Tracing"));
+
+static cl::opt<bool>
+ProfileMode("profile", cl::desc("Enable Profiling [unimp]"));
//===----------------------------------------------------------------------===//
@@ -24,7 +39,7 @@ cl::Flag ProfileMode ("profile", "Enable Profiling [unimp]");
Interpreter::Interpreter() : ExitCode(0), Profile(ProfileMode),
Trace(TraceMode), CurFrame(-1) {
CurMod = 0;
- loadModule(InputArgv.size() ? InputArgv[0] : "-");
+ loadModule(InputFile);
// Initialize the "backend"
initializeExecutionEngine();
@@ -37,6 +52,12 @@ Interpreter::Interpreter() : ExitCode(0), Profile(ProfileMode),
int main(int argc, char** argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm interpreter\n");
+ // Add the module name to the start of the argv vector...
+ //
+ InputArgv.insert(InputArgv.begin(), InputFile);
+
+
+
// Create the interpreter...
Interpreter I;
@@ -52,13 +73,6 @@ int main(int argc, char** argv) {
if (ProfileMode) I.enableProfiling();
if (TraceMode) I.enableTracing();
- // Ensure that there is at least one argument... the name of the program.
- // This is only unavailable if the program was read from stdin, instead of a
- // file.
- //
- if (InputArgv.empty())
- InputArgv.push_back("from-stdin-prog");
-
// Start interpreter into the main function...
//
if (!I.callMainMethod(MainFunction, InputArgv) && !DebugMode) {
diff --git a/tools/llvm-as/as.cpp b/tools/llvm-as/as.cpp
index a956203e64..c66dd598b9 100644
--- a/tools/llvm-as/as.cpp
+++ b/tools/llvm-as/as.cpp
@@ -18,10 +18,18 @@
#include <memory>
using std::cerr;
-cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false);
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index a956203e64..c66dd598b9 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -18,10 +18,18 @@
#include <memory>
using std::cerr;
-cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false);
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
diff --git a/tools/llvm-dis/dis.cpp b/tools/llvm-dis/dis.cpp
index eb9a3a39ed..361564c8e5 100644
--- a/tools/llvm-dis/dis.cpp
+++ b/tools/llvm-dis/dis.cpp
@@ -27,13 +27,22 @@ enum OutputMode {
c, // Generate C code
};
-cl::String InputFilename ("", "Load <arg> file, print as assembly", 0, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
- clEnumVal(llvm, "Output LLVM assembly"),
- clEnumVal(c , "Output C code for program"),
- 0);
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<enum OutputMode>
+WriteMode(cl::desc("Specify the output format:"),
+ cl::values(
+ clEnumVal(llvm, "Output LLVM assembly"),
+ clEnumVal(c , "Output C code for program"),
+ 0));
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index eb9a3a39ed..361564c8e5 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -27,13 +27,22 @@ enum OutputMode {
c, // Generate C code
};
-cl::String InputFilename ("", "Load <arg> file, print as assembly", 0, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
- clEnumVal(llvm, "Output LLVM assembly"),
- clEnumVal(c , "Output C code for program"),
- 0);
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<enum OutputMode>
+WriteMode(cl::desc("Specify the output format:"),
+ cl::values(
+ clEnumVal(llvm, "Output LLVM assembly"),
+ clEnumVal(c , "Output C code for program"),
+ 0));
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp
index d1680c0967..4730f54250 100644
--- a/tools/llvm-extract/llvm-extract.cpp
+++ b/tools/llvm-extract/llvm-extract.cpp
@@ -18,8 +18,17 @@
#include "Support/CommandLine.h"
#include <memory>
-static cl::String InputFilename("", "Specify input bytecode file", 0, "-");
-static cl::String ExtractFunc("func", "Specify function to extract", 0, "main");
+// InputFilename - The filename to read from.
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
+ cl::init("-"), cl::value_desc("filename"));
+
+
+// ExtractFunc - The function to extract from the module... defaults to main.
+static cl::opt<string>
+ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
+ cl::value_desc("function"));
+
struct FunctionExtractorPass : public Pass {
const char *getPassName() const { return "Function Extractor"; }
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 28499f1988..e2ab02e92d 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -22,13 +22,25 @@
using std::cerr;
-cl::StringList InputFilenames("", "Load <arg> files, linking them together",
- cl::OneOrMore);
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "-");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::Flag Verbose ("v", "Print information about actions taken");
-cl::Flag DumpAsm ("d", "Print assembly as linked", cl::Hidden, false);
-cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
+static cl::list<std::string>
+InputFilenames(cl::Positional, cl::OneOrMore,
+ cl::desc("Load <arg> files, linking them together"));
+
+static cl::opt<std::string>
+OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+Verbose("v", cl::desc("Print information about actions taken"));
+
+static cl::opt<bool>
+DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
+
+static cl::list<std::string>
+LibPaths("L", cl::desc("Specify a library search path"), cl::ZeroOrMore,
+ cl::value_desc("directory"), cl::Prefix);
// FileExists - Return true if the specified string is an openable file...
static inline bool FileExists(const std::string &FN) {
@@ -74,9 +86,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
int main(int argc, char **argv) {
- cl::ParseCommandLineOptions(argc, argv, " llvm linker\n",
- cl::EnableSingleLetterArgValue |
- cl::DisableSingleLetterArgGrouping);
+ cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
unsigned BaseArg = 0;
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 609fd2c1e0..54eae4103a 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -123,13 +123,27 @@ struct {
// Command line option handling code...
//
-cl::String InputFilename ("", "Load <arg> file to optimize", cl::NoFlags, "-");
-cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
-cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
-cl::Flag PrintEachXForm("p", "Print module after each transformation");
-cl::Flag Quiet ("q", "Don't print modifying pass names", 0, false);
-cl::Alias QuietA ("quiet", "Alias for -q", cl::NoFlags, Quiet);
-cl::EnumList<enum Opts> OptimizationList(cl::NoFlags,
+static cl::opt<string>
+InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
+
+static cl::opt<string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+static cl::opt<bool>
+Force("f", cl::desc("Overwrite output files"));
+
+static cl::opt<bool>
+PrintEachXForm("p", cl::desc("Print module after each transformation"));
+
+static cl::opt<bool>
+Quiet("q", cl::desc("Don't print modifying pass names"));
+
+static cl::alias
+QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet));
+
+static cl::list<enum Opts>
+OptimizationList(cl::desc("Optimizations available:"), cl::values(
clEnumVal(dce , "Dead Code Elimination"),
clEnumVal(die , "Dead Instruction Elimination"),
clEnumVal(constprop , "Simple constant propogation"),
@@ -169,7 +183,7 @@ cl::EnumList<enum Opts> OptimizationList(cl::NoFlags,
clEnumVal(printm , "Print working module to stderr"),
clEnumVal(verify , "Verify module is well formed"),
clEnumVal(lowerrefs , "Decompose multi-dimensional structure/array refs to use one index per instruction"),
-0);
+0));