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)
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...
INITIALIZE_PASS(InstCount, "instcount", "Counts the various types of Instructions", false, true) FunctionPass *llvm
Base class for instruction visitors.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
STATISTIC(NumFunctions, "Total number of functions")
void visitFunction(Function &F)
void initializeInstCountPass(PassRegistry &)
void visit(Iterator Start, Iterator End)
static bool runOnFunction(Function &F, bool PostInlining)
void visitBasicBlock(BasicBlock &BB)
LLVM Basic Block Representation.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setPreservesAll()
Set by analyses that do not transform their input at all.
This class implements an extremely fast bulk output stream that can only output to a stream...
void visitInstruction(Instruction &I)