22#define DEBUG_TYPE "instcount"
24STATISTIC(TotalInsts,
"Number of instructions of all types");
26STATISTIC(TotalFuncs,
"Number of non-external functions");
29 "Largest number of instructions in a single function");
31 "Largest number of basic blocks in a single function");
34 "Number of instructions of all types (before optimizations)");
36 "Number of basic blocks (before optimizations)");
38 "Number of non-external functions (before optimizations)");
41 "Largest number of instructions in a single function (before "
44 "Largest number of basic blocks in a single function (before "
47#define HANDLE_INST(N, OPCODE, CLASS) \
48 STATISTIC(Num##OPCODE##Inst, "Number of " #OPCODE " insts"); \
49 STATISTIC(Num##OPCODE##InstPreOptimization, \
50 "Number of " #OPCODE " insts (before optimizations)");
52#include "llvm/IR/Instruction.def"
58 bool IsPreOptimization;
61 if (IsPreOptimization) {
62 ++TotalFuncsPreOptimization;
63 LargestFunctionSizePreOptimization.updateMax(
F.getInstructionCount());
64 LargestFunctionBBCountPreOptimization.updateMax(
F.size());
67 LargestFunctionSize.updateMax(
F.getInstructionCount());
68 LargestFunctionBBCount.updateMax(
F.size());
73 if (IsPreOptimization)
74 ++TotalBlocksPreOptimization;
79#define HANDLE_INST(N, OPCODE, CLASS) \
80 void visit##OPCODE(CLASS &) { \
81 if (IsPreOptimization) { \
82 ++Num##OPCODE##InstPreOptimization; \
83 ++TotalInstsPreOptimization; \
85 ++Num##OPCODE##Inst; \
90#include "llvm/IR/Instruction.def"
93 errs() <<
"Instruction Count does not know about " <<
I;
98 InstCount(
bool IsPreOptimization =
false)
99 : IsPreOptimization(IsPreOptimization) {}
107 InstCount(this->IsPreOptimization).visit(
F);
FunctionAnalysisManager FAM
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
LLVM Basic Block Representation.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Base class for instruction visitors.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.