1 /* Default macros to initialize the lang_hooks data structure.
2    Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3    Contributed by Alexandre Oliva  <aoliva@redhat.com>
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.  */
21 
22 #ifndef GCC_LANG_HOOKS_DEF_H
23 #define GCC_LANG_HOOKS_DEF_H
24 
25 #include "hooks.h"
26 
27 struct diagnostic_context;
28 
29 /* Provide a hook routine for alias sets that always returns 1.  This is
30    used by languages that haven't deal with alias sets yet.  */
31 extern HOST_WIDE_INT hook_get_alias_set_0 (tree);
32 
33 /* Note to creators of new hooks:
34 
35    The macros in this file should NOT be surrounded by a
36    #ifdef...#endif pair, since this file declares the defaults.  Each
37    front end overrides any hooks it wishes to, in the file containing
38    its struct lang_hooks, AFTER including this file.  */
39 
40 /* See langhooks.h for the definition and documentation of each hook.  */
41 
42 extern void lhd_do_nothing (void);
43 extern void lhd_do_nothing_t (tree);
44 extern void lhd_do_nothing_i (int);
45 extern void lhd_do_nothing_f (struct function *);
46 extern bool lhd_post_options (const char **);
47 extern HOST_WIDE_INT lhd_get_alias_set (tree);
48 extern tree lhd_return_tree (tree);
49 extern tree lhd_return_null_tree_v (void);
50 extern tree lhd_return_null_tree (tree);
51 extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
52 extern int lhd_safe_from_p (rtx, tree);
53 extern tree lhd_staticp (tree);
54 extern void lhd_print_tree_nothing (FILE *, tree, int);
55 extern const char *lhd_decl_printable_name (tree, int);
56 extern int lhd_types_compatible_p (tree, tree);
57 extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
58 extern int lhd_expand_decl (tree);
59 extern void lhd_print_error_function (struct diagnostic_context *,
60 				      const char *);
61 extern void lhd_set_decl_assembler_name (tree);
62 extern bool lhd_can_use_bit_fields_p (void);
63 extern bool lhd_warn_unused_global_decl (tree);
64 extern void lhd_incomplete_type_error (tree, tree);
65 extern tree lhd_type_promotes_to (tree);
66 extern void lhd_register_builtin_type (tree, const char *);
67 extern bool lhd_decl_ok_for_sibcall (tree);
68 extern const char *lhd_comdat_group (tree);
69 extern tree lhd_expr_size (tree);
70 extern size_t lhd_tree_size (enum tree_code);
71 extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
72 extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
73 
74 /* Declarations of default tree inlining hooks.  */
75 extern tree lhd_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
76 					     void *, struct pointer_set_t*);
77 extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *);
78 extern int lhd_tree_inlining_disregard_inline_limits (tree);
79 extern tree lhd_tree_inlining_add_pending_fn_decls (void *, tree);
80 extern int lhd_tree_inlining_auto_var_in_fn_p (tree, tree);
81 extern int lhd_tree_inlining_anon_aggr_type_p (tree);
82 extern int lhd_tree_inlining_start_inlining (tree);
83 extern void lhd_tree_inlining_end_inlining (tree);
84 extern tree lhd_tree_inlining_convert_parm_for_inlining (tree, tree, tree, int);
85 extern void lhd_initialize_diagnostics (struct diagnostic_context *);
86 extern tree lhd_callgraph_analyze_expr (tree *, int *, tree);
87 
88 
89 /* Declarations for tree gimplification hooks.  */
90 extern int lhd_gimplify_expr (tree *, tree *, tree *);
91 
92 #define LANG_HOOKS_NAME			"GNU unknown"
93 #define LANG_HOOKS_IDENTIFIER_SIZE	sizeof (struct lang_identifier)
94 #define LANG_HOOKS_INIT			hook_bool_void_false
95 #define LANG_HOOKS_FINISH		lhd_do_nothing
96 #define LANG_HOOKS_PARSE_FILE		lhd_do_nothing_i
97 #define LANG_HOOKS_CLEAR_BINDING_STACK	lhd_do_nothing
98 #define LANG_HOOKS_INIT_OPTIONS		hook_uint_uint_constcharptrptr_0
99 #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
100 #define LANG_HOOKS_HANDLE_OPTION	hook_int_size_t_constcharptr_int_0
101 #define LANG_HOOKS_MISSING_ARGUMENT	hook_bool_constcharptr_size_t_false
102 #define LANG_HOOKS_POST_OPTIONS		lhd_post_options
103 #define LANG_HOOKS_GET_ALIAS_SET	lhd_get_alias_set
104 #define LANG_HOOKS_EXPAND_CONSTANT	lhd_return_tree
105 #define LANG_HOOKS_EXPAND_EXPR		lhd_expand_expr
106 #define LANG_HOOKS_EXPAND_DECL		lhd_expand_decl
107 #define LANG_HOOKS_SAFE_FROM_P		lhd_safe_from_p
108 #define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t
109 #define LANG_HOOKS_STATICP		lhd_staticp
110 #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES lhd_do_nothing_t
111 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
112 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name
113 #define LANG_HOOKS_CAN_USE_BIT_FIELDS_P lhd_can_use_bit_fields_p
114 #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS false
115 #define LANG_HOOKS_NO_BODY_BLOCKS	false
116 #define LANG_HOOKS_PRINT_STATISTICS	lhd_do_nothing
117 #define LANG_HOOKS_PRINT_XNODE		lhd_print_tree_nothing
118 #define LANG_HOOKS_PRINT_DECL		lhd_print_tree_nothing
119 #define LANG_HOOKS_PRINT_TYPE		lhd_print_tree_nothing
120 #define LANG_HOOKS_PRINT_IDENTIFIER	lhd_print_tree_nothing
121 #define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
122 #define LANG_HOOKS_DECL_PRINTABLE_NAME	lhd_decl_printable_name
123 #define LANG_HOOKS_GET_CALLEE_FNDECL	lhd_return_null_tree
124 #define LANG_HOOKS_EXPR_SIZE		lhd_expr_size
125 #define LANG_HOOKS_TREE_SIZE		lhd_tree_size
126 #define LANG_HOOKS_TYPES_COMPATIBLE_P	lhd_types_compatible_p
127 #define LANG_HOOKS_BUILTIN_FUNCTION	builtin_function
128 #define LANG_HOOKS_EXPR_TO_DECL		lhd_expr_to_decl
129 #define LANG_HOOKS_TO_TARGET_CHARSET	lhd_to_target_charset
130 #define LANG_HOOKS_INIT_TS		lhd_do_nothing
131 
132 #define LANG_HOOKS_FUNCTION_INIT	lhd_do_nothing_f
133 #define LANG_HOOKS_FUNCTION_FINAL	lhd_do_nothing_f
134 #define LANG_HOOKS_FUNCTION_ENTER_NESTED lhd_do_nothing_f
135 #define LANG_HOOKS_FUNCTION_LEAVE_NESTED lhd_do_nothing_f
136 #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P hook_bool_tree_true
137 
138 /* Attribute hooks.  */
139 #define LANG_HOOKS_ATTRIBUTE_TABLE		NULL
140 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE	NULL
141 #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE	NULL
142 
143 /* Tree inlining hooks.  */
144 #define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
145 #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
146   lhd_tree_inlining_cannot_inline_tree_fn
147 #define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
148   lhd_tree_inlining_disregard_inline_limits
149 #define LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS \
150   lhd_tree_inlining_add_pending_fn_decls
151 #define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
152   lhd_tree_inlining_auto_var_in_fn_p
153 #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
154   lhd_tree_inlining_anon_aggr_type_p
155 #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
156   hook_bool_tree_tree_false
157 #define LANG_HOOKS_TREE_INLINING_START_INLINING \
158   lhd_tree_inlining_start_inlining
159 #define LANG_HOOKS_TREE_INLINING_END_INLINING \
160   lhd_tree_inlining_end_inlining
161 #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
162   lhd_tree_inlining_convert_parm_for_inlining
163 
164 #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
165   LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
166   LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
167   LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, \
168   LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS, \
169   LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P, \
170   LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P, \
171   LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
172   LANG_HOOKS_TREE_INLINING_START_INLINING, \
173   LANG_HOOKS_TREE_INLINING_END_INLINING, \
174   LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
175 }
176 
177 #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
178 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION NULL
179 
180 #define LANG_HOOKS_CALLGRAPH_INITIALIZER { \
181   LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR, \
182   LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, \
183 }
184 
185 #define LANG_HOOKS_FUNCTION_INITIALIZER {	\
186   LANG_HOOKS_FUNCTION_INIT,			\
187   LANG_HOOKS_FUNCTION_FINAL,			\
188   LANG_HOOKS_FUNCTION_ENTER_NESTED,		\
189   LANG_HOOKS_FUNCTION_LEAVE_NESTED,		\
190   LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P	\
191 }
192 
193 /* Hooks for tree gimplification.  */
194 #define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
195 #define LANG_HOOKS_FOLD_OBJ_TYPE_REF NULL
196 
197 /* Tree dump hooks.  */
198 extern bool lhd_tree_dump_dump_tree (void *, tree);
199 extern int lhd_tree_dump_type_quals (tree);
200 extern tree lhd_make_node (enum tree_code);
201 
202 #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree
203 #define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals
204 
205 #define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
206   LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
207   LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
208 }
209 
210 /* Types hooks.  There are no reasonable defaults for most of them,
211    so we create a compile-time error instead.  */
212 #define LANG_HOOKS_MAKE_TYPE lhd_make_node
213 #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error
214 #define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
215 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type
216 #define LANG_HOOKS_TYPE_MAX_SIZE	lhd_return_null_tree
217 #define LANG_HOOKS_HASH_TYPES		true
218 
219 #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
220   LANG_HOOKS_MAKE_TYPE, \
221   LANG_HOOKS_TYPE_FOR_MODE, \
222   LANG_HOOKS_TYPE_FOR_SIZE, \
223   LANG_HOOKS_UNSIGNED_TYPE, \
224   LANG_HOOKS_SIGNED_TYPE, \
225   LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, \
226   LANG_HOOKS_TYPE_PROMOTES_TO, \
227   LANG_HOOKS_REGISTER_BUILTIN_TYPE, \
228   LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
229   LANG_HOOKS_TYPE_MAX_SIZE, \
230   LANG_HOOKS_HASH_TYPES \
231 }
232 
233 /* Declaration hooks.  */
234 #define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
235 #define LANG_HOOKS_INSERT_BLOCK	insert_block
236 #define LANG_HOOKS_PUSHDECL	pushdecl
237 #define LANG_HOOKS_GETDECLS	getdecls
238 #define LANG_HOOKS_LOOKUP_NAME	lhd_return_null_tree
239 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
240 #define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
241 #define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
242 #define LANG_HOOKS_DECL_OK_FOR_SIBCALL	lhd_decl_ok_for_sibcall
243 #define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
244 
245 #define LANG_HOOKS_DECLS { \
246   LANG_HOOKS_GLOBAL_BINDINGS_P, \
247   LANG_HOOKS_INSERT_BLOCK, \
248   LANG_HOOKS_PUSHDECL, \
249   LANG_HOOKS_GETDECLS, \
250   LANG_HOOKS_LOOKUP_NAME, \
251   LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
252   LANG_HOOKS_WRITE_GLOBALS, \
253   LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
254   LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
255   LANG_HOOKS_COMDAT_GROUP \
256 }
257 
258 /* The whole thing.  The structure is defined in langhooks.h.  */
259 #define LANG_HOOKS_INITIALIZER { \
260   LANG_HOOKS_NAME, \
261   LANG_HOOKS_IDENTIFIER_SIZE, \
262   LANG_HOOKS_TREE_SIZE, \
263   LANG_HOOKS_INIT_OPTIONS, \
264   LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \
265   LANG_HOOKS_HANDLE_OPTION, \
266   LANG_HOOKS_MISSING_ARGUMENT, \
267   LANG_HOOKS_POST_OPTIONS, \
268   LANG_HOOKS_INIT, \
269   LANG_HOOKS_FINISH, \
270   LANG_HOOKS_PARSE_FILE, \
271   LANG_HOOKS_CLEAR_BINDING_STACK, \
272   LANG_HOOKS_GET_ALIAS_SET, \
273   LANG_HOOKS_EXPAND_CONSTANT, \
274   LANG_HOOKS_EXPAND_EXPR, \
275   LANG_HOOKS_EXPAND_DECL, \
276   LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES, \
277   LANG_HOOKS_SAFE_FROM_P, \
278   LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
279   LANG_HOOKS_MARK_ADDRESSABLE, \
280   LANG_HOOKS_STATICP, \
281   LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
282   LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
283   LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \
284   LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \
285   LANG_HOOKS_NO_BODY_BLOCKS, \
286   LANG_HOOKS_PRINT_STATISTICS, \
287   LANG_HOOKS_PRINT_XNODE, \
288   LANG_HOOKS_PRINT_DECL, \
289   LANG_HOOKS_PRINT_TYPE, \
290   LANG_HOOKS_PRINT_IDENTIFIER, \
291   LANG_HOOKS_DECL_PRINTABLE_NAME, \
292   LANG_HOOKS_TYPES_COMPATIBLE_P, \
293   LANG_HOOKS_GET_CALLEE_FNDECL, \
294   LANG_HOOKS_PRINT_ERROR_FUNCTION, \
295   LANG_HOOKS_EXPR_SIZE, \
296   LANG_HOOKS_TO_TARGET_CHARSET, \
297   LANG_HOOKS_ATTRIBUTE_TABLE, \
298   LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
299   LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
300   LANG_HOOKS_FUNCTION_INITIALIZER, \
301   LANG_HOOKS_TREE_INLINING_INITIALIZER, \
302   LANG_HOOKS_CALLGRAPH_INITIALIZER, \
303   LANG_HOOKS_TREE_DUMP_INITIALIZER, \
304   LANG_HOOKS_DECLS, \
305   LANG_HOOKS_FOR_TYPES_INITIALIZER, \
306   LANG_HOOKS_GIMPLIFY_EXPR, \
307   LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
308   LANG_HOOKS_BUILTIN_FUNCTION, \
309   LANG_HOOKS_INIT_TS,          \
310   LANG_HOOKS_EXPR_TO_DECL, \
311 }
312 
313 #endif /* GCC_LANG_HOOKS_DEF_H */
314