
LLVM Techniques, Tips, and Best Practices Clang and Middle-End Libraries
By :

As mentioned in the previous section, a compiler is a complex piece of software. Collecting statistical numbers—for example, the number of basic blocks processed by a specific optimization—is one of the easiest and most efficient ways to get a quick portrait on the runtime behaviors of a compiler.
There are several ways to collect statistics in LLVM. In this section, we are going to learn three of the most common and useful options for doing this, and these methods are outlined here:
Statistic
classThe first option is a general utility that collects statistics via simple counters; the second option is specifically designed to profile compiler optimizations; and the last option is used for collecting timing information in the compiler.
Let's start with the first one.
In this section, we are going to demonstrate new features...