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.
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
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.
bool contains(int64_t Idx) const
LLVM_ABI void print(llvm::raw_ostream &OS)
SmallVector< Chunk > Chunks