110d565efSmrg /* The lang_hooks data structure.
2*ec02198aSmrg    Copyright (C) 2001-2020 Free Software Foundation, Inc.
310d565efSmrg 
410d565efSmrg This file is part of GCC.
510d565efSmrg 
610d565efSmrg GCC is free software; you can redistribute it and/or modify
710d565efSmrg it under the terms of the GNU General Public License as published by
810d565efSmrg the Free Software Foundation; either version 3, or (at your option)
910d565efSmrg any later version.
1010d565efSmrg 
1110d565efSmrg GCC is distributed in the hope that it will be useful,
1210d565efSmrg but WITHOUT ANY WARRANTY; without even the implied warranty of
1310d565efSmrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1410d565efSmrg GNU General Public License for more details.
1510d565efSmrg 
1610d565efSmrg You should have received a copy of the GNU General Public License
1710d565efSmrg along with GCC; see the file COPYING3.  If not see
1810d565efSmrg <http://www.gnu.org/licenses/>.  */
1910d565efSmrg 
2010d565efSmrg #ifndef GCC_LANG_HOOKS_H
2110d565efSmrg #define GCC_LANG_HOOKS_H
2210d565efSmrg 
2310d565efSmrg /* FIXME: This file should be #include-d after tree.h (for enum tree_code).  */
2410d565efSmrg 
2510d565efSmrg struct diagnostic_info;
2610d565efSmrg 
2710d565efSmrg struct gimplify_omp_ctx;
2810d565efSmrg 
2910d565efSmrg struct array_descr_info;
3010d565efSmrg 
3110d565efSmrg /* A print hook for print_tree ().  */
3210d565efSmrg typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
3310d565efSmrg 
3410d565efSmrg enum classify_record
3510d565efSmrg   { RECORD_IS_STRUCT, RECORD_IS_CLASS, RECORD_IS_INTERFACE };
3610d565efSmrg 
3710d565efSmrg class substring_loc;
3810d565efSmrg 
3910d565efSmrg /* The following hooks are documented in langhooks.c.  Must not be
4010d565efSmrg    NULL.  */
4110d565efSmrg 
4210d565efSmrg struct lang_hooks_for_tree_inlining
4310d565efSmrg {
4410d565efSmrg   bool (*var_mod_type_p) (tree, tree);
4510d565efSmrg };
4610d565efSmrg 
4710d565efSmrg /* The following hooks are used by tree-dump.c.  */
4810d565efSmrg 
4910d565efSmrg struct lang_hooks_for_tree_dump
5010d565efSmrg {
5110d565efSmrg   /* Dump language-specific parts of tree nodes.  Returns nonzero if it
5210d565efSmrg      does not want the usual dumping of the second argument.  */
5310d565efSmrg   bool (*dump_tree) (void *, tree);
5410d565efSmrg 
5510d565efSmrg   /* Determine type qualifiers in a language-specific way.  */
5610d565efSmrg   int (*type_quals) (const_tree);
5710d565efSmrg };
5810d565efSmrg 
5910d565efSmrg /* Hooks related to types.  */
6010d565efSmrg 
6110d565efSmrg struct lang_hooks_for_types
6210d565efSmrg {
6310d565efSmrg   /* Return a new type (with the indicated CODE), doing whatever
6410d565efSmrg      language-specific processing is required.  */
6510d565efSmrg   tree (*make_type) (enum tree_code);
6610d565efSmrg 
67*ec02198aSmrg   /* Make an enum type with the given name and values, associating
68*ec02198aSmrg      them all with the given source location.  */
69*ec02198aSmrg   tree (*simulate_enum_decl) (location_t, const char *, vec<string_int_pair>);
70*ec02198aSmrg 
7110d565efSmrg   /* Return what kind of RECORD_TYPE this is, mainly for purposes of
7210d565efSmrg      debug information.  If not defined, record types are assumed to
7310d565efSmrg      be structures.  */
7410d565efSmrg   enum classify_record (*classify_record) (tree);
7510d565efSmrg 
7610d565efSmrg   /* Given MODE and UNSIGNEDP, return a suitable type-tree with that
7710d565efSmrg      mode.  */
7810d565efSmrg   tree (*type_for_mode) (machine_mode, int);
7910d565efSmrg 
8010d565efSmrg   /* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an
8110d565efSmrg      integer type with at least that precision.  */
8210d565efSmrg   tree (*type_for_size) (unsigned, int);
8310d565efSmrg 
8410d565efSmrg   /* True if the type is an instantiation of a generic type,
8510d565efSmrg      e.g. C++ template implicit specializations.  */
8610d565efSmrg   bool (*generic_p) (const_tree);
8710d565efSmrg 
8810d565efSmrg   /* Returns the TREE_VEC of elements of a given generic argument pack.  */
8910d565efSmrg   tree (*get_argument_pack_elems) (const_tree);
9010d565efSmrg 
9110d565efSmrg   /* Given a type, apply default promotions to unnamed function
9210d565efSmrg      arguments and return the new type.  Return the same type if no
9310d565efSmrg      change.  Required by any language that supports variadic
9410d565efSmrg      arguments.  The default hook dies.  */
9510d565efSmrg   tree (*type_promotes_to) (tree);
9610d565efSmrg 
9710d565efSmrg   /* Register TYPE as a builtin type with the indicated NAME.  The
9810d565efSmrg      TYPE is placed in the outermost lexical scope.  The semantics
9910d565efSmrg      should be analogous to:
10010d565efSmrg 
10110d565efSmrg        typedef TYPE NAME;
10210d565efSmrg 
10310d565efSmrg      in C.  The default hook ignores the declaration.  */
10410d565efSmrg   void (*register_builtin_type) (tree, const char *);
10510d565efSmrg 
10610d565efSmrg   /* This routine is called in tree.c to print an error message for
10710d565efSmrg      invalid use of an incomplete type.  VALUE is the expression that
10810d565efSmrg      was used (or 0 if that isn't known) and TYPE is the type that was
10910d565efSmrg      invalid.  LOC is the location of the use.  */
11010d565efSmrg   void (*incomplete_type_error) (location_t loc, const_tree value,
11110d565efSmrg 				 const_tree type);
11210d565efSmrg 
11310d565efSmrg   /* Called from assign_temp to return the maximum size, if there is one,
11410d565efSmrg      for a type.  */
11510d565efSmrg   tree (*max_size) (const_tree);
11610d565efSmrg 
11710d565efSmrg   /* Register language specific type size variables as potentially OpenMP
11810d565efSmrg      firstprivate variables.  */
11910d565efSmrg   void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree);
12010d565efSmrg 
12110d565efSmrg   /* Return true if TYPE is a mappable type.  */
12210d565efSmrg   bool (*omp_mappable_type) (tree type);
12310d565efSmrg 
12410d565efSmrg   /* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
12510d565efSmrg      Called only after doing all language independent checks.
12610d565efSmrg      At present, this function is only called when both TYPE1 and TYPE2 are
12710d565efSmrg      FUNCTION_TYPE or METHOD_TYPE.  */
12810d565efSmrg   bool (*type_hash_eq) (const_tree, const_tree);
12910d565efSmrg 
13010d565efSmrg   /* If non-NULL, return TYPE1 with any language-specific modifiers copied from
13110d565efSmrg      TYPE2.  */
13210d565efSmrg   tree (*copy_lang_qualifiers) (const_tree, const_tree);
13310d565efSmrg 
13410d565efSmrg   /* Return TRUE if TYPE uses a hidden descriptor and fills in information
13510d565efSmrg      for the debugger about the array bounds, strides, etc.  */
13610d565efSmrg   bool (*get_array_descr_info) (const_tree, struct array_descr_info *);
13710d565efSmrg 
13810d565efSmrg   /* Fill in information for the debugger about the bounds of TYPE.  */
13910d565efSmrg   void (*get_subrange_bounds) (const_tree, tree *, tree *);
14010d565efSmrg 
14110d565efSmrg   /* Called on INTEGER_TYPEs.  Return NULL_TREE for non-biased types.  For
14210d565efSmrg      biased types, return as an INTEGER_CST node the value that is represented
14310d565efSmrg      by a physical zero.  */
14410d565efSmrg   tree (*get_type_bias) (const_tree);
14510d565efSmrg 
14610d565efSmrg   /* A type descriptive of TYPE's complex layout generated to help the
14710d565efSmrg      debugger to decode variable-length or self-referential constructs.
14810d565efSmrg      This is only used for the AT_GNAT_descriptive_type DWARF attribute.  */
14910d565efSmrg   tree (*descriptive_type) (const_tree);
15010d565efSmrg 
15110d565efSmrg   /* If we requested a pointer to a vector, build up the pointers that
15210d565efSmrg      we stripped off while looking for the inner type.  Similarly for
15310d565efSmrg      return values from functions.  The argument TYPE is the top of the
15410d565efSmrg      chain, and BOTTOM is the new type which we will point to.  */
15510d565efSmrg   tree (*reconstruct_complex_type) (tree, tree);
15610d565efSmrg 
15710d565efSmrg   /* Returns the tree that represents the underlying data type used to
15810d565efSmrg      implement the enumeration.  The default implementation will just use
15910d565efSmrg      type_for_size.  Used in dwarf2out.c to add a DW_AT_type base type
16010d565efSmrg      reference to a DW_TAG_enumeration.  */
16110d565efSmrg   tree (*enum_underlying_base_type) (const_tree);
16210d565efSmrg 
16310d565efSmrg   /* Return a type to use in the debug info instead of TYPE, or NULL_TREE to
16410d565efSmrg      keep TYPE.  This is useful to keep a single "source type" when the
16510d565efSmrg      middle-end uses specialized types, for instance constrained discriminated
16610d565efSmrg      types in Ada.  */
16710d565efSmrg   tree (*get_debug_type) (const_tree);
16810d565efSmrg 
16910d565efSmrg   /* Return TRUE if TYPE implements a fixed point type and fills in information
17010d565efSmrg      for the debugger about scale factor, etc.  */
17110d565efSmrg   bool (*get_fixed_point_type_info) (const_tree,
17210d565efSmrg 				     struct fixed_point_type_info *);
17310d565efSmrg 
17410d565efSmrg   /* Returns -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute
17510d565efSmrg      value otherwise.  */
17610d565efSmrg   int (*type_dwarf_attribute) (const_tree, int);
17710d565efSmrg 
17810d565efSmrg   /* Returns a tree for the unit size of T excluding tail padding that
17910d565efSmrg      might be used by objects inheriting from T.  */
18010d565efSmrg   tree (*unit_size_without_reusable_padding) (tree);
18110d565efSmrg };
18210d565efSmrg 
18310d565efSmrg /* Language hooks related to decls and the symbol table.  */
18410d565efSmrg 
18510d565efSmrg struct lang_hooks_for_decls
18610d565efSmrg {
18710d565efSmrg   /* Return true if we are in the global binding level.  This hook is really
18810d565efSmrg      needed only if the language supports variable-sized types at the global
18910d565efSmrg      level, i.e. declared outside subprograms.  */
19010d565efSmrg   bool (*global_bindings_p) (void);
19110d565efSmrg 
19210d565efSmrg   /* Function to add a decl to the current scope level.  Takes one
19310d565efSmrg      argument, a decl to add.  Returns that decl, or, if the same
19410d565efSmrg      symbol is already declared, may return a different decl for that
19510d565efSmrg      name.  */
19610d565efSmrg   tree (*pushdecl) (tree);
19710d565efSmrg 
19810d565efSmrg   /* Returns the chain of decls so far in the current scope level.  */
19910d565efSmrg   tree (*getdecls) (void);
20010d565efSmrg 
20110d565efSmrg   /* Returns -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
20210d565efSmrg      value otherwise.  */
20310d565efSmrg   int (*decl_dwarf_attribute) (const_tree, int);
20410d565efSmrg 
20510d565efSmrg   /* Returns True if the parameter is a generic parameter decl
20610d565efSmrg      of a generic type, e.g a template template parameter for the C++ FE.  */
20710d565efSmrg   bool (*generic_generic_parameter_decl_p) (const_tree);
20810d565efSmrg 
20910d565efSmrg   /* Determine if a function parameter got expanded from a
21010d565efSmrg      function parameter pack.  */
21110d565efSmrg   bool (*function_parm_expanded_from_pack_p) (tree, tree);
21210d565efSmrg 
21310d565efSmrg   /* Returns the generic declaration of a generic function instantiations.  */
21410d565efSmrg   tree (*get_generic_function_decl) (const_tree);
21510d565efSmrg 
21610d565efSmrg   /* Returns true when we should warn for an unused global DECL.
21710d565efSmrg      We will already have checked that it has static binding.  */
21810d565efSmrg   bool (*warn_unused_global) (const_tree);
21910d565efSmrg 
22010d565efSmrg   /* Perform any post compilation-proper parser cleanups and
22110d565efSmrg      processing.  This is currently only needed for the C++ parser,
22210d565efSmrg      which hopefully can be cleaned up so this hook is no longer
22310d565efSmrg      necessary.  */
22410d565efSmrg   void (*post_compilation_parsing_cleanups) (void);
22510d565efSmrg 
22610d565efSmrg   /* True if this decl may be called via a sibcall.  */
22710d565efSmrg   bool (*ok_for_sibcall) (const_tree);
22810d565efSmrg 
229*ec02198aSmrg   /* Return a tree for the actual data of an array descriptor - or NULL_TREE
230*ec02198aSmrg      if original tree is not an array descriptor.  If the second argument
231*ec02198aSmrg      is true, only the TREE_TYPE is returned without generating a new tree.  */
232*ec02198aSmrg   tree (*omp_array_data) (tree, bool);
233*ec02198aSmrg 
234*ec02198aSmrg   /* True if OpenMP should regard this DECL as being a scalar which has Fortran's
235*ec02198aSmrg      allocatable or pointer attribute.  */
236*ec02198aSmrg   bool (*omp_is_allocatable_or_ptr) (const_tree);
237*ec02198aSmrg 
238*ec02198aSmrg   /* Check whether this DECL belongs to a Fortran optional argument.
239*ec02198aSmrg      With 'for_present_check' set to false, decls which are optional parameters
240*ec02198aSmrg      themselve are returned as tree - or a NULL_TREE otherwise. Those decls are
241*ec02198aSmrg      always pointers.  With 'for_present_check' set to true, the decl for
242*ec02198aSmrg      checking whether an argument is present is returned; for arguments with
243*ec02198aSmrg      value attribute this is the hidden argument and of BOOLEAN_TYPE.  If the
244*ec02198aSmrg      decl is unrelated to optional arguments, NULL_TREE is returned.  */
245*ec02198aSmrg   tree (*omp_check_optional_argument) (tree, bool);
246*ec02198aSmrg 
24710d565efSmrg   /* True if OpenMP should privatize what this DECL points to rather
24810d565efSmrg      than the DECL itself.  */
24910d565efSmrg   bool (*omp_privatize_by_reference) (const_tree);
25010d565efSmrg 
25110d565efSmrg   /* Return sharing kind if OpenMP sharing attribute of DECL is
25210d565efSmrg      predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise.  */
25310d565efSmrg   enum omp_clause_default_kind (*omp_predetermined_sharing) (tree);
25410d565efSmrg 
25510d565efSmrg   /* Return decl that should be reported for DEFAULT(NONE) failure
25610d565efSmrg      diagnostics.  Usually the DECL passed in.  */
25710d565efSmrg   tree (*omp_report_decl) (tree);
25810d565efSmrg 
25910d565efSmrg   /* Return true if DECL's DECL_VALUE_EXPR (if any) should be
26010d565efSmrg      disregarded in OpenMP construct, because it is going to be
26110d565efSmrg      remapped during OpenMP lowering.  SHARED is true if DECL
26210d565efSmrg      is going to be shared, false if it is going to be privatized.  */
26310d565efSmrg   bool (*omp_disregard_value_expr) (tree, bool);
26410d565efSmrg 
26510d565efSmrg   /* Return true if DECL that is shared iff SHARED is true should
26610d565efSmrg      be put into OMP_CLAUSE_PRIVATE_DEBUG.  */
26710d565efSmrg   bool (*omp_private_debug_clause) (tree, bool);
26810d565efSmrg 
26910d565efSmrg   /* Return true if DECL in private clause needs
27010d565efSmrg      OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause.  */
27110d565efSmrg   bool (*omp_private_outer_ref) (tree);
27210d565efSmrg 
27310d565efSmrg   /* Build and return code for a default constructor for DECL in
27410d565efSmrg      response to CLAUSE.  OUTER is corresponding outer region's
27510d565efSmrg      variable if needed.  Return NULL if nothing to be done.  */
27610d565efSmrg   tree (*omp_clause_default_ctor) (tree clause, tree decl, tree outer);
27710d565efSmrg 
27810d565efSmrg   /* Build and return code for a copy constructor from SRC to DST.  */
27910d565efSmrg   tree (*omp_clause_copy_ctor) (tree clause, tree dst, tree src);
28010d565efSmrg 
28110d565efSmrg   /* Similarly, except use an assignment operator instead.  */
28210d565efSmrg   tree (*omp_clause_assign_op) (tree clause, tree dst, tree src);
28310d565efSmrg 
28410d565efSmrg   /* Build and return code for a constructor of DST that sets it to
28510d565efSmrg      SRC + ADD.  */
28610d565efSmrg   tree (*omp_clause_linear_ctor) (tree clause, tree dst, tree src, tree add);
28710d565efSmrg 
28810d565efSmrg   /* Build and return code destructing DECL.  Return NULL if nothing
28910d565efSmrg      to be done.  */
29010d565efSmrg   tree (*omp_clause_dtor) (tree clause, tree decl);
29110d565efSmrg 
29210d565efSmrg   /* Do language specific checking on an implicitly determined clause.  */
29310d565efSmrg   void (*omp_finish_clause) (tree clause, gimple_seq *pre_p);
29410d565efSmrg 
29510d565efSmrg   /* Return true if DECL is a scalar variable (for the purpose of
29610d565efSmrg      implicit firstprivatization).  */
29710d565efSmrg   bool (*omp_scalar_p) (tree decl);
29810d565efSmrg };
29910d565efSmrg 
30010d565efSmrg /* Language hooks related to LTO serialization.  */
30110d565efSmrg 
30210d565efSmrg struct lang_hooks_for_lto
30310d565efSmrg {
30410d565efSmrg   /* Begin a new LTO section named NAME.  */
30510d565efSmrg   void (*begin_section) (const char *name);
30610d565efSmrg 
30710d565efSmrg   /* Write DATA of length LEN to the currently open LTO section.  BLOCK is a
30810d565efSmrg      pointer to the dynamically allocated memory containing DATA.  The
30910d565efSmrg      append_data function is responsible for freeing it when it is no longer
31010d565efSmrg      needed.  */
31110d565efSmrg   void (*append_data) (const void *data, size_t len, void *block);
31210d565efSmrg 
31310d565efSmrg   /* End the previously begun LTO section.  */
31410d565efSmrg   void (*end_section) (void);
31510d565efSmrg };
31610d565efSmrg 
31710d565efSmrg /* Language-specific hooks.  See langhooks-def.h for defaults.  */
31810d565efSmrg 
31910d565efSmrg struct lang_hooks
32010d565efSmrg {
32110d565efSmrg   /* String identifying the front end and optionally language standard
322c7a68eb7Smrg      version, e.g. "GNU C++98".  */
32310d565efSmrg   const char *name;
32410d565efSmrg 
32510d565efSmrg   /* sizeof (struct lang_identifier), so make_node () creates
32610d565efSmrg      identifier nodes long enough for the language-specific slots.  */
32710d565efSmrg   size_t identifier_size;
32810d565efSmrg 
32910d565efSmrg   /* Remove any parts of the tree that are used only by the FE. */
33010d565efSmrg   void (*free_lang_data) (tree);
33110d565efSmrg 
332c7a68eb7Smrg   /* Determines the size of any language-specific tcc_constant,
333c7a68eb7Smrg      tcc_exceptional or tcc_type nodes.  Since it is called from
334c7a68eb7Smrg      make_node, the only information available is the tree code.
335c7a68eb7Smrg      Expected to die on unrecognized codes.  */
33610d565efSmrg   size_t (*tree_size) (enum tree_code);
33710d565efSmrg 
33810d565efSmrg   /* Return the language mask used for converting argv into a sequence
33910d565efSmrg      of options.  */
34010d565efSmrg   unsigned int (*option_lang_mask) (void);
34110d565efSmrg 
34210d565efSmrg   /* Initialize variables in an options structure.  */
34310d565efSmrg   void (*init_options_struct) (struct gcc_options *opts);
34410d565efSmrg 
34510d565efSmrg   /* After the initialize_diagnostics hook is called, do any simple
34610d565efSmrg      initialization needed before any calls to handle_option, other
34710d565efSmrg      than that done by the init_options_struct hook.  */
34810d565efSmrg   void (*init_options) (unsigned int decoded_options_count,
34910d565efSmrg 			struct cl_decoded_option *decoded_options);
35010d565efSmrg 
35110d565efSmrg   /* Callback used to perform language-specific initialization for the
35210d565efSmrg      global diagnostic context structure.  */
35310d565efSmrg   void (*initialize_diagnostics) (diagnostic_context *);
35410d565efSmrg 
355c7a68eb7Smrg   /* Register language-specific dumps.  */
356c7a68eb7Smrg   void (*register_dumps) (gcc::dump_manager *);
357c7a68eb7Smrg 
35810d565efSmrg   /* Return true if a warning should be given about option OPTION,
35910d565efSmrg      which is for the wrong language, false if it should be quietly
36010d565efSmrg      ignored.  */
36110d565efSmrg   bool (*complain_wrong_lang_p) (const struct cl_option *option);
36210d565efSmrg 
36310d565efSmrg   /* Handle the switch CODE, which has real type enum opt_code from
36410d565efSmrg      options.h.  If the switch takes an argument, it is passed in ARG
36510d565efSmrg      which points to permanent storage.  The handler is responsible for
36610d565efSmrg      checking whether ARG is NULL, which indicates that no argument
36710d565efSmrg      was in fact supplied.  For -f and -W switches, VALUE is 1 or 0
36810d565efSmrg      for the positive and negative forms respectively.  HANDLERS should
36910d565efSmrg      be passed to any recursive handle_option calls.  LOC is the
37010d565efSmrg      location of the option.
37110d565efSmrg 
37210d565efSmrg      Return true if the switch is valid, false if invalid.  */
3730fc04c29Smrg   bool (*handle_option) (size_t code, const char *arg, HOST_WIDE_INT value,
3740fc04c29Smrg 			 int kind, location_t loc,
37510d565efSmrg 			 const struct cl_option_handlers *handlers);
37610d565efSmrg 
37710d565efSmrg   /* Called when all command line options have been parsed to allow
37810d565efSmrg      further processing and initialization
37910d565efSmrg 
38010d565efSmrg      Should return true to indicate that a compiler back-end is
38110d565efSmrg      not required, such as with the -E option.
38210d565efSmrg 
38310d565efSmrg      If errorcount is nonzero after this call the compiler exits
38410d565efSmrg      immediately and the finish hook is not called.  */
38510d565efSmrg   bool (*post_options) (const char **);
38610d565efSmrg 
38710d565efSmrg   /* Called after post_options to initialize the front end.  Return
38810d565efSmrg      false to indicate that no further compilation be performed, in
38910d565efSmrg      which case the finish hook is called immediately.  */
39010d565efSmrg   bool (*init) (void);
39110d565efSmrg 
39210d565efSmrg   /* Called at the end of compilation, as a finalizer.  */
39310d565efSmrg   void (*finish) (void);
39410d565efSmrg 
39510d565efSmrg   /* Parses the entire file.  */
39610d565efSmrg   void (*parse_file) (void);
39710d565efSmrg 
39810d565efSmrg   /* Determines if it's ok for a function to have no noreturn attribute.  */
39910d565efSmrg   bool (*missing_noreturn_ok_p) (tree);
40010d565efSmrg 
40110d565efSmrg   /* Called to obtain the alias set to be used for an expression or type.
40210d565efSmrg      Returns -1 if the language does nothing special for it.  */
40310d565efSmrg   alias_set_type (*get_alias_set) (tree);
40410d565efSmrg 
40510d565efSmrg   /* Function to finish handling an incomplete decl at the end of
40610d565efSmrg      compilation.  Default hook is does nothing.  */
40710d565efSmrg   void (*finish_incomplete_decl) (tree);
40810d565efSmrg 
40910d565efSmrg   /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
41010d565efSmrg      DECL_NODE with a newly GC-allocated copy.  */
41110d565efSmrg   void (*dup_lang_specific_decl) (tree);
41210d565efSmrg 
41310d565efSmrg   /* Set the DECL_ASSEMBLER_NAME for a node.  If it is the sort of
41410d565efSmrg      thing that the assembler should talk about, set
41510d565efSmrg      DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE.
41610d565efSmrg      Otherwise, set it to the ERROR_MARK_NODE to ensure that the
41710d565efSmrg      assembler does not talk about it.  */
41810d565efSmrg   void (*set_decl_assembler_name) (tree);
41910d565efSmrg 
420c7a68eb7Smrg   /* Overwrite the DECL_ASSEMBLER_NAME for a node.  The name is being
421c7a68eb7Smrg      changed (including to or from NULL_TREE).  */
422c7a68eb7Smrg   void (*overwrite_decl_assembler_name) (tree, tree);
423c7a68eb7Smrg 
42410d565efSmrg   /* The front end can add its own statistics to -fmem-report with
42510d565efSmrg      this hook.  It should output to stderr.  */
42610d565efSmrg   void (*print_statistics) (void);
42710d565efSmrg 
42810d565efSmrg   /* Called by print_tree when there is a tree of class tcc_exceptional
42910d565efSmrg      that it doesn't know how to display.  */
43010d565efSmrg   lang_print_tree_hook print_xnode;
43110d565efSmrg 
43210d565efSmrg   /* Called to print language-dependent parts of tcc_decl, tcc_type,
43310d565efSmrg      and IDENTIFIER_NODE nodes.  */
43410d565efSmrg   lang_print_tree_hook print_decl;
43510d565efSmrg   lang_print_tree_hook print_type;
43610d565efSmrg   lang_print_tree_hook print_identifier;
43710d565efSmrg 
43810d565efSmrg   /* Computes the name to use to print a declaration.  DECL is the
43910d565efSmrg      non-NULL declaration in question.  VERBOSITY determines what
44010d565efSmrg      information will be printed: 0: DECL_NAME, demangled as
44110d565efSmrg      necessary.  1: and scope information.  2: and any other
44210d565efSmrg      information that might be interesting, such as function parameter
44310d565efSmrg      types in C++.  The name is in the internal character set and
44410d565efSmrg      needs to be converted to the locale character set of diagnostics,
44510d565efSmrg      or to the execution character set for strings such as
44610d565efSmrg      __PRETTY_FUNCTION__.  */
44710d565efSmrg   const char *(*decl_printable_name) (tree decl, int verbosity);
44810d565efSmrg 
44910d565efSmrg   /* Computes the dwarf-2/3 name for a tree.  VERBOSITY determines what
45010d565efSmrg      information will be printed: 0: DECL_NAME, demangled as
45110d565efSmrg      necessary.  1: and scope information.  */
45210d565efSmrg   const char *(*dwarf_name) (tree, int verbosity);
45310d565efSmrg 
45410d565efSmrg   /* This compares two types for equivalence ("compatible" in C-based languages).
45510d565efSmrg      This routine should only return 1 if it is sure.  It should not be used
45610d565efSmrg      in contexts where erroneously returning 0 causes problems.  */
45710d565efSmrg   int (*types_compatible_p) (tree x, tree y);
45810d565efSmrg 
45910d565efSmrg   /* Called by report_error_function to print out function name.  */
46010d565efSmrg   void (*print_error_function) (diagnostic_context *, const char *,
46110d565efSmrg 				struct diagnostic_info *);
46210d565efSmrg 
46310d565efSmrg   /* Convert a character from the host's to the target's character
46410d565efSmrg      set.  The character should be in what C calls the "basic source
46510d565efSmrg      character set" (roughly, the set of characters defined by plain
46610d565efSmrg      old ASCII).  The default is to return the character unchanged,
46710d565efSmrg      which is correct in most circumstances.  Note that both argument
46810d565efSmrg      and result should be sign-extended under -fsigned-char,
46910d565efSmrg      zero-extended under -fno-signed-char.  */
47010d565efSmrg   HOST_WIDE_INT (*to_target_charset) (HOST_WIDE_INT);
47110d565efSmrg 
47210d565efSmrg   /* Pointers to machine-independent attribute tables, for front ends
47310d565efSmrg      using attribs.c.  If one is NULL, it is ignored.  Respectively, a
47410d565efSmrg      table of attributes specific to the language, a table of
47510d565efSmrg      attributes common to two or more languages (to allow easy
47610d565efSmrg      sharing), and a table of attributes for checking formats.  */
47710d565efSmrg   const struct attribute_spec *attribute_table;
47810d565efSmrg   const struct attribute_spec *common_attribute_table;
47910d565efSmrg   const struct attribute_spec *format_attribute_table;
48010d565efSmrg 
48110d565efSmrg   struct lang_hooks_for_tree_inlining tree_inlining;
48210d565efSmrg 
48310d565efSmrg   struct lang_hooks_for_tree_dump tree_dump;
48410d565efSmrg 
48510d565efSmrg   struct lang_hooks_for_decls decls;
48610d565efSmrg 
48710d565efSmrg   struct lang_hooks_for_types types;
48810d565efSmrg 
48910d565efSmrg   struct lang_hooks_for_lto lto;
49010d565efSmrg 
49110d565efSmrg   /* Returns a TREE_VEC of the generic parameters of an instantiation of
49210d565efSmrg      a generic type or decl, e.g. C++ template instantiation.  If
49310d565efSmrg      TREE_CHAIN of the return value is set, it is an INTEGER_CST
49410d565efSmrg      indicating how many of the elements are non-default.  */
49510d565efSmrg   tree (*get_innermost_generic_parms) (const_tree);
49610d565efSmrg 
49710d565efSmrg   /* Returns the TREE_VEC of arguments of an instantiation
49810d565efSmrg      of a generic type of decl, e.g. C++ template instantiation.  */
49910d565efSmrg   tree (*get_innermost_generic_args) (const_tree);
50010d565efSmrg 
50110d565efSmrg   /* Determine if a tree is a function parameter pack.  */
50210d565efSmrg   bool (*function_parameter_pack_p) (const_tree);
50310d565efSmrg 
50410d565efSmrg   /* Perform language-specific gimplification on the argument.  Returns an
50510d565efSmrg      enum gimplify_status, though we can't see that type here.  */
50610d565efSmrg   int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *);
50710d565efSmrg 
50810d565efSmrg   /* Do language specific processing in the builtin function DECL  */
50910d565efSmrg   tree (*builtin_function) (tree decl);
51010d565efSmrg 
51110d565efSmrg   /* Like builtin_function, but make sure the scope is the external scope.
51210d565efSmrg      This is used to delay putting in back end builtin functions until the ISA
51310d565efSmrg      that defines the builtin is declared via function specific target options,
51410d565efSmrg      which can save memory for machines like the x86_64 that have multiple
51510d565efSmrg      ISAs.  If this points to the same function as builtin_function, the
51610d565efSmrg      backend must add all of the builtins at program initialization time.  */
51710d565efSmrg   tree (*builtin_function_ext_scope) (tree decl);
51810d565efSmrg 
519*ec02198aSmrg   /* Do language-specific processing for target-specific built-in
520*ec02198aSmrg      function DECL, so that it is defined in the global scope (only)
521*ec02198aSmrg      and is available without needing to be explicitly declared.
522*ec02198aSmrg 
523*ec02198aSmrg      This is intended for targets that want to inject declarations of
524*ec02198aSmrg      built-in functions into the source language (such as in response
525*ec02198aSmrg      to a pragma) rather than providing them in the source language itself.  */
526*ec02198aSmrg   tree (*simulate_builtin_function_decl) (tree decl);
527*ec02198aSmrg 
52810d565efSmrg   /* Used to set up the tree_contains_structure array for a frontend. */
52910d565efSmrg   void (*init_ts) (void);
53010d565efSmrg 
53110d565efSmrg   /* Called by recompute_tree_invariant_for_addr_expr to go from EXPR
53210d565efSmrg      to a contained expression or DECL, possibly updating *TC or *SE
53310d565efSmrg      if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating.  */
53410d565efSmrg   tree (*expr_to_decl) (tree expr, bool *tc, bool *se);
53510d565efSmrg 
53610d565efSmrg   /* The EH personality function decl.  */
53710d565efSmrg   tree (*eh_personality) (void);
53810d565efSmrg 
53910d565efSmrg   /* Map a type to a runtime object to match type.  */
54010d565efSmrg   tree (*eh_runtime_type) (tree);
54110d565efSmrg 
54210d565efSmrg   /* If non-NULL, this is a function that returns a function decl to be
54310d565efSmrg      executed if an unhandled exception is propagated out of a cleanup
54410d565efSmrg      region.  For example, in C++, an exception thrown by a destructor
54510d565efSmrg      during stack unwinding is required to result in a call to
54610d565efSmrg      `std::terminate', so the C++ version of this function returns a
54710d565efSmrg      FUNCTION_DECL for `std::terminate'.  */
54810d565efSmrg   tree (*eh_protect_cleanup_actions) (void);
54910d565efSmrg 
55010d565efSmrg   /* Return true if a stmt can fallthru.  Used by block_may_fallthru
55110d565efSmrg      to possibly handle language trees.  */
55210d565efSmrg   bool (*block_may_fallthru) (const_tree);
55310d565efSmrg 
55410d565efSmrg   /* True if this language uses __cxa_end_cleanup when the ARM EABI
55510d565efSmrg      is enabled.  */
55610d565efSmrg   bool eh_use_cxa_end_cleanup;
55710d565efSmrg 
55810d565efSmrg   /* True if this language requires deep unsharing of tree nodes prior to
55910d565efSmrg      gimplification.  */
56010d565efSmrg   bool deep_unsharing;
56110d565efSmrg 
56210d565efSmrg   /* True if this language may use custom descriptors for nested functions
56310d565efSmrg      instead of trampolines.  */
56410d565efSmrg   bool custom_function_descriptors;
56510d565efSmrg 
566c7a68eb7Smrg   /* True if this language emits begin stmt notes.  */
567c7a68eb7Smrg   bool emits_begin_stmt;
568c7a68eb7Smrg 
56910d565efSmrg   /* Run all lang-specific selftests.  */
57010d565efSmrg   void (*run_lang_selftests) (void);
57110d565efSmrg 
57210d565efSmrg   /* Attempt to determine the source location of the substring.
57310d565efSmrg      If successful, return NULL and write the source location to *OUT_LOC.
57410d565efSmrg      Otherwise return an error message.  Error messages are intended
57510d565efSmrg      for GCC developers (to help debugging) rather than for end-users.  */
57610d565efSmrg   const char *(*get_substring_location) (const substring_loc &,
57710d565efSmrg 					 location_t *out_loc);
57810d565efSmrg 
57910d565efSmrg   /* Whenever you add entries here, make sure you adjust langhooks-def.h
58010d565efSmrg      and langhooks.c accordingly.  */
58110d565efSmrg };
58210d565efSmrg 
58310d565efSmrg /* Each front end provides its own.  */
58410d565efSmrg extern struct lang_hooks lang_hooks;
58510d565efSmrg 
58610d565efSmrg extern tree add_builtin_function (const char *name, tree type,
58710d565efSmrg 				  int function_code, enum built_in_class cl,
58810d565efSmrg 				  const char *library_name,
58910d565efSmrg 				  tree attrs);
59010d565efSmrg 
59110d565efSmrg extern tree add_builtin_function_ext_scope (const char *name, tree type,
59210d565efSmrg 					    int function_code,
59310d565efSmrg 					    enum built_in_class cl,
59410d565efSmrg 					    const char *library_name,
59510d565efSmrg 					    tree attrs);
596*ec02198aSmrg extern tree simulate_builtin_function_decl (location_t, const char *, tree,
597*ec02198aSmrg 					    int, const char *, tree);
59810d565efSmrg extern tree add_builtin_type (const char *name, tree type);
59910d565efSmrg 
60010d565efSmrg /* Language helper functions.  */
60110d565efSmrg 
60210d565efSmrg extern bool lang_GNU_C (void);
60310d565efSmrg extern bool lang_GNU_CXX (void);
60410d565efSmrg extern bool lang_GNU_Fortran (void);
60510d565efSmrg extern bool lang_GNU_OBJC (void);
60610d565efSmrg 
60710d565efSmrg #endif /* GCC_LANG_HOOKS_H */
608