24 #define DEBUG_TYPE "instcount"
26 STATISTIC(TotalInsts ,
"Number of instructions (of all types)");
27 STATISTIC(TotalBlocks,
"Number of basic blocks");
28 STATISTIC(TotalFuncs ,
"Number of non-external functions");
30 #define HANDLE_INST(N, OPCODE, CLASS) \
31 STATISTIC(Num ## OPCODE ## Inst, "Number of " #OPCODE " insts");
33 #include "llvm/IR/Instruction.def"
42 #define HANDLE_INST(N, OPCODE, CLASS) \
43 void visit##OPCODE(CLASS &) { ++Num##OPCODE##Inst; ++TotalInsts; }
45 #include "llvm/IR/Instruction.def"
48 errs() <<
"Instruction Count does not know about " <<
I;
69 "Counts the various types of Instructions",
false,
true)
76 bool InstCount::runOnFunction(
Function &
F) {
FunctionPass * createInstCountPass()
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Base class for instruction visitors.
STATISTIC(NumFunctions,"Total number of functions")
A Module instance is used to store all the information related to an LLVM module. ...
void visitFunction(Function &F)
void initializeInstCountPass(PassRegistry &)
void visitBasicBlock(BasicBlock &BB)
LLVM Basic Block Representation.
INITIALIZE_PASS(InstCount,"instcount","Counts the various types of Instructions", false, true) FunctionPass *llvm
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
void setPreservesAll()
Set by analyses that do not transform their input at all.
llvm_unreachable("Unknown RegBank!")
This class implements an extremely fast bulk output stream that can only output to a stream...
void visitInstruction(Instruction &I)