LLVM: include/llvm/Support/DebugCounter.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42#ifndef LLVM_SUPPORT_DEBUGCOUNTER_H

43#define LLVM_SUPPORT_DEBUGCOUNTER_H

44

50#include

51

52namespace llvm {

53

54class raw_ostream;

55

57public:

63 };

64

66

67

68

70

71

73

74

75 void push_back(const std::string &);

76

77

78

79

80

81

84 }

86

89 return true;

91 }

92

93

94

95

98 }

99

103 };

104

105

108 auto Result = Us.Counters.find(ID);

109 assert(Result != Us.Counters.end() && "Asking about a non-set counter");

110 return {Result->second.Count, Result->second.CurrChunkIdx};

111 }

112

113

116 auto &Counter = Us.Counters[ID];

117 Counter.Count = State.Count;

118 Counter.CurrChunkIdx = State.ChunkIdx;

119 }

120

121

123

125

126

129 }

130

131

133

134

137 }

138

139

143 }

145

146

147

148

149

150

152

154

155#ifdef NDEBUG

156 return false;

157#else

159#endif

160 }

161

162protected:

167 return Result;

168 }

169

176 };

177

180

181

182

184

186

188};

189

190#define DEBUG_COUNTER(VARNAME, COUNTERNAME, DESC) \

191 static const unsigned VARNAME = \

192 DebugCounter::registerCounter(COUNTERNAME, DESC)

193

194}

195#endif

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

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

static CounterState getCounterState(unsigned ID)

static 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

void push_back(const std::string &)

static bool isCountingEnabled()

unsigned getCounterId(const std::string &Name) const

static 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 bool parseChunks(StringRef Str, SmallVector< Chunk > &Res)

Return true on parsing error and print the error message on the llvm::errs()

static DebugCounter & instance()

Returns a reference to the singleton instance.

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.

This is an optimization pass for GlobalISel generic memory operations.

Description of the encoding of one expression Op.

void print(llvm::raw_ostream &OS)

bool contains(int64_t Idx)

SmallVector< Chunk > Chunks