From 95b2c7da5e83670881270c1cd231a240be0556d9 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 19 Dec 2006 22:59:26 +0000 Subject: [PATCH] eliminate static ctors for Statistic objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32703 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMAsmPrinter.cpp | 6 ++++-- lib/Target/Alpha/AlphaAsmPrinter.cpp | 5 +++-- lib/Target/Alpha/AlphaCodeEmitter.cpp | 7 +------ lib/Target/Alpha/AlphaISelDAGToDAG.cpp | 1 - lib/Target/Alpha/AlphaLLRP.cpp | 12 ++++++------ lib/Target/IA64/IA64AsmPrinter.cpp | 5 +++-- lib/Target/IA64/IA64Bundling.cpp | 5 +++-- lib/Target/IA64/IA64ISelDAGToDAG.cpp | 5 +---- lib/Target/PowerPC/PPCAsmPrinter.cpp | 4 ++-- lib/Target/PowerPC/PPCBranchSelector.cpp | 4 ++-- lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 4 +--- lib/Target/Sparc/DelaySlotFiller.cpp | 5 +++-- lib/Target/Sparc/FPMover.cpp | 7 ++++--- lib/Target/Sparc/SparcAsmPrinter.cpp | 5 +++-- lib/Target/X86/X86ATTAsmPrinter.cpp | 4 ++++ lib/Target/X86/X86AsmPrinter.cpp | 4 ---- lib/Target/X86/X86AsmPrinter.h | 3 --- lib/Target/X86/X86CodeEmitter.cpp | 6 ++---- lib/Target/X86/X86FloatingPoint.cpp | 8 ++++---- lib/Target/X86/X86ISelDAGToDAG.cpp | 10 ++++------ lib/Target/X86/X86IntelAsmPrinter.cpp | 4 ++++ 21 files changed, 54 insertions(+), 60 deletions(-) diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index 291073e04cd..d4c6634214a 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "ARM.h" #include "ARMInstrInfo.h" #include "llvm/Constants.h" @@ -33,9 +34,9 @@ #include using namespace llvm; -namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); +STATISTIC(EmittedInsts, "Number of machine instrs printed"); +namespace { static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { switch (CC) { default: assert(0 && "Unknown condition code"); @@ -144,6 +145,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { II != E; ++II) { // Print the assembly for the instruction. O << "\t"; + ++EmittedInsts; printInstruction(II); } } diff --git a/lib/Target/Alpha/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AlphaAsmPrinter.cpp index be8973a337a..6e36f115234 100644 --- a/lib/Target/Alpha/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AlphaAsmPrinter.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "Alpha.h" #include "AlphaInstrInfo.h" #include "AlphaTargetMachine.h" @@ -26,9 +27,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); - struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter { /// Unique incrementer for label values for referencing Global values. diff --git a/lib/Target/Alpha/AlphaCodeEmitter.cpp b/lib/Target/Alpha/AlphaCodeEmitter.cpp index 6f5bc70f058..15aef8532d5 100644 --- a/lib/Target/Alpha/AlphaCodeEmitter.cpp +++ b/lib/Target/Alpha/AlphaCodeEmitter.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "alpha-emitter" #include "AlphaTargetMachine.h" #include "AlphaRelocations.h" #include "Alpha.h" @@ -22,14 +23,8 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Function.h" #include "llvm/Support/Debug.h" -#include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic - NumEmitted("alpha-emitter", "Number of machine instructions emitted"); -} - namespace { class AlphaCodeEmitter : public MachineFunctionPass { const AlphaInstrInfo *II; diff --git a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp index fc752aa31f6..14790456599 100644 --- a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp +++ b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp @@ -22,7 +22,6 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Intrinsics.h" diff --git a/lib/Target/Alpha/AlphaLLRP.cpp b/lib/Target/Alpha/AlphaLLRP.cpp index 6e59e466b69..a5c984eaf6c 100644 --- a/lib/Target/Alpha/AlphaLLRP.cpp +++ b/lib/Target/Alpha/AlphaLLRP.cpp @@ -8,10 +8,11 @@ //===----------------------------------------------------------------------===// // // 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 "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -22,11 +23,10 @@ #include "llvm/Support/CommandLine.h" using namespace llvm; -namespace { - Statistic nopintro("alpha-nops", "Number of nops inserted"); - Statistic nopalign("alpha-nops-align", - "Number of nops inserted for alignment"); +STATISTIC(nopintro, "Number of nops inserted"); +STATISTIC(nopalign, "Number of nops inserted for alignment"); +namespace { cl::opt AlignAll("alpha-align-all", cl::Hidden, cl::desc("Align all blocks")); diff --git a/lib/Target/IA64/IA64AsmPrinter.cpp b/lib/Target/IA64/IA64AsmPrinter.cpp index 6915cbc5d95..4f45dc7790c 100644 --- a/lib/Target/IA64/IA64AsmPrinter.cpp +++ b/lib/Target/IA64/IA64AsmPrinter.cpp @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "IA64.h" #include "IA64TargetMachine.h" #include "llvm/Module.h" @@ -28,9 +29,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); - struct IA64AsmPrinter : public AsmPrinter { std::set ExternalFunctionNames, ExternalObjectNames; diff --git a/lib/Target/IA64/IA64Bundling.cpp b/lib/Target/IA64/IA64Bundling.cpp index 9b5e4c741e4..7e37df022d7 100644 --- a/lib/Target/IA64/IA64Bundling.cpp +++ b/lib/Target/IA64/IA64Bundling.cpp @@ -20,6 +20,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ia64-codegen" #include "IA64.h" #include "IA64InstrInfo.h" #include "IA64TargetMachine.h" @@ -31,9 +32,9 @@ #include using namespace llvm; -namespace { - Statistic StopBitsAdded("ia64-codegen", "Number of stop bits added"); +STATISTIC(StopBitsAdded, "Number of stop bits added"); +namespace { struct IA64BundlingPass : public MachineFunctionPass { /// Target machine description which we query for reg. names, data /// layout, etc. diff --git a/lib/Target/IA64/IA64ISelDAGToDAG.cpp b/lib/Target/IA64/IA64ISelDAGToDAG.cpp index 7a49418de64..6185d380b54 100644 --- a/lib/Target/IA64/IA64ISelDAGToDAG.cpp +++ b/lib/Target/IA64/IA64ISelDAGToDAG.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ia64-codegen" #include "IA64.h" #include "IA64TargetMachine.h" #include "IA64ISelLowering.h" @@ -21,7 +22,6 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Intrinsics.h" @@ -32,9 +32,6 @@ using namespace llvm; 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 /// instructions for SelectionDAG operations. diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 1ffd65265f1..3a1f945b332 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -44,9 +44,9 @@ #include using namespace llvm; -namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); +STATISTIC(EmittedInsts, "Number of machine instrs printed"); +namespace { struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; const PPCSubtarget &Subtarget; diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp index 7a8b094bfff..e8274f3b9e5 100644 --- a/lib/Target/PowerPC/PPCBranchSelector.cpp +++ b/lib/Target/PowerPC/PPCBranchSelector.cpp @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ppc-branch-select" #include "PPC.h" #include "PPCInstrBuilder.h" #include "PPCInstrInfo.h" @@ -27,8 +28,7 @@ #include "llvm/Support/MathExtras.h" using namespace llvm; -static Statistic NumExpanded("ppc-branch-select", - "Num branches expanded to long format"); +STATISTIC(NumExpanded, "Number of branches expanded to long format"); namespace { struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass { diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 08cceecb5b0..c8a7738372b 100644 --- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ppc-codegen" #include "PPC.h" #include "PPCPredicates.h" #include "PPCTargetMachine.h" @@ -23,7 +24,6 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Intrinsics.h" @@ -35,8 +35,6 @@ using namespace llvm; namespace { - Statistic FrameOff("ppc-codegen", "Number of frame idx offsets collapsed"); - //===--------------------------------------------------------------------===// /// PPCDAGToDAGISel - PPC specific code to select PPC machine /// instructions for SelectionDAG operations. diff --git a/lib/Target/Sparc/DelaySlotFiller.cpp b/lib/Target/Sparc/DelaySlotFiller.cpp index 768b79b9fb1..898b23ab50f 100644 --- a/lib/Target/Sparc/DelaySlotFiller.cpp +++ b/lib/Target/Sparc/DelaySlotFiller.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "delayslotfiller" #include "Sparc.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -19,9 +20,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic FilledSlots("delayslotfiller", "Num. of delay slots filled"); +STATISTIC(FilledSlots, "Number of delay slots filled"); +namespace { struct Filler : public MachineFunctionPass { /// Target machine description which we query for reg. names, data /// layout, etc. diff --git a/lib/Target/Sparc/FPMover.cpp b/lib/Target/Sparc/FPMover.cpp index b85d2a9da01..f7e6506de43 100644 --- a/lib/Target/Sparc/FPMover.cpp +++ b/lib/Target/Sparc/FPMover.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "fpmover" #include "Sparc.h" #include "SparcSubtarget.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -21,10 +22,10 @@ #include "llvm/Support/Debug.h" using namespace llvm; -namespace { - Statistic NumFpDs("fpmover", "Number of instructions translated"); - Statistic NoopFpDs("fpmover", "Number of noop instructions removed"); +STATISTIC(NumFpDs , "Number of instructions translated"); +STATISTIC(NoopFpDs, "Number of noop instructions removed"); +namespace { struct FPMover : public MachineFunctionPass { /// Target machine description which we query for reg. names, data /// layout, etc. diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index 458b1531915..3bb003ad3d3 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "Sparc.h" #include "SparcInstrInfo.h" #include "llvm/Constants.h" @@ -32,9 +33,9 @@ #include using namespace llvm; -namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); +STATISTIC(EmittedInsts, "Number of machine instrs printed"); +namespace { struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T) : AsmPrinter(O, TM, T) { diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index f9645b80d28..f9b03b2455f 100755 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "X86ATTAsmPrinter.h" #include "X86.h" #include "X86MachineFunctionInfo.h" @@ -23,8 +24,11 @@ #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + /// getSectionForFunction - Return the section that we should emit the /// specified function body into. std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 578e1aa9785..65d2e7d36a6 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -27,12 +27,8 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" - using namespace llvm; -Statistic llvm::EmittedInsts("asm-printer", - "Number of machine instrs printed"); - static X86FunctionInfo calculateFunctionInfo(const Function *F, const TargetData *TD) { X86FunctionInfo Info; diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h index af182fab259..c5f521bf786 100755 --- a/lib/Target/X86/X86AsmPrinter.h +++ b/lib/Target/X86/X86AsmPrinter.h @@ -22,15 +22,12 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineDebugInfo.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include namespace llvm { -extern Statistic EmittedInsts; - // FIXME: Move this to CodeGen/AsmPrinter.h namespace PICStyle { enum X86AsmPICStyle { diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index dbbd66f491b..fa3cd57b8a3 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "x86-emitter" #include "X86InstrInfo.h" #include "X86Subtarget.h" #include "X86TargetMachine.h" @@ -28,10 +29,7 @@ #include "llvm/Target/TargetOptions.h" using namespace llvm; -namespace { - Statistic - NumEmitted("x86-emitter", "Number of machine instructions emitted"); -} +STATISTIC(NumEmitted, "Number of machine instructions emitted"); namespace { class VISIBILITY_HIDDEN Emitter : public MachineFunctionPass { diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp index b70b6e29712..7bed30364fb 100644 --- a/lib/Target/X86/X86FloatingPoint.cpp +++ b/lib/Target/X86/X86FloatingPoint.cpp @@ -28,7 +28,7 @@ // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "fp" +#define DEBUG_TYPE "x86-codegen" #include "X86.h" #include "X86InstrInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -47,10 +47,10 @@ #include using namespace llvm; -namespace { - Statistic NumFXCH("x86-codegen", "Number of fxch instructions inserted"); - Statistic NumFP ("x86-codegen", "Number of floating point instructions"); +STATISTIC(NumFXCH, "Number of fxch instructions inserted"); +STATISTIC(NumFP , "Number of floating point instructions"); +namespace { struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index 863e6d8a14d..411bcbeb561 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -38,6 +38,10 @@ #include using namespace llvm; +STATISTIC(NumFPKill , "Number of FP_REG_KILL instructions added"); +STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor"); + + //===----------------------------------------------------------------------===// // Pattern Matcher Implementation //===----------------------------------------------------------------------===// @@ -75,12 +79,6 @@ 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 /// SelectionDAG operations. diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index 142177c4ee2..fa352957502 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "X86IntelAsmPrinter.h" #include "X86TargetAsmInfo.h" #include "X86.h" @@ -23,8 +24,11 @@ #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const { // Intel asm always emits functions to _text. return "_text"; -- 2.34.1