~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/gcc-plugins/gcc-generate-rtl-pass.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Generator for RTL pass related boilerplate code/data
  4  *
  5  * Supports gcc 4.5-6
  6  *
  7  * Usage:
  8  *
  9  * 1. before inclusion define PASS_NAME
 10  * 2. before inclusion define NO_* for unimplemented callbacks
 11  *    NO_GATE
 12  *    NO_EXECUTE
 13  * 3. before inclusion define PROPERTIES_* and TODO_FLAGS_* to override
 14  *    the default 0 values
 15  * 4. for convenience, all the above will be undefined after inclusion!
 16  * 5. the only exported name is make_PASS_NAME_pass() to register with gcc
 17  */
 18 
 19 #ifndef PASS_NAME
 20 #error at least PASS_NAME must be defined
 21 #else
 22 #define __GCC_PLUGIN_STRINGIFY(n)       #n
 23 #define _GCC_PLUGIN_STRINGIFY(n)        __GCC_PLUGIN_STRINGIFY(n)
 24 #define _GCC_PLUGIN_CONCAT2(x, y)       x ## y
 25 #define _GCC_PLUGIN_CONCAT3(x, y, z)    x ## y ## z
 26 
 27 #define __PASS_NAME_PASS_DATA(n)        _GCC_PLUGIN_CONCAT2(n, _pass_data)
 28 #define _PASS_NAME_PASS_DATA            __PASS_NAME_PASS_DATA(PASS_NAME)
 29 
 30 #define __PASS_NAME_PASS(n)             _GCC_PLUGIN_CONCAT2(n, _pass)
 31 #define _PASS_NAME_PASS                 __PASS_NAME_PASS(PASS_NAME)
 32 
 33 #define _PASS_NAME_NAME                 _GCC_PLUGIN_STRINGIFY(PASS_NAME)
 34 
 35 #define __MAKE_PASS_NAME_PASS(n)        _GCC_PLUGIN_CONCAT3(make_, n, _pass)
 36 #define _MAKE_PASS_NAME_PASS            __MAKE_PASS_NAME_PASS(PASS_NAME)
 37 
 38 #ifdef NO_GATE
 39 #define _GATE NULL
 40 #define _HAS_GATE false
 41 #else
 42 #define __GATE(n)                       _GCC_PLUGIN_CONCAT2(n, _gate)
 43 #define _GATE                           __GATE(PASS_NAME)
 44 #define _HAS_GATE true
 45 #endif
 46 
 47 #ifdef NO_EXECUTE
 48 #define _EXECUTE NULL
 49 #define _HAS_EXECUTE false
 50 #else
 51 #define __EXECUTE(n)                    _GCC_PLUGIN_CONCAT2(n, _execute)
 52 #define _EXECUTE                        __EXECUTE(PASS_NAME)
 53 #define _HAS_EXECUTE true
 54 #endif
 55 
 56 #ifndef PROPERTIES_REQUIRED
 57 #define PROPERTIES_REQUIRED 0
 58 #endif
 59 
 60 #ifndef PROPERTIES_PROVIDED
 61 #define PROPERTIES_PROVIDED 0
 62 #endif
 63 
 64 #ifndef PROPERTIES_DESTROYED
 65 #define PROPERTIES_DESTROYED 0
 66 #endif
 67 
 68 #ifndef TODO_FLAGS_START
 69 #define TODO_FLAGS_START 0
 70 #endif
 71 
 72 #ifndef TODO_FLAGS_FINISH
 73 #define TODO_FLAGS_FINISH 0
 74 #endif
 75 
 76 namespace {
 77 static const pass_data _PASS_NAME_PASS_DATA = {
 78                 .type                   = RTL_PASS,
 79                 .name                   = _PASS_NAME_NAME,
 80                 .optinfo_flags          = OPTGROUP_NONE,
 81                 .tv_id                  = TV_NONE,
 82                 .properties_required    = PROPERTIES_REQUIRED,
 83                 .properties_provided    = PROPERTIES_PROVIDED,
 84                 .properties_destroyed   = PROPERTIES_DESTROYED,
 85                 .todo_flags_start       = TODO_FLAGS_START,
 86                 .todo_flags_finish      = TODO_FLAGS_FINISH,
 87 };
 88 
 89 class _PASS_NAME_PASS : public rtl_opt_pass {
 90 public:
 91         _PASS_NAME_PASS() : rtl_opt_pass(_PASS_NAME_PASS_DATA, g) {}
 92 
 93 #ifndef NO_GATE
 94         virtual bool gate(function *) { return _GATE(); }
 95 #endif
 96 
 97         virtual opt_pass *clone() { return new _PASS_NAME_PASS(); }
 98 
 99 #ifndef NO_EXECUTE
100         virtual unsigned int execute(function *) { return _EXECUTE(); }
101 #endif
102 };
103 }
104 
105 opt_pass *_MAKE_PASS_NAME_PASS(void)
106 {
107         return new _PASS_NAME_PASS();
108 }
109 
110 /* clean up user provided defines */
111 #undef PASS_NAME
112 #undef NO_GATE
113 #undef NO_EXECUTE
114 
115 #undef PROPERTIES_DESTROYED
116 #undef PROPERTIES_PROVIDED
117 #undef PROPERTIES_REQUIRED
118 #undef TODO_FLAGS_FINISH
119 #undef TODO_FLAGS_START
120 
121 /* clean up generated defines */
122 #undef _EXECUTE
123 #undef __EXECUTE
124 #undef _GATE
125 #undef __GATE
126 #undef _GCC_PLUGIN_CONCAT2
127 #undef _GCC_PLUGIN_CONCAT3
128 #undef _GCC_PLUGIN_STRINGIFY
129 #undef __GCC_PLUGIN_STRINGIFY
130 #undef _HAS_EXECUTE
131 #undef _HAS_GATE
132 #undef _MAKE_PASS_NAME_PASS
133 #undef __MAKE_PASS_NAME_PASS
134 #undef _PASS_NAME_NAME
135 #undef _PASS_NAME_PASS
136 #undef __PASS_NAME_PASS
137 #undef _PASS_NAME_PASS_DATA
138 #undef __PASS_NAME_PASS_DATA
139 
140 #endif /* PASS_NAME */
141 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php