Go to the documentation of this file.
15 class DebugCounterList :
public cl::list<std::string, DebugCounter> {
20 template <
class... Mods>
21 explicit DebugCounterList(Mods &&... Ms) :
Base(
std::forward<Mods>(Ms)...) {}
24 void printOptionInfo(
size_t GlobalWidth)
const override {
32 outs() <<
" -" << ArgStr;
35 Option::printHelpStr(HelpStr, GlobalWidth, ArgStr.size() + 6);
37 for (
const auto &
Name : CounterInstance) {
39 CounterInstance.getCounterInfo(CounterInstance.getCounterId(
Name));
40 size_t NumSpaces = GlobalWidth -
Info.first.size() - 8;
47 struct CreateDebugCounterOption {
49 return new DebugCounterList(
51 cl::desc(
"Comma separated list of debug counter skip and count"),
66 cl::desc(
"Print out debug counter info after all counters accumulated"));
86 if (CounterPair.second.empty()) {
87 errs() <<
"DebugCounter Error: " << Val <<
" does not have an = in it\n";
93 if (CounterPair.second.getAsInteger(0, CounterVal)) {
94 errs() <<
"DebugCounter Error: " << CounterPair.second
95 <<
" is not a number\n";
100 if (CounterPair.first.endswith(
"-skip")) {
101 auto CounterName = CounterPair.first.drop_back(5);
102 unsigned CounterID =
getCounterId(std::string(CounterName));
104 errs() <<
"DebugCounter Error: " << CounterName
105 <<
" is not a registered counter\n";
110 CounterInfo &Counter = Counters[CounterID];
111 Counter.Skip = CounterVal;
112 Counter.IsSet =
true;
113 }
else if (CounterPair.first.endswith(
"-count")) {
114 auto CounterName = CounterPair.first.drop_back(6);
115 unsigned CounterID =
getCounterId(std::string(CounterName));
117 errs() <<
"DebugCounter Error: " << CounterName
118 <<
" is not a registered counter\n";
123 CounterInfo &Counter = Counters[CounterID];
124 Counter.StopAfter = CounterVal;
125 Counter.IsSet =
true;
127 errs() <<
"DebugCounter Error: " << CounterPair.first
128 <<
" does not end with -skip or -count\n";
134 RegisteredCounters.
end());
138 OS <<
"Counters and values:\n";
139 for (
auto &CounterName : CounterNames) {
140 unsigned CounterID =
getCounterId(std::string(CounterName));
141 OS <<
left_justify(RegisteredCounters[CounterID], 32) <<
": {"
142 << Us.Counters[CounterID].Count <<
"," << Us.Counters[CounterID].Skip
143 <<
"," << Us.Counters[CounterID].StopAfter <<
"}\n";
static ManagedStatic< DebugCounterList, CreateDebugCounterOption > DebugCounterOption
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This is an optimization pass for GlobalISel generic memory operations.
static void enableAllCounters()
LocationClass< Ty > location(Ty &L)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static DebugCounter & instance()
Returns a reference to the singleton instance.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
This class implements an extremely fast bulk output stream that can only output to a stream.
Analysis containing CSE Info
void push_back(const std::string &)
S is passed via registers r2 But gcc stores them to the and then reload them to and r3 before issuing the call(r0 contains the address of the format string)
initializer< Ty > init(const Ty &Val)
iterator end()
Return an iterator to the end of the vector.
StringRef - Represent a constant reference to a string, i.e.
static ManagedStatic< DebugCounter > DC
void initDebugCounterOptions()
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
void print(raw_ostream &OS) const
unsigned getCounterId(const std::string &Name) const
static bool PrintDebugCounter
void sort(IteratorTy Start, IteratorTy End)
iterator begin()
Return an iterator to the start of the vector.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
LLVM_DUMP_METHOD void dump() const