GCC Middle and Back End API Reference
lang_hooks Struct Reference

#include <langhooks.h>

Collaboration diagram for lang_hooks:

Data Fields

const char * name
size_t identifier_size
void(* free_lang_data )(tree)
size_t(* tree_size )(enum tree_code)
unsigned int(* option_lang_mask )(void)
void(* init_options_struct )(struct gcc_options *opts)
void(* init_options )(unsigned int decoded_options_count, struct cl_decoded_option *decoded_options)
void(* initialize_diagnostics )(diagnostic_context *)
bool(* complain_wrong_lang_p )(const struct cl_option *option)
bool(* handle_option )(size_t code, const char *arg, int value, int kind, location_t loc, const struct cl_option_handlers *handlers)
bool(* post_options )(const char **)
bool(* init )(void)
void(* finish )(void)
void(* parse_file )(void)
bool(* missing_noreturn_ok_p )(tree)
alias_set_type(* get_alias_set )(tree)
void(* finish_incomplete_decl )(tree)
void(* dup_lang_specific_decl )(tree)
void(* set_decl_assembler_name )(tree)
void(* print_statistics )(void)
lang_print_tree_hook print_xnode
lang_print_tree_hook print_decl
lang_print_tree_hook print_type
lang_print_tree_hook print_identifier
const char *(* decl_printable_name )(tree decl, int verbosity)
const char *(* dwarf_name )(tree, int verbosity)
int(* types_compatible_p )(tree x, tree y)
void(* print_error_function )(diagnostic_context *, const char *, struct diagnostic_info *)
HOST_WIDE_INT(* to_target_charset )(HOST_WIDE_INT)
struct attribute_spec * attribute_table
struct attribute_spec * common_attribute_table
struct attribute_spec * format_attribute_table
struct lang_hooks_for_tree_inlining tree_inlining
struct lang_hooks_for_tree_dump tree_dump
struct lang_hooks_for_decls decls
struct lang_hooks_for_types types
struct lang_hooks_for_cilkplus cilkplus
struct lang_hooks_for_lto lto
tree(* get_innermost_generic_parms )(const_tree)
tree(* get_innermost_generic_args )(const_tree)
bool(* function_parameter_pack_p )(const_tree)
int(* gimplify_expr )(tree *, gimple_seq *, gimple_seq *)
tree(* builtin_function )(tree decl)
tree(* builtin_function_ext_scope )(tree decl)
void(* init_ts )(void)
tree(* expr_to_decl )(tree expr, bool *tc, bool *se)
tree(* eh_personality )(void)
tree(* eh_runtime_type )(tree)
tree(* eh_protect_cleanup_actions )(void)
bool(* block_may_fallthru )(const_tree)
bool eh_use_cxa_end_cleanup
bool deep_unsharing
bool chkp_supported

Detailed Description

   Language-specific hooks.  See langhooks-def.h for defaults.  

Field Documentation

struct attribute_spec* lang_hooks::attribute_table
     Pointers to machine-independent attribute tables, for front ends
     using attribs.c.  If one is NULL, it is ignored.  Respectively, a
     table of attributes specific to the language, a table of
     attributes common to two or more languages (to allow easy
     sharing), and a table of attributes for checking formats.  

Referenced by find_attribute_namespace().

bool(* lang_hooks::block_may_fallthru)(const_tree)
     Return true if a stmt can fallthru.  Used by block_may_fallthru
     to possibly handle language trees.  
tree(* lang_hooks::builtin_function)(tree decl)
     Do language specific processing in the builtin function DECL  

Referenced by add_builtin_function_common().

tree(* lang_hooks::builtin_function_ext_scope)(tree decl)
     Like builtin_function, but make sure the scope is the external scope.
     This is used to delay putting in back end builtin functions until the ISA
     that defines the builtin is declared via function specific target options,
     which can save memory for machines like the x86_64 that have multiple
     ISAs.  If this points to the same function as builtin_function, the
     backend must add all of the builtins at program initialization time.  
bool lang_hooks::chkp_supported
     True if this language allows pointers checker instrumentation.  
struct lang_hooks_for_cilkplus lang_hooks::cilkplus

Referenced by gimplify_omp_workshare().

struct attribute_spec* lang_hooks::common_attribute_table
bool(* lang_hooks::complain_wrong_lang_p)(const struct cl_option *option)
     Return true if a warning should be given about option OPTION,
     which is for the wrong language, false if it should be quietly
     ignored.  
