Mercurial > hg > CbC > CbC_gcc
comparison gcc/gcc-plugin.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | |
children | b7f97abdc517 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
1 /* Public header file for plugins to include. | |
2 Copyright (C) 2009 Free Software Foundation, Inc. | |
3 | |
4 This file is part of GCC. | |
5 | |
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. | |
10 | |
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. | |
15 | |
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/>. */ | |
19 | |
20 #ifndef GCC_PLUGIN_H | |
21 #define GCC_PLUGIN_H | |
22 | |
23 #ifndef IN_GCC | |
24 #define IN_GCC | |
25 #endif | |
26 | |
27 #include "config.h" | |
28 #include "system.h" | |
29 #include "highlev-plugin-common.h" | |
30 #include "hashtab.h" | |
31 | |
32 /* Event names. */ | |
33 enum plugin_event | |
34 { | |
35 # define DEFEVENT(NAME) NAME, | |
36 # include "plugin.def" | |
37 # undef DEFEVENT | |
38 PLUGIN_EVENT_FIRST_DYNAMIC | |
39 }; | |
40 | |
41 extern const char **plugin_event_name; | |
42 | |
43 struct plugin_argument | |
44 { | |
45 char *key; /* key of the argument. */ | |
46 char *value; /* value is optional and can be NULL. */ | |
47 }; | |
48 | |
49 /* Additional information about the plugin. Used by --help and --version. */ | |
50 | |
51 struct plugin_info | |
52 { | |
53 const char *version; | |
54 const char *help; | |
55 }; | |
56 | |
57 /* Represents the gcc version. Used to avoid using an incompatible plugin. */ | |
58 | |
59 struct plugin_gcc_version | |
60 { | |
61 const char *basever; | |
62 const char *datestamp; | |
63 const char *devphase; | |
64 const char *revision; | |
65 const char *configuration_arguments; | |
66 }; | |
67 | |
68 /* Object that keeps track of the plugin name and its arguments. */ | |
69 struct plugin_name_args | |
70 { | |
71 char *base_name; /* Short name of the plugin (filename without | |
72 .so suffix). */ | |
73 const char *full_name; /* Path to the plugin as specified with | |
74 -fplugin=. */ | |
75 int argc; /* Number of arguments specified with | |
76 -fplugin-arg-... */ | |
77 struct plugin_argument *argv; /* Array of ARGC key-value pairs. */ | |
78 const char *version; /* Version string provided by plugin. */ | |
79 const char *help; /* Help string provided by plugin. */ | |
80 }; | |
81 | |
82 /* The default version check. Compares every field in VERSION. */ | |
83 | |
84 extern bool plugin_default_version_check (struct plugin_gcc_version *, | |
85 struct plugin_gcc_version *); | |
86 | |
87 /* Function type for the plugin initialization routine. Each plugin module | |
88 should define this as an externally-visible function with name | |
89 "plugin_init." | |
90 | |
91 PLUGIN_INFO - plugin invocation information. | |
92 VERSION - the plugin_gcc_version symbol of GCC. | |
93 | |
94 Returns 0 if initialization finishes successfully. */ | |
95 | |
96 typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, | |
97 struct plugin_gcc_version *version); | |
98 | |
99 /* Declaration for "plugin_init" function so that it doesn't need to be | |
100 duplicated in every plugin. */ | |
101 extern int plugin_init (struct plugin_name_args *plugin_info, | |
102 struct plugin_gcc_version *version); | |
103 | |
104 /* Function type for a plugin callback routine. | |
105 | |
106 GCC_DATA - event-specific data provided by GCC | |
107 USER_DATA - plugin-specific data provided by the plugin */ | |
108 | |
109 typedef void (*plugin_callback_func) (void *gcc_data, void *user_data); | |
110 | |
111 /* Called from the plugin's initialization code. Register a single callback. | |
112 This function can be called multiple times. | |
113 | |
114 PLUGIN_NAME - display name for this plugin | |
115 EVENT - which event the callback is for | |
116 CALLBACK - the callback to be called at the event | |
117 USER_DATA - plugin-provided data. | |
118 */ | |
119 | |
120 /* Number of event ids / names registered so far. */ | |
121 | |
122 extern int get_event_last (void); | |
123 | |
124 int get_named_event_id (const char *name, enum insert_option insert); | |
125 | |
126 /* This is also called without a callback routine for the | |
127 PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO, PLUGIN_REGISTER_GGC_ROOTS and | |
128 PLUGIN_REGISTER_GGC_CACHES pseudo-events, with a specific user_data. | |
129 */ | |
130 | |
131 extern void register_callback (const char *plugin_name, | |
132 int event, | |
133 plugin_callback_func callback, | |
134 void *user_data); | |
135 | |
136 extern int unregister_callback (const char *plugin_name, int event); | |
137 | |
138 #endif /* GCC_PLUGIN_H */ |