Add # of printed instructions statistic to both the SPARC and X86 LLC backends.

llvm-svn: 8892
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp
index ec85038..029935d 100644
--- a/llvm/lib/Target/Sparc/EmitAssembly.cpp
+++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp
@@ -21,11 +21,14 @@
 #include "llvm/Pass.h"
 #include "llvm/Assembly/Writer.h"
 #include "Support/StringExtras.h"
+#include "Support/Statistic.h"
 #include "SparcInternals.h"
 #include <string>
 
 namespace {
 
+Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
+
 class GlobalIdTable: public Annotation {
   static AnnotationID AnnotId;
   friend class AsmPrinter;              // give access to AnnotId
@@ -483,7 +486,6 @@
     toAsm << ")";
 }
 
-
 void
 SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI)
 {
@@ -507,6 +509,7 @@
       N = 1;
   
   toAsm << "\n";
+  ++EmittedInsts;
 }
 
 void
diff --git a/llvm/lib/Target/X86/Printer.cpp b/llvm/lib/Target/X86/Printer.cpp
index d36f298..fbc6b6e 100644
--- a/llvm/lib/Target/X86/Printer.cpp
+++ b/llvm/lib/Target/X86/Printer.cpp
@@ -18,10 +18,13 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/Mangler.h"
+#include "Support/Statistic.h"
 #include "Support/StringExtras.h"
 #include "Support/CommandLine.h"
 
 namespace {
+  Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
+
   // FIXME: This should be automatically picked up by autoconf from the C
   // frontend
   cl::opt<bool> EmitCygwin("enable-cygwin-compatible-output", cl::Hidden,
@@ -573,6 +576,7 @@
   const TargetInstrInfo &TII = TM.getInstrInfo();
   const TargetInstrDescriptor &Desc = TII.get(Opcode);
 
+  ++EmittedInsts;
   switch (Desc.TSFlags & X86II::FormMask) {
   case X86II::Pseudo:
     // Print pseudo-instructions as comments; either they should have been