GCC Middle and Back End API Reference
langhooks.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "intl.h"
#include "tm.h"
#include "toplev.h"
#include "tree.h"
#include "tree-inline.h"
#include "gimple.h"
#include "rtl.h"
#include "insn-config.h"
#include "flags.h"
#include "langhooks.h"
#include "target.h"
#include "langhooks-def.h"
#include "ggc.h"
#include "diagnostic.h"
#include "tree-diagnostic.h"
#include "cgraph.h"
#include "timevar.h"
#include "output.h"
Include dependency graph for langhooks.c:

Functions

void lhd_do_nothing ()
void lhd_do_nothing_t (tree ARG_UNUSED(t))
tree lhd_pass_through_t ()
tree lhd_do_nothing_iii_return_null_tree (int ARG_UNUSED(i), int ARG_UNUSED(j), int ARG_UNUSED(k))
void lhd_do_nothing_f (struct function *ARG_UNUSED(f))
tree lhd_return_null_tree_v ()
tree lhd_return_null_tree (tree ARG_UNUSED(t))
tree lhd_return_null_const_tree (const_tree ARG_UNUSED(t))
bool lhd_post_options (const char **ARG_UNUSED(pfilename))
void lhd_print_tree_nothing (FILE *ARG_UNUSED(file), tree ARG_UNUSED(node), int ARG_UNUSED(indent))
bool lhd_warn_unused_global_decl ()
void lhd_set_decl_assembler_name ()
tree lhd_type_promotes_to (tree ARG_UNUSED(type))
void lhd_register_builtin_type (tree ARG_UNUSED(type), const char *ARG_UNUSED(name))
void lhd_incomplete_type_error (const_tree ARG_UNUSED(value), const_tree type)
alias_set_type lhd_get_alias_set (tree ARG_UNUSED(t))
const char * lhd_decl_printable_name (tree decl, int ARG_UNUSED(verbosity))
const char * lhd_dwarf_name ()
int lhd_types_compatible_p ()
bool lhd_tree_dump_dump_tree ()
int lhd_tree_dump_type_quals ()
int lhd_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
size_t lhd_tree_size ()
bool lhd_decl_ok_for_sibcall ()
void write_global_declarations ()
void lhd_initialize_diagnostics ()
void lhd_init_options (unsigned int decoded_options_count, struct cl_decoded_option *decoded_options)
bool lhd_complain_wrong_lang_p ()
bool lhd_handle_option (size_t code, const char *arg, int value, int kind, location_t loc, const struct cl_option_handlers *handlers)
void lhd_print_error_function (diagnostic_context *context, const char *file, diagnostic_info *diagnostic)
tree lhd_make_node ()
HOST_WIDE_INT lhd_to_target_charset ()
tree lhd_expr_to_decl ()
enum omp_clause_default_kind lhd_omp_predetermined_sharing ()
tree lhd_omp_assignment ()
void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *c, tree t)
bool lhd_omp_mappable_type ()
static tree add_builtin_function_common (const char *name, tree type, int function_code, enum built_in_class cl, const char *library_name, tree attrs, tree(*hook)(tree))
tree add_builtin_function (const char *name, tree type, int function_code, enum built_in_class cl, const char *library_name, tree attrs)
tree add_builtin_function_ext_scope (const char *name, tree type, int function_code, enum built_in_class cl, const char *library_name, tree attrs)
tree lhd_builtin_function ()
tree add_builtin_type ()
void lhd_begin_section ()
void lhd_append_data ()
void lhd_end_section ()
void lhd_install_body_with_frame_cleanup ()
bool lhd_cilk_detect_spawn ()

Variables

static sectionsaved_section

Function Documentation

tree add_builtin_function ( const char *  name,
tree  type,
int  function_code,
enum built_in_class  cl,
const char *  library_name,
tree  attrs 
)

Create a builtin function.

