comparison gcc/langhooks.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 a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* The lang_hooks data structure. 1 /* The lang_hooks data structure.
2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 2 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
47 struct lang_hooks_for_callgraph 47 struct lang_hooks_for_callgraph
48 { 48 {
49 /* The node passed is a language-specific tree node. If its contents 49 /* The node passed is a language-specific tree node. If its contents
50 are relevant to use of other declarations, mark them. */ 50 are relevant to use of other declarations, mark them. */
51 tree (*analyze_expr) (tree *, int *); 51 tree (*analyze_expr) (tree *, int *);
52
53 /* Emit thunks associated to function. */
54 void (*emit_associated_thunks) (tree);
55 }; 52 };
56 53
57 /* The following hooks are used by tree-dump.c. */ 54 /* The following hooks are used by tree-dump.c. */
58 55
59 struct lang_hooks_for_tree_dump 56 struct lang_hooks_for_tree_dump
88 tree (*type_for_size) (unsigned, int); 85 tree (*type_for_size) (unsigned, int);
89 86
90 /* True if the type is an instantiation of a generic type, 87 /* True if the type is an instantiation of a generic type,
91 e.g. C++ template implicit specializations. */ 88 e.g. C++ template implicit specializations. */
92 bool (*generic_p) (const_tree); 89 bool (*generic_p) (const_tree);
90
91 /* Returns the TREE_VEC of elements of a given generic argument pack. */
92 tree (*get_argument_pack_elems) (const_tree);
93 93
94 /* Given a type, apply default promotions to unnamed function 94 /* Given a type, apply default promotions to unnamed function
95 arguments and return the new type. Return the same type if no 95 arguments and return the new type. Return the same type if no
96 change. Required by any language that supports variadic 96 change. Required by any language that supports variadic
97 arguments. The default hook dies. */ 97 arguments. The default hook dies. */
128 128
129 /* Return TRUE if TYPE uses a hidden descriptor and fills in information 129 /* Return TRUE if TYPE uses a hidden descriptor and fills in information
130 for the debugger about the array bounds, strides, etc. */ 130 for the debugger about the array bounds, strides, etc. */
131 bool (*get_array_descr_info) (const_tree, struct array_descr_info *); 131 bool (*get_array_descr_info) (const_tree, struct array_descr_info *);
132 132
133 /* Fill in information for the debugger about the bounds of TYPE. */
134 void (*get_subrange_bounds) (const_tree, tree *, tree *);
135
133 /* If we requested a pointer to a vector, build up the pointers that 136 /* If we requested a pointer to a vector, build up the pointers that
134 we stripped off while looking for the inner type. Similarly for 137 we stripped off while looking for the inner type. Similarly for
135 return values from functions. The argument TYPE is the top of the 138 return values from functions. The argument TYPE is the top of the
136 chain, and BOTTOM is the new type which we will point to. */ 139 chain, and BOTTOM is the new type which we will point to. */
137 tree (*reconstruct_complex_type) (tree, tree); 140 tree (*reconstruct_complex_type) (tree, tree);
157 tree (*pushdecl) (tree); 160 tree (*pushdecl) (tree);
158 161
159 /* Returns the chain of decls so far in the current scope level. */ 162 /* Returns the chain of decls so far in the current scope level. */
160 tree (*getdecls) (void); 163 tree (*getdecls) (void);
161 164
165 /* Returns true if DECL is explicit member function. */
166 bool (*function_decl_explicit_p) (tree);
167
168 /* Returns True if the parameter is a generic parameter decl
169 of a generic type, e.g a template template parameter for the C++ FE. */
170 bool (*generic_generic_parameter_decl_p) (const_tree);
171
172 /* Determine if a function parameter got expanded from a
173 function parameter pack. */
174 bool (*function_parm_expanded_from_pack_p) (tree, tree);
175
176 /* Returns the generic declaration of a generic function instantiations. */
177 tree (*get_generic_function_decl) (const_tree);
178
162 /* Returns true when we should warn for an unused global DECL. 179 /* Returns true when we should warn for an unused global DECL.
163 We will already have checked that it has static binding. */ 180 We will already have checked that it has static binding. */
164 bool (*warn_unused_global) (const_tree); 181 bool (*warn_unused_global) (const_tree);
165 182
166 /* Obtain a list of globals and do final output on them at end 183 /* Obtain a list of globals and do final output on them at end
167 of compilation */ 184 of compilation */
168 void (*final_write_globals) (void); 185 void (*final_write_globals) (void);
169 186
170 /* True if this decl may be called via a sibcall. */ 187 /* True if this decl may be called via a sibcall. */
171 bool (*ok_for_sibcall) (const_tree); 188 bool (*ok_for_sibcall) (const_tree);
172
173 /* Return the COMDAT group into which this DECL should be placed.
174 It is known that the DECL belongs in *some* COMDAT group when
175 this hook is called. The return value will be used immediately,
176 but not explicitly deallocated, so implementations should not use
177 xmalloc to allocate the string returned. (Typically, the return
178 value will be the string already stored in an
179 IDENTIFIER_NODE.) */
180 const char * (*comdat_group) (tree);
181 189
182 /* True if OpenMP should privatize what this DECL points to rather 190 /* True if OpenMP should privatize what this DECL points to rather
183 than the DECL itself. */ 191 than the DECL itself. */
184 bool (*omp_privatize_by_reference) (const_tree); 192 bool (*omp_privatize_by_reference) (const_tree);
185 193
218 226
219 /* Do language specific checking on an implicitly determined clause. */ 227 /* Do language specific checking on an implicitly determined clause. */
220 void (*omp_finish_clause) (tree clause); 228 void (*omp_finish_clause) (tree clause);
221 }; 229 };
222 230
231 /* Language hooks related to LTO serialization. */
232
233 struct lang_hooks_for_lto
234 {
235 /* Begin a new LTO section named NAME. */
236 void (*begin_section) (const char *name);
237
238 /* Write DATA of length LEN to the currently open LTO section. BLOCK is a
239 pointer to the dynamically allocated memory containing DATA. The
240 append_data function is responsible for freeing it when it is no longer
241 needed. */
242 void (*append_data) (const void *data, size_t len, void *block);
243
244 /* End the previously begun LTO section. */
245 void (*end_section) (void);
246 };
247
223 /* Language-specific hooks. See langhooks-def.h for defaults. */ 248 /* Language-specific hooks. See langhooks-def.h for defaults. */
224 249
225 struct lang_hooks 250 struct lang_hooks
226 { 251 {
227 /* String identifying the front end. e.g. "GNU C++". */ 252 /* String identifying the front end. e.g. "GNU C++". */
228 const char *name; 253 const char *name;
229 254
230 /* sizeof (struct lang_identifier), so make_node () creates 255 /* sizeof (struct lang_identifier), so make_node () creates
231 identifier nodes long enough for the language-specific slots. */ 256 identifier nodes long enough for the language-specific slots. */
232 size_t identifier_size; 257 size_t identifier_size;
258
259 /* Remove any parts of the tree that are used only by the FE. */
260 void (*free_lang_data) (tree);
233 261
234 /* Determines the size of any language-specific tcc_constant or 262 /* Determines the size of any language-specific tcc_constant or
235 tcc_exceptional nodes. Since it is called from make_node, the 263 tcc_exceptional nodes. Since it is called from make_node, the
236 only information available is the tree code. Expected to die 264 only information available is the tree code. Expected to die
237 on unrecognized codes. */ 265 on unrecognized codes. */
288 316
289 /* Called to obtain the alias set to be used for an expression or type. 317 /* Called to obtain the alias set to be used for an expression or type.
290 Returns -1 if the language does nothing special for it. */ 318 Returns -1 if the language does nothing special for it. */
291 alias_set_type (*get_alias_set) (tree); 319 alias_set_type (*get_alias_set) (tree);
292 320
293 /* Called by expand_expr for language-specific tree codes.
294 Fourth argument is actually an enum expand_modifier. */
295 rtx (*expand_expr) (tree, rtx, enum machine_mode, int, rtx *);
296
297 /* Function to finish handling an incomplete decl at the end of 321 /* Function to finish handling an incomplete decl at the end of
298 compilation. Default hook is does nothing. */ 322 compilation. Default hook is does nothing. */
299 void (*finish_incomplete_decl) (tree); 323 void (*finish_incomplete_decl) (tree);
300
301 /* Mark EXP saying that we need to be able to take the address of
302 it; it should not be allocated in a register. Return true if
303 successful. */
304 bool (*mark_addressable) (tree);
305
306 /* Hook called by staticp for language-specific tree codes. */
307 tree (*staticp) (tree);
308 324
309 /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the 325 /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
310 DECL_NODE with a newly GC-allocated copy. */ 326 DECL_NODE with a newly GC-allocated copy. */
311 void (*dup_lang_specific_decl) (tree); 327 void (*dup_lang_specific_decl) (tree);
312 328
334 /* Computes the name to use to print a declaration. DECL is the 350 /* Computes the name to use to print a declaration. DECL is the
335 non-NULL declaration in question. VERBOSITY determines what 351 non-NULL declaration in question. VERBOSITY determines what
336 information will be printed: 0: DECL_NAME, demangled as 352 information will be printed: 0: DECL_NAME, demangled as
337 necessary. 1: and scope information. 2: and any other 353 necessary. 1: and scope information. 2: and any other
338 information that might be interesting, such as function parameter 354 information that might be interesting, such as function parameter
339 types in C++. */ 355 types in C++. The name is in the internal character set and
356 needs to be converted to the locale character set of diagnostics,
357 or to the execution character set for strings such as
358 __PRETTY_FUNCTION__. */
340 const char *(*decl_printable_name) (tree decl, int verbosity); 359 const char *(*decl_printable_name) (tree decl, int verbosity);
341 360
342 /* Computes the dwarf-2/3 name for a tree. VERBOSITY determines what 361 /* Computes the dwarf-2/3 name for a tree. VERBOSITY determines what
343 information will be printed: 0: DECL_NAME, demangled as 362 information will be printed: 0: DECL_NAME, demangled as
344 necessary. 1: and scope information. */ 363 necessary. 1: and scope information. */
350 int (*types_compatible_p) (tree x, tree y); 369 int (*types_compatible_p) (tree x, tree y);
351 370
352 /* Called by report_error_function to print out function name. */ 371 /* Called by report_error_function to print out function name. */
353 void (*print_error_function) (struct diagnostic_context *, const char *, 372 void (*print_error_function) (struct diagnostic_context *, const char *,
354 struct diagnostic_info *); 373 struct diagnostic_info *);
355
356 /* Called from expr_size to calculate the size of the value of an
357 expression in a language-dependent way. Returns a tree for the size
358 in bytes. A frontend can call lhd_expr_size to get the default
359 semantics in cases that it doesn't want to handle specially. */
360 tree (*expr_size) (const_tree);
361 374
362 /* Convert a character from the host's to the target's character 375 /* Convert a character from the host's to the target's character
363 set. The character should be in what C calls the "basic source 376 set. The character should be in what C calls the "basic source
364 character set" (roughly, the set of characters defined by plain 377 character set" (roughly, the set of characters defined by plain
365 old ASCII). The default is to return the character unchanged, 378 old ASCII). The default is to return the character unchanged,
385 398
386 struct lang_hooks_for_decls decls; 399 struct lang_hooks_for_decls decls;
387 400
388 struct lang_hooks_for_types types; 401 struct lang_hooks_for_types types;
389 402
403 struct lang_hooks_for_lto lto;
404
405 /* Returns the generic parameters of an instantiation of
406 a generic type or decl, e.g. C++ template instantiation. */
407 tree (*get_innermost_generic_parms) (const_tree);
408
409 /* Returns the TREE_VEC of arguments of an instantiation
410 of a generic type of decl, e.g. C++ template instantiation. */
411 tree (*get_innermost_generic_args) (const_tree);
412
413 /* Determine if a tree is a function parameter pack. */
414 bool (*function_parameter_pack_p) (const_tree);
415
390 /* Perform language-specific gimplification on the argument. Returns an 416 /* Perform language-specific gimplification on the argument. Returns an
391 enum gimplify_status, though we can't see that type here. */ 417 enum gimplify_status, though we can't see that type here. */
392 int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *); 418 int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *);
393 419
394 /* Fold an OBJ_TYPE_REF expression to the address of a function. 420 /* Fold an OBJ_TYPE_REF expression to the address of a function.
412 /* Called by recompute_tree_invariant_for_addr_expr to go from EXPR 438 /* Called by recompute_tree_invariant_for_addr_expr to go from EXPR
413 to a contained expression or DECL, possibly updating *TC or *SE 439 to a contained expression or DECL, possibly updating *TC or *SE
414 if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating. */ 440 if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating. */
415 tree (*expr_to_decl) (tree expr, bool *tc, bool *se); 441 tree (*expr_to_decl) (tree expr, bool *tc, bool *se);
416 442
443 /* The EH personality function decl. */
444 tree (*eh_personality) (void);
445
446 /* Map a type to a runtime object to match type. */
447 tree (*eh_runtime_type) (tree);
448
449 /* True if this language uses __cxa_end_cleanup when the ARM EABI
450 is enabled. */
451 bool eh_use_cxa_end_cleanup;
452
417 /* Whenever you add entries here, make sure you adjust langhooks-def.h 453 /* Whenever you add entries here, make sure you adjust langhooks-def.h
418 and langhooks.c accordingly. */ 454 and langhooks.c accordingly. */
419 }; 455 };
420 456
421 /* Each front end provides its own. */ 457 /* Each front end provides its own. */
422 extern const struct lang_hooks lang_hooks; 458 extern struct lang_hooks lang_hooks;
423 extern tree add_builtin_function (const char *name, tree type, 459 extern tree add_builtin_function (const char *name, tree type,
424 int function_code, enum built_in_class cl, 460 int function_code, enum built_in_class cl,
425 const char *library_name, 461 const char *library_name,
426 tree attrs); 462 tree attrs);
427 463