const char*(* lang_hooks::decl_printable_name)(tree decl, int verbosity)
     Computes the name to use to print a declaration.  DECL is the
     non-NULL declaration in question.  VERBOSITY determines what
     information will be printed: 0: DECL_NAME, demangled as
     necessary.  1: and scope information.  2: and any other
     information that might be interesting, such as function parameter
     types in C++.  The name is in the internal character set and
     needs to be converted to the locale character set of diagnostics,
     or to the execution character set for strings such as
     __PRETTY_FUNCTION__.  

Referenced by convert_gimple_call(), lhd_print_error_function(), maybe_init_pretty_print(), and symtab_dissolve_same_comdat_group_list().

bool lang_hooks::deep_unsharing
     True if this language requires deep unsharing of tree nodes prior to
     gimplification.  
void(* lang_hooks::dup_lang_specific_decl)(tree)
     Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
     DECL_NODE with a newly GC-allocated copy.  

Referenced by canonicalize_component_ref(), and mark_local_labels_stmt().

const char*(* lang_hooks::dwarf_name)(tree, int verbosity)
     Computes the dwarf-2/3 name for a tree.  VERBOSITY determines what
     information will be printed: 0: DECL_NAME, demangled as
     necessary.  1: and scope information.  
tree(* lang_hooks::eh_personality)(void)
     The EH personality function decl.  
tree(* lang_hooks::eh_protect_cleanup_actions)(void)
     If non-NULL, this is a function that returns a function decl to be
     executed if an unhandled exception is propagated out of a cleanup
     region.  For example, in C++, an exception thrown by a destructor
     during stack unwinding is required to result in a call to
     `std::terminate', so the C++ version of this function returns a
     FUNCTION_DECL for `std::terminate'.  

Referenced by lower_try_finally_dup_block().

tree(* lang_hooks::eh_runtime_type)(tree)
     Map a type to a runtime object to match type.  

Referenced by t2r_eq().

bool lang_hooks::eh_use_cxa_end_cleanup
     True if this language uses __cxa_end_cleanup when the ARM EABI
     is enabled.  
tree(* lang_hooks::expr_to_decl)(tree expr, bool *tc, bool *se)
     Called by recompute_tree_invariant_for_addr_expr to go from EXPR
     to a contained expression or DECL, possibly updating *TC or *SE
     if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating.  
void(* lang_hooks::finish)(void)
     Called at the end of compilation, as a finalizer.  
void(* lang_hooks::finish_incomplete_decl)(tree)
     Function to finish handling an incomplete decl at the end of
     compilation.  Default hook is does nothing.  
struct attribute_spec* lang_hooks::format_attribute_table
void(* lang_hooks::free_lang_data)(tree)
     Remove any parts of the tree that are used only by the FE. 

Referenced by comp_type_attributes().

bool(* lang_hooks::function_parameter_pack_p)(const_tree)
     Determine if a tree is a function parameter pack.  
alias_set_type(* lang_hooks::get_alias_set)(tree)
     Called to obtain the alias set to be used for an expression or type.
     Returns -1 if the language does nothing special for it.  

Referenced by alias_ptr_types_compatible_p().

tree(* lang_hooks::get_innermost_generic_args)(const_tree)
     Returns the TREE_VEC of arguments of an instantiation
     of a generic type of decl, e.g. C++ template instantiation.  

Referenced by output_one_line_info_table().

tree(* lang_hooks::get_innermost_generic_parms)(const_tree)
     Returns a TREE_VEC of the generic parameters of an instantiation of
     a generic type or decl, e.g. C++ template instantiation.  If
     TREE_CHAIN of the return value is set, it is an INTEGER_CST
     indicating how many of the elements are non-default.  

Referenced by output_one_line_info_table().

int(* lang_hooks::gimplify_expr)(tree *, gimple_seq *, gimple_seq *)
     Perform language-specific gimplification on the argument.  Returns an
     enum gimplify_status, though we can't see that type here.  
bool(* lang_hooks::handle_option)(size_t code, const char *arg, int value, int kind, location_t loc, const struct cl_option_handlers *handlers)
     Handle the switch CODE, which has real type enum opt_code from
     options.h.  If the switch takes an argument, it is passed in ARG
     which points to permanent storage.  The handler is responsible for
     checking whether ARG is NULL, which indicates that no argument
     was in fact supplied.  For -f and -W switches, VALUE is 1 or 0
     for the positive and negative forms respectively.  HANDLERS should
     be passed to any recursive handle_option calls.  LOC is the
     location of the option.

     Return true if the switch is valid, false if invalid.  
