From 2c9b913fc0fe0c6b2e41e84fc80f905a743ca054 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Mon, 6 Oct 2003 15:41:21 +0000 Subject: [PATCH] Add # of printed instructions statistic to both the SPARC and X86 LLC backends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8892 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/SparcV9/SparcV9AsmPrinter.cpp | 5 ++++- lib/Target/X86/Printer.cpp | 4 ++++ lib/Target/X86/X86AsmPrinter.cpp | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index ec85038e5a7..029935da6ed 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.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 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 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &mop, toAsm << ")"; } - void SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI) { @@ -507,6 +509,7 @@ SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI) N = 1; toAsm << "\n"; + ++EmittedInsts; } void diff --git a/lib/Target/X86/Printer.cpp b/lib/Target/X86/Printer.cpp index d36f298fe99..fbc6b6e1aff 100644 --- a/lib/Target/X86/Printer.cpp +++ b/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 EmitCygwin("enable-cygwin-compatible-output", cl::Hidden, @@ -573,6 +576,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) { 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 diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index d36f298fe99..fbc6b6e1aff 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.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 EmitCygwin("enable-cygwin-compatible-output", cl::Hidden, @@ -573,6 +576,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) { 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 -- 2.34.1