GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "insn-codes.h"
#include "optabs-libfuncs.h"
#include "libfuncs.h"
#include "optabs-query.h"
#include "tree.h"
#include "stringpool.h"
#include "varasm.h"
#include "stor-layout.h"
#include "rtl.h"
#include "gt-optabs-libfuncs.h"
Data Structures | |
struct | libfunc_decl_hasher |
Macros | |
#define | libfunc_hash (this_target_libfuncs->x_libfunc_hash) |
#define | DECIMAL_PREFIX "dpd_" |
Functions | |
rtx | convert_optab_libfunc (convert_optab optab, machine_mode mode1, machine_mode mode2) |
rtx | optab_libfunc (optab optab, machine_mode mode) |
static void | gen_libfunc (optab optable, const char *opname, int suffix, machine_mode mode) |
void | gen_int_libfunc (optab optable, const char *opname, char suffix, machine_mode mode) |
void | gen_fp_libfunc (optab optable, const char *opname, char suffix, machine_mode mode) |
void | gen_fixed_libfunc (optab optable, const char *opname, char suffix, machine_mode mode) |
void | gen_signed_fixed_libfunc (optab optable, const char *opname, char suffix, machine_mode mode) |
void | gen_unsigned_fixed_libfunc (optab optable, const char *opname, char suffix, machine_mode mode) |
void | gen_int_fp_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_intv_fp_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_int_fp_fixed_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_int_fp_signed_fixed_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_int_fixed_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_int_signed_fixed_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_int_unsigned_fixed_libfunc (optab optable, const char *name, char suffix, machine_mode mode) |
void | gen_interclass_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_int_to_fp_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_ufloat_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_int_to_fp_nondecimal_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_fp_to_int_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_intraclass_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_trunc_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_extend_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_fract_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_fractuns_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_satfract_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
void | gen_satfractuns_conv_libfunc (convert_optab tab, const char *opname, machine_mode tmode, machine_mode fmode) |
tree | build_libfunc_function_visibility (const char *name, symbol_visibility vis) |
tree | build_libfunc_function (const char *name) |
rtx | init_one_libfunc_visibility (const char *name, symbol_visibility vis) |
rtx | init_one_libfunc (const char *name) |
rtx | set_user_assembler_libfunc (const char *name, const char *asmspec) |
void | set_optab_libfunc (optab op, machine_mode mode, const char *name) |
void | set_conv_libfunc (convert_optab optab, machine_mode tmode, machine_mode fmode, const char *name) |
void | init_optabs (void) |
static void | init_sync_libfuncs_1 (optab tab, const char *base, int max) |
void | init_sync_libfuncs (int max) |
Variables | |
struct target_libfuncs | default_target_libfuncs |
static hash_table< libfunc_decl_hasher > * | libfunc_decls |
#define DECIMAL_PREFIX "dpd_" |
Prefixes for the current version of decimal floating point (BID vs. DPD)
Referenced by gen_fp_libfunc(), gen_interclass_conv_libfunc(), and gen_intraclass_conv_libfunc().
#define libfunc_hash (this_target_libfuncs->x_libfunc_hash) |
Referenced by convert_optab_libfunc(), init_optabs(), optab_libfunc(), set_conv_libfunc(), and set_optab_libfunc().
tree build_libfunc_function | ( | const char * | name | ) |
Build a decl for a libfunc named NAME.
References build_libfunc_function_visibility(), and VISIBILITY_DEFAULT.
tree build_libfunc_function_visibility | ( | const char * | name, |
symbol_visibility | vis ) |
Build a decl for a libfunc named NAME with visibility VIS.
References build_decl(), build_function_type(), DECL_ARTIFICIAL, DECL_ASSEMBLER_NAME, DECL_EXTERNAL, DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, gcc_assert, get_identifier(), integer_type_node, NULL_TREE, TREE_PUBLIC, and UNKNOWN_LOCATION.
Referenced by build_libfunc_function(), and init_one_libfunc_visibility().
rtx convert_optab_libfunc | ( | convert_optab | optab, |
machine_mode | mode1, | ||
machine_mode | mode2 ) |
Return libfunc corresponding operation defined by OPTAB converting from MODE2 to MODE1. Trigger lazy initialization if needed, return NULL if no libfunc is available.
References libfunc_hash, libfunc_entry::mode1, libfunc_entry::mode2, NULL, NULL_RTX, and libfunc_entry::op.
Referenced by convert_mode_scalar(), debug_optab_libfuncs(), expand_fix(), expand_fixed_convert(), and expand_float().
void gen_extend_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Pick proper libcall for extend_optab. We need to chose if we do truncation or extension and interclass or intraclass.
References gen_interclass_conv_libfunc(), gen_intraclass_conv_libfunc(), GET_MODE_CLASS, GET_MODE_PRECISION(), and is_a().
void gen_fixed_libfunc | ( | optab | optable, |
const char * | opname, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that fixed-point operation is involved.
References ALL_FIXED_POINT_MODE_P, and gen_libfunc().
Referenced by gen_int_fixed_libfunc(), and gen_int_fp_fixed_libfunc().
void gen_fp_libfunc | ( | optab | optable, |
const char * | opname, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that FP and set decimal prefix if needed.
References DECIMAL_FLOAT_MODE_P, DECIMAL_PREFIX, gen_libfunc(), and GET_MODE_CLASS.
Referenced by gen_int_fp_fixed_libfunc(), gen_int_fp_libfunc(), gen_int_fp_signed_fixed_libfunc(), and gen_intv_fp_libfunc().
void gen_fp_to_int_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Same as gen_interclass_conv_libfunc but verify that we are producing fp->int conversion with no decimal floating point involved.
References DECIMAL_FLOAT_MODE_P, gen_interclass_conv_libfunc(), and GET_MODE_CLASS.
void gen_fract_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Pick proper libcall for fract_optab. We need to chose if we do interclass or intraclass.
References ALL_FIXED_POINT_MODE_P, gen_interclass_conv_libfunc(), gen_intraclass_conv_libfunc(), and GET_MODE_CLASS.
void gen_fractuns_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Pick proper libcall for fractuns_optab.
References ALL_FIXED_POINT_MODE_P, gen_interclass_conv_libfunc(), and GET_MODE_CLASS.
void gen_int_fixed_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that INT or FIXED operation is involved.
References ALL_FIXED_POINT_MODE_P, gen_fixed_libfunc(), gen_int_libfunc(), and INTEGRAL_MODE_P.
void gen_int_fp_fixed_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that FP or INT or FIXED operation is involved.
References ALL_FIXED_POINT_MODE_P, DECIMAL_FLOAT_MODE_P, gen_fixed_libfunc(), gen_fp_libfunc(), gen_int_libfunc(), GET_MODE_CLASS, and INTEGRAL_MODE_P.
void gen_int_fp_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that FP or INT operation is involved.
References DECIMAL_FLOAT_MODE_P, gen_fp_libfunc(), gen_int_libfunc(), GET_MODE_CLASS, and INTEGRAL_MODE_P.
void gen_int_fp_signed_fixed_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that FP or INT or signed FIXED operation is involved.
References DECIMAL_FLOAT_MODE_P, gen_fp_libfunc(), gen_int_libfunc(), gen_signed_fixed_libfunc(), GET_MODE_CLASS, INTEGRAL_MODE_P, and SIGNED_FIXED_POINT_MODE_P.
void gen_int_libfunc | ( | optab | optable, |
const char * | opname, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that integer operation is involved.
References BITS_PER_WORD, gen_libfunc(), GET_MODE_BITSIZE(), INT_TYPE_SIZE, is_int_mode(), LONG_LONG_TYPE_SIZE, trapv_binoptab_p(), and trapv_unoptab_p().
Referenced by gen_int_fixed_libfunc(), gen_int_fp_fixed_libfunc(), gen_int_fp_libfunc(), gen_int_fp_signed_fixed_libfunc(), gen_int_signed_fixed_libfunc(), gen_int_unsigned_fixed_libfunc(), and gen_intv_fp_libfunc().
void gen_int_signed_fixed_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that INT or signed FIXED operation is involved.
References gen_int_libfunc(), gen_signed_fixed_libfunc(), INTEGRAL_MODE_P, and SIGNED_FIXED_POINT_MODE_P.
void gen_int_to_fp_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Same as gen_interclass_conv_libfunc but verify that we are producing int->fp conversion.
References DECIMAL_FLOAT_MODE_P, gen_interclass_conv_libfunc(), and GET_MODE_CLASS.
Referenced by gen_ufloat_conv_libfunc().
void gen_int_to_fp_nondecimal_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Same as gen_interclass_conv_libfunc but verify that we are producing fp->int conversion.
References gen_interclass_conv_libfunc(), and GET_MODE_CLASS.
void gen_int_unsigned_fixed_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that INT or unsigned FIXED operation is involved.
References gen_int_libfunc(), gen_unsigned_fixed_libfunc(), INTEGRAL_MODE_P, and UNSIGNED_FIXED_POINT_MODE_P.
void gen_interclass_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Initialize the libfunc fields of an entire group of entries of an inter-mode-class conversion optab. The string formation rules are similar to the ones for init_libfuncs, above, but instead of having a mode name and an operand count these functions have two mode names and no operand count.
References DECIMAL_FLOAT_MODE_P, DECIMAL_PREFIX, GET_MODE_NAME, ggc_alloc_string(), set_conv_libfunc(), and targetm.
Referenced by gen_extend_conv_libfunc(), gen_fp_to_int_conv_libfunc(), gen_fract_conv_libfunc(), gen_fractuns_conv_libfunc(), gen_int_to_fp_conv_libfunc(), gen_int_to_fp_nondecimal_conv_libfunc(), gen_satfract_conv_libfunc(), gen_satfractuns_conv_libfunc(), and gen_trunc_conv_libfunc().
void gen_intraclass_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Initialize the libfunc fields of an of an intra-mode-class conversion optab. The string formation rules are similar to the ones for init_libfunc, above.
References DECIMAL_FLOAT_MODE_P, DECIMAL_PREFIX, GET_MODE_NAME, ggc_alloc_string(), set_conv_libfunc(), and targetm.
Referenced by gen_extend_conv_libfunc(), gen_fract_conv_libfunc(), gen_satfract_conv_libfunc(), and gen_trunc_conv_libfunc().
void gen_intv_fp_libfunc | ( | optab | optable, |
const char * | name, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that FP or INT operation is involved and add 'v' suffix for integer operation.
References DECIMAL_FLOAT_MODE_P, gen_fp_libfunc(), gen_int_libfunc(), and GET_MODE_CLASS.
|
static |
Initialize the libfunc fields of an entire group of entries in some optab. Each entry is set equal to a string consisting of a leading pair of underscores followed by a generic operation name followed by a mode name (downshifted to lowercase) followed by a single character representing the number of operands for the given operation (which is usually one of the characters '2', '3', or '4'). OPTABLE is the table in which libfunc fields are to be initialized. OPNAME is the generic (string) name of the operation. SUFFIX is the character which specifies the number of operands for the given generic operation. MODE is the mode to generate for.
References GET_MODE_NAME, ggc_alloc_string(), set_optab_libfunc(), and targetm.
Referenced by gen_fixed_libfunc(), gen_fp_libfunc(), gen_int_libfunc(), gen_signed_fixed_libfunc(), and gen_unsigned_fixed_libfunc().
void gen_satfract_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Pick proper libcall for satfract_optab. We need to chose if we do interclass or intraclass.
References ALL_FIXED_POINT_MODE_P, gen_interclass_conv_libfunc(), gen_intraclass_conv_libfunc(), and GET_MODE_CLASS.
void gen_satfractuns_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Pick proper libcall for satfractuns_optab.
References ALL_FIXED_POINT_MODE_P, gen_interclass_conv_libfunc(), and GET_MODE_CLASS.
void gen_signed_fixed_libfunc | ( | optab | optable, |
const char * | opname, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that signed fixed-point operation is involved.
References gen_libfunc(), and SIGNED_FIXED_POINT_MODE_P.
Referenced by gen_int_fp_signed_fixed_libfunc(), and gen_int_signed_fixed_libfunc().
void gen_trunc_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
Pick proper libcall for trunc_optab. We need to chose if we do truncation or extension and interclass or intraclass.
References arm_bfloat_half_format, gen_interclass_conv_libfunc(), gen_intraclass_conv_libfunc(), GET_MODE_CLASS, GET_MODE_PRECISION(), ibm_extended_format, ieee_half_format, ieee_quad_format, is_a(), and REAL_MODE_FORMAT.
void gen_ufloat_conv_libfunc | ( | convert_optab | tab, |
const char * | opname, | ||
machine_mode | tmode, | ||
machine_mode | fmode ) |
ufloat_optab is special by using floatun for FP and floatuns decimal fp naming scheme.
References DECIMAL_FLOAT_MODE_P, and gen_int_to_fp_conv_libfunc().
void gen_unsigned_fixed_libfunc | ( | optab | optable, |
const char * | opname, | ||
char | suffix, | ||
machine_mode | mode ) |
Like gen_libfunc, but verify that unsigned fixed-point operation is involved.
References gen_libfunc(), and UNSIGNED_FIXED_POINT_MODE_P.
Referenced by gen_int_unsigned_fixed_libfunc().
rtx init_one_libfunc | ( | const char * | name | ) |
References init_one_libfunc_visibility(), and VISIBILITY_DEFAULT.
Referenced by allocate_dynamic_stack_space(), asan_emit_allocas_unpoison(), asan_emit_stack_protection(), default_memtag_insert_random_tag(), expand_asan_emit_allocas_unpoison(), expand_BITINTTOFLOAT(), expand_DIVMODBITINT(), expand_FLOATTOBITINT(), expand_HWASAN_ALLOCA_UNPOISON(), expand_HWASAN_MARK(), expand_main_function(), expand_MULBITINT(), hwasan_emit_prologue(), hwasan_emit_untag_frame(), init_optabs(), set_conv_libfunc(), and set_optab_libfunc().
rtx init_one_libfunc_visibility | ( | const char * | name, |
symbol_visibility | vis ) |
Return a libfunc for NAME, creating one if we don't already have one. The decl is given visibility VIS. The returned rtx is a SYMBOL_REF.
References build_libfunc_function_visibility(), hash_table< Descriptor, Lazy, Allocator >::create_ggc(), DECL_RTL, get_identifier(), IDENTIFIER_HASH_VALUE, libfunc_decls, NULL, and XEXP.
Referenced by init_one_libfunc().
void init_optabs | ( | void | ) |
Call this to initialize the contents of the optabs appropriately for the current target machine.
References BITS_PER_WORD, complex_double_type_node, hash_table< Descriptor, Lazy, Allocator >::create_ggc(), init_one_libfunc(), int_mode_for_size(), INT_TYPE_SIZE, libfunc_hash, opt_mode< T >::require(), set_optab_libfunc(), targetm, this_fn_optabs, TYPE_MODE, unwind_sjlj_register_libfunc, and unwind_sjlj_unregister_libfunc.
Referenced by lang_dependent_init_target().
void init_sync_libfuncs | ( | int | max | ) |
References init_sync_libfuncs_1().
|
static |
A helper function for init_sync_libfuncs. Using the basename BASE, install libfuncs into TAB for BASE_N for 1 <= N <= MAX.
References gcc_assert, GET_MODE_2XWIDER_MODE(), i, and set_optab_libfunc().
Referenced by init_sync_libfuncs().
Return libfunc corresponding operation defined by OPTAB in MODE. Trigger lazy initialization if needed, return NULL if no libfunc is available.
References libfunc_hash, libfunc_entry::mode1, libfunc_entry::mode2, NULL, NULL_RTX, and libfunc_entry::op.
Referenced by can_compare_and_swap_p(), debug_optab_libfuncs(), expand_atomic_compare_and_swap(), expand_atomic_fetch_op(), expand_binop(), expand_builtin_powi(), expand_DIVMOD(), expand_divmod(), expand_twoval_binop_libfunc(), expand_unop(), get_compute_type(), maybe_emit_sync_lock_test_and_set(), prepare_cmp_insn(), prepare_float_lib_cmp(), target_supports_divmod_p(), and vectorizable_operation().
void set_conv_libfunc | ( | convert_optab | optab, |
machine_mode | tmode, | ||
machine_mode | fmode, | ||
const char * | name ) |
Call this to reset the function entry for one conversion optab (OPTABLE) from mode FMODE to mode TMODE to NAME, which should be either 0 or a string constant.
References ggc_alloc(), init_one_libfunc(), libfunc_hash, libfunc_entry::mode1, libfunc_entry::mode2, NULL, and libfunc_entry::op.
Referenced by gen_interclass_conv_libfunc(), and gen_intraclass_conv_libfunc().
void set_optab_libfunc | ( | optab | op, |
machine_mode | mode, | ||
const char * | name ) |
Call this to reset the function entry for one optab (OPTABLE) in mode MODE to NAME, which should be either 0 or a string constant.
References ggc_alloc(), init_one_libfunc(), libfunc_hash, libfunc_entry::mode1, libfunc_entry::mode2, NULL, and libfunc_entry::op.
Referenced by gen_libfunc(), init_optabs(), init_sync_libfuncs_1(), and set_builtin_user_assembler_name().
rtx set_user_assembler_libfunc | ( | const char * | name, |
const char * | asmspec ) |
Adjust the assembler name of libfunc NAME to ASMSPEC.
References DECL_RTL, gcc_assert, get_identifier(), IDENTIFIER_HASH_VALUE, libfunc_decls, set_user_assembler_name(), and XEXP.
Referenced by set_builtin_user_assembler_name().
struct target_libfuncs default_target_libfuncs |
Mapping from optabs to underlying library functions Copyright (C) 1987-2024 Free Software Foundation, Inc. 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/>.
|
static |
A table of previously-created libfuncs, hashed by name.
Referenced by init_one_libfunc_visibility(), and set_user_assembler_libfunc().