LLVM: include/llvm/ADT/Statistic.h File Reference (original) (raw)

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metrics from passes. More...

#include "llvm/Config/llvm-config.h"
#include "[llvm/Support/Compiler.h](Compiler%5F8h%5Fsource.html)"
#include <atomic>
#include <memory>
#include <vector>

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metrics from passes.

These statistics are printed at the end of a run (from llvm_shutdown), when the -stats command line option is passed on the command line.

This is useful for reporting information like the number of instructions simplified, optimized or removed by various transformations, like this:

static Statistic NumInstsKilled("gcse", "Number of instructions killed");

Later, in the code: ++NumInstsKilled;

NOTE: Statistics must be declared as global variables.

Definition in file Statistic.h.