Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::InstructionCounter Class Reference

#include <instruction-counter.h>

Collaboration diagram for impala::InstructionCounter:

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...
 

Detailed Description

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.

Member Typedef Documentation

typedef std::map<std::string, int> impala::InstructionCounter::CounterMap
private

Definition at line 75 of file instruction-counter.h.

Constructor & Destructor Documentation

InstructionCounter::InstructionCounter ( )

Definition at line 37 of file instruction-counter.cc.

Member Function Documentation

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().

void InstructionCounter::IncrementCount ( const char *  name)
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.

template<class Iterator >
void impala::InstructionCounter::visit ( Iterator  start,
Iterator  end 
)
inlineprivate

Allows for easy visitation of iterators.

Definition at line 79 of file instruction-counter.h.

References visit().

Member Data Documentation

const char * InstructionCounter::BINARY_INSTS = "Binary Instructions "
static

Definition at line 41 of file instruction-counter.h.

const char * InstructionCounter::CAST_INSTS = "Cast Instructions "
static

Definition at line 43 of file instruction-counter.h.

CounterMap impala::InstructionCounter::counters_
private

This maps instruction names to their respective count.

Definition at line 89 of file instruction-counter.h.

const char * InstructionCounter::MEMORY_INSTS = "Memory Instructions "
static

Definition at line 42 of file instruction-counter.h.

const char * InstructionCounter::OTHER_INSTS = "Other Instructions "
static

Definition at line 44 of file instruction-counter.h.

const char * InstructionCounter::TERMINATOR_INSTS = "Terminator Instructions "
static

Definition at line 40 of file instruction-counter.h.

const char * InstructionCounter::TOTAL_BLOCKS = "Total Blocks"
static

Definition at line 38 of file instruction-counter.h.

const char * InstructionCounter::TOTAL_FUNCTIONS = "Total Functions"
static

Definition at line 39 of file instruction-counter.h.

const char * InstructionCounter::TOTAL_INSTS = "Total Instructions"
static

String constants for instruction count names.

Definition at line 37 of file instruction-counter.h.


The documentation for this class was generated from the following files: