[llvm-commits] CVS: llvm/tools/analyze/analyze.cpp
Robert L. Bocchino Jr.
bocchino at persephone.cs.uiuc.edu
Thu Mar 2 18:12:26 PST 2006
Changes in directory llvm/tools/analyze:
analyze.cpp updated: 1.65 -> 1.66
---
Log message:
Implemented -quiet feature for analyze
---
Diffs of the changes: (+35 -30)
analyze.cpp | 65 ++++++++++++++++++++++++++++++++----------------------------
1 files changed, 35 insertions(+), 30 deletions(-)
Index: llvm/tools/analyze/analyze.cpp
diff -u llvm/tools/analyze/analyze.cpp:1.65 llvm/tools/analyze/analyze.cpp:1.66
--- llvm/tools/analyze/analyze.cpp:1.65 Sun Oct 23 20:00:13 2005
+++ llvm/tools/analyze/analyze.cpp Thu Mar 2 20:12:04 2006
@@ -31,13 +31,36 @@
using namespace llvm;
+namespace {
+ cl::opt<std::string>
+ InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"),
+ cl::value_desc("filename"));
+
+ cl::opt<bool> Quiet("q", cl::desc("Don't print analysis pass names"));
+ cl::alias QuietA("quiet", cl::desc("Alias for -q"),
+ cl::aliasopt(Quiet));
+
+ cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
+ cl::desc("Do not verify input module"));
+
+ // The AnalysesList is automatically populated with registered Passes by the
+ // PassNameParser.
+ //
+ cl::list<const PassInfo*, bool, FilteredPassNameParser<PassInfo::Analysis> >
+ AnalysesList(cl::desc("Analyses available:"));
+
+ Timer BytecodeLoadTimer("Bytecode Loader");
+}
+
struct ModulePassPrinter : public ModulePass {
const PassInfo *PassToPrint;
ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
virtual bool runOnModule(Module &M) {
- std::cout << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
- getAnalysisID<Pass>(PassToPrint).print(std::cout, &M);
+ if (!Quiet) {
+ std::cout << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
+ getAnalysisID<Pass>(PassToPrint).print(std::cout, &M);
+ }
// Get and print pass...
return false;
@@ -56,11 +79,12 @@
FunctionPassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
virtual bool runOnFunction(Function &F) {
- std::cout << "Printing analysis '" << PassToPrint->getPassName()
- << "' for function '" << F.getName() << "':\n";
- getAnalysisID<Pass>(PassToPrint).print(std::cout, F.getParent());
-
+ if (!Quiet) {
+ std::cout << "Printing analysis '" << PassToPrint->getPassName()
+ << "' for function '" << F.getName() << "':\n";
+ }
// Get and print pass...
+ getAnalysisID<Pass>(PassToPrint).print(std::cout, F.getParent());
return false;
}
@@ -77,11 +101,13 @@
BasicBlockPassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
virtual bool runOnBasicBlock(BasicBlock &BB) {
- std::cout << "Printing Analysis info for BasicBlock '" << BB.getName()
- << "': Pass " << PassToPrint->getPassName() << ":\n";
- getAnalysisID<Pass>(PassToPrint).print(std::cout, BB.getParent()->getParent());
+ if (!Quiet) {
+ std::cout << "Printing Analysis info for BasicBlock '" << BB.getName()
+ << "': Pass " << PassToPrint->getPassName() << ":\n";
+ }
// Get and print pass...
+ getAnalysisID<Pass>(PassToPrint).print(std::cout, BB.getParent()->getParent());
return false;
}
@@ -95,27 +121,6 @@
-namespace {
- cl::opt<std::string>
- InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"),
- cl::value_desc("filename"));
-
- cl::opt<bool> Quiet("q", cl::desc("Don't print analysis pass names"));
- cl::alias QuietA("quiet", cl::desc("Alias for -q"),
- cl::aliasopt(Quiet));
-
- cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
- cl::desc("Do not verify input module"));
-
- // The AnalysesList is automatically populated with registered Passes by the
- // PassNameParser.
- //
- cl::list<const PassInfo*, bool, FilteredPassNameParser<PassInfo::Analysis> >
- AnalysesList(cl::desc("Analyses available:"));
-
- Timer BytecodeLoadTimer("Bytecode Loader");
-}
-
int main(int argc, char **argv) {
try {
cl::ParseCommandLineOptions(argc, argv, " llvm analysis printer tool\n");
More information about the llvm-commits
mailing list