xref: /dflybsd-src/contrib/gcc-4.7/gcc/langhooks.h (revision 81fc95a5293ee307c688a350a3feb4734aaddbb4)
1e4b17023SJohn Marino /* The lang_hooks data structure.
2e4b17023SJohn Marino    Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3e4b17023SJohn Marino    2011 Free Software Foundation, Inc.
4e4b17023SJohn Marino 
5e4b17023SJohn Marino This file is part of GCC.
6e4b17023SJohn Marino 
7e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify
8e4b17023SJohn Marino it under the terms of the GNU General Public License as published by
9e4b17023SJohn Marino the Free Software Foundation; either version 3, or (at your option)
10e4b17023SJohn Marino any later version.
11e4b17023SJohn Marino 
12e4b17023SJohn Marino GCC is distributed in the hope that it will be useful,
13e4b17023SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
14e4b17023SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15e4b17023SJohn Marino GNU General Public License for more details.
16e4b17023SJohn Marino 
17e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
19e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
20e4b17023SJohn Marino 
21e4b17023SJohn Marino #ifndef GCC_LANG_HOOKS_H
22e4b17023SJohn Marino #define GCC_LANG_HOOKS_H
23e4b17023SJohn Marino 
24e4b17023SJohn Marino /* This file should be #include-d after tree.h.  */
25e4b17023SJohn Marino 
26e4b17023SJohn Marino struct diagnostic_info;
27e4b17023SJohn Marino 
28e4b17023SJohn Marino struct gimplify_omp_ctx;
29e4b17023SJohn Marino 
30e4b17023SJohn Marino struct array_descr_info;
31e4b17023SJohn Marino 
32e4b17023SJohn Marino /* A print hook for print_tree ().  */
33e4b17023SJohn Marino typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
34e4b17023SJohn Marino 
35e4b17023SJohn Marino enum classify_record
36e4b17023SJohn Marino   { RECORD_IS_STRUCT, RECORD_IS_CLASS, RECORD_IS_INTERFACE };
37e4b17023SJohn Marino 
38e4b17023SJohn Marino /* The following hooks are documented in langhooks.c.  Must not be
39e4b17023SJohn Marino    NULL.  */
40e4b17023SJohn Marino 
41e4b17023SJohn Marino struct lang_hooks_for_tree_inlining
42e4b17023SJohn Marino {
43e4b17023SJohn Marino   bool (*var_mod_type_p) (tree, tree);
44e4b17023SJohn Marino };
45e4b17023SJohn Marino 
46e4b17023SJohn Marino struct lang_hooks_for_callgraph
47e4b17023SJohn Marino {
48e4b17023SJohn Marino   /* The node passed is a language-specific tree node.  If its contents
49e4b17023SJohn Marino      are relevant to use of other declarations, mark them.  */
50e4b17023SJohn Marino   tree (*analyze_expr) (tree *, int *);
51e4b17023SJohn Marino };
52e4b17023SJohn Marino 
53e4b17023SJohn Marino /* The following hooks are used by tree-dump.c.  */
54e4b17023SJohn Marino 
55e4b17023SJohn Marino struct lang_hooks_for_tree_dump
56e4b17023SJohn Marino {
57e4b17023SJohn Marino   /* Dump language-specific parts of tree nodes.  Returns nonzero if it
58e4b17023SJohn Marino      does not want the usual dumping of the second argument.  */
59e4b17023SJohn Marino   bool (*dump_tree) (void *, tree);
60e4b17023SJohn Marino 
61e4b17023SJohn Marino   /* Determine type qualifiers in a language-specific way.  */
62e4b17023SJohn Marino   int (*type_quals) (const_tree);
63e4b17023SJohn Marino };
64e4b17023SJohn Marino 
65e4b17023SJohn Marino /* Hooks related to types.  */
66e4b17023SJohn Marino 
67e4b17023SJohn Marino struct lang_hooks_for_types
68e4b17023SJohn Marino {
69e4b17023SJohn Marino   /* Return a new type (with the indicated CODE), doing whatever
70e4b17023SJohn Marino      language-specific processing is required.  */
71e4b17023SJohn Marino   tree (*make_type) (enum tree_code);
72e4b17023SJohn Marino 
73e4b17023SJohn Marino   /* Return what kind of RECORD_TYPE this is, mainly for purposes of
74e4b17023SJohn Marino      debug information.  If not defined, record types are assumed to
75e4b17023SJohn Marino      be structures.  */
76e4b17023SJohn Marino   enum classify_record (*classify_record) (tree);
77e4b17023SJohn Marino 
78e4b17023SJohn Marino   /* Given MODE and UNSIGNEDP, return a suitable type-tree with that
79e4b17023SJohn Marino      mode.  */
80e4b17023SJohn Marino   tree (*type_for_mode) (enum machine_mode, int);
81e4b17023SJohn Marino 
82e4b17023SJohn Marino   /* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an
83e4b17023SJohn Marino      integer type with at least that precision.  */
84e4b17023SJohn Marino   tree (*type_for_size) (unsigned, int);
85e4b17023SJohn Marino 
86e4b17023SJohn Marino   /* True if the type is an instantiation of a generic type,
87e4b17023SJohn Marino      e.g. C++ template implicit specializations.  */
88e4b17023SJohn Marino   bool (*generic_p) (const_tree);
89e4b17023SJohn Marino 
90e4b17023SJohn Marino   /* Returns the TREE_VEC of elements of a given generic argument pack.  */
91e4b17023SJohn Marino   tree (*get_argument_pack_elems) (const_tree);
92e4b17023SJohn Marino 
93e4b17023SJohn Marino   /* Given a type, apply default promotions to unnamed function
94e4b17023SJohn Marino      arguments and return the new type.  Return the same type if no
95e4b17023SJohn Marino      change.  Required by any language that supports variadic
96e4b17023SJohn Marino      arguments.  The default hook dies.  */
97e4b17023SJohn Marino   tree (*type_promotes_to) (tree);
98e4b17023SJohn Marino 
99e4b17023SJohn Marino   /* Register TYPE as a builtin type with the indicated NAME.  The
100e4b17023SJohn Marino      TYPE is placed in the outermost lexical scope.  The semantics
101e4b17023SJohn Marino      should be analogous to:
102e4b17023SJohn Marino 
103e4b17023SJohn Marino        typedef TYPE NAME;
104e4b17023SJohn Marino 
105e4b17023SJohn Marino      in C.  The default hook ignores the declaration.  */
106e4b17023SJohn Marino   void (*register_builtin_type) (tree, const char *);
107e4b17023SJohn Marino 
108e4b17023SJohn Marino   /* This routine is called in tree.c to print an error message for
109e4b17023SJohn Marino      invalid use of an incomplete type.  VALUE is the expression that
110e4b17023SJohn Marino      was used (or 0 if that isn't known) and TYPE is the type that was
111e4b17023SJohn Marino      invalid.  */
112e4b17023SJohn Marino   void (*incomplete_type_error) (const_tree value, const_tree type);
113e4b17023SJohn Marino 
114e4b17023SJohn Marino   /* Called from assign_temp to return the maximum size, if there is one,
115e4b17023SJohn Marino      for a type.  */
116e4b17023SJohn Marino   tree (*max_size) (const_tree);
117e4b17023SJohn Marino 
118e4b17023SJohn Marino   /* Register language specific type size variables as potentially OpenMP
119e4b17023SJohn Marino      firstprivate variables.  */
120e4b17023SJohn Marino   void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree);
121e4b17023SJohn Marino 
122e4b17023SJohn Marino   /* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
123e4b17023SJohn Marino      Called only after doing all language independent checks.
124e4b17023SJohn Marino      At present, this function is only called when both TYPE1 and TYPE2 are
125e4b17023SJohn Marino      FUNCTION_TYPEs.  */
126e4b17023SJohn Marino   bool (*type_hash_eq) (const_tree, const_tree);
127e4b17023SJohn Marino 
128e4b17023SJohn Marino   /* Return TRUE if TYPE uses a hidden descriptor and fills in information
129e4b17023SJohn Marino      for the debugger about the array bounds, strides, etc.  */
130e4b17023SJohn Marino   bool (*get_array_descr_info) (const_tree, struct array_descr_info *);
131e4b17023SJohn Marino 
132e4b17023SJohn Marino   /* Fill in information for the debugger about the bounds of TYPE.  */
133e4b17023SJohn Marino   void (*get_subrange_bounds) (const_tree, tree *, tree *);
134e4b17023SJohn Marino 
135e4b17023SJohn Marino   /* A type descriptive of TYPE's complex layout generated to help the
136e4b17023SJohn Marino      debugger to decode variable-length or self-referential constructs.
137e4b17023SJohn Marino      This is only used for the AT_GNAT_descriptive_type DWARF attribute.  */
138e4b17023SJohn Marino   tree (*descriptive_type) (const_tree);
139e4b17023SJohn Marino 
140e4b17023SJohn Marino   /* If we requested a pointer to a vector, build up the pointers that
141e4b17023SJohn Marino      we stripped off while looking for the inner type.  Similarly for
142e4b17023SJohn Marino      return values from functions.  The argument TYPE is the top of the
143e4b17023SJohn Marino      chain, and BOTTOM is the new type which we will point to.  */
144e4b17023SJohn Marino   tree (*reconstruct_complex_type) (tree, tree);
145e4b17023SJohn Marino };
146e4b17023SJohn Marino 
147e4b17023SJohn Marino /* Language hooks related to decls and the symbol table.  */
148e4b17023SJohn Marino 
149e4b17023SJohn Marino struct lang_hooks_for_decls
150e4b17023SJohn Marino {
151e4b17023SJohn Marino   /* Return true if we are in the global binding level.  This hook is really
152e4b17023SJohn Marino      needed only if the language supports variable-sized types at the global
153e4b17023SJohn Marino      level, i.e. declared outside subprograms.  */
154e4b17023SJohn Marino   bool (*global_bindings_p) (void);
155e4b17023SJohn Marino 
156e4b17023SJohn Marino   /* Function to add a decl to the current scope level.  Takes one
157e4b17023SJohn Marino      argument, a decl to add.  Returns that decl, or, if the same
158e4b17023SJohn Marino      symbol is already declared, may return a different decl for that
159e4b17023SJohn Marino      name.  */
160e4b17023SJohn Marino   tree (*pushdecl) (tree);
161e4b17023SJohn Marino 
162e4b17023SJohn Marino   /* Returns the chain of decls so far in the current scope level.  */
163e4b17023SJohn Marino   tree (*getdecls) (void);
164e4b17023SJohn Marino 
165e4b17023SJohn Marino   /* Returns true if DECL is explicit member function.  */
166e4b17023SJohn Marino   bool (*function_decl_explicit_p) (tree);
167e4b17023SJohn Marino 
168e4b17023SJohn Marino   /* Returns True if the parameter is a generic parameter decl
169e4b17023SJohn Marino      of a generic type, e.g a template template parameter for the C++ FE.  */
170e4b17023SJohn Marino   bool (*generic_generic_parameter_decl_p) (const_tree);
171e4b17023SJohn Marino 
172e4b17023SJohn Marino   /* Determine if a function parameter got expanded from a
173e4b17023SJohn Marino      function parameter pack.  */
174e4b17023SJohn Marino   bool (*function_parm_expanded_from_pack_p) (tree, tree);
175e4b17023SJohn Marino 
176e4b17023SJohn Marino   /* Returns the generic declaration of a generic function instantiations.  */
177e4b17023SJohn Marino   tree (*get_generic_function_decl) (const_tree);
178e4b17023SJohn Marino 
179e4b17023SJohn Marino   /* Returns true when we should warn for an unused global DECL.
180e4b17023SJohn Marino      We will already have checked that it has static binding.  */
181e4b17023SJohn Marino   bool (*warn_unused_global) (const_tree);
182e4b17023SJohn Marino 
183e4b17023SJohn Marino   /* Obtain a list of globals and do final output on them at end
184e4b17023SJohn Marino      of compilation */
185e4b17023SJohn Marino   void (*final_write_globals) (void);
186e4b17023SJohn Marino 
187e4b17023SJohn Marino   /* True if this decl may be called via a sibcall.  */
188e4b17023SJohn Marino   bool (*ok_for_sibcall) (const_tree);
189e4b17023SJohn Marino 
190e4b17023SJohn Marino   /* True if OpenMP should privatize what this DECL points to rather
191e4b17023SJohn Marino      than the DECL itself.  */
192e4b17023SJohn Marino   bool (*omp_privatize_by_reference) (const_tree);
193e4b17023SJohn Marino 
194e4b17023SJohn Marino   /* Return sharing kind if OpenMP sharing attribute of DECL is
195e4b17023SJohn Marino      predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise.  */
196e4b17023SJohn Marino   enum omp_clause_default_kind (*omp_predetermined_sharing) (tree);
197e4b17023SJohn Marino 
198e4b17023SJohn Marino   /* Return decl that should be reported for DEFAULT(NONE) failure
199e4b17023SJohn Marino      diagnostics.  Usually the DECL passed in.  */
200e4b17023SJohn Marino   tree (*omp_report_decl) (tree);
201e4b17023SJohn Marino 
202e4b17023SJohn Marino   /* Return true if DECL's DECL_VALUE_EXPR (if any) should be
203e4b17023SJohn Marino      disregarded in OpenMP construct, because it is going to be
204e4b17023SJohn Marino      remapped during OpenMP lowering.  SHARED is true if DECL
205e4b17023SJohn Marino      is going to be shared, false if it is going to be privatized.  */
206e4b17023SJohn Marino   bool (*omp_disregard_value_expr) (tree, bool);
207e4b17023SJohn Marino 
208e4b17023SJohn Marino   /* Return true if DECL that is shared iff SHARED is true should
209e4b17023SJohn Marino      be put into OMP_CLAUSE_PRIVATE_DEBUG.  */
210e4b17023SJohn Marino   bool (*omp_private_debug_clause) (tree, bool);
211e4b17023SJohn Marino 
212e4b17023SJohn Marino   /* Return true if DECL in private clause needs
213e4b17023SJohn Marino      OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause.  */
214e4b17023SJohn Marino   bool (*omp_private_outer_ref) (tree);
215e4b17023SJohn Marino 
216e4b17023SJohn Marino   /* Build and return code for a default constructor for DECL in
217e4b17023SJohn Marino      response to CLAUSE.  OUTER is corresponding outer region's
218e4b17023SJohn Marino      variable if needed.  Return NULL if nothing to be done.  */
219e4b17023SJohn Marino   tree (*omp_clause_default_ctor) (tree clause, tree decl, tree outer);
220e4b17023SJohn Marino 
221e4b17023SJohn Marino   /* Build and return code for a copy constructor from SRC to DST.  */
222e4b17023SJohn Marino   tree (*omp_clause_copy_ctor) (tree clause, tree dst, tree src);
223e4b17023SJohn Marino 
224e4b17023SJohn Marino   /* Similarly, except use an assignment operator instead.  */
225e4b17023SJohn Marino   tree (*omp_clause_assign_op) (tree clause, tree dst, tree src);
226e4b17023SJohn Marino 
227e4b17023SJohn Marino   /* Build and return code destructing DECL.  Return NULL if nothing
228e4b17023SJohn Marino      to be done.  */
229e4b17023SJohn Marino   tree (*omp_clause_dtor) (tree clause, tree decl);
230e4b17023SJohn Marino 
231e4b17023SJohn Marino   /* Do language specific checking on an implicitly determined clause.  */
232e4b17023SJohn Marino   void (*omp_finish_clause) (tree clause);
233e4b17023SJohn Marino };
234e4b17023SJohn Marino 
235e4b17023SJohn Marino /* Language hooks related to LTO serialization.  */
236e4b17023SJohn Marino 
237e4b17023SJohn Marino struct lang_hooks_for_lto
238e4b17023SJohn Marino {
239e4b17023SJohn Marino   /* Begin a new LTO section named NAME.  */
240e4b17023SJohn Marino   void (*begin_section) (const char *name);
241e4b17023SJohn Marino 
242e4b17023SJohn Marino   /* Write DATA of length LEN to the currently open LTO section.  BLOCK is a
243e4b17023SJohn Marino      pointer to the dynamically allocated memory containing DATA.  The
244e4b17023SJohn Marino      append_data function is responsible for freeing it when it is no longer
245e4b17023SJohn Marino      needed.  */
246e4b17023SJohn Marino   void (*append_data) (const void *data, size_t len, void *block);
247e4b17023SJohn Marino 
248e4b17023SJohn Marino   /* End the previously begun LTO section.  */
249e4b17023SJohn Marino   void (*end_section) (void);
250e4b17023SJohn Marino };
251e4b17023SJohn Marino 
252e4b17023SJohn Marino /* Language-specific hooks.  See langhooks-def.h for defaults.  */
253e4b17023SJohn Marino 
254e4b17023SJohn Marino struct lang_hooks
255e4b17023SJohn Marino {
256e4b17023SJohn Marino   /* String identifying the front end.  e.g. "GNU C++".  */
257e4b17023SJohn Marino   const char *name;
258e4b17023SJohn Marino 
259e4b17023SJohn Marino   /* sizeof (struct lang_identifier), so make_node () creates
260e4b17023SJohn Marino      identifier nodes long enough for the language-specific slots.  */
261e4b17023SJohn Marino   size_t identifier_size;
262e4b17023SJohn Marino 
263e4b17023SJohn Marino   /* Remove any parts of the tree that are used only by the FE. */
264e4b17023SJohn Marino   void (*free_lang_data) (tree);
265e4b17023SJohn Marino 
266e4b17023SJohn Marino   /* Determines the size of any language-specific tcc_constant or
267e4b17023SJohn Marino      tcc_exceptional nodes.  Since it is called from make_node, the
268e4b17023SJohn Marino      only information available is the tree code.  Expected to die
269e4b17023SJohn Marino      on unrecognized codes.  */
270e4b17023SJohn Marino   size_t (*tree_size) (enum tree_code);
271e4b17023SJohn Marino 
272e4b17023SJohn Marino   /* Return the language mask used for converting argv into a sequence
273e4b17023SJohn Marino      of options.  */
274e4b17023SJohn Marino   unsigned int (*option_lang_mask) (void);
275e4b17023SJohn Marino 
276e4b17023SJohn Marino   /* Initialize variables in an options structure.  */
277e4b17023SJohn Marino   void (*init_options_struct) (struct gcc_options *opts);
278e4b17023SJohn Marino 
279e4b17023SJohn Marino   /* After the initialize_diagnostics hook is called, do any simple
280e4b17023SJohn Marino      initialization needed before any calls to handle_option, other
281e4b17023SJohn Marino      than that done by the init_options_struct hook.  */
282e4b17023SJohn Marino   void (*init_options) (unsigned int decoded_options_count,
283e4b17023SJohn Marino 			struct cl_decoded_option *decoded_options);
284e4b17023SJohn Marino 
285e4b17023SJohn Marino   /* Callback used to perform language-specific initialization for the
286e4b17023SJohn Marino      global diagnostic context structure.  */
287e4b17023SJohn Marino   void (*initialize_diagnostics) (diagnostic_context *);
288e4b17023SJohn Marino 
289e4b17023SJohn Marino   /* Return true if a warning should be given about option OPTION,
290e4b17023SJohn Marino      which is for the wrong language, false if it should be quietly
291e4b17023SJohn Marino      ignored.  */
292e4b17023SJohn Marino   bool (*complain_wrong_lang_p) (const struct cl_option *option);
293e4b17023SJohn Marino 
294e4b17023SJohn Marino   /* Handle the switch CODE, which has real type enum opt_code from
295e4b17023SJohn Marino      options.h.  If the switch takes an argument, it is passed in ARG
296e4b17023SJohn Marino      which points to permanent storage.  The handler is responsible for
297e4b17023SJohn Marino      checking whether ARG is NULL, which indicates that no argument
298e4b17023SJohn Marino      was in fact supplied.  For -f and -W switches, VALUE is 1 or 0
299e4b17023SJohn Marino      for the positive and negative forms respectively.  HANDLERS should
300e4b17023SJohn Marino      be passed to any recursive handle_option calls.  LOC is the
301e4b17023SJohn Marino      location of the option.
302e4b17023SJohn Marino 
303e4b17023SJohn Marino      Return true if the switch is valid, false if invalid.  */
304e4b17023SJohn Marino   bool (*handle_option) (size_t code, const char *arg, int value, int kind,
305e4b17023SJohn Marino 			 location_t loc,
306e4b17023SJohn Marino 			 const struct cl_option_handlers *handlers);
307e4b17023SJohn Marino 
308e4b17023SJohn Marino   /* Called when all command line options have been parsed to allow
309e4b17023SJohn Marino      further processing and initialization
310e4b17023SJohn Marino 
311e4b17023SJohn Marino      Should return true to indicate that a compiler back-end is
312e4b17023SJohn Marino      not required, such as with the -E option.
313e4b17023SJohn Marino 
314e4b17023SJohn Marino      If errorcount is nonzero after this call the compiler exits
315e4b17023SJohn Marino      immediately and the finish hook is not called.  */
316e4b17023SJohn Marino   bool (*post_options) (const char **);
317e4b17023SJohn Marino 
318e4b17023SJohn Marino   /* Called after post_options to initialize the front end.  Return
319e4b17023SJohn Marino      false to indicate that no further compilation be performed, in
320e4b17023SJohn Marino      which case the finish hook is called immediately.  */
321e4b17023SJohn Marino   bool (*init) (void);
322e4b17023SJohn Marino 
323e4b17023SJohn Marino   /* Called at the end of compilation, as a finalizer.  */
324e4b17023SJohn Marino   void (*finish) (void);
325e4b17023SJohn Marino 
326e4b17023SJohn Marino   /* Parses the entire file.  */
327e4b17023SJohn Marino   void (*parse_file) (void);
328e4b17023SJohn Marino 
329e4b17023SJohn Marino   /* Determines if it's ok for a function to have no noreturn attribute.  */
330e4b17023SJohn Marino   bool (*missing_noreturn_ok_p) (tree);
331e4b17023SJohn Marino 
332e4b17023SJohn Marino   /* Called to obtain the alias set to be used for an expression or type.
333e4b17023SJohn Marino      Returns -1 if the language does nothing special for it.  */
334e4b17023SJohn Marino   alias_set_type (*get_alias_set) (tree);
335e4b17023SJohn Marino 
336e4b17023SJohn Marino   /* Function to finish handling an incomplete decl at the end of
337e4b17023SJohn Marino      compilation.  Default hook is does nothing.  */
338e4b17023SJohn Marino   void (*finish_incomplete_decl) (tree);
339e4b17023SJohn Marino 
340e4b17023SJohn Marino   /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
341e4b17023SJohn Marino      DECL_NODE with a newly GC-allocated copy.  */
342e4b17023SJohn Marino   void (*dup_lang_specific_decl) (tree);
343e4b17023SJohn Marino 
344e4b17023SJohn Marino   /* Set the DECL_ASSEMBLER_NAME for a node.  If it is the sort of
345e4b17023SJohn Marino      thing that the assembler should talk about, set
346e4b17023SJohn Marino      DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE.
347e4b17023SJohn Marino      Otherwise, set it to the ERROR_MARK_NODE to ensure that the
348e4b17023SJohn Marino      assembler does not talk about it.  */
349e4b17023SJohn Marino   void (*set_decl_assembler_name) (tree);
350e4b17023SJohn Marino 
351e4b17023SJohn Marino   /* The front end can add its own statistics to -fmem-report with
352e4b17023SJohn Marino      this hook.  It should output to stderr.  */
353e4b17023SJohn Marino   void (*print_statistics) (void);
354e4b17023SJohn Marino 
355e4b17023SJohn Marino   /* Called by print_tree when there is a tree of class tcc_exceptional
356e4b17023SJohn Marino      that it doesn't know how to display.  */
357e4b17023SJohn Marino   lang_print_tree_hook print_xnode;
358e4b17023SJohn Marino 
359e4b17023SJohn Marino   /* Called to print language-dependent parts of tcc_decl, tcc_type,
360e4b17023SJohn Marino      and IDENTIFIER_NODE nodes.  */
361e4b17023SJohn Marino   lang_print_tree_hook print_decl;
362e4b17023SJohn Marino   lang_print_tree_hook print_type;
363e4b17023SJohn Marino   lang_print_tree_hook print_identifier;
364e4b17023SJohn Marino 
365e4b17023SJohn Marino   /* Computes the name to use to print a declaration.  DECL is the
366e4b17023SJohn Marino      non-NULL declaration in question.  VERBOSITY determines what
367e4b17023SJohn Marino      information will be printed: 0: DECL_NAME, demangled as
368e4b17023SJohn Marino      necessary.  1: and scope information.  2: and any other
369e4b17023SJohn Marino      information that might be interesting, such as function parameter
370e4b17023SJohn Marino      types in C++.  The name is in the internal character set and
371e4b17023SJohn Marino      needs to be converted to the locale character set of diagnostics,
372e4b17023SJohn Marino      or to the execution character set for strings such as
373e4b17023SJohn Marino      __PRETTY_FUNCTION__.  */
374e4b17023SJohn Marino   const char *(*decl_printable_name) (tree decl, int verbosity);
375e4b17023SJohn Marino 
376e4b17023SJohn Marino   /* Computes the dwarf-2/3 name for a tree.  VERBOSITY determines what
377e4b17023SJohn Marino      information will be printed: 0: DECL_NAME, demangled as
378e4b17023SJohn Marino      necessary.  1: and scope information.  */
379e4b17023SJohn Marino   const char *(*dwarf_name) (tree, int verbosity);
380e4b17023SJohn Marino 
381e4b17023SJohn Marino   /* This compares two types for equivalence ("compatible" in C-based languages).
382e4b17023SJohn Marino      This routine should only return 1 if it is sure.  It should not be used
383e4b17023SJohn Marino      in contexts where erroneously returning 0 causes problems.  */
384e4b17023SJohn Marino   int (*types_compatible_p) (tree x, tree y);
385e4b17023SJohn Marino 
386e4b17023SJohn Marino   /* Called by report_error_function to print out function name.  */
387e4b17023SJohn Marino   void (*print_error_function) (diagnostic_context *, const char *,
388e4b17023SJohn Marino 				struct diagnostic_info *);
389e4b17023SJohn Marino 
390e4b17023SJohn Marino   /* Convert a character from the host's to the target's character
391e4b17023SJohn Marino      set.  The character should be in what C calls the "basic source
392e4b17023SJohn Marino      character set" (roughly, the set of characters defined by plain
393e4b17023SJohn Marino      old ASCII).  The default is to return the character unchanged,
394e4b17023SJohn Marino      which is correct in most circumstances.  Note that both argument
395e4b17023SJohn Marino      and result should be sign-extended under -fsigned-char,
396e4b17023SJohn Marino      zero-extended under -fno-signed-char.  */
397e4b17023SJohn Marino   HOST_WIDE_INT (*to_target_charset) (HOST_WIDE_INT);
398e4b17023SJohn Marino 
399e4b17023SJohn Marino   /* Pointers to machine-independent attribute tables, for front ends
400e4b17023SJohn Marino      using attribs.c.  If one is NULL, it is ignored.  Respectively, a
401e4b17023SJohn Marino      table of attributes specific to the language, a table of
402e4b17023SJohn Marino      attributes common to two or more languages (to allow easy
403e4b17023SJohn Marino      sharing), and a table of attributes for checking formats.  */
404e4b17023SJohn Marino   const struct attribute_spec *attribute_table;
405e4b17023SJohn Marino   const struct attribute_spec *common_attribute_table;
406e4b17023SJohn Marino   const struct attribute_spec *format_attribute_table;
407e4b17023SJohn Marino 
408e4b17023SJohn Marino   struct lang_hooks_for_tree_inlining tree_inlining;
409e4b17023SJohn Marino 
410e4b17023SJohn Marino   struct lang_hooks_for_callgraph callgraph;
411e4b17023SJohn Marino 
412e4b17023SJohn Marino   struct lang_hooks_for_tree_dump tree_dump;
413e4b17023SJohn Marino 
414e4b17023SJohn Marino   struct lang_hooks_for_decls decls;
415e4b17023SJohn Marino 
416e4b17023SJohn Marino   struct lang_hooks_for_types types;
417e4b17023SJohn Marino 
418e4b17023SJohn Marino   struct lang_hooks_for_lto lto;
419e4b17023SJohn Marino 
420e4b17023SJohn Marino   /* Returns the generic parameters of an instantiation of
421e4b17023SJohn Marino      a generic type or decl, e.g. C++ template instantiation.  */
422e4b17023SJohn Marino   tree (*get_innermost_generic_parms) (const_tree);
423e4b17023SJohn Marino 
424e4b17023SJohn Marino   /* Returns the TREE_VEC of arguments of an instantiation
425e4b17023SJohn Marino      of a generic type of decl, e.g. C++ template instantiation.  */
426e4b17023SJohn Marino   tree (*get_innermost_generic_args) (const_tree);
427e4b17023SJohn Marino 
428e4b17023SJohn Marino   /* Determine if a tree is a function parameter pack.  */
429e4b17023SJohn Marino   bool (*function_parameter_pack_p) (const_tree);
430e4b17023SJohn Marino 
431e4b17023SJohn Marino   /* Perform language-specific gimplification on the argument.  Returns an
432e4b17023SJohn Marino      enum gimplify_status, though we can't see that type here.  */
433e4b17023SJohn Marino   int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *);
434e4b17023SJohn Marino 
435e4b17023SJohn Marino   /* Do language specific processing in the builtin function DECL  */
436e4b17023SJohn Marino   tree (*builtin_function) (tree decl);
437e4b17023SJohn Marino 
438e4b17023SJohn Marino   /* Like builtin_function, but make sure the scope is the external scope.
439e4b17023SJohn Marino      This is used to delay putting in back end builtin functions until the ISA
440e4b17023SJohn Marino      that defines the builtin is declared via function specific target options,
441e4b17023SJohn Marino      which can save memory for machines like the x86_64 that have multiple
442e4b17023SJohn Marino      ISAs.  If this points to the same function as builtin_function, the
443e4b17023SJohn Marino      backend must add all of the builtins at program initialization time.  */
444e4b17023SJohn Marino   tree (*builtin_function_ext_scope) (tree decl);
445e4b17023SJohn Marino 
446e4b17023SJohn Marino   /* Used to set up the tree_contains_structure array for a frontend. */
447e4b17023SJohn Marino   void (*init_ts) (void);
448e4b17023SJohn Marino 
449e4b17023SJohn Marino   /* Called by recompute_tree_invariant_for_addr_expr to go from EXPR
450e4b17023SJohn Marino      to a contained expression or DECL, possibly updating *TC or *SE
451e4b17023SJohn Marino      if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating.  */
452e4b17023SJohn Marino   tree (*expr_to_decl) (tree expr, bool *tc, bool *se);
453e4b17023SJohn Marino 
454e4b17023SJohn Marino   /* The EH personality function decl.  */
455e4b17023SJohn Marino   tree (*eh_personality) (void);
456e4b17023SJohn Marino 
457e4b17023SJohn Marino   /* Map a type to a runtime object to match type.  */
458e4b17023SJohn Marino   tree (*eh_runtime_type) (tree);
459e4b17023SJohn Marino 
460e4b17023SJohn Marino   /* If non-NULL, this is a function that returns a function decl to be
461e4b17023SJohn Marino      executed if an unhandled exception is propagated out of a cleanup
462e4b17023SJohn Marino      region.  For example, in C++, an exception thrown by a destructor
463e4b17023SJohn Marino      during stack unwinding is required to result in a call to
464e4b17023SJohn Marino      `std::terminate', so the C++ version of this function returns a
465e4b17023SJohn Marino      FUNCTION_DECL for `std::terminate'.  */
466e4b17023SJohn Marino   tree (*eh_protect_cleanup_actions) (void);
467e4b17023SJohn Marino 
468*5ce9237cSJohn Marino   /* Return true if a stmt can fallthru.  Used by block_may_fallthru
469*5ce9237cSJohn Marino      to possibly handle language trees.  */
470*5ce9237cSJohn Marino   bool (*block_may_fallthru) (const_tree);
471*5ce9237cSJohn Marino 
472e4b17023SJohn Marino   /* True if this language uses __cxa_end_cleanup when the ARM EABI
473e4b17023SJohn Marino      is enabled.  */
474e4b17023SJohn Marino   bool eh_use_cxa_end_cleanup;
475e4b17023SJohn Marino 
476e4b17023SJohn Marino   /* True if this language requires deep unsharing of tree nodes prior to
477e4b17023SJohn Marino      gimplification.  */
478e4b17023SJohn Marino   bool deep_unsharing;
479e4b17023SJohn Marino 
480e4b17023SJohn Marino   /* Whenever you add entries here, make sure you adjust langhooks-def.h
481e4b17023SJohn Marino      and langhooks.c accordingly.  */
482e4b17023SJohn Marino };
483e4b17023SJohn Marino 
484e4b17023SJohn Marino /* Each front end provides its own.  */
485e4b17023SJohn Marino extern struct lang_hooks lang_hooks;
486e4b17023SJohn Marino extern tree add_builtin_function (const char *name, tree type,
487e4b17023SJohn Marino 				  int function_code, enum built_in_class cl,
488e4b17023SJohn Marino 				  const char *library_name,
489e4b17023SJohn Marino 				  tree attrs);
490e4b17023SJohn Marino 
491e4b17023SJohn Marino extern tree add_builtin_function_ext_scope (const char *name, tree type,
492e4b17023SJohn Marino 					    int function_code,
493e4b17023SJohn Marino 					    enum built_in_class cl,
494e4b17023SJohn Marino 					    const char *library_name,
495e4b17023SJohn Marino 					    tree attrs);
496e4b17023SJohn Marino 
497e4b17023SJohn Marino #endif /* GCC_LANG_HOOKS_H */
498