LLVM: include/llvm/PassSupport.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20#if !defined(LLVM_PASS_H) || defined(LLVM_PASSSUPPORT_H)

21#error "Do not include <PassSupport.h>; include <Pass.h> instead"

22#endif

23

24#ifndef LLVM_PASSSUPPORT_H

25#define LLVM_PASSSUPPORT_H

26

33#include

34

35namespace llvm {

36

38

39#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis) \

40 static void initialize##passName##PassOnce(PassRegistry &Registry) {

41

42#define INITIALIZE_PASS_DEPENDENCY(depName) initialize##depName##Pass(Registry);

43

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), cfg, analysis); \

48 Registry.registerPass(*PI, true); \

49 } \

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)); \

54 }

55

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)

59

60#define INITIALIZE_PASS_WITH_OPTIONS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \

61 INITIALIZE_PASS_BEGIN(PassName, Arg, Name, Cfg, Analysis) \

62 PassName::registerOptions();

63

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)

67

69 if constexpr (std::is_default_constructible_v)

71 else

72

73

75}

76

77

78

79

80

81

82

83

84

85

86

87

88

90

92 bool is_analysis = false)

93 : PassInfo(Name, PassArg, &passName::ID,

95 is_analysis) {

97 }

98};

99

100

101

102

103

104

105

109

110

111

113

114

115

117

118

119

121};

122

123}

124

125#endif

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,...

PassInfo(StringRef name, StringRef arg, const void *pi, NormalCtor_t normal, bool isCFGOnly, bool is_analysis)

PassInfo ctor - Do not call this directly, this should only be invoked through RegisterPass.

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.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

This is an optimization pass for GlobalISel generic memory operations.

Pass * callDefaultCtor()

Definition PassSupport.h:68

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

virtual void passRegistered(const PassInfo *)

Callback functions - These functions are invoked whenever a pass is loaded or removed from the curren...

Definition PassSupport.h:112

PassRegistrationListener()=default

virtual void passEnumerate(const PassInfo *)

passEnumerate - Callback function invoked when someone calls enumeratePasses on this PassRegistration...

Definition PassSupport.h:120

LLVM_ABI void enumeratePasses()

enumeratePasses - Iterate over the registered passes, calling the passEnumerate callback on each Pass...

virtual ~PassRegistrationListener()=default

RegisterPass(StringRef PassArg, StringRef Name, bool CFGOnly=false, bool is_analysis=false)

Definition PassSupport.h:91