* config/msp430/msp430.c (msp430_asm_integer): Support addition
[official-gcc.git] / gcc / gcc-plugin.h
blob5fbc46cc2e19c08ac23669287ee904ac8ea6fe30
1 /* Public header file for plugins to include.
2 Copyright (C) 2009-2015 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 #ifndef IN_GCC
24 #define IN_GCC
25 #endif
27 #include "config.h"
28 #include "system.h"
29 #include "coretypes.h"
30 #include "highlev-plugin-common.h"
31 #include "tm.h"
32 #include "hashtab.h"
33 #include "hash-set.h"
34 #include "vec.h"
35 #include "hard-reg-set.h"
36 #include "input.h"
37 #include "function.h"
38 #include "predict.h"
39 #include "dominance.h"
40 #include "cfg.h"
41 #include "cfgrtl.h"
42 #include "cfganal.h"
43 #include "lcm.h"
44 #include "cfgbuild.h"
45 #include "cfgcleanup.h"
46 #include "hash-map.h"
47 #include "is-a.h"
48 #include "plugin-api.h"
49 #include "ipa-ref.h"
50 #include "statistics.h"
51 #include "alias.h"
52 #include "flags.h"
53 #include "symtab.h"
54 #include "tree-core.h"
55 #include "hash-set.h"
56 #include "inchash.h"
57 #include "fold-const.h"
58 #include "tree-check.h"
60 /* Event names. */
61 enum plugin_event
63 # define DEFEVENT(NAME) NAME,
64 # include "plugin.def"
65 # undef DEFEVENT
66 PLUGIN_EVENT_FIRST_DYNAMIC
69 /* All globals declared here have C linkage to reduce link compatibility
70 issues with implementation language choice and mangling. */
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
75 extern const char **plugin_event_name;
77 struct plugin_argument
79 char *key; /* key of the argument. */
80 char *value; /* value is optional and can be NULL. */
83 /* Additional information about the plugin. Used by --help and --version. */
85 struct plugin_info
87 const char *version;
88 const char *help;
91 /* Represents the gcc version. Used to avoid using an incompatible plugin. */
93 struct plugin_gcc_version
95 const char *basever;
96 const char *datestamp;
97 const char *devphase;
98 const char *revision;
99 const char *configuration_arguments;
102 /* Object that keeps track of the plugin name and its arguments. */
103 struct plugin_name_args
105 char *base_name; /* Short name of the plugin (filename without
106 .so suffix). */
107 const char *full_name; /* Path to the plugin as specified with
108 -fplugin=. */
109 int argc; /* Number of arguments specified with
110 -fplugin-arg-... */
111 struct plugin_argument *argv; /* Array of ARGC key-value pairs. */
112 const char *version; /* Version string provided by plugin. */
113 const char *help; /* Help string provided by plugin. */
116 /* The default version check. Compares every field in VERSION. */
118 extern bool plugin_default_version_check (struct plugin_gcc_version *,
119 struct plugin_gcc_version *);
121 /* Function type for the plugin initialization routine. Each plugin module
122 should define this as an externally-visible function with name
123 "plugin_init."
125 PLUGIN_INFO - plugin invocation information.
126 VERSION - the plugin_gcc_version symbol of GCC.
128 Returns 0 if initialization finishes successfully. */
130 typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info,
131 struct plugin_gcc_version *version);
133 /* Declaration for "plugin_init" function so that it doesn't need to be
134 duplicated in every plugin. */
135 extern int plugin_init (struct plugin_name_args *plugin_info,
136 struct plugin_gcc_version *version);
138 /* Function type for a plugin callback routine.
140 GCC_DATA - event-specific data provided by GCC
141 USER_DATA - plugin-specific data provided by the plugin */
143 typedef void (*plugin_callback_func) (void *gcc_data, void *user_data);
145 /* Called from the plugin's initialization code. Register a single callback.
146 This function can be called multiple times.
148 PLUGIN_NAME - display name for this plugin
149 EVENT - which event the callback is for
150 CALLBACK - the callback to be called at the event
151 USER_DATA - plugin-provided data.
154 /* Number of event ids / names registered so far. */
156 extern int get_event_last (void);
158 int get_named_event_id (const char *name, enum insert_option insert);
160 /* This is also called without a callback routine for the
161 PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO and PLUGIN_REGISTER_GGC_ROOTS
162 pseudo-events, with a specific user_data.
165 extern void register_callback (const char *plugin_name,
166 int event,
167 plugin_callback_func callback,
168 void *user_data);
170 extern int unregister_callback (const char *plugin_name, int event);
173 /* Retrieve the plugin directory name, as returned by the
174 -fprint-file-name=plugin argument to the gcc program, which is the
175 -iplugindir program argument to cc1. */
176 extern const char* default_plugin_dir_name (void);
178 #ifdef __cplusplus
180 #endif
182 /* In case the C++ compiler does name mangling for globals, declare
183 plugin_is_GPL_compatible extern "C" so that a later definition
184 in a plugin file will have this linkage. */
185 #ifdef __cplusplus
186 extern "C" {
187 #endif
188 extern int plugin_is_GPL_compatible;
189 #ifdef __cplusplus
191 #endif
193 #endif /* GCC_PLUGIN_H */