When inserting code, make sure not to insert it before PHI nodes. This
[oota-llvm.git] / lib / Support / Statistic.cpp
index 1141086c3f3c34f2b49998f0446ffe7222db0967..f94f246bae4d0986509f8ada14d90554949b6f53 100644 (file)
@@ -1,5 +1,12 @@
 //===-- Statistic.cpp - Easy way to expose stats information --------------===//
 //
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
 // This file implements the 'Statistic' class, which is designed to be an easy
 // way to expose various success metrics from passes.  These statistics are
 // printed at the end of a run, when the -stats command line option is enabled
 //
 //===----------------------------------------------------------------------===//
 
-#include "Support/Statistic.h"
-#include "Support/CommandLine.h"
-#include <iostream>
+#include "llvm/ADT/Statistic.h"
+#include "llvm/Support/CommandLine.h"
 #include <sstream>
+#include <iostream>
 #include <algorithm>
+using namespace llvm;
 
 // GetLibSupportInfoOutputFile - Return a file stream to print our output on...
-std::ostream *GetLibSupportInfoOutputFile();
-
-bool DebugFlag;  // DebugFlag - Exported boolean set by the -debug option
+namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
 
 unsigned StatisticBase::NumStats = 0;
 
@@ -33,19 +39,11 @@ unsigned StatisticBase::NumStats = 0;
 static cl::opt<bool>
 Enabled("stats", cl::desc("Enable statistics output from program"));
 
-#ifndef NDEBUG
-// -debug - Command line option to enable the DEBUG statements in the passes.
-// This flag may only be enabled in debug builds.
-static cl::opt<bool, true>
-Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
-      cl::location(DebugFlag));
-#endif
-
 struct StatRecord {
   std::string Value;
   const char *Name, *Desc;
 
-  StatRecord(const std::string V, const char *N, const char *D)
+  StatRecord(const std::string &V, const char *N, const char *D)
     : Value(V), Name(N), Desc(D) {}
 
   bool operator<(const StatRecord &SR) const {
@@ -80,9 +78,9 @@ void StatisticBase::destroy() const {
     // Figure out how long the biggest Value and Name fields are...
     unsigned MaxNameLen = 0, MaxValLen = 0;
     for (unsigned i = 0, e = AccumStats->size(); i != e; ++i) {
-      MaxValLen = std::max(MaxValLen, 
+      MaxValLen = std::max(MaxValLen,
                            (unsigned)(*AccumStats)[i].Value.length());
-      MaxNameLen = std::max(MaxNameLen, 
+      MaxNameLen = std::max(MaxNameLen,
                             (unsigned)std::strlen((*AccumStats)[i].Name));
     }