14 #ifndef IMPALA_CODEGEN_INSTRUCTION_COUNTER_H_
15 #define IMPALA_CODEGEN_INSTRUCTION_COUNTER_H_
24 #include "base/logging.h"
25 #include "llvm/IR/Instruction.h"
26 #include "llvm/IR/Module.h"
27 #include "llvm/IR/Function.h"
49 void visit(
const llvm::Module& M);
52 void visit(
const llvm::Function &F);
55 void visit(
const llvm::BasicBlock &BB);
59 void visit(
const llvm::Instruction &I);
63 std::stringstream* stream)
const;
78 template<
class Iterator>
79 void visit(Iterator start, Iterator end) {
80 while (start != end) {
94 #endif // IMPALA_CODEGEN_INSTRUCTION_COUNTER_H_
static const char * TOTAL_INSTS
String constants for instruction count names.
void visit(Iterator start, Iterator end)
Allows for easy visitation of iterators.
int GetCount(const char *name)
Return count of counter described by name.
void ResetCount()
Set all counts to 0.
static const char * OTHER_INSTS
static const char * CAST_INSTS
static const char * TOTAL_BLOCKS
std::map< std::string, int > CounterMap
void PrintCounter(const char *name, int count, int max_count_len, std::stringstream *stream) const
Prints a single counter described by name and count.
static const char * TERMINATOR_INSTS
std::string PrintCounters() const
Prints all counters.
void visit(const llvm::Module &M)
Visits each Function in Module M.
static const char * TOTAL_FUNCTIONS
CounterMap counters_
This maps instruction names to their respective count.
static const char * BINARY_INSTS
void IncrementCount(const char *name)
Increment InstructionCount with name_ equal to name argument.
static const char * MEMORY_INSTS