GCC Middle and Back End API 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"
Variables | |
static section * | saved_section |
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 |
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 a@re dhat. 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.
tree lhd_do_nothing_iii_return_null_tree | ( | int | ARG_UNUSEDi, |
int | ARG_UNUSEDj, | ||
int | ARG_UNUSEDk | ||
) |
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.
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 | ||
) |
The default function to print out name of current function that caused an error.
References _, BLOCK_ABSTRACT_ORIGIN, BLOCK_SOURCE_LOCATION, BLOCK_SUPERCONTEXT, lang_hooks::decl_printable_name, expand_location(), identifier_to_locale(), NULL, pp_comma, pp_newline(), pp_printf(), diagnostic_context::printer, diagnostic_context::show_column, and TREE_CODE.
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.
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.
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.
|
static |
LTO hooks. Used to save and restore any previously active section.