20#if !defined(LLVM_PASS_H) || defined(LLVM_PASSSUPPORT_H)
21#error "Do not include <PassSupport.h>; include <Pass.h> instead"
24#ifndef LLVM_PASSSUPPORT_H
25#define LLVM_PASSSUPPORT_H
39#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis) \
40 static void initialize##passName##PassOnce(PassRegistry &Registry) {
42#define INITIALIZE_PASS_DEPENDENCY(depName) initialize##depName##Pass(Registry);
44#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis) \
45 PassInfo *PI = new PassInfo( \
46 name, arg, &passName::ID, \
47 PassInfo::NormalCtor_t(callDefaultCtor<passName>), cfg, analysis); \
48 Registry.registerPass(*PI, true); \
50 static llvm::once_flag Initialize##passName##PassFlag; \
51 void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
52 llvm::call_once(Initialize##passName##PassFlag, \
53 initialize##passName##PassOnce, std::ref(Registry)); \
56#define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
57 INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis) \
58 INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
60#define INITIALIZE_PASS_WITH_OPTIONS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
61 INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
62 PassName::registerOptions();
64#define INITIALIZE_PASS_WITH_OPTIONS(PassName, Arg, Name, Cfg, Analysis) \
65 INITIALIZE_PASS_WITH_OPTIONS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \
66 INITIALIZE_PASS_END(PassName, Arg, Name, Cfg, Analysis)
69 if constexpr (std::is_default_constructible_v<PassName>)
92 bool is_analysis =
false)
static cl::opt< bool > CFGOnly("dot-mcfg-only", cl::init(false), cl::Hidden, cl::desc("Print only the CFG without blocks body"))
static const char PassName[]
PassInfo class - An instance of this class exists for every pass known by the system,...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_ABI void registerPass(const PassInfo &PI, bool ShouldFree=false)
registerPass - Register a pass (by means of its PassInfo) with the registry.
Pass interface - Implemented by all 'passes'.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
PassRegistrationListener class - This class is meant to be derived from by clients that are intereste...
virtual void passRegistered(const PassInfo *)
Callback functions - These functions are invoked whenever a pass is loaded or removed from the curren...
PassRegistrationListener()=default
virtual void passEnumerate(const PassInfo *)
passEnumerate - Callback function invoked when someone calls enumeratePasses on this PassRegistration...
LLVM_ABI void enumeratePasses()
enumeratePasses - Iterate over the registered passes, calling the passEnumerate callback on each Pass...
virtual ~PassRegistrationListener()=default
RegisterPass<t> template - This template class is used to notify the system that a Pass is available ...
RegisterPass(StringRef PassArg, StringRef Name, bool CFGOnly=false, bool is_analysis=false)