* config/arm/neon-gen.ml: Include vxWorks.h rather than stdint.h
[official-gcc.git] / gcc / gcc-plugin.h
blobe788eb731bb8f63af73edb18d61bd520d34e0c7b
1 /* Public header file for plugins to include.
2 Copyright (C) 2009 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_PLUGIN_H
21 #define GCC_PLUGIN_H
23 /* Event names. Keep in sync with plugin_event_name[]. */
24 enum plugin_event
26 PLUGIN_PASS_MANAGER_SETUP, /* To hook into pass manager. */
27 PLUGIN_FINISH_TYPE, /* After finishing parsing a type. */
28 PLUGIN_FINISH_UNIT, /* Useful for summary processing. */
29 PLUGIN_CXX_CP_PRE_GENERICIZE, /* Allows to see low level AST in C++ FE. */
30 PLUGIN_FINISH, /* Called before GCC exits. */
31 PLUGIN_INFO, /* Information about the plugin */
32 PLUGIN_ATTRIBUTES, /* Called during attribute registration. */
33 PLUGIN_EVENT_LAST /* Dummy event used for indexing callback
34 array. */
37 extern const char *plugin_event_name[];
39 struct plugin_argument
41 char *key; /* key of the argument. */
42 char *value; /* value is optional and can be NULL. */
45 enum pass_positioning_ops
47 PASS_POS_INSERT_AFTER, /* Insert after the reference pass. */
48 PASS_POS_INSERT_BEFORE, /* Insert before the reference pass. */
49 PASS_POS_REPLACE /* Replace the reference pass. */
52 struct plugin_pass
54 struct opt_pass *pass; /* New pass provided by the plugin. */
55 const char *reference_pass_name; /* Name of the reference pass for hooking
56 up the new pass. */
57 int ref_pass_instance_number; /* Insert the pass at the specified
58 instance number of the reference pass.
59 Do it for every instance if it is 0. */
60 enum pass_positioning_ops pos_op; /* how to insert the new pass. */
63 /* Additional information about the plugin. Used by --help and --version. */
65 struct plugin_info
67 const char *version;
68 const char *help;
71 /* Represents the gcc version. Used to avoid using an incompatible plugin. */
73 struct plugin_gcc_version
75 const char *basever;
76 const char *datestamp;
77 const char *devphase;
78 const char *revision;
79 const char *configuration_arguments;
82 /* Object that keeps track of the plugin name and its arguments. */
83 struct plugin_name_args
85 char *base_name; /* Short name of the plugin (filename without
86 .so suffix). */
87 const char *full_name; /* Path to the plugin as specified with
88 -fplugin=. */
89 int argc; /* Number of arguments specified with
90 -fplugin-arg-... */
91 struct plugin_argument *argv; /* Array of ARGC key-value pairs. */
92 const char *version; /* Version string provided by plugin. */
93 const char *help; /* Help string provided by plugin. */
96 /* The default version check. Compares every field in VERSION. */
98 extern bool plugin_default_version_check (struct plugin_gcc_version *,
99 struct plugin_gcc_version *);
101 /* Function type for the plugin initialization routine. Each plugin module
102 should define this as an externally-visible function with name
103 "plugin_init."
105 PLUGIN_INFO - plugin invocation information.
106 VERSION - the plugin_gcc_version symbol of GCC.
108 Returns 0 if initialization finishes successfully. */
110 typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info,
111 struct plugin_gcc_version *version);
113 /* Declaration for "plugin_init" function so that it doesn't need to be
114 duplicated in every plugin. */
115 extern int plugin_init (struct plugin_name_args *plugin_info,
116 struct plugin_gcc_version *version);
118 /* Function type for a plugin callback routine.
120 GCC_DATA - event-specific data provided by GCC
121 USER_DATA - plugin-specific data provided by the plugin */
123 typedef void (*plugin_callback_func) (void *gcc_data, void *user_data);
125 /* Called from the plugin's initialization code. Register a single callback.
126 This function can be called multiple times.
128 PLUGIN_NAME - display name for this plugin
129 EVENT - which event the callback is for
130 CALLBACK - the callback to be called at the event
131 USER_DATA - plugin-provided data */
133 extern void register_callback (const char *plugin_name,
134 enum plugin_event event,
135 plugin_callback_func callback,
136 void *user_data);
138 #endif /* GCC_PLUGIN_H */