]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/langhooks.h
* libjava.jni/jni.exp (gcj_jni_build_header): Use local_exec, not
[thirdparty/gcc.git] / gcc / langhooks.h
CommitLineData
b0278d39 1/* The lang_hooks data structure.
e8602e56 2 Copyright 2001 Free Software Foundation, Inc.
e8602e56 3
4This file is part of GNU CC.
5
6GNU CC 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 2, or (at your option)
9any later version.
10
11GNU CC 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 GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21#ifndef GCC_LANG_HOOKS_H
22#define GCC_LANG_HOOKS_H
23
b7fced5e 24/* A print hook for print_tree (). */
25typedef void (*lang_print_tree_hook) PARAMS ((FILE *, tree, int indent));
26
b0278d39 27/* The following hooks are documented in langhooks.c. Must not be
28 NULL. */
29
30struct lang_hooks_for_tree_inlining
31{
32 union tree_node *(*walk_subtrees) PARAMS ((union tree_node **, int *,
33 union tree_node *(*)
34 (union tree_node **,
35 int *, void *),
36 void *, void *));
37 int (*cannot_inline_tree_fn) PARAMS ((union tree_node **));
38 int (*disregard_inline_limits) PARAMS ((union tree_node *));
39 union tree_node *(*add_pending_fn_decls) PARAMS ((void *,
40 union tree_node *));
41 int (*tree_chain_matters_p) PARAMS ((union tree_node *));
42 int (*auto_var_in_fn_p) PARAMS ((union tree_node *, union tree_node *));
43 union tree_node *(*copy_res_decl_for_inlining) PARAMS ((union tree_node *,
44 union tree_node *,
45 union tree_node *,
46 void *, int *,
47 void *));
48 int (*anon_aggr_type_p) PARAMS ((union tree_node *));
054e01a7 49 int (*start_inlining) PARAMS ((union tree_node *));
50 void (*end_inlining) PARAMS ((union tree_node *));
b0278d39 51};
52
3119c950 53/* The following hooks are used by tree-dump.c. */
54
55struct lang_hooks_for_tree_dump
56{
57 /* Dump language-specific parts of tree nodes. Returns non-zero if it
58 does not want the usual dumping of the second argument. */
59 int (*dump_tree) PARAMS ((void *, tree));
60
61 /* Determine type qualifiers in a language-specific way. */
62 int (*type_quals) PARAMS ((tree));
63};
64
b0278d39 65/* Language-specific hooks. See langhooks-def.h for defaults. */
66
67struct lang_hooks
68{
d19bd1f0 69 /* String identifying the front end. e.g. "GNU C++". */
70 const char *name;
71
72 /* sizeof (struct lang_identifier), so make_node () creates
73 identifier nodes long enough for the language-specific slots. */
74 size_t identifier_size;
75
435fb09b 76 /* The first callback made to the front end, for simple
77 initialization needed before any calls to decode_option. */
b0278d39 78 void (*init_options) PARAMS ((void));
79
80 /* Function called with an option vector as argument, to decode a
81 single option (typically starting with -f or -W or +). It should
82 return the number of command-line arguments it uses if it handles
83 the option, or 0 and not complain if it does not recognise the
84 option. If this function returns a negative number, then its
85 absolute value is the number of command-line arguments used, but,
86 in addition, no language-independent option processing should be
87 done for this option. */
88 int (*decode_option) PARAMS ((int, char **));
89
435fb09b 90 /* Called when all command line options have been parsed. Should do
91 any required consistency checks, modifications etc. Complex
92 initialization should be left to the "init" callback, since GC
93 and the identifier hashes are set up between now and then. */
b0278d39 94 void (*post_options) PARAMS ((void));
95
435fb09b 96 /* Called after post_options, to initialize the front end. The main
97 input filename is passed, which may be NULL; the front end should
98 return the original filename (e.g. foo.i -> foo.c). Return NULL
99 to indicate a serious error of some sort; in that case no
100 compilation is performed, and the finish hook is called
101 immediately. */
102 const char * (*init) PARAMS ((const char *));
103
104 /* Called at the end of compilation, as a finalizer. */
105 void (*finish) PARAMS ((void));
106
107 /* Called immediately after parsing to clear the binding stack. */
108 void (*clear_binding_stack) PARAMS ((void));
109
b0278d39 110 /* Called to obtain the alias set to be used for an expression or type.
111 Returns -1 if the language does nothing special for it. */
112 HOST_WIDE_INT (*get_alias_set) PARAMS ((tree));
113
b3187c7c 114 /* Called with an expression that is to be processed as a constant.
115 Returns either the same expression or a language-independent
116 constant equivalent to its input. */
117 tree (*expand_constant) PARAMS ((tree));
118
119 /* Hook called by safe_from_p for language-specific tree codes. It is
120 up to the language front-end to install a hook if it has any such
121 codes that safe_from_p needs to know about. Since same_from_p will
122 recursively explore the TREE_OPERANDs of an expression, this hook
123 should not reexamine those pieces. This routine may recursively
124 call safe_from_p; it should always pass `0' as the TOP_P
125 parameter. */
126 int (*safe_from_p) PARAMS ((rtx, tree));
127
f1833f1b 128 /* Hook called by staticp for language-specific tree codes. */
129 int (*staticp) PARAMS ((tree));
130
dbc42b78 131 /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
132 DECL_NODE with a newly GC-allocated copy. */
133 void (*dup_lang_specific_decl) PARAMS ((tree));
134
1d347c23 135 /* Called before its argument, an UNSAVE_EXPR, is to be
136 unsaved. Modify it in-place so that all the evaluate only once
137 things are cleared out. */
138 tree (*unsave_expr_now) PARAMS ((tree));
139
b0278d39 140 /* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */
141 bool honor_readonly;
142
b7fced5e 143 /* The front end can add its own statistics to -fmem-report with
144 this hook. It should output to stderr. */
145 void (*print_statistics) PARAMS ((void));
146
147 /* Called by print_tree when there is a tree of class 'x' that it
148 doesn't know how to display. */
149 lang_print_tree_hook print_xnode;
150
151 /* Called to print language-dependent parts of a class 'd', class
152 't', and IDENTIFIER_NODE nodes. */
153 lang_print_tree_hook print_decl;
154 lang_print_tree_hook print_type;
155 lang_print_tree_hook print_identifier;
156
157 /* Set yydebug for bison-based parsers, when -dy is given on the
158 command line. By default, if the parameter is non-zero, prints a
159 warning that the front end does not use such a parser. */
160 void (*set_yydebug) PARAMS ((int));
161
b0278d39 162 struct lang_hooks_for_tree_inlining tree_inlining;
3119c950 163
164 struct lang_hooks_for_tree_dump tree_dump;
b0278d39 165
3119c950 166 /* Whenever you add entries here, make sure you adjust langhooks-def.h
b0278d39 167 and langhooks.c accordingly. */
168};
169
170/* Each front end provides its own. */
d19bd1f0 171extern const struct lang_hooks lang_hooks;
e8602e56 172
173#endif /* GCC_LANG_HOOKS_H */