LLVM 22.0.0git
PassInstrumentation.h File Reference

This file defines the Pass Instrumentation classes that provide instrumentation points into the pass execution by PassManager. More...

#include "llvm/ADT/Any.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/Compiler.h"
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

class  llvm::PassInstrumentationCallbacks
 This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass control to the registered callbacks. More...
class  llvm::PassInstrumentation
 This class provides instrumentation entry points for the Pass Manager, doing calls to callbacks registered in PassInstrumentationCallbacks. More...
class  llvm::PassInstrumentationAnalysis
 Pseudo-analysis pass that exposes the PassInstrumentation to pass managers. More...

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Functions

LLVM_ABI bool llvm::isSpecialPass (StringRef PassID, const std::vector< StringRef > &Specials)

Detailed Description

This file defines the Pass Instrumentation classes that provide instrumentation points into the pass execution by PassManager.

There are two main classes:

  • PassInstrumentation provides a set of instrumentation points for pass managers to call on.
  • PassInstrumentationCallbacks registers callbacks and provides access to them for PassInstrumentation.

PassInstrumentation object is being used as a result of PassInstrumentationAnalysis (so it is intended to be easily copyable).

Intended scheme of use for Pass Instrumentation is as follows:

  • register instrumentation callbacks in PassInstrumentationCallbacks instance. PassBuilder provides helper for that.
  • register PassInstrumentationAnalysis with all the PassManagers. PassBuilder handles that automatically when registering analyses.
  • Pass Manager requests PassInstrumentationAnalysis from analysis manager and gets PassInstrumentation as its result.
  • Pass Manager invokes PassInstrumentation entry points appropriately, passing StringRef identification ("name") of the pass currently being executed and IRUnit it works on. There can be different schemes of providing names in future, currently it is just a name() of the pass.
  • PassInstrumentation wraps address of IRUnit into llvm::Any and passes control to all the registered callbacks. Note that we specifically wrap 'const IRUnitT*' so as to avoid any accidental changes to IR in instrumenting callbacks.
  • Some instrumentation points (BeforePass) allow to control execution of a pass. For those callbacks returning false means pass will not be executed.

Definition in file PassInstrumentation.h.