static tree add_builtin_function_common ( const char *  name,
tree  type,
int  function_code,
enum built_in_class  cl,
const char *  library_name,
tree  attrs,
tree(*)(tree hook 
)
static

Common function for add_builtin_function and add_builtin_function_ext_scope.

DECL_FUNCTION_CODE is a bitfield; verify that the value fits.

 Possibly apply some default attributes to this built-in function.   

References lang_hooks::builtin_function.

tree add_builtin_function_ext_scope ( const char *  name,
tree  type,
int  function_code,
enum built_in_class  cl,
const char *  library_name,
tree  attrs 
)

Like add_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.

tree add_builtin_type ( )

Create a builtin type.

References NULL, and switch_to_section().

void lhd_append_data ( )

Write DATA of length LEN to the current LTO output section. This default implementation just calls assemble_string and frees BLOCK.

void lhd_begin_section ( )

Begin a new LTO output section named NAME. This default implementation saves the old section and emits assembly code to switch to the new section.

Save the old section so we can restore it in lto_end_asm_section.

 Create a new section and switch to it.   
tree lhd_builtin_function ( )

References assemble_string().

bool lhd_cilk_detect_spawn ( )

Empty function to handle cilk_valid_spawn.

bool lhd_complain_wrong_lang_p ( )

By default, always complain about options for the wrong language.

References BLOCK_ABSTRACT_ORIGIN, gcc_assert, and TREE_CODE.

bool lhd_decl_ok_for_sibcall ( )

Return true if decl, which is a function decl, may be called by a sibcall.

const char* lhd_decl_printable_name ( tree  decl,
int   ARG_UNUSEDverbosity 
)

This is the default decl_printable_name function.

References TYPE_MAIN_VARIANT.

void lhd_do_nothing ( void  )

Default language-specific hooks. Copyright (C) 2001-2013 Free Software Foundation, Inc. Contributed by Alexandre Oliva aoliv.nosp@m.a@re.nosp@m.dhat..nosp@m.com

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. Do nothing; in many cases the default hook.

void lhd_do_nothing_f ( struct function ARG_UNUSEDf)

Do nothing (function).

References NULL_TREE.

tree lhd_do_nothing_iii_return_null_tree ( int   ARG_UNUSEDi,
int   ARG_UNUSEDj,
int   ARG_UNUSED
)

Do nothing (int, int, int). Return NULL_TREE.

void lhd_do_nothing_t ( tree   ARG_UNUSEDt)

Do nothing (tree).

const char* lhd_dwarf_name ( )

This is the default dwarf_name function.

void lhd_end_section ( void  )

Finish the current LTO output section. This default implementation emits assembly code to switch to any section previously saved by lhd_begin_section.

tree lhd_expr_to_decl ( )
alias_set_type lhd_get_alias_set ( tree   ARG_UNUSEDt)

Provide a default routine for alias sets that always returns -1. This is used by languages that don't need to do anything special.

int lhd_gimplify_expr ( tree expr_p,
gimple_seq pre_p,
gimple_seq post_p 
)

lang_hooks.gimplify_expr re-writes *EXPR_P into GIMPLE form.

References lang_hooks::decls, lang_hooks_for_decls::getdecls, and timevar_start().

bool lhd_handle_option ( size_t  code,
const char *  arg,
int  value,
int  kind,
location_t  loc,
const struct cl_option_handlers handlers 
)

By default, no language-specific options are valid.

void lhd_incomplete_type_error ( const_tree   ARG_UNUSEDvalue,
const_tree  type 
)

Invalid use of an incomplete type.

void lhd_init_options ( unsigned int  decoded_options_count,
struct cl_decoded_option decoded_options 
)

Called to perform language-specific options initialization.

void lhd_initialize_diagnostics ( )

Called to perform language-specific initialization of CTX.

References diagnostic_abstract_origin, file_name_as_prefix(), NULL, pretty_printer::prefix, and diagnostic_context::printer.

void lhd_install_body_with_frame_cleanup ( )

Empty function that is replaced with appropriate language dependent frame cleanup function for _Cilk_spawn.

tree lhd_make_node ( )
tree lhd_omp_assignment ( )

Generate code to copy SRC to DST.

void lhd_omp_firstprivatize_type_sizes ( struct gimplify_omp_ctx c,
tree  t 
)

Register language specific type size variables as potentially OpenMP firstprivate variables.

bool lhd_omp_mappable_type ( )

Return true if TYPE is an OpenMP mappable type. By default return true if type is complete.

enum omp_clause_default_kind lhd_omp_predetermined_sharing ( )

Return sharing kind if OpenMP sharing attribute of DECL is predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise.

References build_decl, BUILTINS_LOCATION, DECL_BUILT_IN_CLASS, DECL_EXTERNAL, get_identifier(), and TREE_PUBLIC.

tree lhd_pass_through_t ( )

Pass through (tree).

References NULL_TREE.

bool lhd_post_options ( const char **  ARG_UNUSEDpfilename)

The default post options hook.

Excess precision other than "fast" requires front-end support.

void lhd_print_error_function ( diagnostic_context context,
const char *  file,
diagnostic_info diagnostic 
)
void lhd_print_tree_nothing ( FILE *  ARG_UNUSEDfile,
tree   ARG_UNUSEDnode,
int   ARG_UNUSEDindent 
)

Called from by print-tree.c.

void lhd_register_builtin_type ( tree   ARG_UNUSEDtype,
const char *  ARG_UNUSEDname 
)

Registration of machine- or os-specific builtin types.

tree lhd_return_null_const_tree ( const_tree   ARG_UNUSEDt)

Do nothing (return NULL_TREE).

References EXCESS_PRECISION_FAST.

tree lhd_return_null_tree ( tree   ARG_UNUSEDt)

Do nothing (return NULL_TREE).

References NULL_TREE.

tree lhd_return_null_tree_v ( void  )

Do nothing (return NULL_TREE).

References NULL_TREE.

void lhd_set_decl_assembler_name ( )

Set the DECL_ASSEMBLER_NAME for DECL.

The language-independent code should never use the DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and VAR_DECLs for variables with static storage duration need a real DECL_ASSEMBLER_NAME.

 By default, assume the name to use in assembly code is the same
 as that used in the source language.  (That's correct for C, and
 GCC used to set DECL_ASSEMBLER_NAME to the same value as
 DECL_NAME in build_decl, so this choice provides backwards
 compatibility with existing front-ends.  This assumption is wrapped
 in a target hook, to allow for target-specific modification of the
 identifier.

 Can't use just the variable's own name for a variable whose scope
 is less than the whole compilation.  Concatenate a distinguishing
 number - we use the DECL_UID.   

References ASM_FORMAT_PRIVATE_NAME, DECL_NAME, DECL_UID, get_identifier(), IDENTIFIER_POINTER, and targetm.

HOST_WIDE_INT lhd_to_target_charset ( )
bool lhd_tree_dump_dump_tree ( )

lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree nodes. Returns nonzero if it does not want the usual dumping of the second argument.

References gcc_unreachable.

int lhd_tree_dump_type_quals ( )

lang_hooks.tree_dump.type_qual: Determine type qualifiers in a language-specific way.

size_t lhd_tree_size ( )

lang_hooks.tree_size: Determine the size of a tree with code C, which is a language-specific tree code in category tcc_constant or tcc_exceptional. The default expects never to be called.

tree lhd_type_promotes_to ( tree   ARG_UNUSEDtype)

Type promotion for variable arguments.

int lhd_types_compatible_p ( )

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.

References GS_UNHANDLED.

bool lhd_warn_unused_global_decl ( )

Called from check_global_declarations.

This is what used to exist in check_global_declarations. Probably not many of these actually apply to non-C languages.

void write_global_declarations ( void  )

lang_hooks.decls.final_write_globals: perform final processing on global variables.

 Really define vars that have had only a tentative definition.
 Really output inline functions that must actually be callable
 and have not been output so far.   
 Process the decls in reverse order–earliest first.
 Put them into VEC from back to front, then take out from front.   
 This lang hook is dual-purposed, and also finalizes the
 compilation unit.   
 Clean up.   

Variable Documentation

section* saved_section
static

LTO hooks. Used to save and restore any previously active section.