Subzero: Rewrite the pass timing infrastructure.

This makes it much more useful for individual analysis and long-term translation performance tracking.

1. Collect and report aggregated across the entire translation, instead of function-by-function.  If you really care about a single function, just extract it and translate it separately for analysis.

2. Remove "-verbose time" and just use -timing.

3. Collects two kinds of timings: cumulative and flat.  Cumulative measures the total time, even if a callee also times itself.  Flat only measures the currently active timer at the top of the stack.  The flat times should add up to 100%, but cumulative will usually add up to much more than 100%.

BUG= none
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/610813002
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 47f6a5e..e1925df 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -12,7 +12,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PNaClTranslator.h"
 #include "IceCfg.h"
 #include "IceCfgNode.h"
 #include "IceClFlags.h"
@@ -20,6 +19,7 @@
 #include "IceInst.h"
 #include "IceOperand.h"
 #include "IceTypeConverter.h"
+#include "PNaClTranslator.h"
 #include "llvm/Analysis/NaCl/PNaClABIProps.h"
 #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
 #include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
@@ -852,7 +852,7 @@
     }
   }
 
-  ~FunctionParser() override;
+  ~FunctionParser() override {};
 
   // Set the next constant ID to the given constant C.
   void setNextConstantID(Ice::Constant *C) {
@@ -860,8 +860,6 @@
   }
 
 private:
-  // Timer for reading function bitcode and converting to ICE.
-  Ice::Timer TConvert;
   // The corresponding ICE function defined by the function block.
   Ice::Cfg *Func;
   // The index to the current basic block being built.
@@ -1376,13 +1374,6 @@
   }
 };
 
-FunctionParser::~FunctionParser() {
-  if (getFlags().SubzeroTimingEnabled) {
-    errs() << "[Subzero timing] Convert function " << Func->getFunctionName()
-           << ": " << TConvert.getElapsedSec() << " sec\n";
-  }
-}
-
 void FunctionParser::ReportInvalidBinopOpcode(unsigned Opcode, Ice::Type Ty) {
   std::string Buffer;
   raw_string_ostream StrBuf(Buffer);