GCC Middle and Back End API Reference
optabs-libfuncs.cc File 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"
Include dependency graph for optabs-libfuncs.cc:

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
 

Macro Definition Documentation

◆ DECIMAL_PREFIX

#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().

◆ libfunc_hash

#define libfunc_hash    (this_target_libfuncs->x_libfunc_hash)

Function Documentation

◆ build_libfunc_function()

tree build_libfunc_function ( const char * name)
Build a decl for a libfunc named NAME.   

References build_libfunc_function_visibility(), and VISIBILITY_DEFAULT.

◆ build_libfunc_function_visibility()

tree build_libfunc_function_visibility ( const char * name,
symbol_visibility vis )

◆ convert_optab_libfunc()

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().

◆ gen_extend_conv_libfunc()

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().

◆ gen_fixed_libfunc()

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().

◆ gen_fp_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().

◆ gen_fp_to_int_conv_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.

◆ gen_fract_conv_libfunc()

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.

◆ gen_fractuns_conv_libfunc()

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.

◆ gen_int_fixed_libfunc()

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.

◆ gen_int_fp_fixed_libfunc()

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.

◆ gen_int_fp_libfunc()

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.

◆ gen_int_fp_signed_fixed_libfunc()

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.

◆ gen_int_libfunc()

void gen_int_libfunc ( optab optable,
const char * opname,
char suffix,
machine_mode mode )

◆ gen_int_signed_fixed_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.

◆ gen_int_to_fp_conv_libfunc()

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().

◆ gen_int_to_fp_nondecimal_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.

◆ gen_int_unsigned_fixed_libfunc()

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.

◆ gen_interclass_conv_libfunc()

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().

◆ gen_intraclass_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().

◆ gen_intv_fp_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.

◆ gen_libfunc()

static void gen_libfunc ( optab optable,
const char * opname,
int suffix,
machine_mode mode )
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().

◆ gen_satfract_conv_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.

◆ gen_satfractuns_conv_libfunc()

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.

◆ gen_signed_fixed_libfunc()

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().

◆ gen_trunc_conv_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.

◆ gen_ufloat_conv_libfunc()

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().

◆ gen_unsigned_fixed_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().

◆ init_one_libfunc()

◆ init_one_libfunc_visibility()

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().

◆ init_optabs()

◆ init_sync_libfuncs()

void init_sync_libfuncs ( int max)

◆ init_sync_libfuncs_1()

static void init_sync_libfuncs_1 ( optab tab,
const char * base,
int max )
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().

◆ optab_libfunc()

◆ set_conv_libfunc()

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().

◆ set_optab_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().

◆ set_user_assembler_libfunc()

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().

Variable Documentation

◆ default_target_libfuncs

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/>.   

◆ libfunc_decls

hash_table<libfunc_decl_hasher>* libfunc_decls
static
A table of previously-created libfuncs, hashed by name.   

Referenced by init_one_libfunc_visibility(), and set_user_assembler_libfunc().