]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/langhooks-def.h
2004-07-08 Joseph S. Myers <jsm@polyomino.org.uk>
[thirdparty/gcc.git] / gcc / langhooks-def.h
CommitLineData
b0278d39 1/* Default macros to initialize the lang_hooks data structure.
a8349c62 2 Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
b0278d39 3 Contributed by Alexandre Oliva <aoliva@redhat.com>
4
4642865b 5This file is part of GCC.
b0278d39 6
4642865b 7GCC is free software; you can redistribute it and/or modify
b0278d39 8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
4642865b 12GCC is distributed in the hope that it will be useful,
b0278d39 13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
4642865b 18along with GCC; see the file COPYING. If not, write to
b0278d39 19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#ifndef GCC_LANG_HOOKS_DEF_H
23#define GCC_LANG_HOOKS_DEF_H
24
dd436eaf 25#include "hooks.h"
26
6c7ff025 27struct diagnostic_context;
28
b0278d39 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. */
3ad4992f 31extern HOST_WIDE_INT hook_get_alias_set_0 (tree);
b0278d39 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
e938cdf5 38 its struct lang_hooks, AFTER including this file. */
b0278d39 39
40/* See langhooks.h for the definition and documentation of each hook. */
41
3ad4992f 42extern void lhd_do_nothing (void);
43extern void lhd_do_nothing_t (tree);
44extern void lhd_do_nothing_i (int);
45extern void lhd_do_nothing_f (struct function *);
46extern bool lhd_post_options (const char **);
47extern HOST_WIDE_INT lhd_get_alias_set (tree);
48extern tree lhd_return_tree (tree);
54bd1509 49extern tree lhd_return_null_tree_v (void);
3ad4992f 50extern tree lhd_return_null_tree (tree);
37b9a732 51extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
3ad4992f 52extern int lhd_safe_from_p (rtx, tree);
53extern int lhd_staticp (tree);
54extern int lhd_unsafe_for_reeval (tree);
55extern void lhd_clear_binding_stack (void);
56extern void lhd_print_tree_nothing (FILE *, tree, int);
57extern const char *lhd_decl_printable_name (tree, int);
4ee9c684 58extern int lhd_types_compatible_p (tree, tree);
60ffaf4d 59extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
4ee9c684 60extern int lhd_expand_decl (tree);
3ad4992f 61extern void lhd_print_error_function (struct diagnostic_context *,
62 const char *);
63extern void lhd_set_decl_assembler_name (tree);
64extern bool lhd_can_use_bit_fields_p (void);
65extern bool lhd_warn_unused_global_decl (tree);
66extern void lhd_incomplete_type_error (tree, tree);
67extern tree lhd_type_promotes_to (tree);
b268e47e 68extern void lhd_register_builtin_type (tree, const char *);
3ad4992f 69extern bool lhd_decl_ok_for_sibcall (tree);
70extern tree lhd_expr_size (tree);
a0d8c66d 71extern bool lhd_decl_uninit (tree);
264f4f30 72extern tree lhd_get_callee_fndecl (tree);
3ad4992f 73extern size_t lhd_tree_size (enum tree_code);
b0278d39 74
75/* Declarations of default tree inlining hooks. */
3ad4992f 76extern tree lhd_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
77 void *, void *);
78extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *);
79extern int lhd_tree_inlining_disregard_inline_limits (tree);
80extern tree lhd_tree_inlining_add_pending_fn_decls (void *, tree);
3ad4992f 81extern int lhd_tree_inlining_auto_var_in_fn_p (tree, tree);
82extern tree lhd_tree_inlining_copy_res_decl_for_inlining (tree, tree, tree,
83 void *, int *, tree);
84extern int lhd_tree_inlining_anon_aggr_type_p (tree);
85extern int lhd_tree_inlining_start_inlining (tree);
86extern void lhd_tree_inlining_end_inlining (tree);
f0c467da 87extern tree lhd_tree_inlining_convert_parm_for_inlining (tree, tree, tree, int);
f63da8d3 88extern void lhd_initialize_diagnostics (struct diagnostic_context *);
ec1e35b2 89extern tree lhd_callgraph_analyze_expr (tree *, int *, tree);
90
3ad4992f 91
4ee9c684 92/* Declarations for tree gimplification hooks. */
93extern int lhd_gimplify_expr (tree *, tree *, tree *);
94
d19bd1f0 95#define LANG_HOOKS_NAME "GNU unknown"
96#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
03bde601 97#define LANG_HOOKS_INIT hook_bool_void_false
b0278d39 98#define LANG_HOOKS_FINISH lhd_do_nothing
1c542e4c 99#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
b0278d39 100#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
4838a8b6 101#define LANG_HOOKS_INIT_OPTIONS hook_uint_uint_constcharptrptr_0
b6e50631 102#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
4838a8b6 103#define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constcharptr_int_0
76bf7746 104#define LANG_HOOKS_MISSING_ARGUMENT hook_bool_constcharptr_size_t_false
03bde601 105#define LANG_HOOKS_POST_OPTIONS lhd_post_options
b0278d39 106#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set
b3187c7c 107#define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree
b467ecc1 108#define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr
4ee9c684 109#define LANG_HOOKS_EXPAND_DECL lhd_expand_decl
b3187c7c 110#define LANG_HOOKS_SAFE_FROM_P lhd_safe_from_p
ee23fd7b 111#define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t
112#define LANG_HOOKS_UNSAFE_FOR_REEVAL lhd_unsafe_for_reeval
f1833f1b 113#define LANG_HOOKS_STATICP lhd_staticp
dbc42b78 114#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
1d347c23 115#define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now
04745efb 116#define LANG_HOOKS_MAYBE_BUILD_CLEANUP lhd_return_null_tree
d1f6c8f2 117#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name
d50b22af 118#define LANG_HOOKS_CAN_USE_BIT_FIELDS_P lhd_can_use_bit_fields_p
4f7f7efd 119#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS false
b0278d39 120#define LANG_HOOKS_HONOR_READONLY false
685b5cc2 121#define LANG_HOOKS_NO_BODY_BLOCKS false
b7fced5e 122#define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing
123#define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing
124#define LANG_HOOKS_PRINT_DECL lhd_print_tree_nothing
125#define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing
126#define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing
6c7ff025 127#define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
96554925 128#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
264f4f30 129#define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_tree
c3f16ae3 130#define LANG_HOOKS_EXPR_SIZE lhd_expr_size
295e387a 131#define LANG_HOOKS_TREE_SIZE lhd_tree_size
4ee9c684 132#define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p
b0cdf642 133#define LANG_HOOKS_UPDATE_DECL_AFTER_SAVING NULL
b0278d39 134
c80c4f22 135#define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f
1f3233d1 136#define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f
c80c4f22 137#define LANG_HOOKS_FUNCTION_ENTER_NESTED lhd_do_nothing_f
138#define LANG_HOOKS_FUNCTION_LEAVE_NESTED lhd_do_nothing_f
4ee9c684 139#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P hook_bool_tree_true
90e3d9ba 140
f8e93a2e 141/* Attribute hooks. */
142#define LANG_HOOKS_ATTRIBUTE_TABLE NULL
143#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE NULL
144#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL
145
b0278d39 146/* Tree inlining hooks. */
147#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
148#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
149 lhd_tree_inlining_cannot_inline_tree_fn
150#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
151 lhd_tree_inlining_disregard_inline_limits
152#define LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS \
153 lhd_tree_inlining_add_pending_fn_decls
b0278d39 154#define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
155 lhd_tree_inlining_auto_var_in_fn_p
156#define LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING \
157 lhd_tree_inlining_copy_res_decl_for_inlining
158#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
159 lhd_tree_inlining_anon_aggr_type_p
21ac3a84 160#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
1f8a6ff8 161 hook_bool_tree_tree_false
054e01a7 162#define LANG_HOOKS_TREE_INLINING_START_INLINING \
163 lhd_tree_inlining_start_inlining
164#define LANG_HOOKS_TREE_INLINING_END_INLINING \
165 lhd_tree_inlining_end_inlining
78b80426 166#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
167 lhd_tree_inlining_convert_parm_for_inlining
309c7c52 168#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
169 NULL
b0278d39 170
171#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
172 LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
173 LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
174 LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, \
175 LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS, \
b0278d39 176 LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P, \
177 LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING, \
054e01a7 178 LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P, \
21ac3a84 179 LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
054e01a7 180 LANG_HOOKS_TREE_INLINING_START_INLINING, \
78b80426 181 LANG_HOOKS_TREE_INLINING_END_INLINING, \
309c7c52 182 LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING, \
183 LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
ec1e35b2 184}
b0278d39 185
ec1e35b2 186#define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
833eb724 187#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION NULL
188
189#define LANG_HOOKS_CALLGRAPH_INITIALIZER { \
ec1e35b2 190 LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR, \
833eb724 191 LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, \
ec1e35b2 192}
833eb724 193
1f3233d1 194#define LANG_HOOKS_FUNCTION_INITIALIZER { \
195 LANG_HOOKS_FUNCTION_INIT, \
196 LANG_HOOKS_FUNCTION_FINAL, \
197 LANG_HOOKS_FUNCTION_ENTER_NESTED, \
4ee9c684 198 LANG_HOOKS_FUNCTION_LEAVE_NESTED, \
199 LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P \
c80c4f22 200}
201
4ee9c684 202/* Hooks for tree gimplification. */
203#define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
215e2f1d 204#define LANG_HOOKS_FOLD_OBJ_TYPE_REF NULL
90e3d9ba 205
3119c950 206/* Tree dump hooks. */
3ad4992f 207extern bool lhd_tree_dump_dump_tree (void *, tree);
208extern int lhd_tree_dump_type_quals (tree);
674b05f5 209extern tree lhd_make_node (enum tree_code);
3119c950 210
211#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree
212#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals
213
214#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
215 LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
216 LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
20325f61 217}
218
ee23fd7b 219/* Types hooks. There are no reasonable defaults for most of them,
220 so we create a compile-time error instead. */
674b05f5 221#define LANG_HOOKS_MAKE_TYPE lhd_make_node
1dd25100 222#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error
63c62881 223#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
b268e47e 224#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type
b225134e 225#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_tree
a26d3281 226#define LANG_HOOKS_HASH_TYPES true
a1f71e15 227
228#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
771d21fa 229 LANG_HOOKS_MAKE_TYPE, \
230 LANG_HOOKS_TYPE_FOR_MODE, \
4070745f 231 LANG_HOOKS_TYPE_FOR_SIZE, \
232 LANG_HOOKS_UNSIGNED_TYPE, \
233 LANG_HOOKS_SIGNED_TYPE, \
1dd25100 234 LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, \
63c62881 235 LANG_HOOKS_TYPE_PROMOTES_TO, \
b268e47e 236 LANG_HOOKS_REGISTER_BUILTIN_TYPE, \
a26d3281 237 LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
b225134e 238 LANG_HOOKS_TYPE_MAX_SIZE, \
a26d3281 239 LANG_HOOKS_HASH_TYPES \
a1f71e15 240}
241
20325f61 242/* Declaration hooks. */
243#define LANG_HOOKS_PUSHLEVEL pushlevel
244#define LANG_HOOKS_POPLEVEL poplevel
245#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
246#define LANG_HOOKS_INSERT_BLOCK insert_block
247#define LANG_HOOKS_SET_BLOCK set_block
248#define LANG_HOOKS_PUSHDECL pushdecl
249#define LANG_HOOKS_GETDECLS getdecls
8d58a5a7 250#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
28db4d96 251#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
8efca15a 252#define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
e2e9c55b 253#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
20325f61 254
255#define LANG_HOOKS_DECLS { \
256 LANG_HOOKS_PUSHLEVEL, \
257 LANG_HOOKS_POPLEVEL, \
258 LANG_HOOKS_GLOBAL_BINDINGS_P, \
259 LANG_HOOKS_INSERT_BLOCK, \
260 LANG_HOOKS_SET_BLOCK, \
261 LANG_HOOKS_PUSHDECL, \
8d58a5a7 262 LANG_HOOKS_GETDECLS, \
28db4d96 263 LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
e2e9c55b 264 LANG_HOOKS_WRITE_GLOBALS, \
8efca15a 265 LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
e2e9c55b 266 LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
20325f61 267}
3119c950 268
269/* The whole thing. The structure is defined in langhooks.h. */
b0278d39 270#define LANG_HOOKS_INITIALIZER { \
d19bd1f0 271 LANG_HOOKS_NAME, \
272 LANG_HOOKS_IDENTIFIER_SIZE, \
295e387a 273 LANG_HOOKS_TREE_SIZE, \
b0278d39 274 LANG_HOOKS_INIT_OPTIONS, \
b6e50631 275 LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \
5457b645 276 LANG_HOOKS_HANDLE_OPTION, \
76bf7746 277 LANG_HOOKS_MISSING_ARGUMENT, \
b0278d39 278 LANG_HOOKS_POST_OPTIONS, \
435fb09b 279 LANG_HOOKS_INIT, \
280 LANG_HOOKS_FINISH, \
b78207a0 281 LANG_HOOKS_PARSE_FILE, \
435fb09b 282 LANG_HOOKS_CLEAR_BINDING_STACK, \
b0278d39 283 LANG_HOOKS_GET_ALIAS_SET, \
b3187c7c 284 LANG_HOOKS_EXPAND_CONSTANT, \
b467ecc1 285 LANG_HOOKS_EXPAND_EXPR, \
4ee9c684 286 LANG_HOOKS_EXPAND_DECL, \
aff9e656 287 LANG_HOOKS_TRUTHVALUE_CONVERSION, \
b3187c7c 288 LANG_HOOKS_SAFE_FROM_P, \
ee23fd7b 289 LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
290 LANG_HOOKS_UNSAFE_FOR_REEVAL, \
9b86eec0 291 LANG_HOOKS_MARK_ADDRESSABLE, \
f1833f1b 292 LANG_HOOKS_STATICP, \
dbc42b78 293 LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
1d347c23 294 LANG_HOOKS_UNSAVE_EXPR_NOW, \
04745efb 295 LANG_HOOKS_MAYBE_BUILD_CLEANUP, \
d1f6c8f2 296 LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \
d50b22af 297 LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \
4f7f7efd 298 LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \
b0278d39 299 LANG_HOOKS_HONOR_READONLY, \
685b5cc2 300 LANG_HOOKS_NO_BODY_BLOCKS, \
b7fced5e 301 LANG_HOOKS_PRINT_STATISTICS, \
302 LANG_HOOKS_PRINT_XNODE, \
303 LANG_HOOKS_PRINT_DECL, \
304 LANG_HOOKS_PRINT_TYPE, \
305 LANG_HOOKS_PRINT_IDENTIFIER, \
96554925 306 LANG_HOOKS_DECL_PRINTABLE_NAME, \
4ee9c684 307 LANG_HOOKS_TYPES_COMPATIBLE_P, \
264f4f30 308 LANG_HOOKS_GET_CALLEE_FNDECL, \
6c7ff025 309 LANG_HOOKS_PRINT_ERROR_FUNCTION, \
c3f16ae3 310 LANG_HOOKS_EXPR_SIZE, \
b0cdf642 311 LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, \
f8e93a2e 312 LANG_HOOKS_ATTRIBUTE_TABLE, \
313 LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
314 LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
c80c4f22 315 LANG_HOOKS_FUNCTION_INITIALIZER, \
3119c950 316 LANG_HOOKS_TREE_INLINING_INITIALIZER, \
833eb724 317 LANG_HOOKS_CALLGRAPH_INITIALIZER, \
20325f61 318 LANG_HOOKS_TREE_DUMP_INITIALIZER, \
a1f71e15 319 LANG_HOOKS_DECLS, \
90e3d9ba 320 LANG_HOOKS_FOR_TYPES_INITIALIZER, \
4ee9c684 321 LANG_HOOKS_GIMPLIFY_EXPR, \
215e2f1d 322 LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
b0278d39 323}
324
325#endif /* GCC_LANG_HOOKS_DEF_H */