25#define DEBUG_TYPE "instcount"
27STATISTIC(TotalInsts,
"Number of instructions (of all types)");
29STATISTIC(TotalFuncs,
"Number of non-external functions");
31#define HANDLE_INST(N, OPCODE, CLASS) \
32 STATISTIC(Num##OPCODE##Inst, "Number of " #OPCODE " insts");
34#include "llvm/IR/Instruction.def"
43#define HANDLE_INST(N, OPCODE, CLASS) \
44 void visit##OPCODE(CLASS &) { \
45 ++Num##OPCODE##Inst; \
49#include "llvm/IR/Instruction.def"
52 errs() <<
"Instruction Count does not know about " <<
I;
90char InstCountLegacyPass::ID = 0;
92 "Counts the various types of Instructions",
false,
true)
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static bool runOnFunction(Function &F, bool PostInlining)
FunctionAnalysisManager FAM
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
LLVM Basic Block Representation.
FunctionPass class - This class is used to implement most global optimizations.
Base class for instruction visitors.
void visitFunction(Function &F)
void visitBasicBlock(BasicBlock &BB)
void visitInstruction(Instruction &I)
A Module instance is used to store all the information related to an LLVM module.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
void initializeInstCountLegacyPassPass(PassRegistry &)
FunctionPass * createInstCountPass()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &)