eliminate static ctors for Statistic objects.

llvm-svn: 32703
This commit is contained in:
Chris Lattner 2006-12-19 22:59:26 +00:00
parent e712a5a1d2
commit 1ef9cd400d
21 changed files with 54 additions and 60 deletions

View File

@ -13,6 +13,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asm-printer"
#include "ARM.h" #include "ARM.h"
#include "ARMInstrInfo.h" #include "ARMInstrInfo.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
@ -33,9 +34,9 @@
#include <cctype> #include <cctype>
using namespace llvm; using namespace llvm;
namespace { STATISTIC(EmittedInsts, "Number of machine instrs printed");
Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
namespace {
static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { static const char *ARMCondCodeToString(ARMCC::CondCodes CC) {
switch (CC) { switch (CC) {
default: assert(0 && "Unknown condition code"); default: assert(0 && "Unknown condition code");
@ -144,6 +145,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
II != E; ++II) { II != E; ++II) {
// Print the assembly for the instruction. // Print the assembly for the instruction.
O << "\t"; O << "\t";
++EmittedInsts;
printInstruction(II); printInstruction(II);
} }
} }

View File

@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asm-printer"
#include "Alpha.h" #include "Alpha.h"
#include "AlphaInstrInfo.h" #include "AlphaInstrInfo.h"
#include "AlphaTargetMachine.h" #include "AlphaTargetMachine.h"
@ -26,9 +27,9 @@
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
using namespace llvm; using namespace llvm;
STATISTIC(EmittedInsts, "Number of machine instrs printed");
namespace { namespace {
Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter { struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter {
/// Unique incrementer for label values for referencing Global values. /// Unique incrementer for label values for referencing Global values.

View File

@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "alpha-emitter"
#include "AlphaTargetMachine.h" #include "AlphaTargetMachine.h"
#include "AlphaRelocations.h" #include "AlphaRelocations.h"
#include "Alpha.h" #include "Alpha.h"
@ -22,14 +23,8 @@
#include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/Passes.h"
#include "llvm/Function.h" #include "llvm/Function.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
using namespace llvm; using namespace llvm;
namespace {
Statistic
NumEmitted("alpha-emitter", "Number of machine instructions emitted");
}
namespace { namespace {
class AlphaCodeEmitter : public MachineFunctionPass { class AlphaCodeEmitter : public MachineFunctionPass {
const AlphaInstrInfo *II; const AlphaInstrInfo *II;

View File

@ -22,7 +22,6 @@
#include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/GlobalValue.h" #include "llvm/GlobalValue.h"
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"

View File

@ -8,10 +8,11 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// Here we check for potential replay traps introduced by the spiller // Here we check for potential replay traps introduced by the spiller
// We also align some branch targets if we can do so for free // We also align some branch targets if we can do so for free.
//
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "alpha-nops"
#include "Alpha.h" #include "Alpha.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineInstrBuilder.h"
@ -22,11 +23,10 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
using namespace llvm; using namespace llvm;
namespace { STATISTIC(nopintro, "Number of nops inserted");
Statistic nopintro("alpha-nops", "Number of nops inserted"); STATISTIC(nopalign, "Number of nops inserted for alignment");
Statistic nopalign("alpha-nops-align",
"Number of nops inserted for alignment");
namespace {
cl::opt<bool> cl::opt<bool>
AlignAll("alpha-align-all", cl::Hidden, AlignAll("alpha-align-all", cl::Hidden,
cl::desc("Align all blocks")); cl::desc("Align all blocks"));

View File

@ -16,6 +16,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asm-printer"
#include "IA64.h" #include "IA64.h"
#include "IA64TargetMachine.h" #include "IA64TargetMachine.h"
#include "llvm/Module.h" #include "llvm/Module.h"
@ -28,9 +29,9 @@
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
using namespace llvm; using namespace llvm;
STATISTIC(EmittedInsts, "Number of machine instrs printed");
namespace { namespace {
Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
struct IA64AsmPrinter : public AsmPrinter { struct IA64AsmPrinter : public AsmPrinter {
std::set<std::string> ExternalFunctionNames, ExternalObjectNames; std::set<std::string> ExternalFunctionNames, ExternalObjectNames;

View File

@ -20,6 +20,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ia64-codegen"
#include "IA64.h" #include "IA64.h"
#include "IA64InstrInfo.h" #include "IA64InstrInfo.h"
#include "IA64TargetMachine.h" #include "IA64TargetMachine.h"
@ -31,9 +32,9 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
namespace { STATISTIC(StopBitsAdded, "Number of stop bits added");
Statistic StopBitsAdded("ia64-codegen", "Number of stop bits added");
namespace {
struct IA64BundlingPass : public MachineFunctionPass { struct IA64BundlingPass : public MachineFunctionPass {
/// Target machine description which we query for reg. names, data /// Target machine description which we query for reg. names, data
/// layout, etc. /// layout, etc.

View File

@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ia64-codegen"
#include "IA64.h" #include "IA64.h"
#include "IA64TargetMachine.h" #include "IA64TargetMachine.h"
#include "IA64ISelLowering.h" #include "IA64ISelLowering.h"
@ -21,7 +22,6 @@
#include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/GlobalValue.h" #include "llvm/GlobalValue.h"
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
@ -32,9 +32,6 @@
using namespace llvm; using namespace llvm;
namespace { namespace {
Statistic FusedFP ("ia64-codegen", "Number of fused fp operations");
Statistic FrameOff("ia64-codegen", "Number of frame idx offsets collapsed");
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// IA64DAGToDAGISel - IA64 specific code to select IA64 machine /// IA64DAGToDAGISel - IA64 specific code to select IA64 machine
/// instructions for SelectionDAG operations. /// instructions for SelectionDAG operations.

View File

@ -44,9 +44,9 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
namespace { STATISTIC(EmittedInsts, "Number of machine instrs printed");
Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
namespace {
struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter {
std::set<std::string> FnStubs, GVStubs; std::set<std::string> FnStubs, GVStubs;
const PPCSubtarget &Subtarget; const PPCSubtarget &Subtarget;

View File

@ -15,6 +15,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ppc-branch-select"
#include "PPC.h" #include "PPC.h"
#include "PPCInstrBuilder.h" #include "PPCInstrBuilder.h"
#include "PPCInstrInfo.h" #include "PPCInstrInfo.h"
@ -27,8 +28,7 @@
#include "llvm/Support/MathExtras.h" #include "llvm/Support/MathExtras.h"
using namespace llvm; using namespace llvm;
static Statistic NumExpanded("ppc-branch-select", STATISTIC(NumExpanded, "Number of branches expanded to long format");
"Num branches expanded to long format");
namespace { namespace {
struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass { struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass {

View File

@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ppc-codegen"
#include "PPC.h" #include "PPC.h"
#include "PPCPredicates.h" #include "PPCPredicates.h"
#include "PPCTargetMachine.h" #include "PPCTargetMachine.h"
@ -23,7 +24,6 @@
#include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/GlobalValue.h" #include "llvm/GlobalValue.h"
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
@ -35,8 +35,6 @@
using namespace llvm; using namespace llvm;
namespace { namespace {
Statistic FrameOff("ppc-codegen", "Number of frame idx offsets collapsed");
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// PPCDAGToDAGISel - PPC specific code to select PPC machine /// PPCDAGToDAGISel - PPC specific code to select PPC machine
/// instructions for SelectionDAG operations. /// instructions for SelectionDAG operations.

View File

@ -11,6 +11,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "delayslotfiller"
#include "Sparc.h" #include "Sparc.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineInstrBuilder.h"
@ -19,9 +20,9 @@
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
using namespace llvm; using namespace llvm;
namespace { STATISTIC(FilledSlots, "Number of delay slots filled");
Statistic FilledSlots("delayslotfiller", "Num. of delay slots filled");
namespace {
struct Filler : public MachineFunctionPass { struct Filler : public MachineFunctionPass {
/// Target machine description which we query for reg. names, data /// Target machine description which we query for reg. names, data
/// layout, etc. /// layout, etc.

View File

@ -11,6 +11,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "fpmover"
#include "Sparc.h" #include "Sparc.h"
#include "SparcSubtarget.h" #include "SparcSubtarget.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
@ -21,10 +22,10 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
using namespace llvm; using namespace llvm;
namespace { STATISTIC(NumFpDs , "Number of instructions translated");
Statistic NumFpDs("fpmover", "Number of instructions translated"); STATISTIC(NoopFpDs, "Number of noop instructions removed");
Statistic NoopFpDs("fpmover", "Number of noop instructions removed");
namespace {
struct FPMover : public MachineFunctionPass { struct FPMover : public MachineFunctionPass {
/// Target machine description which we query for reg. names, data /// Target machine description which we query for reg. names, data
/// layout, etc. /// layout, etc.

View File

@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asm-printer"
#include "Sparc.h" #include "Sparc.h"
#include "SparcInstrInfo.h" #include "SparcInstrInfo.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
@ -32,9 +33,9 @@
#include <cctype> #include <cctype>
using namespace llvm; using namespace llvm;
namespace { STATISTIC(EmittedInsts, "Number of machine instrs printed");
Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
namespace {
struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter {
SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T) SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
: AsmPrinter(O, TM, T) { : AsmPrinter(O, TM, T) {

View File

@ -13,6 +13,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asm-printer"
#include "X86ATTAsmPrinter.h" #include "X86ATTAsmPrinter.h"
#include "X86.h" #include "X86.h"
#include "X86MachineFunctionInfo.h" #include "X86MachineFunctionInfo.h"
@ -23,8 +24,11 @@
#include "llvm/Support/Mangler.h" #include "llvm/Support/Mangler.h"
#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Statistic.h"
using namespace llvm; using namespace llvm;
STATISTIC(EmittedInsts, "Number of machine instrs printed");
/// getSectionForFunction - Return the section that we should emit the /// getSectionForFunction - Return the section that we should emit the
/// specified function body into. /// specified function body into.
std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const {

View File

@ -27,12 +27,8 @@
#include "llvm/Assembly/Writer.h" #include "llvm/Assembly/Writer.h"
#include "llvm/Support/Mangler.h" #include "llvm/Support/Mangler.h"
#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetAsmInfo.h"
using namespace llvm; using namespace llvm;
Statistic llvm::EmittedInsts("asm-printer",
"Number of machine instrs printed");
static X86FunctionInfo calculateFunctionInfo(const Function *F, static X86FunctionInfo calculateFunctionInfo(const Function *F,
const TargetData *TD) { const TargetData *TD) {
X86FunctionInfo Info; X86FunctionInfo Info;

View File

@ -22,15 +22,12 @@
#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/CodeGen/MachineDebugInfo.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include <set> #include <set>
namespace llvm { namespace llvm {
extern Statistic EmittedInsts;
// FIXME: Move this to CodeGen/AsmPrinter.h // FIXME: Move this to CodeGen/AsmPrinter.h
namespace PICStyle { namespace PICStyle {
enum X86AsmPICStyle { enum X86AsmPICStyle {

View File

@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "x86-emitter"
#include "X86InstrInfo.h" #include "X86InstrInfo.h"
#include "X86Subtarget.h" #include "X86Subtarget.h"
#include "X86TargetMachine.h" #include "X86TargetMachine.h"
@ -28,10 +29,7 @@
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
using namespace llvm; using namespace llvm;
namespace { STATISTIC(NumEmitted, "Number of machine instructions emitted");
Statistic
NumEmitted("x86-emitter", "Number of machine instructions emitted");
}
namespace { namespace {
class VISIBILITY_HIDDEN Emitter : public MachineFunctionPass { class VISIBILITY_HIDDEN Emitter : public MachineFunctionPass {

View File

@ -28,7 +28,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "fp" #define DEBUG_TYPE "x86-codegen"
#include "X86.h" #include "X86.h"
#include "X86InstrInfo.h" #include "X86InstrInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
@ -47,10 +47,10 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
namespace { STATISTIC(NumFXCH, "Number of fxch instructions inserted");
Statistic NumFXCH("x86-codegen", "Number of fxch instructions inserted"); STATISTIC(NumFP , "Number of floating point instructions");
Statistic NumFP ("x86-codegen", "Number of floating point instructions");
namespace {
struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass { struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass {
virtual bool runOnMachineFunction(MachineFunction &MF); virtual bool runOnMachineFunction(MachineFunction &MF);

View File

@ -38,6 +38,10 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
STATISTIC(NumFPKill , "Number of FP_REG_KILL instructions added");
STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor");
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Pattern Matcher Implementation // Pattern Matcher Implementation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -75,12 +79,6 @@ namespace {
} }
namespace { namespace {
Statistic
NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added");
Statistic
NumLoadMoved("x86-codegen", "Number of loads moved below TokenFactor");
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// ISel - X86 specific code to select X86 machine instructions for /// ISel - X86 specific code to select X86 machine instructions for
/// SelectionDAG operations. /// SelectionDAG operations.

View File

@ -13,6 +13,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asm-printer"
#include "X86IntelAsmPrinter.h" #include "X86IntelAsmPrinter.h"
#include "X86TargetAsmInfo.h" #include "X86TargetAsmInfo.h"
#include "X86.h" #include "X86.h"
@ -23,8 +24,11 @@
#include "llvm/Support/Mangler.h" #include "llvm/Support/Mangler.h"
#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Statistic.h"
using namespace llvm; using namespace llvm;
STATISTIC(EmittedInsts, "Number of machine instrs printed");
std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const { std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const {
// Intel asm always emits functions to _text. // Intel asm always emits functions to _text.
return "_text"; return "_text";