Merge in changes from:
[official-gcc.git] / gcc / feature-internal.h
blob094c01fde8509cc7f8f942514f16b775699e54d0
1 /* Compiler-side interface to global compiler state for GCC plugins.
2 Copyright (C) 2009 Free Software Foundation, Inc.
4 Contributed by Inria.
6 Authors: Grigori Fursin <grigori.fursin@inria.fr>, Cupertino Miranda
7 <cupertinomiranda@gmail.com>, Zbigniew Chamski <zbigniew.chamski@gmail.com>.
9 This file is part of GCC.
11 GCC is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free
13 Software Foundation; either version 3, or (at your option) any later
14 version.
16 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
17 WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 for more details.
21 You should have received a copy of the GNU General Public License
22 along with GCC; see the file COPYING3. If not see
23 <http://www.gnu.org/licenses/>. */
25 #ifndef FEATURE_INTERNAL_H
26 #define FEATURE_INTERNAL_H
28 /* Compiler feature: a well-defined compiler property (config or state
29 information) that can be modified at runtime in a limited and controlled
30 fashion. */
31 struct feature {
32 const char *name; /* Feature name */
33 void *data; /* Data for a static/memoized feature */
34 long int data_size; /* size of the data - for copying etc. */
35 const void * (*callback) (void); /* Callback to dynamically extract
36 feature value */
37 const void * (*get_subfeature) (const char *name);
38 /* callback to dynamically get values of
39 subfeatures */
40 void * (*set_subfeature) (const char *name, void *value);
41 /* callback to set values of subfeatures */
44 /* Manipulation of feature directory (table) */
45 extern void register_feature (const struct feature *feature);
46 extern struct feature *find_feature (const char *feature_name);
47 extern void init_features (void);
49 /* Access to values of either features or elements of feature sets */
50 extern const void *get_feature (const char *feature_name);
51 extern const void *get_subfeature (const char *feature_name,
52 const char *subfeat_name);
53 extern void *set_subfeature (const char *feature_name,
54 const char *subfeat_name, void *value);
56 /* Extract the size of features and feature sets */
57 extern int get_feature_size (const char *feature_name);
58 extern int get_num_features (int type); /* not implemented */
59 extern int get_num_subfeatures (const char *feat_name, int type); /* not implemented */
61 /* List of all known features, or all known elements of a feature set */
62 extern const char **list_features (void);
63 extern const char **list_subfeatures (const char *feat_name, int type); /* not implemented */
65 #endif /* FEATURE_INTERNAL_H */