LLVM 23.0.0git
InstCount.cpp File Reference
#include "llvm/Analysis/InstCount.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/Instruction.def"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instcount"
#define HANDLE_INST(N, OPCODE, CLASS)
#define HANDLE_INST(N, OPCODE, CLASS)

Functions

 STATISTIC (TotalInsts, "Number of instructions of all types")
 STATISTIC (TotalBlocks, "Number of basic blocks")
 STATISTIC (TotalFuncs, "Number of non-external functions")
 STATISTIC (LargestFunctionSize, "Largest number of instructions in a single function")
 STATISTIC (LargestFunctionBBCount, "Largest number of basic blocks in a single function")
 STATISTIC (TotalInstsPreOptimization, "Number of instructions of all types (before optimizations)")
 STATISTIC (TotalBlocksPreOptimization, "Number of basic blocks (before optimizations)")
 STATISTIC (TotalFuncsPreOptimization, "Number of non-external functions (before optimizations)")
 STATISTIC (LargestFunctionSizePreOptimization, "Largest number of instructions in a single function (before " "optimizations)")
 STATISTIC (LargestFunctionBBCountPreOptimization, "Largest number of basic blocks in a single function (before " "optimizations)")

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "instcount"

Definition at line 22 of file InstCount.cpp.

◆ HANDLE_INST [1/2]

#define HANDLE_INST ( N,
OPCODE,
CLASS )
Value:
STATISTIC(Num##OPCODE##Inst, "Number of " #OPCODE " insts"); \
STATISTIC(Num##OPCODE##InstPreOptimization, \
"Number of " #OPCODE " insts (before optimizations)");
#define STATISTIC(VARNAME, DESC)
Definition Statistic.h:171

Definition at line 47 of file InstCount.cpp.

◆ HANDLE_INST [2/2]

#define HANDLE_INST ( N,
OPCODE,
CLASS )
Value:
void visit##OPCODE(CLASS &) { \
if (IsPreOptimization) { \
++Num##OPCODE##InstPreOptimization; \
++TotalInstsPreOptimization; \
} else { \
++Num##OPCODE##Inst; \
++TotalInsts; \
} \
}
static void visit(BasicBlock &Start, std::function< bool(BasicBlock *)> op)

Definition at line 47 of file InstCount.cpp.

Function Documentation

◆ STATISTIC() [1/10]

STATISTIC ( LargestFunctionBBCount ,
"Largest number of basic blocks in a single function"  )

◆ STATISTIC() [2/10]

STATISTIC ( LargestFunctionBBCountPreOptimization ,
"Largest number of basic blocks in a single function (before " "optimizations)"  )

◆ STATISTIC() [3/10]

STATISTIC ( LargestFunctionSize ,
"Largest number of instructions in a single function"  )

◆ STATISTIC() [4/10]

STATISTIC ( LargestFunctionSizePreOptimization ,
"Largest number of instructions in a single function (before " "optimizations)"  )

◆ STATISTIC() [5/10]

STATISTIC ( TotalBlocks ,
"Number of basic blocks"  )

◆ STATISTIC() [6/10]

STATISTIC ( TotalBlocksPreOptimization ,
"Number of basic blocks (before optimizations)"  )

◆ STATISTIC() [7/10]

STATISTIC ( TotalFuncs ,
"Number of non-external functions"  )

◆ STATISTIC() [8/10]

STATISTIC ( TotalFuncsPreOptimization ,
"Number of non-external functions (before optimizations)"  )

◆ STATISTIC() [9/10]

STATISTIC ( TotalInsts ,
"Number of instructions of all types"  )

◆ STATISTIC() [10/10]

STATISTIC ( TotalInstsPreOptimization ,
"Number of instructions of all types (before optimizations)"  )