llvm.org GIT mirror llvm / ac0b6ae
Detemplatize the Statistic class. The only type it is instantiated with is 'unsigned'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
97 changed file(s) with 252 addition(s) and 255 deletion(s). Raw diff Collapse all Expand all
77 //===----------------------------------------------------------------------===//
88 //
99 // This file defines the 'Statistic' class, which is designed to be an easy way
10 // to expose various success metrics from passes. These statistics are printed
11 // at the end of a run, when the -stats command line option is enabled on the
12 // command line.
10 // to expose various metrics from passes. These statistics are printed at the
11 // end of a run (from llvm_shutdown), when the -stats command line option is
12 // passed on the command line.
1313 //
1414 // This is useful for reporting information like the number of instructions
1515 // simplified, optimized or removed by various transformations, like this:
1616 //
17 // static Statistic<> NumInstsKilled("gcse", "Number of instructions killed");
17 // static Statistic NumInstsKilled("gcse", "Number of instructions killed");
1818 //
1919 // Later, in the code: ++NumInstsKilled;
20 //
21 // NOTE: Statistics *must* be declared as global variables.
2022 //
2123 //===----------------------------------------------------------------------===//
2224
2830
2931 namespace llvm {
3032
31 // StatisticBase - Nontemplated base class for Statistic<> class...
33 // StatisticBase - Nontemplated base class for Statistic class...
3234 class StatisticBase {
3335 const char *Name;
3436 const char *Desc;
5456 };
5557
5658 // Statistic Class - templated on the data type we are monitoring...
57 template
5859 class Statistic : private StatisticBase {
59 DataType Value;
60 unsigned Value;
6061
6162 virtual void printValue(std::ostream &o) const { o << Value; }
62 virtual bool hasSomeData() const { return Value != DataType(); }
63 virtual bool hasSomeData() const { return Value != 0; }
6364 public:
6465 // Normal constructor, default initialize data item...
6566 Statistic(const char *name, const char *desc)
66 : StatisticBase(name, desc), Value(DataType()) {}
67 : StatisticBase(name, desc), Value(0) {}
6768
6869 // Constructor to provide an initial value...
69 Statistic(const DataType &Val, const char *name, const char *desc)
70 Statistic(const unsigned &Val, const char *name, const char *desc)
7071 : StatisticBase(name, desc), Value(Val) {}
7172
7273 // Print information when destroyed, iff command line option is specified
7374 ~Statistic() { destroy(); }
7475
7576 // Allow use of this class as the value itself...
76 operator DataType() const { return Value; }
77 const Statistic &operator=(DataType Val) { Value = Val; return *this; }
77 operator unsigned() const { return Value; }
78 const Statistic &operator=(unsigned Val) { Value = Val; return *this; }
7879 const Statistic &operator++() { ++Value; return *this; }
79 DataType operator++(int) { return Value++; }
80 unsigned operator++(int) { return Value++; }
8081 const Statistic &operator--() { --Value; return *this; }
81 DataType operator--(int) { return Value--; }
82 const Statistic &operator+=(const DataType &V) { Value += V; return *this; }
83 const Statistic &operator-=(const DataType &V) { Value -= V; return *this; }
84 const Statistic &operator*=(const DataType &V) { Value *= V; return *this; }
85 const Statistic &operator/=(const DataType &V) { Value /= V; return *this; }
82 unsigned operator--(int) { return Value--; }
83 const Statistic &operator+=(const unsigned &V) { Value += V; return *this; }
84 const Statistic &operator-=(const unsigned &V) { Value -= V; return *this; }
85 const Statistic &operator*=(const unsigned &V) { Value *= V; return *this; }
86 const Statistic &operator/=(const unsigned &V) { Value /= V; return *this; }
8687 };
87
88 EXTERN_TEMPLATE_INSTANTIATION(class Statistic);
8988
9089 } // End llvm namespace
9190
2525 using namespace llvm;
2626
2727 namespace {
28 Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph");
29 Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined");
30 Statistic<> NumCallEdges("budatastructures", "Number of 'actual' call edges");
28 Statistic MaxSCC("budatastructure", "Maximum SCC Size in Call Graph");
29 Statistic NumBUInlines("budatastructures", "Number of graphs inlined");
30 Statistic NumCallEdges("budatastructures", "Number of 'actual' call edges");
3131
3232 cl::opt
3333 AddGlobals("budatastructures-annotate-calls", cl::Hidden,
2828 using namespace llvm;
2929
3030 namespace {
31 Statistic<> DirCall("calltarget", "Number of direct calls");
32 Statistic<> IndCall("calltarget", "Number of indirect calls");
33 Statistic<> CompleteInd("calltarget", "Number of complete indirect calls");
34 Statistic<> CompleteEmpty("calltarget", "Number of complete empty calls");
31 Statistic DirCall("calltarget", "Number of direct calls");
32 Statistic IndCall("calltarget", "Number of indirect calls");
33 Statistic CompleteInd("calltarget", "Number of complete indirect calls");
34 Statistic CompleteEmpty("calltarget", "Number of complete empty calls");
3535
3636 RegisterPass X("calltarget","Find Call Targets (uses DSA)");
3737 }
2525 namespace {
2626 RegisterPass
2727 X("cbudatastructure", "'Complete' Bottom-up Data Structure Analysis");
28 Statistic<> NumCBUInlines("cbudatastructures", "Number of graphs inlined");
28 Statistic NumCBUInlines("cbudatastructures", "Number of graphs inlined");
2929 }
3030
3131
3333 #define COLLAPSE_ARRAYS_AGGRESSIVELY 0
3434
3535 namespace {
36 Statistic<> NumFolds ("dsa", "Number of nodes completely folded");
37 Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged");
38 Statistic<> NumNodeAllocated ("dsa", "Number of nodes allocated");
39 Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability");
40 Statistic<> NumTrivialDNE ("dsa", "Number of nodes trivially removed");
41 Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed");
36 Statistic NumFolds ("dsa", "Number of nodes completely folded");
37 Statistic NumCallNodesMerged("dsa", "Number of call nodes merged");
38 Statistic NumNodeAllocated ("dsa", "Number of nodes allocated");
39 Statistic NumDNE ("dsa", "Number of nodes removed by reachability");
40 Statistic NumTrivialDNE ("dsa", "Number of nodes trivially removed");
41 Statistic NumTrivialGlobalDNE("dsa", "Number of globals trivially removed");
4242 static cl::opt
4343 DSAFieldLimit("dsa-field-limit", cl::Hidden,
4444 cl::desc("Number of fields to track before collapsing a node"),
2121 using namespace llvm;
2222
2323 namespace {
24 Statistic<>
24 Statistic
2525 NumGlobalsConstanted("ds-opt", "Number of globals marked constant");
26 Statistic<>
26 Statistic
2727 NumGlobalsIsolated("ds-opt", "Number of globals with references dropped");
2828
2929 class DSOpt : public ModulePass {
2222 using namespace llvm;
2323
2424 namespace {
25 Statistic<> TotalNumCallees("totalcallees",
25 Statistic TotalNumCallees("totalcallees",
2626 "Total number of callee functions at all indirect call sites");
27 Statistic<> NumIndirectCalls("numindirect",
27 Statistic NumIndirectCalls("numindirect",
2828 "Total number of indirect call sites in the program");
29 Statistic<> NumPoolNodes("numpools",
29 Statistic NumPoolNodes("numpools",
3030 "Number of allocation nodes that could be pool allocated");
3131
3232 // Typed/Untyped memory accesses: If DSA can infer that the types the loads
3333 // and stores are accessing are correct (ie, the node has not been collapsed),
3434 // increment the appropriate counter.
35 Statistic<> NumTypedMemAccesses("numtypedmemaccesses",
35 Statistic NumTypedMemAccesses("numtypedmemaccesses",
3636 "Number of loads/stores which are fully typed");
37 Statistic<> NumUntypedMemAccesses("numuntypedmemaccesses",
37 Statistic NumUntypedMemAccesses("numuntypedmemaccesses",
3838 "Number of loads/stores which are untyped");
3939
4040 class DSGraphStats : public FunctionPass, public InstVisitor {
3030 namespace {
3131 RegisterPass X("eqdatastructure",
3232 "Equivalence-class Bottom-up Data Structure Analysis");
33 Statistic<> NumEquivBUInlines("equivdatastructures",
33 Statistic NumEquivBUInlines("equivdatastructures",
3434 "Number of graphs inlined");
35 Statistic<> NumFoldGraphInlines("Inline equiv-class graphs bottom up",
35 Statistic NumFoldGraphInlines("Inline equiv-class graphs bottom up",
3636 "Number of graphs inlined");
3737 }
3838
3232 namespace {
3333 cl::opt OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
3434 cl::opt DontPrintAnything("dont-print-ds", cl::ReallyHidden);
35 Statistic<> MaxGraphSize ("dsa", "Maximum graph size");
36 Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
35 Statistic MaxGraphSize ("dsa", "Maximum graph size");
36 Statistic NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
3737 }
3838
3939 void DSNode::dump() const { print(llvm_cerr, 0); }
3333 RegisterPass // Register the pass
3434 Y("tddatastructure", "Top-down Data Structure Analysis");
3535
36 Statistic<> NumTDInlines("tddatastructures", "Number of graphs inlined");
36 Statistic NumTDInlines("tddatastructures", "Number of graphs inlined");
3737 }
3838
3939 void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N,
6464 using namespace llvm;
6565
6666 namespace {
67 Statistic<>
67 Statistic
6868 NumIters("anders-aa", "Number of iterations to reach convergence");
69 Statistic<>
69 Statistic
7070 NumConstraints("anders-aa", "Number of constraints");
71 Statistic<>
71 Statistic
7272 NumNodes("anders-aa", "Number of nodes");
73 Statistic<>
73 Statistic
7474 NumEscapingFunctions("anders-aa", "Number of internal functions that escape");
75 Statistic<>
75 Statistic
7676 NumIndirectCallees("anders-aa", "Number of indirect callees found");
7777
7878 class Andersens : public ModulePass, public AliasAnalysis,
2929 using namespace llvm;
3030
3131 namespace {
32 Statistic<>
32 Statistic
3333 NumNonAddrTakenGlobalVars("globalsmodref-aa",
3434 "Number of global vars without address taken");
35 Statistic<>
35 Statistic
3636 NumNonAddrTakenFunctions("globalsmodref-aa",
3737 "Number of functions without address taken");
38 Statistic<>
38 Statistic
3939 NumNoMemFunctions("globalsmodref-aa",
4040 "Number of functions that do not access memory");
41 Statistic<>
41 Statistic
4242 NumReadMemFunctions("globalsmodref-aa",
4343 "Number of functions that only read memory");
44 Statistic<>
44 Statistic
4545 NumIndirectGlobalVars("globalsmodref-aa",
4646 "Number of indirect global objects");
4747
2020 using namespace llvm;
2121
2222 namespace {
23 Statistic<> TotalInsts ("instcount", "Number of instructions (of all types)");
24 Statistic<> TotalBlocks("instcount", "Number of basic blocks");
25 Statistic<> TotalFuncs ("instcount", "Number of non-external functions");
26 Statistic<> TotalMemInst("instcount", "Number of memory instructions");
23 Statistic TotalInsts ("instcount", "Number of instructions (of all types)");
24 Statistic TotalBlocks("instcount", "Number of basic blocks");
25 Statistic TotalFuncs ("instcount", "Number of non-external functions");
26 Statistic TotalMemInst("instcount", "Number of memory instructions");
2727
2828 #define HANDLE_INST(N, OPCODE, CLASS) \
29 Statistic<> Num##OPCODE##Inst("instcount", "Number of " #OPCODE " insts");
29 Statistic Num##OPCODE##Inst("instcount", "Number of " #OPCODE " insts");
3030
3131 #include "llvm/Instruction.def"
3232
8484 RegisterPass
8585 R("scalar-evolution", "Scalar Evolution Analysis");
8686
87 Statistic<>
87 Statistic
8888 NumBruteForceEvaluations("scalar-evolution",
8989 "Number of brute force evaluations needed to "
9090 "calculate high-order polynomial exit values");
91 Statistic<>
91 Statistic
9292 NumArrayLenItCounts("scalar-evolution",
9393 "Number of trip counts computed with array length");
94 Statistic<>
94 Statistic
9595 NumTripCountsComputed("scalar-evolution",
9696 "Number of loops with predictable loop counts");
97 Statistic<>
97 Statistic
9898 NumTripCountsNotComputed("scalar-evolution",
9999 "Number of loops without predictable loop counts");
100 Statistic<>
100 Statistic
101101 NumBruteForceTripCountsComputed("scalar-evolution",
102102 "Number of loops with trip counts computed by force");
103103
4444
4545 static RegisterPass X("emitbytecode", "Bytecode Writer");
4646
47 static Statistic<>
47 static Statistic
4848 BytesWritten("bytecodewriter", "Number of bytecode bytes written");
4949
5050 //===----------------------------------------------------------------------===//
2929 #include
3030 using namespace llvm;
3131
32 static Statistic<> NumDeadBlocks("branchfold", "Number of dead blocks removed");
33 static Statistic<> NumBranchOpts("branchfold", "Number of branches optimized");
34 static Statistic<> NumTailMerge ("branchfold", "Number of block tails merged");
32 static Statistic NumDeadBlocks("branchfold", "Number of dead blocks removed");
33 static Statistic NumBranchOpts("branchfold", "Number of branches optimized");
34 static Statistic NumTailMerge ("branchfold", "Number of block tails merged");
3535 static cl::opt EnableTailMerge("enable-tail-merge", cl::Hidden);
3636
3737 namespace {
3838 namespace {
3939 RegisterPass X("liveintervals", "Live Interval Analysis");
4040
41 static Statistic<> numIntervals
41 static Statistic numIntervals
4242 ("liveintervals", "Number of original intervals");
4343
44 static Statistic<> numIntervalsAfter
44 static Statistic numIntervalsAfter
4545 ("liveintervals", "Number of intervals after coalescing");
4646
47 static Statistic<> numJoins
47 static Statistic numJoins
4848 ("liveintervals", "Number of interval joins performed");
4949
50 static Statistic<> numPeep
50 static Statistic numPeep
5151 ("liveintervals", "Number of identity moves eliminated after coalescing");
5252
53 static Statistic<> numFolded
53 static Statistic numFolded
5454 ("liveintervals", "Number of loads/stores folded into instructions");
5555
5656 static cl::opt
2828 using namespace llvm;
2929
3030 namespace {
31 static Statistic<> NumAtomic("phielim", "Number of atomic phis lowered");
32 static Statistic<> NumSimple("phielim", "Number of simple phis lowered");
31 static Statistic NumAtomic("phielim", "Number of atomic phis lowered");
32 static Statistic NumSimple("phielim", "Number of simple phis lowered");
3333
3434 struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
3535 bool runOnMachineFunction(MachineFunction &Fn) {
3636
3737 namespace {
3838
39 static Statistic<> NumIters
39 static Statistic NumIters
4040 ("regalloc", "Number of iterations performed");
41 static Statistic<> NumBacktracks
41 static Statistic NumBacktracks
4242 ("regalloc", "Number of times we had to backtrack");
4343
4444 static RegisterRegAlloc
3232 using namespace llvm;
3333
3434 namespace {
35 static Statistic<> NumStores("ra-local", "Number of stores added");
36 static Statistic<> NumLoads ("ra-local", "Number of loads added");
37 static Statistic<> NumFolded("ra-local", "Number of loads/stores folded "
35 static Statistic NumStores("ra-local", "Number of stores added");
36 static Statistic NumLoads ("ra-local", "Number of loads added");
37 static Statistic NumFolded("ra-local", "Number of loads/stores folded "
3838 "into instructions");
3939
4040 static RegisterRegAlloc
3030 using namespace llvm;
3131
3232 namespace {
33 static Statistic<> NumStores("ra-simple", "Number of stores added");
34 static Statistic<> NumLoads ("ra-simple", "Number of loads added");
33 static Statistic NumStores("ra-simple", "Number of stores added");
34 static Statistic NumLoads ("ra-simple", "Number of loads added");
3535
3636 static RegisterRegAlloc
3737 simpleRegAlloc("simple", " simple register allocator",
4242 using namespace llvm;
4343
4444 namespace {
45 static Statistic<> NodesCombined ("dagcombiner",
45 static Statistic NodesCombined ("dagcombiner",
4646 "Number of dag nodes combined");
4747
48 static Statistic<> PreIndexedNodes ("pre_indexed_ops",
48 static Statistic PreIndexedNodes ("pre_indexed_ops",
4949 "Number of pre-indexed nodes created");
50 static Statistic<> PostIndexedNodes ("post_indexed_ops",
50 static Statistic PostIndexedNodes ("post_indexed_ops",
5151 "Number of post-indexed nodes created");
5252
5353 static cl::opt
3535 using namespace llvm;
3636
3737 namespace {
38 static Statistic<> NumNoops ("scheduler", "Number of noops inserted");
39 static Statistic<> NumStalls("scheduler", "Number of pipeline stalls");
38 static Statistic NumNoops ("scheduler", "Number of noops inserted");
39 static Statistic NumStalls("scheduler", "Number of pipeline stalls");
4040 }
4141
4242 static RegisterScheduler
4444 using namespace llvm;
4545
4646 namespace {
47 static Statistic<> NumTwoAddressInstrs("twoaddressinstruction",
47 static Statistic NumTwoAddressInstrs("twoaddressinstruction",
4848 "Number of two-address instructions");
49 static Statistic<> NumCommuted("twoaddressinstruction",
49 static Statistic NumCommuted("twoaddressinstruction",
5050 "Number of instructions commuted to coalesce");
51 static Statistic<> NumConvertedTo3Addr("twoaddressinstruction",
51 static Statistic NumConvertedTo3Addr("twoaddressinstruction",
5252 "Number of instructions promoted to 3-address");
5353
5454 struct VISIBILITY_HIDDEN TwoAddressInstructionPass
3232 using namespace llvm;
3333
3434 namespace {
35 static Statistic<> NumSpills("spiller", "Number of register spills");
36 static Statistic<> NumStores("spiller", "Number of stores added");
37 static Statistic<> NumLoads ("spiller", "Number of loads added");
38 static Statistic<> NumReused("spiller", "Number of values reused");
39 static Statistic<> NumDSE ("spiller", "Number of dead stores elided");
40 static Statistic<> NumDCE ("spiller", "Number of copies elided");
35 static Statistic NumSpills("spiller", "Number of register spills");
36 static Statistic NumStores("spiller", "Number of stores added");
37 static Statistic NumLoads ("spiller", "Number of loads added");
38 static Statistic NumReused("spiller", "Number of values reused");
39 static Statistic NumDSE ("spiller", "Number of dead stores elided");
40 static Statistic NumDCE ("spiller", "Number of copies elided");
4141
4242 enum SpillerName { simple, local };
4343
2626 using namespace llvm;
2727
2828 namespace {
29 Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized");
30 Statistic<> NumGlobals ("lli", "Number of global vars initialized");
29 Statistic NumInitBytes("lli", "Number of bytes of global vars initialized");
30 Statistic NumGlobals ("lli", "Number of global vars initialized");
3131 }
3232
3333 ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0;
2323 using namespace llvm;
2424
2525 namespace {
26 Statistic<> NumDynamicInsts("lli", "Number of dynamic instructions executed");
26 Statistic NumDynamicInsts("lli", "Number of dynamic instructions executed");
2727
2828 Interpreter *TheEE = 0;
2929 }
3333 using namespace llvm;
3434
3535 namespace {
36 Statistic<> NumBytes("jit", "Number of bytes of machine code compiled");
37 Statistic<> NumRelos("jit", "Number of relocations applied");
36 Statistic NumBytes("jit", "Number of bytes of machine code compiled");
37 Statistic NumRelos("jit", "Number of relocations applied");
3838 JIT *TheJIT = 0;
3939 }
4040
1414 // This is useful for reporting information like the number of instructions
1515 // simplified, optimized or removed by various transformations, like this:
1616 //
17 // static Statistic<> NumInstEliminated("GCSE - Number of instructions killed");
17 // static Statistic NumInstEliminated("GCSE - Number of instructions killed");
1818 //
1919 // Later, in the code: ++NumInstEliminated;
2020 //
3131 namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
3232
3333 unsigned StatisticBase::NumStats = 0;
34
35 TEMPLATE_INSTANTIATION(class Statistic);
3634
3735 // -stats - Command line option to cause transformations to emit stats about
3836 // what they did.
2626
2727 // getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
2828 // of constructor/destructor ordering being unspecified by C++. Basically the
29 // problem is that a Statistic<> object gets destroyed, which ends up calling
29 // problem is that a Statistic object gets destroyed, which ends up calling
3030 // 'GetLibSupportInfoOutputFile()' (below), which calls this function.
3131 // LibSupportInfoOutputFilename used to be a global variable, but sometimes it
3232 // would get destroyed before the Statistic, causing havoc to ensue. We "fix"
3434 using namespace llvm;
3535
3636 namespace {
37 Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
37 Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
3838
3939 static const char *ARMCondCodeToString(ARMCC::CondCodes CC) {
4040 switch (CC) {
2626 using namespace llvm;
2727
2828 namespace {
29 Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
29 Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
3030
3131 struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter {
3232
2626 using namespace llvm;
2727
2828 namespace {
29 Statistic<>
29 Statistic
3030 NumEmitted("alpha-emitter", "Number of machine instructions emitted");
3131 }
3232
2222 using namespace llvm;
2323
2424 namespace {
25 Statistic<> nopintro("alpha-nops", "Number of nops inserted");
26 Statistic<> nopalign("alpha-nops-align",
25 Statistic nopintro("alpha-nops", "Number of nops inserted");
26 Statistic nopalign("alpha-nops-align",
2727 "Number of nops inserted for alignment");
2828
2929 cl::opt
2929 using namespace llvm;
3030
3131 namespace {
32 Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
32 Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
3333
3434 struct IA64AsmPrinter : public AsmPrinter {
3535 std::set ExternalFunctionNames, ExternalObjectNames;
3232 using namespace llvm;
3333
3434 namespace {
35 Statistic<> StopBitsAdded("ia64-codegen", "Number of stop bits added");
35 Statistic StopBitsAdded("ia64-codegen", "Number of stop bits added");
3636
3737 struct IA64BundlingPass : public MachineFunctionPass {
3838 /// Target machine description which we query for reg. names, data
3232 using namespace llvm;
3333
3434 namespace {
35 Statistic<> FusedFP ("ia64-codegen", "Number of fused fp operations");
36 Statistic<> FrameOff("ia64-codegen", "Number of frame idx offsets collapsed");
35 Statistic FusedFP ("ia64-codegen", "Number of fused fp operations");
36 Statistic FrameOff("ia64-codegen", "Number of frame idx offsets collapsed");
3737
3838 //===--------------------------------------------------------------------===//
3939 /// IA64DAGToDAGISel - IA64 specific code to select IA64 machine
4545 using namespace llvm;
4646
4747 namespace {
48 Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
48 Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
4949
5050 struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter {
5151 std::set FnStubs, GVStubs;
2626 #include "llvm/Support/MathExtras.h"
2727 using namespace llvm;
2828
29 static Statistic<> NumExpanded("ppc-branch-select",
29 static Statistic NumExpanded("ppc-branch-select",
3030 "Num branches expanded to long format");
3131
3232 namespace {
3535 using namespace llvm;
3636
3737 namespace {
38 Statistic<> FrameOff("ppc-codegen", "Number of frame idx offsets collapsed");
38 Statistic FrameOff("ppc-codegen", "Number of frame idx offsets collapsed");
3939
4040 //===--------------------------------------------------------------------===//
4141 /// PPCDAGToDAGISel - PPC specific code to select PPC machine
1919 using namespace llvm;
2020
2121 namespace {
22 Statistic<> FilledSlots("delayslotfiller", "Num. of delay slots filled");
22 Statistic FilledSlots("delayslotfiller", "Num. of delay slots filled");
2323
2424 struct Filler : public MachineFunctionPass {
2525 /// Target machine description which we query for reg. names, data
2222 using namespace llvm;
2323
2424 namespace {
25 Statistic<> NumFpDs("fpmover", "Number of instructions translated");
26 Statistic<> NoopFpDs("fpmover", "Number of noop instructions removed");
25 Statistic NumFpDs("fpmover", "Number of instructions translated");
26 Statistic NoopFpDs("fpmover", "Number of noop instructions removed");
2727
2828 struct FPMover : public MachineFunctionPass {
2929 /// Target machine description which we query for reg. names, data
3333 using namespace llvm;
3434
3535 namespace {
36 Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
36 Statistic EmittedInsts("asm-printer", "Number of machine instrs printed");
3737
3838 struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter {
3939 SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
2929
3030 using namespace llvm;
3131
32 Statistic<> llvm::EmittedInsts("asm-printer",
32 Statistic llvm::EmittedInsts("asm-printer",
3333 "Number of machine instrs printed");
3434
3535 static X86FunctionInfo calculateFunctionInfo(const Function *F,
2727
2828 namespace llvm {
2929
30 extern Statistic<> EmittedInsts;
30 extern Statistic EmittedInsts;
3131
3232 // FIXME: Move this to CodeGen/AsmPrinter.h
3333 namespace PICStyle {
2828 using namespace llvm;
2929
3030 namespace {
31 Statistic<>
31 Statistic
3232 NumEmitted("x86-emitter", "Number of machine instructions emitted");
3333 }
3434
4848 using namespace llvm;
4949
5050 namespace {
51 Statistic<> NumFXCH("x86-codegen", "Number of fxch instructions inserted");
52 Statistic<> NumFP ("x86-codegen", "Number of floating point instructions");
51 Statistic NumFXCH("x86-codegen", "Number of fxch instructions inserted");
52 Statistic NumFP ("x86-codegen", "Number of floating point instructions");
5353
5454 struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass {
5555 virtual bool runOnMachineFunction(MachineFunction &MF);
7575 }
7676
7777 namespace {
78 Statistic<>
78 Statistic
7979 NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added");
8080
81 Statistic<>
81 Statistic
8282 NumLoadMoved("x86-codegen", "Number of loads moved below TokenFactor");
8383
8484 //===--------------------------------------------------------------------===//
2020 using namespace llvm;
2121
2222 namespace {
23 Statistic<> HelloCounter("hellocount",
23 Statistic HelloCounter("hellocount",
2424 "Counts number of functions greeted");
2525 // Hello - The first implementation, without getAnalysisUsage.
2626 struct Hello : public FunctionPass {
4747 using namespace llvm;
4848
4949 namespace {
50 Statistic<> NumArgumentsPromoted("argpromotion",
50 Statistic NumArgumentsPromoted("argpromotion",
5151 "Number of pointer arguments promoted");
52 Statistic<> NumAggregatesPromoted("argpromotion",
52 Statistic NumAggregatesPromoted("argpromotion",
5353 "Number of aggregate arguments promoted");
54 Statistic<> NumArgumentsDead("argpromotion",
54 Statistic NumArgumentsDead("argpromotion",
5555 "Number of dead pointer args eliminated");
5656
5757 /// ArgPromotion - The 'by reference' to 'by value' argument promotion pass.
2323 using namespace llvm;
2424
2525 namespace {
26 Statistic<> NumMerged("constmerge", "Number of global constants merged");
26 Statistic NumMerged("constmerge", "Number of global constants merged");
2727
2828 struct ConstantMerge : public ModulePass {
2929 // run - For this pass, process all of the globals in the module,
3232 using namespace llvm;
3333
3434 namespace {
35 Statistic<> NumArgumentsEliminated("deadargelim",
35 Statistic NumArgumentsEliminated("deadargelim",
3636 "Number of unread args removed");
37 Statistic<> NumRetValsEliminated("deadargelim",
37 Statistic NumRetValsEliminated("deadargelim",
3838 "Number of unused return values removed");
3939
4040 /// DAE - The dead argument elimination pass.
3636 }
3737 };
3838 RegisterPass X("deadtypeelim", "Dead Type Elimination");
39 Statistic<>
39 Statistic
4040 NumKilled("deadtypeelim", "Number of unused typenames removed from symtab");
4141 }
4242
3232 using namespace llvm;
3333
3434 namespace {
35 Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved");
36 Statistic<> NumGlobals("funcresolve", "Number of global variables resolved");
35 Statistic NumResolved("funcresolve", "Number of varargs functions resolved");
36 Statistic NumGlobals("funcresolve", "Number of global variables resolved");
3737
3838 struct FunctionResolvingPass : public ModulePass {
3939 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
2323 using namespace llvm;
2424
2525 namespace {
26 Statistic<> NumFunctions("globaldce","Number of functions removed");
27 Statistic<> NumVariables("globaldce","Number of global variables removed");
26 Statistic NumFunctions("globaldce","Number of functions removed");
27 Statistic NumVariables("globaldce","Number of global variables removed");
2828
2929 struct GlobalDCE : public ModulePass {
3030 // run - Do the GlobalDCE pass on the specified module, optionally updating
3131 using namespace llvm;
3232
3333 namespace {
34 Statistic<> NumMarked ("globalopt", "Number of globals marked constant");
35 Statistic<> NumSRA ("globalopt", "Number of aggregate globals broken "
34 Statistic NumMarked ("globalopt", "Number of globals marked constant");
35 Statistic NumSRA ("globalopt", "Number of aggregate globals broken "
3636 "into scalars");
37 Statistic<> NumHeapSRA ("globalopt", "Number of heap objects SRA'd");
38 Statistic<> NumSubstitute("globalopt",
37 Statistic NumHeapSRA ("globalopt", "Number of heap objects SRA'd");
38 Statistic NumSubstitute("globalopt",
3939 "Number of globals with initializers stored into them");
40 Statistic<> NumDeleted ("globalopt", "Number of globals deleted");
41 Statistic<> NumFnDeleted("globalopt", "Number of functions deleted");
42 Statistic<> NumGlobUses ("globalopt", "Number of global uses devirtualized");
43 Statistic<> NumLocalized("globalopt", "Number of globals localized");
44 Statistic<> NumShrunkToBool("globalopt",
40 Statistic NumDeleted ("globalopt", "Number of globals deleted");
41 Statistic NumFnDeleted("globalopt", "Number of functions deleted");
42 Statistic NumGlobUses ("globalopt", "Number of global uses devirtualized");
43 Statistic NumLocalized("globalopt", "Number of globals localized");
44 Statistic NumShrunkToBool("globalopt",
4545 "Number of global vars shrunk to booleans");
46 Statistic<> NumFastCallFns("globalopt",
46 Statistic NumFastCallFns("globalopt",
4747 "Number of functions converted to fastcc");
48 Statistic<> NumCtorsEvaluated("globalopt","Number of static ctors evaluated");
48 Statistic NumCtorsEvaluated("globalopt","Number of static ctors evaluated");
4949
5050 struct GlobalOpt : public ModulePass {
5151 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
2424 using namespace llvm;
2525
2626 namespace {
27 Statistic<> NumArgumentsProped("ipconstprop",
27 Statistic NumArgumentsProped("ipconstprop",
2828 "Number of args turned into constants");
29 Statistic<> NumReturnValProped("ipconstprop",
29 Statistic NumReturnValProped("ipconstprop",
3030 "Number of return values turned into constants");
3131
3232 /// IPCP - The interprocedural constant propagation pass
2727 using namespace llvm;
2828
2929 namespace {
30 Statistic<> NumBounceSites("indmemrem", "Number of sites modified");
31 Statistic<> NumBounce ("indmemrem", "Number of bounce functions created");
30 Statistic NumBounceSites("indmemrem", "Number of sites modified");
31 Statistic NumBounce ("indmemrem", "Number of bounce functions created");
3232
3333 class IndMemRemPass : public ModulePass {
3434
2525 using namespace llvm;
2626
2727 namespace {
28 Statistic<> NumInlined("inline", "Number of functions inlined");
29 Statistic<> NumDeleted("inline",
28 Statistic NumInlined("inline", "Number of functions inlined");
29 Statistic NumDeleted("inline",
3030 "Number of functions deleted because all callers found");
3131 cl::opt // FIXME: 200 is VERY conservative
3232 InlineLimit("inline-threshold", cl::Hidden, cl::init(200),
2323 using namespace llvm;
2424
2525 namespace {
26 Statistic<> NumFunctions("internalize", "Number of functions internalized");
27 Statistic<> NumGlobals ("internalize", "Number of global vars internalized");
26 Statistic NumFunctions("internalize", "Number of functions internalized");
27 Statistic NumGlobals ("internalize", "Number of global vars internalized");
2828
2929 // APIFile - A file which contains a list of symbols that should not be marked
3030 // external.
2525 using namespace llvm;
2626
2727 namespace {
28 Statistic<> NumExtracted("loop-extract", "Number of loops extracted");
28 Statistic NumExtracted("loop-extract", "Number of loops extracted");
2929
3030 // FIXME: This is not a function pass, but the PassManager doesn't allow
3131 // Module passes to require FunctionPasses, so we can't get loop info if we're
4949 using namespace llvm;
5050
5151 namespace {
52 Statistic<> LongJmpsTransformed("lowersetjmp",
52 Statistic LongJmpsTransformed("lowersetjmp",
5353 "Number of longjmps transformed");
54 Statistic<> SetJmpsTransformed("lowersetjmp",
54 Statistic SetJmpsTransformed("lowersetjmp",
5555 "Number of setjmps transformed");
56 Statistic<> CallsTransformed("lowersetjmp",
56 Statistic CallsTransformed("lowersetjmp",
5757 "Number of calls invokified");
58 Statistic<> InvokesTransformed("lowersetjmp",
58 Statistic InvokesTransformed("lowersetjmp",
5959 "Number of invokes modified");
6060
6161 //===--------------------------------------------------------------------===//
2727 using namespace llvm;
2828
2929 namespace {
30 Statistic<> NumRemoved("prune-eh", "Number of invokes removed");
31 Statistic<> NumUnreach("prune-eh", "Number of noreturn calls optimized");
30 Statistic NumRemoved("prune-eh", "Number of invokes removed");
31 Statistic NumUnreach("prune-eh", "Number of noreturn calls optimized");
3232
3333 struct PruneEH : public CallGraphSCCPass {
3434 /// DoesNotUnwind - This set contains all of the functions which we have
2222 using namespace llvm;
2323
2424 namespace {
25 Statistic<> NumRaised("raiseallocs", "Number of allocations raised");
25 Statistic NumRaised("raiseallocs", "Number of allocations raised");
2626
2727 // RaiseAllocations - Turn %malloc and %free calls into the appropriate
2828 // instruction.
3434
3535 /// This statistic keeps track of the total number of library calls that have
3636 /// been simplified regardless of which call it is.
37 Statistic<> SimplifiedLibCalls("simplify-libcalls",
37 Statistic SimplifiedLibCalls("simplify-libcalls",
3838 "Number of library calls simplified");
3939
4040 // Forward declarations
6767 LibCallOptimization **Prev, *Next;
6868 const char *FunctionName; ///< Name of the library call we optimize
6969 #ifndef NDEBUG
70 Statistic<> occurrences; ///< debug statistic (-debug-only=simplify-libcalls)
70 Statistic occurrences; ///< debug statistic (-debug-only=simplify-libcalls)
7171 #endif
7272 public:
7373 /// The \p fname argument must be the name of the library function being
5151 using namespace llvm;
5252
5353 namespace {
54 Statistic<> NumBackEdges("bedge", "Number of BackEdges");
54 Statistic NumBackEdges("bedge", "Number of BackEdges");
5555
5656 enum RandomMeth {
5757 GBV, GBVO, HOSTCC
3333 StartInst("raise-start-inst", cl::Hidden, cl::value_desc("inst name"),
3434 cl::desc("Start raise pass at the instruction with the specified name"));
3535
36 static Statistic<>
36 static Statistic
3737 NumLoadStorePeepholes("raise", "Number of load/store peepholes");
3838
39 static Statistic<>
39 static Statistic
4040 NumGEPInstFormed("raise", "Number of other getelementptr's formed");
4141
42 static Statistic<>
42 static Statistic
4343 NumExprTreesConv("raise", "Number of expression trees converted");
4444
45 static Statistic<>
45 static Statistic
4646 NumCastOfCast("raise", "Number of cast-of-self removed");
4747
48 static Statistic<>
48 static Statistic
4949 NumDCEorCP("raise", "Number of insts DCEd or constprop'd");
5050
51 static Statistic<>
51 static Statistic
5252 NumVarargCallChanges("raise", "Number of vararg call peepholes");
5353
5454 #define PRINT_PEEPHOLE(ID, NUM, I) \
2929 using namespace llvm;
3030
3131 namespace {
32 Statistic<> NumBlockRemoved("adce", "Number of basic blocks removed");
33 Statistic<> NumInstRemoved ("adce", "Number of instructions removed");
34 Statistic<> NumCallRemoved ("adce", "Number of calls and invokes removed");
32 Statistic NumBlockRemoved("adce", "Number of basic blocks removed");
33 Statistic NumInstRemoved ("adce", "Number of instructions removed");
34 Statistic NumCallRemoved ("adce", "Number of calls and invokes removed");
3535
3636 //===----------------------------------------------------------------------===//
3737 // ADCE Class
3535 using namespace llvm;
3636
3737 namespace {
38 Statistic<> NumMoved("block-placement", "Number of basic blocks moved");
38 Statistic NumMoved("block-placement", "Number of basic blocks moved");
3939
4040 struct BlockPlacement : public FunctionPass {
4141 virtual bool runOnFunction(Function &F);
2525 using namespace llvm;
2626
2727 namespace {
28 Statistic<>
28 Statistic
2929 NumBrThread("condprop", "Number of CFG edges threaded through branches");
30 Statistic<>
30 Statistic
3131 NumSwThread("condprop", "Number of CFG edges threaded through switches");
3232
3333 struct CondProp : public FunctionPass {
2828 using namespace llvm;
2929
3030 namespace {
31 Statistic<> NumInstKilled("constprop", "Number of instructions killed");
31 Statistic NumInstKilled("constprop", "Number of instructions killed");
3232
3333 struct ConstantPropagation : public FunctionPass {
3434 bool runOnFunction(Function &F);
4545 using namespace llvm;
4646
4747 namespace {
48 Statistic<> NumSetCCRemoved("cee", "Number of setcc instruction eliminated");
49 Statistic<> NumOperandsCann("cee", "Number of operands canonicalized");
50 Statistic<> BranchRevectors("cee", "Number of branches revectored");
48 Statistic NumSetCCRemoved("cee", "Number of setcc instruction eliminated");
49 Statistic NumOperandsCann("cee", "Number of operands canonicalized");
50 Statistic BranchRevectors("cee", "Number of branches revectored");
5151
5252 class ValueInfo;
5353 class Relation {
2525 using namespace llvm;
2626
2727 namespace {
28 Statistic<> DIEEliminated("die", "Number of insts removed");
29 Statistic<> DCEEliminated("dce", "Number of insts removed");
28 Statistic DIEEliminated("die", "Number of insts removed");
29 Statistic DCEEliminated("dce", "Number of insts removed");
3030
3131 //===--------------------------------------------------------------------===//
3232 // DeadInstElimination pass implementation
2727 using namespace llvm;
2828
2929 namespace {
30 Statistic<> NumStores("dse", "Number of stores deleted");
31 Statistic<> NumOther ("dse", "Number of other instrs removed");
30 Statistic NumStores("dse", "Number of stores deleted");
31 Statistic NumOther ("dse", "Number of other instrs removed");
3232
3333 struct DSE : public FunctionPass {
3434
2727 using namespace llvm;
2828
2929 namespace {
30 Statistic<> NumInstRemoved("gcse", "Number of instructions removed");
31 Statistic<> NumLoadRemoved("gcse", "Number of loads removed");
32 Statistic<> NumCallRemoved("gcse", "Number of calls removed");
33 Statistic<> NumNonInsts ("gcse", "Number of instructions removed due "
30 Statistic NumInstRemoved("gcse", "Number of instructions removed");
31 Statistic NumLoadRemoved("gcse", "Number of loads removed");
32 Statistic NumCallRemoved("gcse", "Number of calls removed");
33 Statistic NumNonInsts ("gcse", "Number of instructions removed due "
3434 "to non-instruction values");
35 Statistic<> NumArgsRepl ("gcse", "Number of function arguments replaced "
35 Statistic NumArgsRepl ("gcse", "Number of function arguments replaced "
3636 "with constant values");
3737
3838 struct GCSE : public FunctionPass {
5151 using namespace llvm;
5252
5353 namespace {
54 Statistic<> NumRemoved ("indvars", "Number of aux indvars removed");
55 Statistic<> NumPointer ("indvars", "Number of pointer indvars promoted");
56 Statistic<> NumInserted("indvars", "Number of canonical indvars added");
57 Statistic<> NumReplaced("indvars", "Number of exit values replaced");
58 Statistic<> NumLFTR ("indvars", "Number of loop exit tests replaced");
54 Statistic NumRemoved ("indvars", "Number of aux indvars removed");
55 Statistic NumPointer ("indvars", "Number of pointer indvars promoted");
56 Statistic NumInserted("indvars", "Number of canonical indvars added");
57 Statistic NumReplaced("indvars", "Number of exit values replaced");
58 Statistic NumLFTR ("indvars", "Number of loop exit tests replaced");
5959
6060 class IndVarSimplify : public FunctionPass {
6161 LoopInfo *LI;
5555 using namespace llvm::PatternMatch;
5656
5757 namespace {
58 Statistic<> NumCombined ("instcombine", "Number of insts combined");
59 Statistic<> NumConstProp("instcombine", "Number of constant folds");
60 Statistic<> NumDeadInst ("instcombine", "Number of dead inst eliminated");
61 Statistic<> NumDeadStore("instcombine", "Number of dead stores eliminated");
62 Statistic<> NumSunkInst ("instcombine", "Number of instructions sunk");
58 Statistic NumCombined ("instcombine", "Number of insts combined");
59 Statistic NumConstProp("instcombine", "Number of constant folds");
60 Statistic NumDeadInst ("instcombine", "Number of dead inst eliminated");
61 Statistic NumDeadStore("instcombine", "Number of dead stores eliminated");
62 Statistic NumSunkInst ("instcombine", "Number of instructions sunk");
6363
6464 class VISIBILITY_HIDDEN InstCombiner
6565 : public FunctionPass,
5353 DisablePromotion("disable-licm-promotion", cl::Hidden,
5454 cl::desc("Disable memory promotion in LICM pass"));
5555
56 Statistic<> NumSunk("licm", "Number of instructions sunk out of loop");
57 Statistic<> NumHoisted("licm", "Number of instructions hoisted out of loop");
58 Statistic<> NumMovedLoads("licm", "Number of load insts hoisted or sunk");
59 Statistic<> NumMovedCalls("licm", "Number of call insts hoisted or sunk");
60 Statistic<> NumPromoted("licm",
56 Statistic NumSunk("licm", "Number of instructions sunk out of loop");
57 Statistic NumHoisted("licm", "Number of instructions hoisted out of loop");
58 Statistic NumMovedLoads("licm", "Number of load insts hoisted or sunk");
59 Statistic NumMovedCalls("licm", "Number of call insts hoisted or sunk");
60 Statistic NumPromoted("licm",
6161 "Number of memory locations promoted to registers");
6262
6363 struct LICM : public FunctionPass {
3737 using namespace llvm;
3838
3939 namespace {
40 Statistic<> NumReduced ("loop-reduce", "Number of GEPs strength reduced");
41 Statistic<> NumInserted("loop-reduce", "Number of PHIs inserted");
42 Statistic<> NumVariable("loop-reduce","Number of PHIs with variable strides");
40 Statistic NumReduced ("loop-reduce", "Number of GEPs strength reduced");
41 Statistic NumInserted("loop-reduce", "Number of PHIs inserted");
42 Statistic NumVariable("loop-reduce","Number of PHIs with variable strides");
4343
4444 /// IVStrideUse - Keep track of one use of a strided induction variable, where
4545 /// the stride is stored externally. The Offset member keeps track of the
3636 using namespace llvm;
3737
3838 namespace {
39 Statistic<> NumUnrolled("loop-unroll", "Number of loops completely unrolled");
39 Statistic NumUnrolled("loop-unroll", "Number of loops completely unrolled");
4040
4141 cl::opt
4242 UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
4343 using namespace llvm;
4444
4545 namespace {
46 Statistic<> NumBranches("loop-unswitch", "Number of branches unswitched");
47 Statistic<> NumSwitches("loop-unswitch", "Number of switches unswitched");
48 Statistic<> NumSelects ("loop-unswitch", "Number of selects unswitched");
49 Statistic<> NumTrivial ("loop-unswitch",
46 Statistic NumBranches("loop-unswitch", "Number of branches unswitched");
47 Statistic NumSwitches("loop-unswitch", "Number of switches unswitched");
48 Statistic NumSelects ("loop-unswitch", "Number of selects unswitched");
49 Statistic NumTrivial ("loop-unswitch",
5050 "Number of unswitches that are trivial");
51 Statistic<> NumSimplify("loop-unswitch",
51 Statistic NumSimplify("loop-unswitch",
5252 "Number of simplifications of unswitched code");
5353 cl::opt
5454 Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
9292 using namespace llvm;
9393
9494 namespace {
95 Statistic<>
95 Statistic
9696 NumVarsReplaced("predsimplify", "Number of argument substitutions");
97 Statistic<>
97 Statistic
9898 NumInstruction("predsimplify", "Number of instructions removed");
99 Statistic<>
99 Statistic
100100 NumSimple("predsimplify", "Number of simple replacements");
101101
102102 /// The InequalityGraph stores the relationships between values.
3636 using namespace llvm;
3737
3838 namespace {
39 Statistic<> NumLinear ("reassociate","Number of insts linearized");
40 Statistic<> NumChanged("reassociate","Number of insts reassociated");
41 Statistic<> NumSwapped("reassociate","Number of insts with operands swapped");
42 Statistic<> NumAnnihil("reassociate","Number of expr tree annihilated");
43 Statistic<> NumFactor ("reassociate","Number of multiplies factored");
39 Statistic NumLinear ("reassociate","Number of insts linearized");
40 Statistic NumChanged("reassociate","Number of insts reassociated");
41 Statistic NumSwapped("reassociate","Number of insts with operands swapped");
42 Statistic NumAnnihil("reassociate","Number of expr tree annihilated");
43 Statistic NumFactor ("reassociate","Number of multiplies factored");
4444
4545 struct ValueEntry {
4646 unsigned Rank;
2929 using namespace llvm;
3030
3131 namespace {
32 Statistic<> NumDemoted("reg2mem", "Number of registers demoted");
32 Statistic NumDemoted("reg2mem", "Number of registers demoted");
3333
3434 struct RegToMem : public FunctionPass {
3535
10791079
10801080
10811081 namespace {
1082 Statistic<> NumInstRemoved("sccp", "Number of instructions removed");
1083 Statistic<> NumDeadBlocks ("sccp", "Number of basic blocks unreachable");
1082 Statistic NumInstRemoved("sccp", "Number of instructions removed");
1083 Statistic NumDeadBlocks ("sccp", "Number of basic blocks unreachable");
10841084
10851085 //===--------------------------------------------------------------------===//
10861086 //
11901190 }
11911191
11921192 namespace {
1193 Statistic<> IPNumInstRemoved("ipsccp", "Number of instructions removed");
1194 Statistic<> IPNumDeadBlocks ("ipsccp", "Number of basic blocks unreachable");
1195 Statistic<> IPNumArgsElimed ("ipsccp",
1193 Statistic IPNumInstRemoved("ipsccp", "Number of instructions removed");
1194 Statistic IPNumDeadBlocks ("ipsccp", "Number of basic blocks unreachable");
1195 Statistic IPNumArgsElimed ("ipsccp",
11961196 "Number of arguments constant propagated");
1197 Statistic<> IPNumGlobalConst("ipsccp",
1197 Statistic IPNumGlobalConst("ipsccp",
11981198 "Number of globals found to be constant");
11991199
12001200 //===--------------------------------------------------------------------===//
3636 using namespace llvm;
3737
3838 namespace {
39 Statistic<> NumReplaced("scalarrepl", "Number of allocas broken up");
40 Statistic<> NumPromoted("scalarrepl", "Number of allocas promoted");
41 Statistic<> NumConverted("scalarrepl",
39 Statistic NumReplaced("scalarrepl", "Number of allocas broken up");
40 Statistic NumPromoted("scalarrepl", "Number of allocas promoted");
41 Statistic NumConverted("scalarrepl",
4242 "Number of aggregates converted to scalar");
4343
4444 struct VISIBILITY_HIDDEN SROA : public FunctionPass {
2929 using namespace llvm;
3030
3131 namespace {
32 Statistic<> NumSimpl("cfgsimplify", "Number of blocks simplified");
32 Statistic NumSimpl("cfgsimplify", "Number of blocks simplified");
3333
3434 struct CFGSimplifyPass : public FunctionPass {
3535 virtual bool runOnFunction(Function &F);
3636 cl::opt
3737 Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
3838 cl::init(6), cl::Hidden);
39 Statistic<> NumEliminated("tailduplicate",
39 Statistic NumEliminated("tailduplicate",
4040 "Number of unconditional branches eliminated");
41 Statistic<> NumPHINodes("tailduplicate", "Number of phi nodes inserted");
41 Statistic NumPHINodes("tailduplicate", "Number of phi nodes inserted");
4242
4343 class TailDup : public FunctionPass {
4444 bool runOnFunction(Function &F);
6060 using namespace llvm;
6161
6262 namespace {
63 Statistic<> NumEliminated("tailcallelim", "Number of tail calls removed");
64 Statistic<> NumAccumAdded("tailcallelim","Number of accumulators introduced");
63 Statistic NumEliminated("tailcallelim", "Number of tail calls removed");
64 Statistic NumAccumAdded("tailcallelim","Number of accumulators introduced");
6565
6666 struct TailCallElim : public FunctionPass {
6767 virtual bool runOnFunction(Function &F);
2929 using namespace llvm;
3030
3131 namespace {
32 Statistic<> NumBroken("break-crit-edges", "Number of blocks inserted");
32 Statistic NumBroken("break-crit-edges", "Number of blocks inserted");
3333
3434 struct VISIBILITY_HIDDEN BreakCriticalEdges : public FunctionPass {
3535 virtual bool runOnFunction(Function &F);
4242 using namespace llvm;
4343
4444 namespace {
45 static Statistic<> NumLCSSA("lcssa",
45 static Statistic NumLCSSA("lcssa",
4646 "Number of live out of a loop variables");
4747
4848 struct LCSSA : public FunctionPass {
4848 using namespace llvm;
4949
5050 namespace {
51 Statistic<>
51 Statistic
5252 NumInserted("loopsimplify", "Number of pre-header or exit blocks inserted");
53 Statistic<>
53 Statistic
5454 NumNested("loopsimplify", "Number of nested loops split out");
5555
5656 struct VISIBILITY_HIDDEN LoopSimplify : public FunctionPass {
2424 using namespace llvm;
2525
2626 namespace {
27 Statistic<> NumLowered("lowerallocs", "Number of allocations lowered");
27 Statistic NumLowered("lowerallocs", "Number of allocations lowered");
2828
2929 /// LowerAllocations - Turn malloc and free instructions into %malloc and
3030 /// %free calls.
4949 using namespace llvm;
5050
5151 namespace {
52 Statistic<> NumInvokes("lowerinvoke", "Number of invokes replaced");
53 Statistic<> NumUnwinds("lowerinvoke", "Number of unwinds replaced");
54 Statistic<> NumSpilled("lowerinvoke",
52 Statistic NumInvokes("lowerinvoke", "Number of invokes replaced");
53 Statistic NumUnwinds("lowerinvoke", "Number of unwinds replaced");
54 Statistic NumSpilled("lowerinvoke",
5555 "Number of registers live across unwind edges");
5656 cl::opt ExpensiveEHSupport("enable-correct-eh-support",
5757 cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code"));
2727 using namespace llvm;
2828
2929 namespace {
30 Statistic<> NumLowered("lowerselect","Number of select instructions lowered");
30 Statistic NumLowered("lowerselect","Number of select instructions lowered");
3131
3232 /// LowerSelect - Turn select instructions into conditional branches.
3333 ///
2525 using namespace llvm;
2626
2727 namespace {
28 Statistic<> NumLowered("lowerswitch", "Number of SwitchInst's replaced");
28 Statistic NumLowered("lowerswitch", "Number of SwitchInst's replaced");
2929
3030 /// LowerSwitch Pass - Replace all SwitchInst instructions with chained branch
3131 /// instructions. Note that this cannot be a BasicBlock pass because it
2323 using namespace llvm;
2424
2525 namespace {
26 Statistic<> NumPromoted("mem2reg", "Number of alloca's promoted");
26 Statistic NumPromoted("mem2reg", "Number of alloca's promoted");
2727
2828 struct VISIBILITY_HIDDEN PromotePass : public FunctionPass {
2929 // runOnFunction - To run this pass, first we calculate the alloca