42#ifndef LLVM_SUPPORT_DEBUGCOUNTER_H
43#define LLVM_SUPPORT_DEBUGCOUNTER_H
109 auto Result = Us.Counters.find(
ID);
110 assert(Result != Us.Counters.end() &&
"Asking about a non-set counter");
111 return {Result->second.Count, Result->second.CurrChunkIdx};
117 auto &Counter = Us.Counters[
ID];
118 Counter.Count = State.
Count;
119 Counter.CurrChunkIdx = State.
ChunkIdx;
122#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
194#define DEBUG_COUNTER(VARNAME, COUNTERNAME, DESC) \
195 static const unsigned VARNAME = \
196 DebugCounter::registerCounter(COUNTERNAME, DESC)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
static CounterState getCounterState(unsigned ID)
static LLVM_ABI void printChunks(raw_ostream &OS, ArrayRef< Chunk >)
CounterVector::const_iterator end() const
CounterVector::const_iterator begin() const
DenseMap< unsigned, CounterInfo > Counters
static bool isCounterSet(unsigned ID)
static bool shouldExecute(unsigned CounterName)
CounterVector RegisteredCounters
std::pair< std::string, std::string > getCounterInfo(unsigned ID) const
LLVM_ABI void push_back(const std::string &)
static bool isCountingEnabled()
unsigned getCounterId(const std::string &Name) const
static LLVM_ABI bool shouldExecuteImpl(unsigned CounterName)
static unsigned registerCounter(StringRef Name, StringRef Desc)
UniqueVector< std::string > CounterVector
unsigned addCounter(const std::string &Name, const std::string &Desc)
static void enableAllCounters()
static LLVM_ABI bool parseChunks(StringRef Str, SmallVector< Chunk > &Res)
Return true on parsing error and print the error message on the llvm::errs()
static LLVM_ABI DebugCounter & instance()
Returns a reference to the singleton instance.
LLVM_ABI void print(raw_ostream &OS) const
LLVM_DUMP_METHOD void dump() const
static void setCounterState(unsigned ID, CounterState State)
unsigned int getNumCounters() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
UniqueVector - This class produces a sequential ID number (base 1) for each unique entry that is adde...
typename VectorType::const_iterator const_iterator
unsigned insert(const T &Entry)
insert - Append entry to the vector if it doesn't already exist.
size_t size() const
size - Returns the number of entries in the vector.
iterator end()
Return an iterator to the end of the vector.
unsigned idFor(const T &Entry) const
idFor - return the ID for an existing entry.
iterator begin()
Return an iterator to the start of the vector.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
Description of the encoding of one expression Op.
bool contains(int64_t Idx) const
LLVM_ABI void print(llvm::raw_ostream &OS)
SmallVector< Chunk > Chunks