annotate gcc/plugin.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Header file for internal GCC plugin mechanism.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2009-2020 Free Software Foundation, Inc.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 the Free Software Foundation; either version 3, or (at your option)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 any later version.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 GNU General Public License for more details.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #ifndef PLUGIN_H
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #define PLUGIN_H
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
111
kono
parents: 67
diff changeset
23 #include "highlev-plugin-common.h"
kono
parents: 67
diff changeset
24
kono
parents: 67
diff changeset
25 /* Event names. */
kono
parents: 67
diff changeset
26 enum plugin_event
kono
parents: 67
diff changeset
27 {
kono
parents: 67
diff changeset
28 # define DEFEVENT(NAME) NAME,
kono
parents: 67
diff changeset
29 # include "plugin.def"
kono
parents: 67
diff changeset
30 # undef DEFEVENT
kono
parents: 67
diff changeset
31 PLUGIN_EVENT_FIRST_DYNAMIC
kono
parents: 67
diff changeset
32 };
kono
parents: 67
diff changeset
33
kono
parents: 67
diff changeset
34 /* All globals declared here have C linkage to reduce link compatibility
kono
parents: 67
diff changeset
35 issues with implementation language choice and mangling. */
kono
parents: 67
diff changeset
36 #ifdef __cplusplus
kono
parents: 67
diff changeset
37 extern "C" {
kono
parents: 67
diff changeset
38 #endif
kono
parents: 67
diff changeset
39
kono
parents: 67
diff changeset
40 extern const char **plugin_event_name;
kono
parents: 67
diff changeset
41
kono
parents: 67
diff changeset
42 struct plugin_argument
kono
parents: 67
diff changeset
43 {
kono
parents: 67
diff changeset
44 char *key; /* key of the argument. */
kono
parents: 67
diff changeset
45 char *value; /* value is optional and can be NULL. */
kono
parents: 67
diff changeset
46 };
kono
parents: 67
diff changeset
47
kono
parents: 67
diff changeset
48 /* Additional information about the plugin. Used by --help and --version. */
kono
parents: 67
diff changeset
49
kono
parents: 67
diff changeset
50 struct plugin_info
kono
parents: 67
diff changeset
51 {
kono
parents: 67
diff changeset
52 const char *version;
kono
parents: 67
diff changeset
53 const char *help;
kono
parents: 67
diff changeset
54 };
kono
parents: 67
diff changeset
55
kono
parents: 67
diff changeset
56 /* Represents the gcc version. Used to avoid using an incompatible plugin. */
kono
parents: 67
diff changeset
57
kono
parents: 67
diff changeset
58 struct plugin_gcc_version
kono
parents: 67
diff changeset
59 {
kono
parents: 67
diff changeset
60 const char *basever;
kono
parents: 67
diff changeset
61 const char *datestamp;
kono
parents: 67
diff changeset
62 const char *devphase;
kono
parents: 67
diff changeset
63 const char *revision;
kono
parents: 67
diff changeset
64 const char *configuration_arguments;
kono
parents: 67
diff changeset
65 };
kono
parents: 67
diff changeset
66
kono
parents: 67
diff changeset
67 /* Object that keeps track of the plugin name and its arguments. */
kono
parents: 67
diff changeset
68 struct plugin_name_args
kono
parents: 67
diff changeset
69 {
kono
parents: 67
diff changeset
70 char *base_name; /* Short name of the plugin (filename without
kono
parents: 67
diff changeset
71 .so suffix). */
kono
parents: 67
diff changeset
72 const char *full_name; /* Path to the plugin as specified with
kono
parents: 67
diff changeset
73 -fplugin=. */
kono
parents: 67
diff changeset
74 int argc; /* Number of arguments specified with
kono
parents: 67
diff changeset
75 -fplugin-arg-... */
kono
parents: 67
diff changeset
76 struct plugin_argument *argv; /* Array of ARGC key-value pairs. */
kono
parents: 67
diff changeset
77 const char *version; /* Version string provided by plugin. */
kono
parents: 67
diff changeset
78 const char *help; /* Help string provided by plugin. */
kono
parents: 67
diff changeset
79 };
kono
parents: 67
diff changeset
80
kono
parents: 67
diff changeset
81 /* The default version check. Compares every field in VERSION. */
kono
parents: 67
diff changeset
82
kono
parents: 67
diff changeset
83 extern bool plugin_default_version_check (struct plugin_gcc_version *,
kono
parents: 67
diff changeset
84 struct plugin_gcc_version *);
kono
parents: 67
diff changeset
85
kono
parents: 67
diff changeset
86 /* Function type for the plugin initialization routine. Each plugin module
kono
parents: 67
diff changeset
87 should define this as an externally-visible function with name
kono
parents: 67
diff changeset
88 "plugin_init."
kono
parents: 67
diff changeset
89
kono
parents: 67
diff changeset
90 PLUGIN_INFO - plugin invocation information.
kono
parents: 67
diff changeset
91 VERSION - the plugin_gcc_version symbol of GCC.
kono
parents: 67
diff changeset
92
kono
parents: 67
diff changeset
93 Returns 0 if initialization finishes successfully. */
kono
parents: 67
diff changeset
94
kono
parents: 67
diff changeset
95 typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info,
kono
parents: 67
diff changeset
96 struct plugin_gcc_version *version);
kono
parents: 67
diff changeset
97
kono
parents: 67
diff changeset
98 /* Declaration for "plugin_init" function so that it doesn't need to be
kono
parents: 67
diff changeset
99 duplicated in every plugin. */
kono
parents: 67
diff changeset
100 extern int plugin_init (struct plugin_name_args *plugin_info,
kono
parents: 67
diff changeset
101 struct plugin_gcc_version *version);
kono
parents: 67
diff changeset
102
kono
parents: 67
diff changeset
103 /* Function type for a plugin callback routine.
kono
parents: 67
diff changeset
104
kono
parents: 67
diff changeset
105 GCC_DATA - event-specific data provided by GCC
kono
parents: 67
diff changeset
106 USER_DATA - plugin-specific data provided by the plugin */
kono
parents: 67
diff changeset
107
kono
parents: 67
diff changeset
108 typedef void (*plugin_callback_func) (void *gcc_data, void *user_data);
kono
parents: 67
diff changeset
109
kono
parents: 67
diff changeset
110 /* Called from the plugin's initialization code. Register a single callback.
kono
parents: 67
diff changeset
111 This function can be called multiple times.
kono
parents: 67
diff changeset
112
kono
parents: 67
diff changeset
113 PLUGIN_NAME - display name for this plugin
kono
parents: 67
diff changeset
114 EVENT - which event the callback is for
kono
parents: 67
diff changeset
115 CALLBACK - the callback to be called at the event
kono
parents: 67
diff changeset
116 USER_DATA - plugin-provided data.
kono
parents: 67
diff changeset
117 */
kono
parents: 67
diff changeset
118
kono
parents: 67
diff changeset
119 /* Number of event ids / names registered so far. */
kono
parents: 67
diff changeset
120
kono
parents: 67
diff changeset
121 extern int get_event_last (void);
kono
parents: 67
diff changeset
122
kono
parents: 67
diff changeset
123 int get_named_event_id (const char *name, enum insert_option insert);
kono
parents: 67
diff changeset
124
kono
parents: 67
diff changeset
125 /* This is also called without a callback routine for the
kono
parents: 67
diff changeset
126 PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO and PLUGIN_REGISTER_GGC_ROOTS
kono
parents: 67
diff changeset
127 pseudo-events, with a specific user_data.
kono
parents: 67
diff changeset
128 */
kono
parents: 67
diff changeset
129
kono
parents: 67
diff changeset
130 extern void register_callback (const char *plugin_name,
kono
parents: 67
diff changeset
131 int event,
kono
parents: 67
diff changeset
132 plugin_callback_func callback,
kono
parents: 67
diff changeset
133 void *user_data);
kono
parents: 67
diff changeset
134
kono
parents: 67
diff changeset
135 extern int unregister_callback (const char *plugin_name, int event);
kono
parents: 67
diff changeset
136
kono
parents: 67
diff changeset
137
kono
parents: 67
diff changeset
138 /* Retrieve the plugin directory name, as returned by the
kono
parents: 67
diff changeset
139 -fprint-file-name=plugin argument to the gcc program, which is the
kono
parents: 67
diff changeset
140 -iplugindir program argument to cc1. */
kono
parents: 67
diff changeset
141 extern const char* default_plugin_dir_name (void);
kono
parents: 67
diff changeset
142
kono
parents: 67
diff changeset
143 #ifdef __cplusplus
kono
parents: 67
diff changeset
144 }
kono
parents: 67
diff changeset
145 #endif
kono
parents: 67
diff changeset
146
kono
parents: 67
diff changeset
147 /* In case the C++ compiler does name mangling for globals, declare
kono
parents: 67
diff changeset
148 plugin_is_GPL_compatible extern "C" so that a later definition
kono
parents: 67
diff changeset
149 in a plugin file will have this linkage. */
kono
parents: 67
diff changeset
150 #ifdef __cplusplus
kono
parents: 67
diff changeset
151 extern "C" {
kono
parents: 67
diff changeset
152 #endif
kono
parents: 67
diff changeset
153 extern int plugin_is_GPL_compatible;
kono
parents: 67
diff changeset
154 #ifdef __cplusplus
kono
parents: 67
diff changeset
155 }
kono
parents: 67
diff changeset
156 #endif
kono
parents: 67
diff changeset
157
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 struct attribute_spec;
111
kono
parents: 67
diff changeset
160 struct scoped_attributes;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 extern void add_new_plugin (const char *);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 extern void parse_plugin_arg_opt (const char *);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
164 extern int invoke_plugin_callbacks_full (int, void *);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 extern void initialize_plugins (void);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 extern bool plugins_active_p (void);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 extern void dump_active_plugins (FILE *);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 extern void debug_active_plugins (void);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
169 extern void warn_if_plugins (void);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 extern void print_plugins_versions (FILE *file, const char *indent);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 extern void print_plugins_help (FILE *file, const char *indent);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 extern void finalize_plugins (void);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
174 extern bool flag_plugin_added;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
175
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
176 /* Called from inside GCC. Invoke all plugin callbacks registered with
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
177 the specified event.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
178 Return PLUGEVT_SUCCESS if at least one callback was called,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
179 PLUGEVT_NO_CALLBACK if there was no callback.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
180
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
181 EVENT - the event identifier
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
182 GCC_DATA - event-specific data provided by the compiler */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
183
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
184 static inline int
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
185 invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
186 void *gcc_data ATTRIBUTE_UNUSED)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
187 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
188 #ifdef ENABLE_PLUGIN
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
189 /* True iff at least one plugin has been added. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
190 if (flag_plugin_added)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
191 return invoke_plugin_callbacks_full (event, gcc_data);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
192 #endif
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
193
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
194 return PLUGEVT_NO_CALLBACK;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
195 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
196
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 /* In attribs.c. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 extern void register_attribute (const struct attribute_spec *attr);
111
kono
parents: 67
diff changeset
200 extern struct scoped_attributes* register_scoped_attributes (const struct attribute_spec *,
kono
parents: 67
diff changeset
201 const char *);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 #endif /* PLUGIN_H */