Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <instruction-counter.h>
Public Member Functions | |
InstructionCounter () | |
void | visit (const llvm::Module &M) |
Visits each Function in Module M. More... | |
void | visit (const llvm::Function &F) |
Increments "Total Functions" InstructionCounter and visits each BasicBlock in F. More... | |
void | visit (const llvm::BasicBlock &BB) |
Increments "Total Blocks" InstructionCounter and visits each Instruction in BB. More... | |
void | visit (const llvm::Instruction &I) |
void | PrintCounter (const char *name, int count, int max_count_len, std::stringstream *stream) const |
Prints a single counter described by name and count. More... | |
std::string | PrintCounters () const |
Prints all counters. More... | |
int | GetCount (const char *name) |
Return count of counter described by name. More... | |
void | ResetCount () |
Set all counts to 0. More... | |
Static Public Attributes | |
static const char * | TOTAL_INSTS = "Total Instructions" |
String constants for instruction count names. More... | |
static const char * | TOTAL_BLOCKS = "Total Blocks" |
static const char * | TOTAL_FUNCTIONS = "Total Functions" |
static const char * | TERMINATOR_INSTS = "Terminator Instructions " |
static const char * | BINARY_INSTS = "Binary Instructions " |
static const char * | MEMORY_INSTS = "Memory Instructions " |
static const char * | CAST_INSTS = "Cast Instructions " |
static const char * | OTHER_INSTS = "Other Instructions " |
Private Types | |
typedef std::map< std::string, int > | CounterMap |
Private Member Functions | |
template<class Iterator > | |
void | visit (Iterator start, Iterator end) |
Allows for easy visitation of iterators. More... | |
void | IncrementCount (const char *name) |
Increment InstructionCount with name_ equal to name argument. More... | |
Private Attributes | |
CounterMap | counters_ |
This maps instruction names to their respective count. More... | |
The InstructionCounter class handles visiting through the instructions in a block, function or module. It holds all of the categories as well as the top level counters such as the total number of instructions.
Definition at line 34 of file instruction-counter.h.
|
private |
Definition at line 75 of file instruction-counter.h.
InstructionCounter::InstructionCounter | ( | ) |
Definition at line 37 of file instruction-counter.cc.
int InstructionCounter::GetCount | ( | const char * | name | ) |
Return count of counter described by name.
Definition at line 67 of file instruction-counter.cc.
Referenced by impala::TEST_F().
|
private |
Increment InstructionCount with name_ equal to name argument.
Definition at line 194 of file instruction-counter.cc.
void InstructionCounter::PrintCounter | ( | const char * | name, |
int | count, | ||
int | max_count_len, | ||
std::stringstream * | stream | ||
) | const |
Prints a single counter described by name and count.
Definition at line 155 of file instruction-counter.cc.
string InstructionCounter::PrintCounters | ( | ) | const |
Prints all counters.
Definition at line 164 of file instruction-counter.cc.
Referenced by impala::LlvmCodeGen::OptimizeModule(), and impala::TEST_F().
void InstructionCounter::ResetCount | ( | ) |
Set all counts to 0.
Definition at line 149 of file instruction-counter.cc.
Referenced by impala::TEST_F().
void impala::InstructionCounter::visit | ( | const llvm::Module & | M | ) |
Visits each Function in Module M.
Referenced by impala::LlvmCodeGen::OptimizeModule(), impala::TEST_F(), and visit().
void impala::InstructionCounter::visit | ( | const llvm::Function & | F | ) |
Increments "Total Functions" InstructionCounter and visits each BasicBlock in F.
void impala::InstructionCounter::visit | ( | const llvm::BasicBlock & | BB | ) |
Increments "Total Blocks" InstructionCounter and visits each Instruction in BB.
void impala::InstructionCounter::visit | ( | const llvm::Instruction & | I | ) |
Increments "Total Instructions" and whichever instruction count I is delegated to in this functions switch statement.
|
inlineprivate |
Allows for easy visitation of iterators.
Definition at line 79 of file instruction-counter.h.
References visit().
|
static |
Definition at line 41 of file instruction-counter.h.
|
static |
Definition at line 43 of file instruction-counter.h.
|
private |
This maps instruction names to their respective count.
Definition at line 89 of file instruction-counter.h.
|
static |
Definition at line 42 of file instruction-counter.h.
|
static |
Definition at line 44 of file instruction-counter.h.
|
static |
Definition at line 40 of file instruction-counter.h.
|
static |
Definition at line 38 of file instruction-counter.h.
|
static |
Definition at line 39 of file instruction-counter.h.
|
static |
String constants for instruction count names.
Definition at line 37 of file instruction-counter.h.