[cfe-commits] r64869 - /cfe/trunk/Driver/clang.cpp

Chris Lattner sabre at nondot.org
Tue Feb 17 17:12:44 PST 2009


Author: lattner
Date: Tue Feb 17 19:12:43 2009
New Revision: 64869

URL: http://llvm.org/viewvc/llvm-project?rev=64869&view=rev
Log:
wire up a minimal -ftime-report, which prints the optimizer/codegen 
times.  Daniel, plz add driver support.

Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=64869&r1=64868&r2=64869&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Tue Feb 17 19:12:43 2009
@@ -42,6 +42,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
+#include "llvm/Pass.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringExtras.h"
@@ -211,6 +212,12 @@
 //===----------------------------------------------------------------------===//
 // Builtin Options
 //===----------------------------------------------------------------------===//
+
+static llvm::cl::opt<bool>
+TimeReport("ftime-report",
+           llvm::cl::desc("Print the amount of time each "
+                          "phase of compilation takes"));
+
 static llvm::cl::opt<bool>
 Freestanding("ffreestanding",
              llvm::cl::desc("Assert that the compilation takes place in a "
@@ -1503,6 +1510,10 @@
   // If no input was specified, read from stdin.
   if (InputFilenames.empty())
     InputFilenames.push_back("-");
+  
+  // Handle -ftime-report.
+  if (TimeReport)
+    llvm::TimePassesIsEnabled = true;
     
   // Create a file manager object to provide access to and cache the filesystem.
   FileManager FileMgr;





More information about the cfe-commits mailing list