size_t lang_hooks::identifier_size
     sizeof (struct lang_identifier), so make_node () creates
     identifier nodes long enough for the language-specific slots.  
bool(* lang_hooks::init)(void)
     Called after post_options to initialize the front end.  Return
     false to indicate that no further compilation be performed, in
     which case the finish hook is called immediately.  
void(* lang_hooks::init_options)(unsigned int decoded_options_count, struct cl_decoded_option *decoded_options)
     After the initialize_diagnostics hook is called, do any simple
     initialization needed before any calls to handle_option, other
     than that done by the init_options_struct hook.  
void(* lang_hooks::init_options_struct)(struct gcc_options *opts)
     Initialize variables in an options structure.  
void(* lang_hooks::init_ts)(void)
     Used to set up the tree_contains_structure array for a frontend. 
void(* lang_hooks::initialize_diagnostics)(diagnostic_context *)
     Callback used to perform language-specific initialization for the
     global diagnostic context structure.  
struct lang_hooks_for_lto lang_hooks::lto

Referenced by lto_write_stream().

bool(* lang_hooks::missing_noreturn_ok_p)(tree)
     Determines if it's ok for a function to have no noreturn attribute.  
const char* lang_hooks::name
     String identifying the front end.  e.g. "GNU C++".  

Referenced by build3_stat().

unsigned int(* lang_hooks::option_lang_mask)(void)
     Return the language mask used for converting argv into a sequence
     of options.  
void(* lang_hooks::parse_file)(void)
     Parses the entire file.  
bool(* lang_hooks::post_options)(const char **)
     Called when all command line options have been parsed to allow
     further processing and initialization

     Should return true to indicate that a compiler back-end is
     not required, such as with the -E option.

     If errorcount is nonzero after this call the compiler exits
     immediately and the finish hook is not called.  
lang_print_tree_hook lang_hooks::print_decl
     Called to print language-dependent parts of tcc_decl, tcc_type,
     and IDENTIFIER_NODE nodes.  

Referenced by debug_tree().

void(* lang_hooks::print_error_function)(diagnostic_context *, const char *, struct diagnostic_info *)
     Called by report_error_function to print out function name.  

Referenced by diagnostic_report_current_function().

lang_print_tree_hook lang_hooks::print_identifier

Referenced by debug_tree().

void(* lang_hooks::print_statistics)(void)
     The front end can add its own statistics to -fmem-report with
     this hook.  It should output to stderr.  
lang_print_tree_hook lang_hooks::print_type

Referenced by debug_tree().

lang_print_tree_hook lang_hooks::print_xnode
     Called by print_tree when there is a tree of class tcc_exceptional
     that it doesn't know how to display.  
void(* lang_hooks::set_decl_assembler_name)(tree)
     Set the DECL_ASSEMBLER_NAME for a node.  If it is the sort of
     thing that the assembler should talk about, set
     DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE.
     Otherwise, set it to the ERROR_MARK_NODE to ensure that the
     assembler does not talk about it.  
HOST_WIDE_INT(* lang_hooks::to_target_charset)(HOST_WIDE_INT)
     Convert a character from the host's to the target's character
     set.  The character should be in what C calls the "basic source
     character set" (roughly, the set of characters defined by plain
     old ASCII).  The default is to return the character unchanged,
     which is correct in most circumstances.  Note that both argument
     and result should be sign-extended under -fsigned-char,
     zero-extended under -fno-signed-char.  
struct lang_hooks_for_tree_dump lang_hooks::tree_dump
struct lang_hooks_for_tree_inlining lang_hooks::tree_inlining
size_t(* lang_hooks::tree_size)(enum tree_code)
     Determines the size of any language-specific tcc_constant or
     tcc_exceptional nodes.  Since it is called from make_node, the
     only information available is the tree code.  Expected to die
     on unrecognized codes.  
int(* lang_hooks::types_compatible_p)(tree x, tree y)
     This compares two types for equivalence ("compatible" in C-based languages).
     This routine should only return 1 if it is sure.  It should not be used
     in contexts where erroneously returning 0 causes problems.  

The documentation for this struct was generated from the following file: