]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gcc-plugin.h
[AArch64] Temporarily remove aarch64_gimple_fold_builtin code for reduction operations
[thirdparty/gcc.git] / gcc / gcc-plugin.h
CommitLineData
9227b6fc 1/* Public header file for plugins to include.
3aea1f79 2 Copyright (C) 2009-2014 Free Software Foundation, Inc.
9227b6fc 3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_PLUGIN_H
21#define GCC_PLUGIN_H
22
a0b14cdf 23#ifndef IN_GCC
24#define IN_GCC
25#endif
26
27#include "config.h"
28#include "system.h"
8d212a8f 29#include "coretypes.h"
c9036234 30#include "highlev-plugin-common.h"
eebf1fd9 31#include "tm.h"
c9036234 32#include "hashtab.h"
eebf1fd9 33#include "hash-set.h"
34#include "vec.h"
35#include "machmode.h"
36#include "hard-reg-set.h"
37#include "input.h"
a0b14cdf 38
c9036234 39/* Event names. */
9227b6fc 40enum plugin_event
41{
c9036234 42# define DEFEVENT(NAME) NAME,
43# include "plugin.def"
44# undef DEFEVENT
45 PLUGIN_EVENT_FIRST_DYNAMIC
9227b6fc 46};
47
2fbcc452 48/* All globals declared here have C linkage to reduce link compatibility
49 issues with implementation language choice and mangling. */
50#ifdef __cplusplus
51extern "C" {
52#endif
53
c9036234 54extern const char **plugin_event_name;
9227b6fc 55
56struct plugin_argument
57{
58 char *key; /* key of the argument. */
59 char *value; /* value is optional and can be NULL. */
60};
61
e16288b4 62/* Additional information about the plugin. Used by --help and --version. */
63
64struct plugin_info
65{
66 const char *version;
2dfeb300 67 const char *help;
e16288b4 68};
69
c80cefd7 70/* Represents the gcc version. Used to avoid using an incompatible plugin. */
71
72struct plugin_gcc_version
73{
74 const char *basever;
75 const char *datestamp;
76 const char *devphase;
77 const char *revision;
78 const char *configuration_arguments;
79};
80
0b3a031a 81/* Object that keeps track of the plugin name and its arguments. */
82struct plugin_name_args
83{
84 char *base_name; /* Short name of the plugin (filename without
85 .so suffix). */
86 const char *full_name; /* Path to the plugin as specified with
87 -fplugin=. */
88 int argc; /* Number of arguments specified with
89 -fplugin-arg-... */
90 struct plugin_argument *argv; /* Array of ARGC key-value pairs. */
91 const char *version; /* Version string provided by plugin. */
92 const char *help; /* Help string provided by plugin. */
93};
94
c80cefd7 95/* The default version check. Compares every field in VERSION. */
96
e8ad34e4 97extern bool plugin_default_version_check (struct plugin_gcc_version *,
98 struct plugin_gcc_version *);
c80cefd7 99
9227b6fc 100/* Function type for the plugin initialization routine. Each plugin module
101 should define this as an externally-visible function with name
102 "plugin_init."
103
0b3a031a 104 PLUGIN_INFO - plugin invocation information.
105 VERSION - the plugin_gcc_version symbol of GCC.
9227b6fc 106
107 Returns 0 if initialization finishes successfully. */
108
0b3a031a 109typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info,
110 struct plugin_gcc_version *version);
9227b6fc 111
112/* Declaration for "plugin_init" function so that it doesn't need to be
113 duplicated in every plugin. */
0b3a031a 114extern int plugin_init (struct plugin_name_args *plugin_info,
115 struct plugin_gcc_version *version);
9227b6fc 116
117/* Function type for a plugin callback routine.
118
119 GCC_DATA - event-specific data provided by GCC
120 USER_DATA - plugin-specific data provided by the plugin */
121
122typedef void (*plugin_callback_func) (void *gcc_data, void *user_data);
123
124/* Called from the plugin's initialization code. Register a single callback.
125 This function can be called multiple times.
126
127 PLUGIN_NAME - display name for this plugin
128 EVENT - which event the callback is for
129 CALLBACK - the callback to be called at the event
740cd0be 130 USER_DATA - plugin-provided data.
131*/
132
c9036234 133/* Number of event ids / names registered so far. */
134
135extern int get_event_last (void);
136
137int get_named_event_id (const char *name, enum insert_option insert);
138
740cd0be 139/* This is also called without a callback routine for the
86b63696 140 PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO, PLUGIN_REGISTER_GGC_ROOTS and
141 PLUGIN_REGISTER_GGC_CACHES pseudo-events, with a specific user_data.
740cd0be 142 */
9227b6fc 143
144extern void register_callback (const char *plugin_name,
c9036234 145 int event,
9227b6fc 146 plugin_callback_func callback,
147 void *user_data);
148
c9036234 149extern int unregister_callback (const char *plugin_name, int event);
150
19bc000d 151
152/* Retrieve the plugin directory name, as returned by the
153 -fprint-file-name=plugin argument to the gcc program, which is the
154 -iplugindir program argument to cc1. */
155extern const char* default_plugin_dir_name (void);
156
2fbcc452 157#ifdef __cplusplus
158}
159#endif
160
74b0726c 161/* In case the C++ compiler does name mangling for globals, declare
162 plugin_is_GPL_compatible extern "C" so that a later definition
163 in a plugin file will have this linkage. */
164#ifdef __cplusplus
165extern "C" {
166#endif
167extern int plugin_is_GPL_compatible;
168#ifdef __cplusplus
169}
170#endif
171
9227b6fc 172#endif /* GCC_PLUGIN_H */