LCOV - code coverage report
Current view: top level - gcc - targhooks.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 53.4 % 900 481
Test Date: 2026-11-14 16:39:50 Functions: 47.3 % 205 97
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Default target hook functions.
       2              :    Copyright (C) 2003-2026 Free Software Foundation, Inc.
       3              : 
       4              : This file is part of GCC.
       5              : 
       6              : GCC is free software; you can redistribute it and/or modify it under
       7              : the terms of the GNU General Public License as published by the Free
       8              : Software Foundation; either version 3, or (at your option) any later
       9              : version.
      10              : 
      11              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14              : for more details.
      15              : 
      16              : You should have received a copy of the GNU General Public License
      17              : along with GCC; see the file COPYING3.  If not see
      18              : <http://www.gnu.org/licenses/>.  */
      19              : 
      20              : /* The migration of target macros to target hooks works as follows:
      21              : 
      22              :    1. Create a target hook that uses the existing target macros to
      23              :       implement the same functionality.
      24              : 
      25              :    2. Convert all the MI files to use the hook instead of the macro.
      26              : 
      27              :    3. Repeat for a majority of the remaining target macros.  This will
      28              :       take some time.
      29              : 
      30              :    4. Tell target maintainers to start migrating.
      31              : 
      32              :    5. Eventually convert the backends to override the hook instead of
      33              :       defining the macros.  This will take some time too.
      34              : 
      35              :    6. TBD when, poison the macros.  Unmigrated targets will break at
      36              :       this point.
      37              : 
      38              :    Note that we expect steps 1-3 to be done by the people that
      39              :    understand what the MI does with each macro, and step 5 to be done
      40              :    by the target maintainers for their respective targets.
      41              : 
      42              :    Note that steps 1 and 2 don't have to be done together, but no
      43              :    target can override the new hook until step 2 is complete for it.
      44              : 
      45              :    Once the macros are poisoned, we will revert to the old migration
      46              :    rules - migrate the macro, callers, and targets all at once.  This
      47              :    comment can thus be removed at that point.  */
      48              : 
      49              : #include "config.h"
      50              : #include "system.h"
      51              : #include "coretypes.h"
      52              : #include "target.h"
      53              : #include "function.h"
      54              : #include "rtl.h"
      55              : #include "tree.h"
      56              : #include "tree-ssa-alias.h"
      57              : #include "gimple-expr.h"
      58              : #include "memmodel.h"
      59              : #include "backend.h"
      60              : #include "emit-rtl.h"
      61              : #include "df.h"
      62              : #include "tm_p.h"
      63              : #include "stringpool.h"
      64              : #include "tree-vrp.h"
      65              : #include "tree-ssanames.h"
      66              : #include "profile-count.h"
      67              : #include "optabs.h"
      68              : #include "regs.h"
      69              : #include "recog.h"
      70              : #include "diagnostic-core.h"
      71              : #include "fold-const.h"
      72              : #include "stor-layout.h"
      73              : #include "varasm.h"
      74              : #include "flags.h"
      75              : #include "explow.h"
      76              : #include "expmed.h"
      77              : #include "calls.h"
      78              : #include "expr.h"
      79              : #include "output.h"
      80              : #include "common/common-target.h"
      81              : #include "reload.h"
      82              : #include "intl.h"
      83              : #include "opts.h"
      84              : #include "gimplify.h"
      85              : #include "predict.h"
      86              : #include "real.h"
      87              : #include "langhooks.h"
      88              : #include "sbitmap.h"
      89              : #include "function-abi.h"
      90              : #include "attribs.h"
      91              : #include "asan.h"
      92              : #include "gimple.h"
      93              : #include "cfgloop.h"
      94              : #include "tree-vectorizer.h"
      95              : #include "options.h"
      96              : #include "case-cfn-macros.h"
      97              : #include "avoid-store-forwarding.h"
      98              : 
      99              : bool
     100            0 : default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED,
     101              :                               rtx addr ATTRIBUTE_UNUSED,
     102              :                               bool strict ATTRIBUTE_UNUSED,
     103              :                               code_helper ATTRIBUTE_UNUSED)
     104              : {
     105              : #ifdef GO_IF_LEGITIMATE_ADDRESS
     106              :   /* Defer to the old implementation using a goto.  */
     107              :   if (strict)
     108              :     return strict_memory_address_p (mode, addr);
     109              :   else
     110              :     return memory_address_p (mode, addr);
     111              : #else
     112            0 :   gcc_unreachable ();
     113              : #endif
     114              : }
     115              : 
     116              : void
     117        27393 : default_external_libcall (rtx fun ATTRIBUTE_UNUSED)
     118              : {
     119              : #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
     120        27393 :   ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
     121              : #endif
     122        27393 : }
     123              : 
     124              : int
     125      5922518 : default_unspec_may_trap_p (const_rtx x, unsigned flags)
     126              : {
     127      5922518 :   int i;
     128              : 
     129              :   /* Any floating arithmetic may trap.  */
     130      5922518 :   if ((SCALAR_FLOAT_MODE_P (GET_MODE (x)) && flag_trapping_math))
     131              :     return 1;
     132              : 
     133     10251563 :   for (i = 0; i < XVECLEN (x, 0); ++i)
     134              :     {
     135      7456389 :       if (may_trap_p_1 (XVECEXP (x, 0, i), flags))
     136              :         return 1;
     137              :     }
     138              : 
     139              :   return 0;
     140              : }
     141              : 
     142              : machine_mode
     143     16368990 : default_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
     144              :                                machine_mode mode,
     145              :                                int *punsignedp ATTRIBUTE_UNUSED,
     146              :                                const_tree funtype ATTRIBUTE_UNUSED,
     147              :                                int for_return ATTRIBUTE_UNUSED)
     148              : {
     149     16368990 :   if (type != NULL_TREE && for_return == 2)
     150      3709564 :     return promote_mode (type, mode, punsignedp);
     151              :   return mode;
     152              : }
     153              : 
     154              : machine_mode
     155            0 : default_promote_function_mode_always_promote (const_tree type,
     156              :                                               machine_mode mode,
     157              :                                               int *punsignedp,
     158              :                                               const_tree funtype ATTRIBUTE_UNUSED,
     159              :                                               int for_return ATTRIBUTE_UNUSED)
     160              : {
     161            0 :   return promote_mode (type, mode, punsignedp);
     162              : }
     163              : 
     164              : /* Sign-extend signed 8/16-bit integer arguments to 32 bits and
     165              :    zero-extend unsigned 8/16-bit integer arguments to 32 bits.  */
     166              : 
     167              : machine_mode
     168            0 : default_promote_function_mode_sign_extend (const_tree type,
     169              :                                            machine_mode mode,
     170              :                                            int *punsignedp,
     171              :                                            const_tree, int)
     172              : {
     173            0 :   if (GET_MODE_CLASS (mode) == MODE_INT
     174            0 :       && (GET_MODE_SIZE (as_a <scalar_int_mode> (mode))
     175            0 :           < GET_MODE_SIZE (SImode)))
     176              :     return SImode;
     177              : 
     178            0 :   return promote_mode (type, mode, punsignedp);
     179              : }
     180              : 
     181              : machine_mode
     182            0 : default_cc_modes_compatible (machine_mode m1, machine_mode m2)
     183              : {
     184            0 :   if (m1 == m2)
     185            0 :     return m1;
     186              :   return VOIDmode;
     187              : }
     188              : 
     189              : bool
     190            0 : default_return_in_memory (const_tree type,
     191              :                           const_tree fntype ATTRIBUTE_UNUSED)
     192              : {
     193            0 :   return (TYPE_MODE (type) == BLKmode);
     194              : }
     195              : 
     196              : rtx
     197            0 : default_legitimize_address (rtx x, rtx orig_x ATTRIBUTE_UNUSED,
     198              :                             machine_mode mode ATTRIBUTE_UNUSED)
     199              : {
     200            0 :   return x;
     201              : }
     202              : 
     203              : bool
     204            0 : default_legitimize_address_displacement (rtx *, rtx *, poly_int64,
     205              :                                          machine_mode)
     206              : {
     207            0 :   return false;
     208              : }
     209              : 
     210              : bool
     211            0 : default_const_not_ok_for_debug_p (rtx x)
     212              : {
     213            0 :   if (GET_CODE (x) == UNSPEC)
     214            0 :     return true;
     215              :   return false;
     216              : }
     217              : 
     218              : rtx
     219            0 : default_expand_builtin_saveregs (void)
     220              : {
     221            0 :   error ("%<__builtin_saveregs%> not supported by this target");
     222            0 :   return const0_rtx;
     223              : }
     224              : 
     225              : void
     226            0 : default_setup_incoming_varargs (cumulative_args_t,
     227              :                                 const function_arg_info &, int *, int)
     228              : {
     229            0 : }
     230              : 
     231              : /* The default implementation of TARGET_BUILTIN_SETJMP_FRAME_VALUE.  */
     232              : 
     233              : rtx
     234            0 : default_builtin_setjmp_frame_value (void)
     235              : {
     236            0 :   return virtual_stack_vars_rtx;
     237              : }
     238              : 
     239              : /* Generic hook that takes a CUMULATIVE_ARGS pointer and returns false.  */
     240              : 
     241              : bool
     242            0 : hook_bool_CUMULATIVE_ARGS_false (cumulative_args_t ca ATTRIBUTE_UNUSED)
     243              : {
     244            0 :   return false;
     245              : }
     246              : 
     247              : bool
     248            0 : default_pretend_outgoing_varargs_named (cumulative_args_t ca ATTRIBUTE_UNUSED)
     249              : {
     250            0 :   return (targetm.calls.setup_incoming_varargs
     251            0 :           != default_setup_incoming_varargs);
     252              : }
     253              : 
     254              : scalar_int_mode
     255       529750 : default_eh_return_filter_mode (void)
     256              : {
     257       529750 :   return targetm.unwind_word_mode ();
     258              : }
     259              : 
     260              : scalar_int_mode
     261        45792 : default_libgcc_cmp_return_mode (void)
     262              : {
     263        45792 :   return word_mode;
     264              : }
     265              : 
     266              : scalar_int_mode
     267          308 : default_libgcc_shift_count_mode (void)
     268              : {
     269          308 :   return word_mode;
     270              : }
     271              : 
     272              : scalar_int_mode
     273       772293 : default_unwind_word_mode (void)
     274              : {
     275       772293 :   return word_mode;
     276              : }
     277              : 
     278              : /* The default implementation of TARGET_SHIFT_TRUNCATION_MASK.  */
     279              : 
     280              : unsigned HOST_WIDE_INT
     281            1 : default_shift_truncation_mask (machine_mode mode)
     282              : {
     283            1 :   return SHIFT_COUNT_TRUNCATED ? GET_MODE_UNIT_BITSIZE (mode) - 1 : 0;
     284              : }
     285              : 
     286              : /* The default implementation of TARGET_MIN_DIVISIONS_FOR_RECIP_MUL.  */
     287              : 
     288              : unsigned int
     289       214371 : default_min_divisions_for_recip_mul (machine_mode mode ATTRIBUTE_UNUSED)
     290              : {
     291       214371 :   return have_insn_for (DIV, mode) ? 3 : 2;
     292              : }
     293              : 
     294              : /* The default implementation of TARGET_MODE_REP_EXTENDED.  */
     295              : 
     296              : int
     297     22355256 : default_mode_rep_extended (scalar_int_mode, scalar_int_mode)
     298              : {
     299     22355256 :   return UNKNOWN;
     300              : }
     301              : 
     302              : /* Generic hook that takes a CUMULATIVE_ARGS pointer and returns true.  */
     303              : 
     304              : bool
     305      6059129 : hook_bool_CUMULATIVE_ARGS_true (cumulative_args_t a ATTRIBUTE_UNUSED)
     306              : {
     307      6059129 :   return true;
     308              : }
     309              : 
     310              : /* Return machine mode for non-standard suffix
     311              :    or VOIDmode if non-standard suffixes are unsupported.  */
     312              : machine_mode
     313            0 : default_mode_for_suffix (char suffix ATTRIBUTE_UNUSED)
     314              : {
     315            0 :   return VOIDmode;
     316              : }
     317              : 
     318              : /* Return machine mode for a floating type which is indicated
     319              :    by the given enum tree_index.  */
     320              : 
     321              : machine_mode
     322      3139053 : default_mode_for_floating_type (enum tree_index ti)
     323              : {
     324      3139053 :   if (ti == TI_FLOAT_TYPE)
     325              :     return SFmode;
     326      1549176 :   gcc_assert (ti == TI_DOUBLE_TYPE || ti == TI_LONG_DOUBLE_TYPE);
     327              :   return DFmode;
     328              : }
     329              : 
     330              : /* The generic C++ ABI specifies this is a 64-bit value.  */
     331              : tree
     332         4851 : default_cxx_guard_type (void)
     333              : {
     334         4851 :   return long_long_integer_type_node;
     335              : }
     336              : 
     337              : /* Returns the size of the cookie to use when allocating an array
     338              :    whose elements have the indicated TYPE.  Assumes that it is already
     339              :    known that a cookie is needed.  */
     340              : 
     341              : tree
     342        86657 : default_cxx_get_cookie_size (tree type)
     343              : {
     344        86657 :   tree cookie_size;
     345              : 
     346              :   /* We need to allocate an additional max (sizeof (size_t), alignof
     347              :      (true_type)) bytes.  */
     348        86657 :   tree sizetype_size;
     349        86657 :   tree type_align;
     350              : 
     351        86657 :   sizetype_size = size_in_bytes (sizetype);
     352        86657 :   type_align = size_int (TYPE_ALIGN_UNIT (type));
     353        86657 :   if (tree_int_cst_lt (type_align, sizetype_size))
     354              :     cookie_size = sizetype_size;
     355              :   else
     356        20324 :     cookie_size = type_align;
     357              : 
     358        86657 :   return cookie_size;
     359              : }
     360              : 
     361              : /* Returns modified FUNCTION_TYPE for cdtor callabi.  */
     362              : 
     363              : tree
     364            0 : default_cxx_adjust_cdtor_callabi_fntype (tree fntype)
     365              : {
     366            0 :   return fntype;
     367              : }
     368              : 
     369              : /* Return true if a parameter must be passed by reference.  This version
     370              :    of the TARGET_PASS_BY_REFERENCE hook uses just MUST_PASS_IN_STACK.  */
     371              : 
     372              : bool
     373            0 : hook_pass_by_reference_must_pass_in_stack (cumulative_args_t,
     374              :                                            const function_arg_info &arg)
     375              : {
     376            0 :   return targetm.calls.must_pass_in_stack (arg);
     377              : }
     378              : 
     379              : /* Return true if a parameter follows callee copies conventions.  This
     380              :    version of the hook is true for all named arguments.  */
     381              : 
     382              : bool
     383            0 : hook_callee_copies_named (cumulative_args_t, const function_arg_info &arg)
     384              : {
     385            0 :   return arg.named;
     386              : }
     387              : 
     388              : /* Emit to STREAM the assembler syntax for insn operand X.  */
     389              : 
     390              : void
     391            0 : default_print_operand (FILE *stream ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
     392              :                        int code ATTRIBUTE_UNUSED)
     393              : {
     394              : #ifdef PRINT_OPERAND
     395              :   PRINT_OPERAND (stream, x, code);
     396              : #else
     397            0 :   gcc_unreachable ();
     398              : #endif
     399              : }
     400              : 
     401              : /* No named operand modifiers are supported by default.  */
     402              : 
     403              : int
     404            0 : default_print_operand_modifier (string_slice, bool)
     405              : {
     406            0 :   return 0;
     407              : }
     408              : 
     409              : /* Emit to STREAM the assembler syntax for an insn operand whose memory
     410              :    address is X.  */
     411              : 
     412              : void
     413            0 : default_print_operand_address (FILE *stream ATTRIBUTE_UNUSED,
     414              :                                machine_mode /*mode*/,
     415              :                                rtx x ATTRIBUTE_UNUSED)
     416              : {
     417              : #ifdef PRINT_OPERAND_ADDRESS
     418              :   PRINT_OPERAND_ADDRESS (stream, x);
     419              : #else
     420            0 :   gcc_unreachable ();
     421              : #endif
     422              : }
     423              : 
     424              : /* Return true if CODE is a valid punctuation character for the
     425              :    `print_operand' hook.  */
     426              : 
     427              : bool
     428            0 : default_print_operand_punct_valid_p (unsigned char code ATTRIBUTE_UNUSED)
     429              : {
     430              : #ifdef PRINT_OPERAND_PUNCT_VALID_P
     431              :   return PRINT_OPERAND_PUNCT_VALID_P (code);
     432              : #else
     433            0 :   return false;
     434              : #endif
     435              : }
     436              : 
     437              : /* The default implementation of TARGET_MANGLE_ASSEMBLER_NAME.  */
     438              : tree
     439       546569 : default_mangle_assembler_name (const char *name ATTRIBUTE_UNUSED)
     440              : {
     441       546569 :   const char *skipped = name + (*name == '*' ? 1 : 0);
     442       546569 :   const char *stripped = targetm.strip_name_encoding (skipped);
     443       546569 :   if (*name != '*' && user_label_prefix[0])
     444            0 :     stripped = ACONCAT ((user_label_prefix, stripped, NULL));
     445       546569 :   return get_identifier (stripped);
     446              : }
     447              : 
     448              : /* The default implementation of TARGET_TRANSLATE_MODE_ATTRIBUTE.  */
     449              : 
     450              : machine_mode
     451        55230 : default_translate_mode_attribute (machine_mode mode)
     452              : {
     453        55230 :   return mode;
     454              : }
     455              : 
     456              : /* True if MODE is valid for the target.  By "valid", we mean able to
     457              :    be manipulated in non-trivial ways.  In particular, this means all
     458              :    the arithmetic is supported.
     459              : 
     460              :    By default we guess this means that any C type is supported.  If
     461              :    we can't map the mode back to a type that would be available in C,
     462              :    then reject it.  Special case, here, is the double-word arithmetic
     463              :    supported by optabs.cc.  */
     464              : 
     465              : bool
     466      3988341 : default_scalar_mode_supported_p (scalar_mode mode)
     467              : {
     468      3988341 :   int precision = GET_MODE_PRECISION (mode);
     469              : 
     470      3988341 :   switch (GET_MODE_CLASS (mode))
     471              :     {
     472      2696236 :     case MODE_PARTIAL_INT:
     473      2696236 :     case MODE_INT:
     474      2696236 :       if (precision == CHAR_TYPE_SIZE)
     475              :         return true;
     476      2602578 :       if (precision == SHORT_TYPE_SIZE)
     477              :         return true;
     478      2522038 :       if (precision == INT_TYPE_SIZE)
     479              :         return true;
     480      2290268 :       if (precision == LONG_TYPE_SIZE)
     481              :         return true;
     482      1461226 :       if (precision == LONG_LONG_TYPE_SIZE)
     483              :         return true;
     484      1483416 :       if (precision == 2 * BITS_PER_WORD)
     485      1298840 :         return true;
     486              :       return false;
     487              : 
     488      1292105 :     case MODE_FLOAT:
     489      1292105 :       if (mode == targetm.c.mode_for_floating_type (TI_FLOAT_TYPE))
     490              :         return true;
     491       960209 :       if (mode == targetm.c.mode_for_floating_type (TI_DOUBLE_TYPE))
     492              :         return true;
     493       331442 :       if (mode == targetm.c.mode_for_floating_type (TI_LONG_DOUBLE_TYPE))
     494       331420 :         return true;
     495              :       return false;
     496              : 
     497              :     case MODE_DECIMAL_FLOAT:
     498              :     case MODE_FRACT:
     499              :     case MODE_UFRACT:
     500              :     case MODE_ACCUM:
     501              :     case MODE_UACCUM:
     502              :       return false;
     503              : 
     504            0 :     default:
     505            0 :       gcc_unreachable ();
     506              :     }
     507              : }
     508              : 
     509              : /* Return true if libgcc supports floating-point mode MODE (known to
     510              :    be supported as a scalar mode).  */
     511              : 
     512              : bool
     513      1619091 : default_libgcc_floating_mode_supported_p (scalar_float_mode mode)
     514              : {
     515      1619091 :   switch (mode)
     516              :     {
     517              : #ifdef HAVE_SFmode
     518              :     case E_SFmode:
     519              : #endif
     520              : #ifdef HAVE_DFmode
     521              :     case E_DFmode:
     522              : #endif
     523              : #ifdef HAVE_XFmode
     524              :     case E_XFmode:
     525              : #endif
     526              : #ifdef HAVE_TFmode
     527              :     case E_TFmode:
     528              : #endif
     529              :       return true;
     530              : 
     531            0 :     default:
     532            0 :       return false;
     533              :     }
     534              : }
     535              : 
     536              : /* Return the machine mode to use for the type _FloatN, if EXTENDED is
     537              :    false, or _FloatNx, if EXTENDED is true, or VOIDmode if not
     538              :    supported.  */
     539              : opt_scalar_float_mode
     540      2078153 : default_floatn_mode (int n, bool extended)
     541              : {
     542      2078153 :   if (extended)
     543              :     {
     544       890637 :       opt_scalar_float_mode cand1, cand2;
     545       890637 :       scalar_float_mode mode;
     546       890637 :       switch (n)
     547              :         {
     548       296879 :         case 32:
     549              : #ifdef HAVE_DFmode
     550       296879 :           cand1 = DFmode;
     551              : #endif
     552       296879 :           break;
     553              : 
     554       296879 :         case 64:
     555              : #ifdef HAVE_XFmode
     556       296879 :           cand1 = XFmode;
     557              : #endif
     558              : #ifdef HAVE_TFmode
     559       296879 :           cand2 = TFmode;
     560              : #endif
     561       296879 :           break;
     562              : 
     563              :         case 128:
     564              :           break;
     565              : 
     566            0 :         default:
     567              :           /* Those are the only valid _FloatNx types.  */
     568            0 :           gcc_unreachable ();
     569              :         }
     570       890637 :       if (cand1.exists (&mode)
     571       593758 :           && REAL_MODE_FORMAT (mode)->ieee_bits > n
     572       593758 :           && targetm.scalar_mode_supported_p (mode)
     573       593736 :           && targetm.libgcc_floating_mode_supported_p (mode))
     574       593736 :         return cand1;
     575       296901 :       if (cand2.exists (&mode)
     576           22 :           && REAL_MODE_FORMAT (mode)->ieee_bits > n
     577       296901 :           && targetm.scalar_mode_supported_p (mode)
     578           22 :           && targetm.libgcc_floating_mode_supported_p (mode))
     579           22 :         return cand2;
     580              :     }
     581              :   else
     582              :     {
     583      1187516 :       opt_scalar_float_mode cand;
     584      1187516 :       scalar_float_mode mode;
     585      1187516 :       switch (n)
     586              :         {
     587              :         case 16:
     588              :           /* Always enable _Float16 if we have basic support for the mode.
     589              :              Targets can control the range and precision of operations on
     590              :              the _Float16 type using TARGET_C_EXCESS_PRECISION.  */
     591              : #ifdef HAVE_HFmode
     592              :           cand = HFmode;
     593              : #endif
     594              :           break;
     595              : 
     596              :         case 32:
     597              : #ifdef HAVE_SFmode
     598              :           cand = SFmode;
     599              : #endif
     600              :           break;
     601              : 
     602              :         case 64:
     603              : #ifdef HAVE_DFmode
     604              :           cand = DFmode;
     605              : #endif
     606              :           break;
     607              : 
     608              :         case 128:
     609              : #ifdef HAVE_TFmode
     610              :           cand = TFmode;
     611              : #endif
     612              :           break;
     613              : 
     614              :         default:
     615              :           break;
     616              :         }
     617      1187516 :       if (cand.exists (&mode)
     618      1187516 :           && REAL_MODE_FORMAT (mode)->ieee_bits == n
     619      1187516 :           && targetm.scalar_mode_supported_p (mode)
     620      1187516 :           && targetm.libgcc_floating_mode_supported_p (mode))
     621      1187516 :         return cand;
     622              :     }
     623       296879 :   return opt_scalar_float_mode ();
     624              : }
     625              : 
     626              : /* Define this to return true if the _Floatn and _Floatnx built-in functions
     627              :    should implicitly enable the built-in function without the __builtin_ prefix
     628              :    in addition to the normal built-in function with the __builtin_ prefix.  The
     629              :    default is to only enable built-in functions without the __builtin_ prefix
     630              :    for the GNU C language.  The argument FUNC is the enum builtin_in_function
     631              :    id of the function to be enabled.  */
     632              : 
     633              : bool
     634    140794892 : default_floatn_builtin_p (int func ATTRIBUTE_UNUSED)
     635              : {
     636    140794892 :   static bool first_time_p = true;
     637    140794892 :   static bool c_or_objective_c;
     638              : 
     639    140794892 :   if (first_time_p)
     640              :     {
     641       242332 :       first_time_p = false;
     642       356764 :       c_or_objective_c = lang_GNU_C () || lang_GNU_OBJC ();
     643              :     }
     644              : 
     645    140794892 :   return c_or_objective_c;
     646              : }
     647              : 
     648              : /* Make some target macros usable by target-independent code.  */
     649              : bool
     650            0 : targhook_words_big_endian (void)
     651              : {
     652            0 :   return !!WORDS_BIG_ENDIAN;
     653              : }
     654              : 
     655              : bool
     656       216041 : targhook_float_words_big_endian (void)
     657              : {
     658       216041 :   return !!FLOAT_WORDS_BIG_ENDIAN;
     659              : }
     660              : 
     661              : /* True if the target supports floating-point exceptions and rounding
     662              :    modes.  */
     663              : 
     664              : bool
     665            0 : default_float_exceptions_rounding_supported_p (void)
     666              : {
     667              : #ifdef HAVE_adddf3
     668            0 :   return HAVE_adddf3;
     669              : #else
     670              :   return false;
     671              : #endif
     672              : }
     673              : 
     674              : /* True if the target supports decimal floating point.  */
     675              : 
     676              : bool
     677      1270397 : default_decimal_float_supported_p (void)
     678              : {
     679      1270397 :   return ENABLE_DECIMAL_FLOAT;
     680              : }
     681              : 
     682              : /* True if the target supports fixed-point arithmetic.  */
     683              : 
     684              : bool
     685       329596 : default_fixed_point_supported_p (void)
     686              : {
     687       329596 :   return ENABLE_FIXED_POINT;
     688              : }
     689              : 
     690              : /* True if the target supports GNU indirect functions.  */
     691              : 
     692              : bool
     693          583 : default_has_ifunc_p (void)
     694              : {
     695          583 :   return HAVE_GNU_INDIRECT_FUNCTION;
     696              : }
     697              : 
     698              : /* Return true if we predict the loop LOOP will be transformed to a
     699              :    low-overhead loop, otherwise return false.
     700              : 
     701              :    By default, false is returned, as this hook's applicability should be
     702              :    verified for each target.  Target maintainers should re-define the hook
     703              :    if the target can take advantage of it.  */
     704              : 
     705              : bool
     706       513181 : default_predict_doloop_p (class loop *loop ATTRIBUTE_UNUSED)
     707              : {
     708       513181 :   return false;
     709              : }
     710              : 
     711              : /* By default, just use the input MODE itself.  */
     712              : 
     713              : machine_mode
     714            0 : default_preferred_doloop_mode (machine_mode mode)
     715              : {
     716            0 :   return mode;
     717              : }
     718              : 
     719              : /* NULL if INSN insn is valid within a low-overhead loop, otherwise returns
     720              :    an error message.
     721              : 
     722              :    This function checks whether a given INSN is valid within a low-overhead
     723              :    loop.  If INSN is invalid it returns the reason for that, otherwise it
     724              :    returns NULL. A called function may clobber any special registers required
     725              :    for low-overhead looping. Additionally, some targets (eg, PPC) use the count
     726              :    register for branch on table instructions. We reject the doloop pattern in
     727              :    these cases.  */
     728              : 
     729              : const char *
     730            0 : default_invalid_within_doloop (const rtx_insn *insn)
     731              : {
     732            0 :   if (CALL_P (insn))
     733              :     return "Function call in loop.";
     734              : 
     735            0 :   if (tablejump_p (insn, NULL, NULL) || computed_jump_p (insn))
     736            0 :     return "Computed branch in the loop.";
     737              : 
     738              :   return NULL;
     739              : }
     740              : 
     741              : /* Mapping of builtin functions to vectorized variants.  */
     742              : 
     743              : tree
     744            0 : default_builtin_vectorized_function (unsigned int, tree, tree)
     745              : {
     746            0 :   return NULL_TREE;
     747              : }
     748              : 
     749              : /* Mapping of target builtin functions to vectorized variants.  */
     750              : 
     751              : tree
     752           24 : default_builtin_md_vectorized_function (tree, tree, tree)
     753              : {
     754           24 :   return NULL_TREE;
     755              : }
     756              : 
     757              : /* Default vectorizer cost model values.  */
     758              : 
     759              : int
     760            0 : default_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
     761              :                                     tree vectype,
     762              :                                     int misalign ATTRIBUTE_UNUSED)
     763              : {
     764            0 :   switch (type_of_cost)
     765              :     {
     766              :       case scalar_stmt:
     767              :       case scalar_load:
     768              :       case scalar_store:
     769              :       case vector_stmt:
     770              :       case vector_load:
     771              :       case vector_store:
     772              :       case vec_to_scalar:
     773              :       case scalar_to_vec:
     774              :       case cond_branch_not_taken:
     775              :       case vec_perm:
     776              :       case vec_promote_demote:
     777              :         return 1;
     778              : 
     779            0 :       case unaligned_load:
     780            0 :       case unaligned_store:
     781            0 :         return 2;
     782              : 
     783            0 :       case cond_branch_taken:
     784            0 :         return 3;
     785              : 
     786            0 :       case vec_construct:
     787            0 :       case vec_deconstruct:
     788            0 :         return estimated_poly_value (TYPE_VECTOR_SUBPARTS (vectype)) - 1;
     789              : 
     790            0 :       default:
     791            0 :         gcc_unreachable ();
     792              :     }
     793              : }
     794              : 
     795              : /* Reciprocal.  */
     796              : 
     797              : tree
     798            0 : default_builtin_reciprocal (tree)
     799              : {
     800            0 :   return NULL_TREE;
     801              : }
     802              : 
     803              : void
     804            0 : default_emit_support_tinfos (emit_support_tinfos_callback)
     805              : {
     806            0 : }
     807              : 
     808              : bool
     809         5344 : hook_bool_CUMULATIVE_ARGS_arg_info_false (cumulative_args_t,
     810              :                                           const function_arg_info &)
     811              : {
     812         5344 :   return false;
     813              : }
     814              : 
     815              : bool
     816            0 : hook_bool_CUMULATIVE_ARGS_arg_info_true (cumulative_args_t,
     817              :                                          const function_arg_info &)
     818              : {
     819            0 :   return true;
     820              : }
     821              : 
     822              : int
     823     12678207 : hook_int_CUMULATIVE_ARGS_arg_info_0 (cumulative_args_t,
     824              :                                      const function_arg_info &)
     825              : {
     826     12678207 :   return 0;
     827              : }
     828              : 
     829              : void
     830     12330248 : hook_void_CUMULATIVE_ARGS (cumulative_args_t)
     831              : {
     832     12330248 : }
     833              : 
     834              : void
     835            0 : hook_void_CUMULATIVE_ARGS_tree (cumulative_args_t ca ATTRIBUTE_UNUSED,
     836              :                                 tree ATTRIBUTE_UNUSED)
     837              : {
     838            0 : }
     839              : 
     840              : void
     841     11965417 : hook_void_CUMULATIVE_ARGS_rtx_tree (cumulative_args_t, rtx, tree)
     842              : {
     843     11965417 : }
     844              : 
     845              : /* Default implementation of TARGET_PUSH_ARGUMENT.  */
     846              : 
     847              : bool
     848            0 : default_push_argument (unsigned int)
     849              : {
     850              : #ifdef PUSH_ROUNDING
     851            0 :   return !ACCUMULATE_OUTGOING_ARGS;
     852              : #else
     853              :   return false;
     854              : #endif
     855              : }
     856              : 
     857              : void
     858            0 : default_function_arg_advance (cumulative_args_t, const function_arg_info &)
     859              : {
     860            0 :   gcc_unreachable ();
     861              : }
     862              : 
     863              : /* Default implementation of TARGET_FUNCTION_ARG_OFFSET.  */
     864              : 
     865              : HOST_WIDE_INT
     866      5497310 : default_function_arg_offset (machine_mode, const_tree)
     867              : {
     868      5497310 :   return 0;
     869              : }
     870              : 
     871              : /* Default implementation of TARGET_FUNCTION_ARG_PADDING: usually pad
     872              :    upward, but pad short args downward on big-endian machines.  */
     873              : 
     874              : pad_direction
     875     12489704 : default_function_arg_padding (machine_mode mode, const_tree type)
     876              : {
     877     12489704 :   if (!BYTES_BIG_ENDIAN)
     878     12489704 :     return PAD_UPWARD;
     879              : 
     880              :   unsigned HOST_WIDE_INT size;
     881              :   if (mode == BLKmode)
     882              :     {
     883              :       if (!type || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
     884              :         return PAD_UPWARD;
     885              :       size = int_size_in_bytes (type);
     886              :     }
     887              :   else
     888              :     /* Targets with variable-sized modes must override this hook
     889              :        and handle variable-sized modes explicitly.  */
     890              :     size = GET_MODE_SIZE (mode).to_constant ();
     891              : 
     892              :   if (size < (PARM_BOUNDARY / BITS_PER_UNIT))
     893              :     return PAD_DOWNWARD;
     894              : 
     895              :   return PAD_UPWARD;
     896              : }
     897              : 
     898              : rtx
     899            0 : default_function_arg (cumulative_args_t, const function_arg_info &)
     900              : {
     901            0 :   gcc_unreachable ();
     902              : }
     903              : 
     904              : rtx
     905            0 : default_function_incoming_arg (cumulative_args_t, const function_arg_info &)
     906              : {
     907            0 :   gcc_unreachable ();
     908              : }
     909              : 
     910              : unsigned int
     911            0 : default_function_arg_boundary (machine_mode mode ATTRIBUTE_UNUSED,
     912              :                                const_tree type ATTRIBUTE_UNUSED)
     913              : {
     914            0 :   return PARM_BOUNDARY;
     915              : }
     916              : 
     917              : unsigned int
     918      5497310 : default_function_arg_round_boundary (machine_mode mode ATTRIBUTE_UNUSED,
     919              :                                      const_tree type ATTRIBUTE_UNUSED)
     920              : {
     921      5497310 :   return PARM_BOUNDARY;
     922              : }
     923              : 
     924              : void
     925            0 : hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED)
     926              : {
     927            0 : }
     928              : 
     929              : const char *
     930       792190 : hook_invalid_arg_for_unprototyped_fn (
     931              :         const_tree typelist ATTRIBUTE_UNUSED,
     932              :         const_tree funcdecl ATTRIBUTE_UNUSED,
     933              :         const_tree val ATTRIBUTE_UNUSED)
     934              : {
     935       792190 :   return NULL;
     936              : }
     937              : 
     938              : /* Initialize the stack protection decls.  */
     939              : 
     940              : /* Stack protection related decls living in libgcc.  */
     941              : static GTY(()) tree stack_chk_guard_decl;
     942              : 
     943              : tree
     944           75 : default_stack_protect_guard (void)
     945              : {
     946           75 :   tree t = stack_chk_guard_decl;
     947              : 
     948           75 :   if (t == NULL)
     949              :     {
     950           40 :       rtx x;
     951              : 
     952           40 :       if (UINTPTR_TYPE && targetm.stack_protect_guard_symbol_p ())
     953              :         /* Get unsigned integer type for uintptr_t.  */
     954           40 :         t = unsigned_integer_tree_node_for_type (UINTPTR_TYPE);
     955              :       else
     956            0 :         t = ptr_type_node;
     957           40 :       t = build_decl (UNKNOWN_LOCATION,
     958              :                       VAR_DECL, get_identifier ("__stack_chk_guard"), t);
     959           40 :       TREE_STATIC (t) = 1;
     960           40 :       TREE_PUBLIC (t) = 1;
     961           40 :       DECL_EXTERNAL (t) = 1;
     962           40 :       TREE_USED (t) = 1;
     963           40 :       TREE_THIS_VOLATILE (t) = 1;
     964           40 :       DECL_ARTIFICIAL (t) = 1;
     965           40 :       DECL_IGNORED_P (t) = 1;
     966              : 
     967              :       /* Do not share RTL as the declaration is visible outside of
     968              :          current function.  */
     969           40 :       if (mode_mem_attrs[(int) DECL_MODE (t)])
     970              :         {
     971              :           /* NB: Don't call make_decl_rtl when mode_mem_attrs isn't
     972              :              initialized.  -save-temps won't initialize mode_mem_attrs
     973              :              and make_decl_rtl will fail.  */
     974           34 :           x = DECL_RTL (t);
     975           34 :           RTX_FLAG (x, used) = 1;
     976              :         }
     977              : 
     978           40 :       stack_chk_guard_decl = t;
     979              :     }
     980              : 
     981           75 :   return t;
     982              : }
     983              : 
     984              : static GTY(()) tree stack_chk_fail_decl;
     985              : 
     986              : tree
     987          328 : default_external_stack_protect_fail (void)
     988              : {
     989          328 :   tree t = stack_chk_fail_decl;
     990              : 
     991          328 :   if (t == NULL_TREE)
     992              :     {
     993          181 :       t = build_function_type_list (void_type_node, NULL_TREE);
     994          181 :       t = build_decl (UNKNOWN_LOCATION,
     995              :                       FUNCTION_DECL, get_identifier ("__stack_chk_fail"), t);
     996          181 :       TREE_STATIC (t) = 1;
     997          181 :       TREE_PUBLIC (t) = 1;
     998          181 :       DECL_EXTERNAL (t) = 1;
     999          181 :       TREE_USED (t) = 1;
    1000          181 :       TREE_THIS_VOLATILE (t) = 1;
    1001          181 :       TREE_NOTHROW (t) = 1;
    1002          181 :       DECL_ARTIFICIAL (t) = 1;
    1003          181 :       DECL_IGNORED_P (t) = 1;
    1004          181 :       DECL_VISIBILITY (t) = VISIBILITY_DEFAULT;
    1005          181 :       DECL_VISIBILITY_SPECIFIED (t) = 1;
    1006              : 
    1007          181 :       stack_chk_fail_decl = t;
    1008              :     }
    1009              : 
    1010          328 :   return build_call_expr (t, 0);
    1011              : }
    1012              : 
    1013              : tree
    1014            1 : default_hidden_stack_protect_fail (void)
    1015              : {
    1016              : #ifndef HAVE_GAS_HIDDEN
    1017              :   return default_external_stack_protect_fail ();
    1018              : #else
    1019            1 :   tree t = stack_chk_fail_decl;
    1020              : 
    1021            1 :   if (!flag_pic)
    1022            1 :     return default_external_stack_protect_fail ();
    1023              : 
    1024            0 :   if (t == NULL_TREE)
    1025              :     {
    1026            0 :       t = build_function_type_list (void_type_node, NULL_TREE);
    1027            0 :       t = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL,
    1028              :                       get_identifier ("__stack_chk_fail_local"), t);
    1029            0 :       TREE_STATIC (t) = 1;
    1030            0 :       TREE_PUBLIC (t) = 1;
    1031            0 :       DECL_EXTERNAL (t) = 1;
    1032            0 :       TREE_USED (t) = 1;
    1033            0 :       TREE_THIS_VOLATILE (t) = 1;
    1034            0 :       TREE_NOTHROW (t) = 1;
    1035            0 :       DECL_ARTIFICIAL (t) = 1;
    1036            0 :       DECL_IGNORED_P (t) = 1;
    1037            0 :       DECL_VISIBILITY_SPECIFIED (t) = 1;
    1038            0 :       DECL_VISIBILITY (t) = VISIBILITY_HIDDEN;
    1039              : 
    1040            0 :       stack_chk_fail_decl = t;
    1041              :     }
    1042              : 
    1043            0 :   return build_call_expr (t, 0);
    1044              : #endif
    1045              : }
    1046              : 
    1047              : bool
    1048     73629527 : hook_bool_const_rtx_commutative_p (const_rtx x,
    1049              :                                    int outer_code ATTRIBUTE_UNUSED)
    1050              : {
    1051     73629527 :   return COMMUTATIVE_P (x);
    1052              : }
    1053              : 
    1054              : rtx
    1055            0 : default_function_value (const_tree ret_type ATTRIBUTE_UNUSED,
    1056              :                         const_tree fn_decl_or_type,
    1057              :                         bool outgoing ATTRIBUTE_UNUSED)
    1058              : {
    1059              :   /* The old interface doesn't handle receiving the function type.  */
    1060            0 :   if (fn_decl_or_type
    1061              :       && !DECL_P (fn_decl_or_type))
    1062              :     fn_decl_or_type = NULL;
    1063              : 
    1064              : #ifdef FUNCTION_VALUE
    1065              :   return FUNCTION_VALUE (ret_type, fn_decl_or_type);
    1066              : #else
    1067            0 :   gcc_unreachable ();
    1068              : #endif
    1069              : }
    1070              : 
    1071              : rtx
    1072       112565 : default_libcall_value (machine_mode mode ATTRIBUTE_UNUSED,
    1073              :                        const_rtx fun ATTRIBUTE_UNUSED)
    1074              : {
    1075              : #ifdef LIBCALL_VALUE
    1076       112565 :   return LIBCALL_VALUE (MACRO_MODE (mode));
    1077              : #else
    1078              :   gcc_unreachable ();
    1079              : #endif
    1080              : }
    1081              : 
    1082              : /* The default hook for TARGET_FUNCTION_VALUE_REGNO_P.  */
    1083              : 
    1084              : bool
    1085            0 : default_function_value_regno_p (const unsigned int regno ATTRIBUTE_UNUSED)
    1086              : {
    1087              : #ifdef FUNCTION_VALUE_REGNO_P
    1088              :   return FUNCTION_VALUE_REGNO_P (regno);
    1089              : #else
    1090            0 :   gcc_unreachable ();
    1091              : #endif
    1092              : }
    1093              : 
    1094              : /* Choose the mode and rtx to use to zero REGNO, storing tem in PMODE and
    1095              :    PREGNO_RTX and returning TRUE if successful, otherwise returning FALSE.  If
    1096              :    the natural mode for REGNO doesn't work, attempt to group it with subsequent
    1097              :    adjacent registers set in TOZERO.  */
    1098              : 
    1099              : static inline bool
    1100            0 : zcur_select_mode_rtx (unsigned int regno, machine_mode *pmode,
    1101              :                       rtx *pregno_rtx, HARD_REG_SET tozero)
    1102              : {
    1103            0 :   rtx regno_rtx = regno_reg_rtx[regno];
    1104            0 :   machine_mode mode = GET_MODE (regno_rtx);
    1105              : 
    1106              :   /* If the natural mode doesn't work, try some wider mode.  */
    1107            0 :   if (!targetm.hard_regno_mode_ok (regno, mode))
    1108              :     {
    1109              :       bool found = false;
    1110            0 :       for (int nregs = 2;
    1111            0 :            !found && nregs <= hard_regno_max_nregs
    1112            0 :              && regno + nregs <= FIRST_PSEUDO_REGISTER
    1113            0 :              && TEST_HARD_REG_BIT (tozero,
    1114              :                                    regno + nregs - 1);
    1115              :            nregs++)
    1116              :         {
    1117            0 :           mode = choose_hard_reg_mode (regno, nregs, 0);
    1118            0 :           if (mode == E_VOIDmode)
    1119            0 :             continue;
    1120            0 :           gcc_checking_assert (targetm.hard_regno_mode_ok (regno, mode));
    1121            0 :           regno_rtx = gen_rtx_REG (mode, regno);
    1122            0 :           found = true;
    1123              :         }
    1124            0 :       if (!found)
    1125              :         return false;
    1126              :     }
    1127              : 
    1128            0 :   *pmode = mode;
    1129            0 :   *pregno_rtx = regno_rtx;
    1130            0 :   return true;
    1131              : }
    1132              : 
    1133              : /* The default hook for TARGET_ZERO_CALL_USED_REGS.  */
    1134              : 
    1135              : HARD_REG_SET
    1136            0 : default_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs)
    1137              : {
    1138            0 :   gcc_assert (!hard_reg_set_empty_p (need_zeroed_hardregs));
    1139              : 
    1140              :   HARD_REG_SET failed;
    1141            0 :   CLEAR_HARD_REG_SET (failed);
    1142              :   bool progress = false;
    1143              : 
    1144              :   /* First, try to zero each register in need_zeroed_hardregs by
    1145              :      loading a zero into it, taking note of any failures in
    1146              :      FAILED.  */
    1147            0 :   for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
    1148            0 :     if (TEST_HARD_REG_BIT (need_zeroed_hardregs, regno))
    1149              :       {
    1150            0 :         rtx_insn *last_insn = get_last_insn ();
    1151            0 :         rtx regno_rtx;
    1152            0 :         machine_mode mode;
    1153              : 
    1154            0 :         if (!zcur_select_mode_rtx (regno, &mode, &regno_rtx,
    1155              :                                    need_zeroed_hardregs))
    1156              :           {
    1157            0 :             SET_HARD_REG_BIT (failed, regno);
    1158            0 :             continue;
    1159              :           }
    1160              : 
    1161            0 :         rtx zero = CONST0_RTX (mode);
    1162            0 :         rtx_insn *insn = emit_move_insn (regno_rtx, zero);
    1163            0 :         if (!valid_insn_p (insn))
    1164              :           {
    1165            0 :             SET_HARD_REG_BIT (failed, regno);
    1166            0 :             delete_insns_since (last_insn);
    1167              :           }
    1168              :         else
    1169              :           {
    1170            0 :             progress = true;
    1171            0 :             regno += hard_regno_nregs (regno, mode) - 1;
    1172              :           }
    1173              :       }
    1174              : 
    1175              :   /* Now retry with copies from zeroed registers, as long as we've
    1176              :      made some PROGRESS, and registers remain to be zeroed in
    1177              :      FAILED.  */
    1178            0 :   while (progress && !hard_reg_set_empty_p (failed))
    1179              :     {
    1180            0 :       HARD_REG_SET retrying = failed;
    1181              : 
    1182            0 :       CLEAR_HARD_REG_SET (failed);
    1183              :       progress = false;
    1184              : 
    1185            0 :       for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
    1186            0 :         if (TEST_HARD_REG_BIT (retrying, regno))
    1187              :           {
    1188            0 :             rtx regno_rtx;
    1189            0 :             machine_mode mode;
    1190              : 
    1191              :             /* This might select registers we've already zeroed.  If grouping
    1192              :                with them is what it takes to get regno zeroed, so be it.  */
    1193            0 :             if (!zcur_select_mode_rtx (regno, &mode, &regno_rtx,
    1194              :                                        need_zeroed_hardregs))
    1195              :               {
    1196            0 :                 SET_HARD_REG_BIT (failed, regno);
    1197            0 :                 continue;
    1198              :               }
    1199              : 
    1200            0 :             bool success = false;
    1201              :             /* Look for a source.  */
    1202            0 :             for (unsigned int src = 0; src < FIRST_PSEUDO_REGISTER; src++)
    1203              :               {
    1204              :                 /* If SRC hasn't been zeroed (yet?), skip it.  */
    1205            0 :                 if (! TEST_HARD_REG_BIT (need_zeroed_hardregs, src))
    1206            0 :                   continue;
    1207            0 :                 if (TEST_HARD_REG_BIT (retrying, src))
    1208            0 :                   continue;
    1209              : 
    1210              :                 /* Check that SRC can hold MODE, and that any other
    1211              :                    registers needed to hold MODE in SRC have also been
    1212              :                    zeroed.  */
    1213            0 :                 if (!targetm.hard_regno_mode_ok (src, mode))
    1214            0 :                   continue;
    1215            0 :                 unsigned n = targetm.hard_regno_nregs (src, mode);
    1216            0 :                 bool ok = true;
    1217            0 :                 for (unsigned i = 1; ok && i < n; i++)
    1218            0 :                   ok = (TEST_HARD_REG_BIT (need_zeroed_hardregs, src + i)
    1219            0 :                         && !TEST_HARD_REG_BIT (retrying, src + i));
    1220            0 :                 if (!ok)
    1221            0 :                   continue;
    1222              : 
    1223              :                 /* SRC is usable, try to copy from it.  */
    1224            0 :                 rtx_insn *last_insn = get_last_insn ();
    1225            0 :                 rtx src_rtx = gen_rtx_REG (mode, src);
    1226            0 :                 rtx_insn *insn = emit_move_insn (regno_rtx, src_rtx);
    1227            0 :                 if (!valid_insn_p (insn))
    1228              :                   /* It didn't work, remove any inserts.  We'll look
    1229              :                      for another SRC.  */
    1230            0 :                   delete_insns_since (last_insn);
    1231              :                 else
    1232              :                   {
    1233              :                     /* We're done for REGNO.  */
    1234              :                     success = true;
    1235              :                     break;
    1236              :                   }
    1237              :               }
    1238              : 
    1239              :             /* If nothing worked for REGNO this round, mark it to be
    1240              :                retried if we get another round.  */
    1241            0 :             if (!success)
    1242            0 :               SET_HARD_REG_BIT (failed, regno);
    1243              :             else
    1244              :               {
    1245              :                 /* Take note so as to enable another round if needed.  */
    1246            0 :                 progress = true;
    1247            0 :                 regno += hard_regno_nregs (regno, mode) - 1;
    1248              :               }
    1249              :           }
    1250              :     }
    1251              : 
    1252              :   /* If any register remained, report it.  */
    1253            0 :   if (!progress)
    1254              :     {
    1255            0 :       static bool issued_error;
    1256            0 :       if (!issued_error)
    1257              :         {
    1258            0 :           const char *name = NULL;
    1259            0 :           for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL;
    1260              :                ++i)
    1261            0 :             if (flag_zero_call_used_regs == zero_call_used_regs_opts[i].flag)
    1262              :               {
    1263              :                 name = zero_call_used_regs_opts[i].name;
    1264              :                 break;
    1265              :               }
    1266              : 
    1267            0 :           if (!name)
    1268            0 :             name = "";
    1269              : 
    1270            0 :           issued_error = true;
    1271            0 :           sorry ("argument %qs is not supported for %qs on this target",
    1272              :                  name, "-fzero-call-used-regs");
    1273              :         }
    1274              :     }
    1275              : 
    1276            0 :   return need_zeroed_hardregs;
    1277              : }
    1278              : 
    1279              : rtx
    1280            0 : default_internal_arg_pointer (void)
    1281              : {
    1282              :   /* If the reg that the virtual arg pointer will be translated into is
    1283              :      not a fixed reg or is the stack pointer, make a copy of the virtual
    1284              :      arg pointer, and address parms via the copy.  The frame pointer is
    1285              :      considered fixed even though it is not marked as such.  */
    1286            0 :   if ((ARG_POINTER_REGNUM == STACK_POINTER_REGNUM
    1287            0 :        || ! (fixed_regs[ARG_POINTER_REGNUM]
    1288              :              || ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)))
    1289            0 :     return copy_to_reg (virtual_incoming_args_rtx);
    1290              :   else
    1291            0 :     return virtual_incoming_args_rtx;
    1292              : }
    1293              : 
    1294              : rtx
    1295            0 : default_static_chain (const_tree ARG_UNUSED (fndecl_or_type), bool incoming_p)
    1296              : {
    1297            0 :   if (incoming_p)
    1298              :     {
    1299              : #ifdef STATIC_CHAIN_INCOMING_REGNUM
    1300              :       return gen_rtx_REG (Pmode, STATIC_CHAIN_INCOMING_REGNUM);
    1301              : #endif
    1302              :     }
    1303              : 
    1304              : #ifdef STATIC_CHAIN_REGNUM
    1305              :   return gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
    1306              : #endif
    1307              : 
    1308            0 :   {
    1309            0 :     static bool issued_error;
    1310            0 :     if (!issued_error)
    1311              :       {
    1312            0 :         issued_error = true;
    1313            0 :         sorry ("nested functions not supported on this target");
    1314              :       }
    1315              : 
    1316              :     /* It really doesn't matter what we return here, so long at it
    1317              :        doesn't cause the rest of the compiler to crash.  */
    1318            0 :     return gen_rtx_MEM (Pmode, stack_pointer_rtx);
    1319              :   }
    1320              : }
    1321              : 
    1322              : void
    1323            0 : default_trampoline_init (rtx ARG_UNUSED (m_tramp), tree ARG_UNUSED (t_func),
    1324              :                          rtx ARG_UNUSED (r_chain))
    1325              : {
    1326            0 :   sorry ("nested function trampolines not supported on this target");
    1327            0 : }
    1328              : 
    1329              : poly_int64
    1330            0 : default_return_pops_args (tree, tree, poly_int64)
    1331              : {
    1332            0 :   return 0;
    1333              : }
    1334              : 
    1335              : reg_class_t
    1336     50966385 : default_ira_change_pseudo_allocno_class (int regno ATTRIBUTE_UNUSED,
    1337              :                                          reg_class_t cl,
    1338              :                                          reg_class_t best_cl ATTRIBUTE_UNUSED)
    1339              : {
    1340     50966385 :   return cl;
    1341              : }
    1342              : 
    1343              : int
    1344            0 : default_ira_callee_saved_register_cost_scale (int)
    1345              : {
    1346            0 :   return (optimize_size
    1347            0 :           ? 1
    1348            0 :           : REG_FREQ_FROM_BB (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
    1349              : }
    1350              : 
    1351              : extern bool
    1352    314812209 : default_lra_p (void)
    1353              : {
    1354    314812209 :   return true;
    1355              : }
    1356              : 
    1357              : int
    1358            0 : default_register_priority (int hard_regno ATTRIBUTE_UNUSED)
    1359              : {
    1360            0 :   return 0;
    1361              : }
    1362              : 
    1363              : extern bool
    1364            0 : default_register_usage_leveling_p (void)
    1365              : {
    1366            0 :   return false;
    1367              : }
    1368              : 
    1369              : extern bool
    1370      4994683 : default_different_addr_displacement_p (void)
    1371              : {
    1372      4994683 :   return false;
    1373              : }
    1374              : 
    1375              : reg_class_t
    1376            0 : default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
    1377              :                           reg_class_t reload_class_i ATTRIBUTE_UNUSED,
    1378              :                           machine_mode reload_mode ATTRIBUTE_UNUSED,
    1379              :                           secondary_reload_info *sri)
    1380              : {
    1381            0 :   enum reg_class rclass = NO_REGS;
    1382            0 :   enum reg_class reload_class = (enum reg_class) reload_class_i;
    1383              : 
    1384            0 :   if (sri->prev_sri && sri->prev_sri->t_icode != CODE_FOR_nothing)
    1385              :     {
    1386            0 :       sri->icode = sri->prev_sri->t_icode;
    1387            0 :       return NO_REGS;
    1388              :     }
    1389              : #ifdef SECONDARY_INPUT_RELOAD_CLASS
    1390              :   if (in_p)
    1391              :     rclass = SECONDARY_INPUT_RELOAD_CLASS (reload_class,
    1392              :                                            MACRO_MODE (reload_mode), x);
    1393              : #endif
    1394              : #ifdef SECONDARY_OUTPUT_RELOAD_CLASS
    1395              :   if (! in_p)
    1396              :     rclass = SECONDARY_OUTPUT_RELOAD_CLASS (reload_class,
    1397              :                                             MACRO_MODE (reload_mode), x);
    1398              : #endif
    1399              :   if (rclass != NO_REGS)
    1400              :     {
    1401              :       enum insn_code icode
    1402              :         = direct_optab_handler (in_p ? reload_in_optab : reload_out_optab,
    1403              :                                 reload_mode);
    1404              : 
    1405              :       if (icode != CODE_FOR_nothing
    1406              :           && !insn_operand_matches (icode, in_p, x))
    1407              :         icode = CODE_FOR_nothing;
    1408              :       else if (icode != CODE_FOR_nothing)
    1409              :         {
    1410              :           const char *insn_constraint, *scratch_constraint;
    1411              :           enum reg_class insn_class, scratch_class;
    1412              : 
    1413              :           gcc_assert (insn_data[(int) icode].n_operands == 3);
    1414              :           insn_constraint = insn_data[(int) icode].operand[!in_p].constraint;
    1415              :           if (!*insn_constraint)
    1416              :             insn_class = ALL_REGS;
    1417              :           else
    1418              :             {
    1419              :               if (in_p)
    1420              :                 {
    1421              :                   gcc_assert (*insn_constraint == '=');
    1422              :                   insn_constraint++;
    1423              :                 }
    1424              :               insn_class = (reg_class_for_constraint
    1425              :                             (lookup_constraint (insn_constraint)));
    1426              :               gcc_assert (insn_class != NO_REGS);
    1427              :             }
    1428              : 
    1429              :           scratch_constraint = insn_data[(int) icode].operand[2].constraint;
    1430              :           /* The scratch register's constraint must start with "=&",
    1431              :              except for an input reload, where only "=" is necessary,
    1432              :              and where it might be beneficial to re-use registers from
    1433              :              the input.  */
    1434              :           gcc_assert (scratch_constraint[0] == '='
    1435              :                       && (in_p || scratch_constraint[1] == '&'));
    1436              :           scratch_constraint++;
    1437              :           if (*scratch_constraint == '&')
    1438              :             scratch_constraint++;
    1439              :           scratch_class = (reg_class_for_constraint
    1440              :                            (lookup_constraint (scratch_constraint)));
    1441              : 
    1442              :           if (reg_class_subset_p (reload_class, insn_class))
    1443              :             {
    1444              :               gcc_assert (scratch_class == rclass);
    1445              :               rclass = NO_REGS;
    1446              :             }
    1447              :           else
    1448              :             rclass = insn_class;
    1449              : 
    1450              :         }
    1451              :       if (rclass == NO_REGS)
    1452              :         sri->icode = icode;
    1453              :       else
    1454              :         sri->t_icode = icode;
    1455              :     }
    1456              :   return rclass;
    1457              : }
    1458              : 
    1459              : /* The default implementation of TARGET_SECONDARY_MEMORY_NEEDED_MODE.  */
    1460              : 
    1461              : machine_mode
    1462            0 : default_secondary_memory_needed_mode (machine_mode mode)
    1463              : {
    1464            0 :   if (!targetm.lra_p ()
    1465            0 :       && known_lt (GET_MODE_BITSIZE (mode), BITS_PER_WORD)
    1466            0 :       && INTEGRAL_MODE_P (mode))
    1467            0 :     return mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (mode), 0).require ();
    1468              :   return mode;
    1469              : }
    1470              : 
    1471              : /* By default, if flag_pic is true, then neither local nor global relocs
    1472              :    should be placed in readonly memory.  */
    1473              : 
    1474              : int
    1475            0 : default_reloc_rw_mask (void)
    1476              : {
    1477            0 :   return flag_pic ? 3 : 0;
    1478              : }
    1479              : 
    1480              : /* By default, address diff vectors are generated
    1481              : for jump tables when flag_pic is true.  */
    1482              : 
    1483              : bool
    1484        16144 : default_generate_pic_addr_diff_vec (void)
    1485              : {
    1486        16144 :   return flag_pic;
    1487              : }
    1488              : 
    1489              : /* Record an element in the table of global constructors.  SYMBOL is
    1490              :    a SYMBOL_REF of the function to be called; PRIORITY is a number
    1491              :    between 0 and MAX_INIT_PRIORITY.  */
    1492              : 
    1493              : void
    1494            0 : default_asm_out_constructor (rtx symbol ATTRIBUTE_UNUSED,
    1495              :                              int priority ATTRIBUTE_UNUSED)
    1496              : {
    1497            0 :   sorry ("global constructors not supported on this target");
    1498            0 : }
    1499              : 
    1500              : /* Likewise for global destructors.  */
    1501              : 
    1502              : void
    1503            0 : default_asm_out_destructor (rtx symbol ATTRIBUTE_UNUSED,
    1504              :                             int priority ATTRIBUTE_UNUSED)
    1505              : {
    1506            0 :   sorry ("global destructors not supported on this target");
    1507            0 : }
    1508              : 
    1509              : /* By default, do no modification. */
    1510            0 : tree default_mangle_decl_assembler_name (tree decl ATTRIBUTE_UNUSED,
    1511              :                                          tree id)
    1512              : {
    1513            0 :    return id;
    1514              : }
    1515              : 
    1516              : /* The default implementation of TARGET_STATIC_RTX_ALIGNMENT.  */
    1517              : 
    1518              : HOST_WIDE_INT
    1519            0 : default_static_rtx_alignment (machine_mode mode)
    1520              : {
    1521            0 :   return GET_MODE_ALIGNMENT (mode);
    1522              : }
    1523              : 
    1524              : /* The default implementation of TARGET_CONSTANT_ALIGNMENT.  */
    1525              : 
    1526              : HOST_WIDE_INT
    1527            0 : default_constant_alignment (const_tree, HOST_WIDE_INT align)
    1528              : {
    1529            0 :   return align;
    1530              : }
    1531              : 
    1532              : /* An implementation of TARGET_CONSTANT_ALIGNMENT that aligns strings
    1533              :    to at least BITS_PER_WORD but otherwise makes no changes.  */
    1534              : 
    1535              : HOST_WIDE_INT
    1536            0 : constant_alignment_word_strings (const_tree exp, HOST_WIDE_INT align)
    1537              : {
    1538            0 :   if (TREE_CODE (exp) == STRING_CST)
    1539            0 :     return MAX (align, BITS_PER_WORD);
    1540              :   return align;
    1541              : }
    1542              : 
    1543              : /* Default to natural alignment for vector types, bounded by
    1544              :    MAX_OFILE_ALIGNMENT.  */
    1545              : 
    1546              : HOST_WIDE_INT
    1547     71776201 : default_vector_alignment (const_tree type)
    1548              : {
    1549     71776201 :   unsigned HOST_WIDE_INT align = MAX_OFILE_ALIGNMENT;
    1550     71776201 :   tree size = TYPE_SIZE (type);
    1551     71776201 :   if (tree_fits_uhwi_p (size))
    1552     71776201 :     align = tree_to_uhwi (size);
    1553     71776201 :   if (align >= MAX_OFILE_ALIGNMENT)
    1554              :     return MAX_OFILE_ALIGNMENT;
    1555     71776194 :   return MAX (align, GET_MODE_ALIGNMENT (TYPE_MODE (type)));
    1556              : }
    1557              : 
    1558              : /* The default implementation of
    1559              :    TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT.  */
    1560              : 
    1561              : poly_uint64
    1562      6781764 : default_preferred_vector_alignment (const_tree type)
    1563              : {
    1564      6781764 :   return TYPE_ALIGN (type);
    1565              : }
    1566              : 
    1567              : /* The default implementation of
    1568              :    TARGET_VECTORIZE_PREFERRED_DIV_AS_SHIFTS_OVER_MULT.  */
    1569              : 
    1570              : bool
    1571        18270 : default_preferred_div_as_shifts_over_mult (const_tree type)
    1572              : {
    1573        18270 :   return !can_mult_highpart_p (TYPE_MODE (type), TYPE_UNSIGNED (type));
    1574              : }
    1575              : 
    1576              : /* By default assume vectors of element TYPE require a multiple of the natural
    1577              :    alignment of TYPE.  TYPE is naturally aligned if IS_PACKED is false.  */
    1578              : bool
    1579       259785 : default_builtin_vector_alignment_reachable (const_tree /*type*/, bool is_packed)
    1580              : {
    1581       259785 :   return ! is_packed;
    1582              : }
    1583              : 
    1584              : /* By default, assume that a target supports any factor of misalignment
    1585              :    memory access if it supports movmisalign pattern.
    1586              :    is_packed is true if the memory access is defined in a packed struct.  */
    1587              : bool
    1588      1423604 : default_builtin_support_vector_misalignment (machine_mode mode,
    1589              :                                              int misalignment
    1590              :                                              ATTRIBUTE_UNUSED,
    1591              :                                              bool is_packed
    1592              :                                              ATTRIBUTE_UNUSED,
    1593              :                                              bool is_gather_scatter
    1594              :                                              ATTRIBUTE_UNUSED)
    1595              : {
    1596      1423604 :   if (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing)
    1597      1423409 :     return true;
    1598              :   return false;
    1599              : }
    1600              : 
    1601              : /* By default, only attempt to parallelize bitwise operations, and
    1602              :    possibly adds/subtracts using bit-twiddling.  */
    1603              : 
    1604              : machine_mode
    1605            0 : default_preferred_simd_mode (scalar_mode)
    1606              : {
    1607            0 :   return word_mode;
    1608              : }
    1609              : 
    1610              : /* By default do not split reductions further.  */
    1611              : 
    1612              : machine_mode
    1613            0 : default_split_reduction (machine_mode mode)
    1614              : {
    1615            0 :   return mode;
    1616              : }
    1617              : 
    1618              : /* By default only the preferred vector mode is tried.  */
    1619              : 
    1620              : unsigned int
    1621            0 : default_autovectorize_vector_modes (vector_modes *, bool)
    1622              : {
    1623            0 :   return 0;
    1624              : }
    1625              : 
    1626              : /* The default implementation of TARGET_VECTORIZE_RELATED_MODE.  */
    1627              : 
    1628              : opt_machine_mode
    1629     34290331 : default_vectorize_related_mode (machine_mode vector_mode,
    1630              :                                 scalar_mode element_mode,
    1631              :                                 poly_uint64 nunits)
    1632              : {
    1633     34290331 :   machine_mode result_mode;
    1634     34290331 :   if ((maybe_ne (nunits, 0U)
    1635     89530437 :        || multiple_p (GET_MODE_SIZE (vector_mode),
    1636              :                       GET_MODE_SIZE (element_mode), &nunits))
    1637     31954453 :       && mode_for_vector (element_mode, nunits).exists (&result_mode)
    1638     31686472 :       && VECTOR_MODE_P (result_mode)
    1639     65975397 :       && targetm.vector_mode_supported_p (result_mode))
    1640     31670600 :     return result_mode;
    1641              : 
    1642      2619731 :   return opt_machine_mode ();
    1643              : }
    1644              : 
    1645              : /* By default a vector of integers is used as a mask.  */
    1646              : 
    1647              : opt_machine_mode
    1648            0 : default_get_mask_mode (machine_mode mode)
    1649              : {
    1650            0 :   return related_int_vector_mode (mode);
    1651              : }
    1652              : 
    1653              : /* By default consider masked stores to be expensive.  */
    1654              : 
    1655              : bool
    1656         9304 : default_conditional_operation_is_expensive (unsigned ifn)
    1657              : {
    1658         9304 :   return ifn == IFN_MASK_STORE;
    1659              : }
    1660              : 
    1661              : /* By default consider masked stores to be expensive.  */
    1662              : 
    1663              : bool
    1664          499 : default_empty_mask_is_expensive (unsigned ifn)
    1665              : {
    1666          499 :   return ifn == IFN_MASK_STORE;
    1667              : }
    1668              : 
    1669              : /* By default, the cost model accumulates three separate costs (prologue,
    1670              :    loop body, and epilogue) for a vectorized loop or block.  So allocate an
    1671              :    array of three unsigned ints, set it to zero, and return its address.  */
    1672              : 
    1673              : vector_costs *
    1674            0 : default_vectorize_create_costs (vec_info *vinfo, bool costing_for_scalar)
    1675              : {
    1676            0 :   return new vector_costs (vinfo, costing_for_scalar);
    1677              : }
    1678              : 
    1679              : /* Determine whether or not a pointer mode is valid. Assume defaults
    1680              :    of ptr_mode or Pmode - can be overridden.  */
    1681              : bool
    1682      7510889 : default_valid_pointer_mode (scalar_int_mode mode)
    1683              : {
    1684      7510889 :   return (mode == ptr_mode || mode == Pmode);
    1685              : }
    1686              : 
    1687              : /* Determine whether the memory reference specified by REF may alias
    1688              :    the C libraries errno location.  */
    1689              : bool
    1690      8460447 : default_ref_may_alias_errno (ao_ref *ref)
    1691              : {
    1692      8460447 :   tree base = ao_ref_base (ref);
    1693              :   /* The default implementation assumes the errno location is
    1694              :      a declaration of type int or is always accessed via a
    1695              :      pointer to int.  We assume that accesses to errno are
    1696              :      not deliberately obfuscated (even in conforming ways).  */
    1697      8460447 :   if (TYPE_UNSIGNED (TREE_TYPE (base))
    1698      8460447 :       || TYPE_MODE (TREE_TYPE (base)) != TYPE_MODE (integer_type_node))
    1699              :     return false;
    1700              :   /* The default implementation assumes an errno location declaration
    1701              :      is never defined in the current compilation unit and may not be
    1702              :      aliased by a local variable.  */
    1703       380541 :   if (DECL_P (base)
    1704       260671 :       && DECL_EXTERNAL (base)
    1705       382643 :       && !TREE_STATIC (base))
    1706              :     return true;
    1707       380448 :   else if (TREE_CODE (base) == MEM_REF
    1708       380448 :            && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
    1709              :     {
    1710       110502 :       const pt_solution *pt = ssa_name_pt_solution (TREE_OPERAND (base, 0));
    1711       108532 :       return !pt || pt->anything || pt->nonlocal;
    1712              :     }
    1713              :   return false;
    1714              : }
    1715              : 
    1716              : /* Return the mode for a pointer to a given ADDRSPACE,
    1717              :    defaulting to ptr_mode for all address spaces.  */
    1718              : 
    1719              : scalar_int_mode
    1720   3258103274 : default_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED)
    1721              : {
    1722   3258103274 :   return ptr_mode;
    1723              : }
    1724              : 
    1725              : /* Return the mode for an address in a given ADDRSPACE,
    1726              :    defaulting to Pmode for all address spaces.  */
    1727              : 
    1728              : scalar_int_mode
    1729    100812684 : default_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED)
    1730              : {
    1731    100812684 :   return Pmode;
    1732              : }
    1733              : 
    1734              : /* Named address space version of valid_pointer_mode.
    1735              :    To match the above, the same modes apply to all address spaces.  */
    1736              : 
    1737              : bool
    1738      7510889 : default_addr_space_valid_pointer_mode (machine_mode mode,
    1739              :                                        addr_space_t as ATTRIBUTE_UNUSED)
    1740              : {
    1741      7510889 :   if (! SCALAR_INT_MODE_P (mode))
    1742              :     return false;
    1743              : 
    1744      7510889 :   return targetm.valid_pointer_mode (as_a <scalar_int_mode> (mode));
    1745              : }
    1746              : 
    1747              : /* Some places still assume that all pointer or address modes are the
    1748              :    standard Pmode and ptr_mode.  These optimizations become invalid if
    1749              :    the target actually supports multiple different modes.  For now,
    1750              :    we disable such optimizations on such targets, using this function.  */
    1751              : 
    1752              : bool
    1753    736331425 : target_default_pointer_address_modes_p (void)
    1754              : {
    1755    736331425 :   if (targetm.addr_space.address_mode != default_addr_space_address_mode)
    1756              :     return false;
    1757    736331425 :   if (targetm.addr_space.pointer_mode != default_addr_space_pointer_mode)
    1758            0 :     return false;
    1759              : 
    1760              :   return true;
    1761              : }
    1762              : 
    1763              : /* Named address space version of legitimate_address_p.
    1764              :    By default, all address spaces have the same form.  */
    1765              : 
    1766              : bool
    1767   1499413657 : default_addr_space_legitimate_address_p (machine_mode mode, rtx mem,
    1768              :                                          bool strict,
    1769              :                                          addr_space_t as ATTRIBUTE_UNUSED,
    1770              :                                          code_helper code)
    1771              : {
    1772   1499413657 :   return targetm.legitimate_address_p (mode, mem, strict, code);
    1773              : }
    1774              : 
    1775              : /* Named address space version of LEGITIMIZE_ADDRESS.
    1776              :    By default, all address spaces have the same form.  */
    1777              : 
    1778              : rtx
    1779       701778 : default_addr_space_legitimize_address (rtx x, rtx oldx, machine_mode mode,
    1780              :                                        addr_space_t as ATTRIBUTE_UNUSED)
    1781              : {
    1782       701778 :   return targetm.legitimize_address (x, oldx, mode);
    1783              : }
    1784              : 
    1785              : /* The default hook for determining if one named address space is a subset of
    1786              :    another and to return which address space to use as the common address
    1787              :    space.  */
    1788              : 
    1789              : bool
    1790            3 : default_addr_space_subset_p (addr_space_t subset, addr_space_t superset)
    1791              : {
    1792            3 :   return (subset == superset);
    1793              : }
    1794              : 
    1795              : /* The default hook for determining if 0 within a named address
    1796              :    space is a valid address.  */
    1797              : 
    1798              : bool
    1799            0 : default_addr_space_zero_address_valid (addr_space_t as ATTRIBUTE_UNUSED)
    1800              : {
    1801            0 :   return false;
    1802              : }
    1803              : 
    1804              : /* The default hook for debugging the address space is to return the
    1805              :    address space number to indicate DW_AT_address_class.  */
    1806              : int
    1807            3 : default_addr_space_debug (addr_space_t as)
    1808              : {
    1809            3 :   return as;
    1810              : }
    1811              : 
    1812              : /* The default hook implementation for TARGET_ADDR_SPACE_DIAGNOSE_USAGE.
    1813              :    Don't complain about any address space.  */
    1814              : 
    1815              : void
    1816          178 : default_addr_space_diagnose_usage (addr_space_t, location_t)
    1817              : {
    1818          178 : }
    1819              : 
    1820              : 
    1821              : /* The default hook for TARGET_ADDR_SPACE_CONVERT. This hook should never be
    1822              :    called for targets with only a generic address space.  */
    1823              : 
    1824              : rtx
    1825            0 : default_addr_space_convert (rtx op ATTRIBUTE_UNUSED,
    1826              :                             tree from_type ATTRIBUTE_UNUSED,
    1827              :                             tree to_type ATTRIBUTE_UNUSED)
    1828              : {
    1829            0 :   gcc_unreachable ();
    1830              : }
    1831              : 
    1832              : 
    1833              : /* The default hook for TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA.  */
    1834              : 
    1835              : addr_space_t
    1836          510 : default_addr_space_for_artificial_rodata (tree, artificial_rodata)
    1837              : {
    1838          510 :   return ADDR_SPACE_GENERIC;
    1839              : }
    1840              : 
    1841              : 
    1842              : /* The default implementation of TARGET_HARD_REGNO_NREGS.  */
    1843              : 
    1844              : unsigned int
    1845            0 : default_hard_regno_nregs (unsigned int, machine_mode mode)
    1846              : {
    1847              :   /* Targets with variable-sized modes must provide their own definition
    1848              :      of this hook.  */
    1849            0 :   return CEIL (GET_MODE_SIZE (mode).to_constant (), UNITS_PER_WORD);
    1850              : }
    1851              : 
    1852              : bool
    1853            0 : default_hard_regno_scratch_ok (unsigned int regno ATTRIBUTE_UNUSED)
    1854              : {
    1855            0 :   return true;
    1856              : }
    1857              : 
    1858              : /* The default implementation of TARGET_MODE_DEPENDENT_ADDRESS_P.  */
    1859              : 
    1860              : bool
    1861     36821830 : default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED,
    1862              :                                   addr_space_t addrspace ATTRIBUTE_UNUSED)
    1863              : {
    1864     36821830 :   return false;
    1865              : }
    1866              : 
    1867              : extern bool default_new_address_profitable_p (rtx, rtx);
    1868              : 
    1869              : 
    1870              : /* The default implementation of TARGET_NEW_ADDRESS_PROFITABLE_P.  */
    1871              : 
    1872              : bool
    1873      1136236 : default_new_address_profitable_p (rtx memref ATTRIBUTE_UNUSED,
    1874              :                                   rtx_insn *insn ATTRIBUTE_UNUSED,
    1875              :                                   rtx new_addr ATTRIBUTE_UNUSED)
    1876              : {
    1877      1136236 :   return true;
    1878              : }
    1879              : 
    1880              : bool
    1881            0 : default_target_option_valid_attribute_p (tree ARG_UNUSED (fndecl),
    1882              :                                          tree ARG_UNUSED (name),
    1883              :                                          tree ARG_UNUSED (args),
    1884              :                                          int ARG_UNUSED (flags))
    1885              : {
    1886            0 :   warning (OPT_Wattributes,
    1887              :            "%<target%> attribute is not supported on this machine");
    1888              : 
    1889            0 :   return false;
    1890              : }
    1891              : 
    1892              : bool
    1893            0 : default_target_option_valid_version_attribute_p (tree ARG_UNUSED (fndecl),
    1894              :                                                  tree ARG_UNUSED (name),
    1895              :                                                  tree ARG_UNUSED (args),
    1896              :                                                  int ARG_UNUSED (flags))
    1897              : {
    1898            0 :   warning (OPT_Wattributes,
    1899              :            "%<target_version%> attribute is not supported on this machine");
    1900              : 
    1901            0 :   return false;
    1902              : }
    1903              : 
    1904              : bool
    1905            0 : default_target_option_pragma_parse (tree ARG_UNUSED (args),
    1906              :                                     tree ARG_UNUSED (pop_target))
    1907              : {
    1908              :   /* If args is NULL the caller is handle_pragma_pop_options ().  In that case,
    1909              :      emit no warning because "#pragma GCC pop_target" is valid on targets that
    1910              :      do not have the "target" pragma.  */
    1911            0 :   if (args)
    1912            0 :     warning (OPT_Wpragmas,
    1913              :              "%<#pragma GCC target%> is not supported for this machine");
    1914              : 
    1915            0 :   return false;
    1916              : }
    1917              : 
    1918              : bool
    1919            0 : default_target_can_inline_p (tree caller, tree callee)
    1920              : {
    1921            0 :   tree callee_opts = DECL_FUNCTION_SPECIFIC_TARGET (callee);
    1922            0 :   tree caller_opts = DECL_FUNCTION_SPECIFIC_TARGET (caller);
    1923            0 :   if (! callee_opts)
    1924            0 :     callee_opts = target_option_default_node;
    1925            0 :   if (! caller_opts)
    1926            0 :     caller_opts = target_option_default_node;
    1927              : 
    1928              :   /* If both caller and callee have attributes, assume that if the
    1929              :      pointer is different, the two functions have different target
    1930              :      options since build_target_option_node uses a hash table for the
    1931              :      options.  */
    1932            0 :   return callee_opts == caller_opts;
    1933              : }
    1934              : 
    1935              : /* By default, return false to not need to collect any target information
    1936              :    for inlining.  Target maintainer should re-define the hook if the
    1937              :    target want to take advantage of it.  */
    1938              : 
    1939              : bool
    1940      5948853 : default_need_ipa_fn_target_info (const_tree, unsigned int &)
    1941              : {
    1942      5948853 :   return false;
    1943              : }
    1944              : 
    1945              : bool
    1946            0 : default_update_ipa_fn_target_info (unsigned int &, const gimple *)
    1947              : {
    1948            0 :   return false;
    1949              : }
    1950              : 
    1951              : /* If the machine does not have a case insn that compares the bounds,
    1952              :    this means extra overhead for dispatch tables, which raises the
    1953              :    threshold for using them.  */
    1954              : 
    1955              : unsigned int
    1956      6747308 : default_case_values_threshold (void)
    1957              : {
    1958      6747308 :   return (targetm.have_casesi () ? 4 : 5);
    1959              : }
    1960              : 
    1961              : bool
    1962    120941568 : default_have_conditional_execution (void)
    1963              : {
    1964    120941568 :   return HAVE_conditional_execution;
    1965              : }
    1966              : 
    1967              : bool
    1968            0 : default_have_ccmp (void)
    1969              : {
    1970            0 :   return targetm.gen_ccmp_first != NULL;
    1971              : }
    1972              : 
    1973              : /* Default implementation of TARGET_CCMP_FIRST_PREFERENCE.  */
    1974              : 
    1975              : ccmp_first_kind
    1976            2 : default_ccmp_first_preference (machine_mode, tree_code, const_tree,
    1977              :                                const_tree)
    1978              : {
    1979            2 :   return CCMP_FIRST_UNSUPPORTED;
    1980              : }
    1981              : 
    1982              : /* By default we assume that c99 functions are present at the runtime,
    1983              :    but sincos is not.  */
    1984              : bool
    1985            0 : default_libc_has_function (enum function_class fn_class,
    1986              :                            tree type ATTRIBUTE_UNUSED)
    1987              : {
    1988            0 :   if (fn_class == function_c94
    1989              :       || fn_class == function_c99_misc
    1990              :       || fn_class == function_c99_math_complex)
    1991            0 :     return true;
    1992              : 
    1993              :   return false;
    1994              : }
    1995              : 
    1996              : /* By default assume that libc has not a fast implementation.  */
    1997              : 
    1998              : bool
    1999            0 : default_libc_has_fast_function (int fcode ATTRIBUTE_UNUSED)
    2000              : {
    2001            0 :   return false;
    2002              : }
    2003              : 
    2004              : bool
    2005            0 : gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED,
    2006              :                        tree type ATTRIBUTE_UNUSED)
    2007              : {
    2008            0 :   return true;
    2009              : }
    2010              : 
    2011              : bool
    2012            0 : no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED,
    2013              :                           tree type ATTRIBUTE_UNUSED)
    2014              : {
    2015            0 :   return false;
    2016              : }
    2017              : 
    2018              : /* Assume some c99 functions are present at the runtime including sincos.  */
    2019              : bool
    2020            0 : bsd_libc_has_function (enum function_class fn_class,
    2021              :                        tree type ATTRIBUTE_UNUSED)
    2022              : {
    2023            0 :   if (fn_class == function_c94
    2024            0 :       || fn_class == function_c99_misc
    2025            0 :       || fn_class == function_sincos)
    2026              :     return true;
    2027              : 
    2028              :   return false;
    2029              : }
    2030              : 
    2031              : /* By default, -fhardened will add -D_FORTIFY_SOURCE=2.  */
    2032              : 
    2033              : unsigned
    2034            0 : default_fortify_source_default_level ()
    2035              : {
    2036            0 :   return 2;
    2037              : }
    2038              : 
    2039              : unsigned
    2040          124 : default_libm_function_max_error (unsigned, machine_mode, bool)
    2041              : {
    2042          124 :   return ~0U;
    2043              : }
    2044              : 
    2045              : unsigned
    2046        78799 : glibc_linux_libm_function_max_error (unsigned cfn, machine_mode mode,
    2047              :                                      bool boundary_p)
    2048              : {
    2049              :   /* Let's use
    2050              :      https://www.gnu.org/software/libc/manual/2.22/html_node/Errors-in-Math-Functions.html
    2051              :      https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
    2052              :      with usual values recorded here and significant outliers handled in
    2053              :      target CPU specific overriders.  The tables only record default
    2054              :      rounding to nearest, for -frounding-math let's add some extra ulps.
    2055              :      For boundary_p values (say finite results outside of [-1.,1.] for
    2056              :      sin/cos, or [-0.,+Inf] for sqrt etc. let's use custom random testers.  */
    2057        78799 :   int rnd = flag_rounding_math ? 4 : 0;
    2058        78799 :   bool sf = (REAL_MODE_FORMAT (mode) == &ieee_single_format
    2059        58650 :              || REAL_MODE_FORMAT (mode) == &mips_single_format
    2060       137449 :              || REAL_MODE_FORMAT (mode) == &motorola_single_format);
    2061        78799 :   bool df = (REAL_MODE_FORMAT (mode) == &ieee_double_format
    2062        38188 :              || REAL_MODE_FORMAT (mode) == &mips_double_format
    2063       116987 :              || REAL_MODE_FORMAT (mode) == &motorola_double_format);
    2064        78799 :   bool xf = (REAL_MODE_FORMAT (mode) == &ieee_extended_intel_96_format
    2065        75483 :              || REAL_MODE_FORMAT (mode) == &ieee_extended_intel_128_format
    2066       141455 :              || REAL_MODE_FORMAT (mode) == &ieee_extended_motorola_format);
    2067        78799 :   bool tf = (REAL_MODE_FORMAT (mode) == &ieee_quad_format
    2068        78799 :              || REAL_MODE_FORMAT (mode) == &mips_quad_format);
    2069              : 
    2070        78799 :   switch (cfn)
    2071              :     {
    2072        52110 :     CASE_CFN_SQRT:
    2073        52110 :     CASE_CFN_SQRT_FN:
    2074        52110 :       if (boundary_p)
    2075              :         /* https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616595.html */
    2076              :         return 0;
    2077        26055 :       if (sf || df || xf || tf)
    2078        25931 :         return 0 + rnd;
    2079              :       break;
    2080         8360 :     CASE_CFN_COS:
    2081         8360 :     CASE_CFN_COS_FN:
    2082              :       /* cos is generally errors like sin, but far more arches have 2ulps
    2083              :          for double.  */
    2084         8360 :       if (!boundary_p && df)
    2085         1556 :         return 2 + rnd;
    2086        25133 :       gcc_fallthrough ();
    2087        25133 :     CASE_CFN_SIN:
    2088        25133 :     CASE_CFN_SIN_FN:
    2089        25133 :       if (boundary_p)
    2090              :         /* According to
    2091              :            https://sourceware.org/pipermail/gcc-patches/2023-April/616315.html
    2092              :            seems default rounding sin/cos stay strictly in [-1.,1.] range,
    2093              :            with rounding to infinity it can be 1ulp larger/smaller.  */
    2094        14722 :         return flag_rounding_math ? 1 : 0;
    2095        10411 :       if (sf || df)
    2096         6720 :         return 1 + rnd;
    2097         3691 :       if (xf || tf)
    2098         3691 :         return 2 + rnd;
    2099              :       break;
    2100              :     default:
    2101              :       break;
    2102              :     }
    2103              : 
    2104          124 :   return default_libm_function_max_error (cfn, mode, boundary_p);
    2105              : }
    2106              : 
    2107              : tree
    2108            0 : default_builtin_tm_load_store (tree ARG_UNUSED (type))
    2109              : {
    2110            0 :   return NULL_TREE;
    2111              : }
    2112              : 
    2113              : /* Compute cost of moving registers to/from memory.  */
    2114              : 
    2115              : int
    2116            0 : default_memory_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
    2117              :                           reg_class_t rclass ATTRIBUTE_UNUSED,
    2118              :                           bool in ATTRIBUTE_UNUSED)
    2119              : {
    2120              : #ifndef MEMORY_MOVE_COST
    2121            0 :     return (4 + memory_move_secondary_cost (mode, (enum reg_class) rclass, in));
    2122              : #else
    2123              :     return MEMORY_MOVE_COST (MACRO_MODE (mode), (enum reg_class) rclass, in);
    2124              : #endif
    2125              : }
    2126              : 
    2127              : /* Compute cost of moving data from a register of class FROM to one of
    2128              :    TO, using MODE.  */
    2129              : 
    2130              : int
    2131            0 : default_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
    2132              :                             reg_class_t from ATTRIBUTE_UNUSED,
    2133              :                             reg_class_t to ATTRIBUTE_UNUSED)
    2134              : {
    2135              : #ifndef REGISTER_MOVE_COST
    2136            0 :   return 2;
    2137              : #else
    2138              :   return REGISTER_MOVE_COST (MACRO_MODE (mode),
    2139              :                              (enum reg_class) from, (enum reg_class) to);
    2140              : #endif
    2141              : }
    2142              : 
    2143              : /* The default implementation of TARGET_CALLEE_SAVE_COST.  */
    2144              : 
    2145              : int
    2146            0 : default_callee_save_cost (spill_cost_type spill_type, unsigned int,
    2147              :                           machine_mode, unsigned int, int mem_cost,
    2148              :                           const HARD_REG_SET &callee_saved_regs,
    2149              :                           bool existing_spills_p)
    2150              : {
    2151            0 :   if (!existing_spills_p)
    2152              :     {
    2153            0 :       auto frame_type = (spill_type == spill_cost_type::SAVE
    2154            0 :                          ? frame_cost_type::ALLOCATION
    2155              :                          : frame_cost_type::DEALLOCATION);
    2156            0 :       mem_cost += targetm.frame_allocation_cost (frame_type,
    2157              :                                                  callee_saved_regs);
    2158              :     }
    2159            0 :   return mem_cost;
    2160              : }
    2161              : 
    2162              : /* The default implementation of TARGET_FRAME_ALLOCATION_COST.  */
    2163              : 
    2164              : int
    2165     16797212 : default_frame_allocation_cost (frame_cost_type, const HARD_REG_SET &)
    2166              : {
    2167     16797212 :   return 0;
    2168              : }
    2169              : 
    2170              : /* The default implementation of TARGET_SLOW_UNALIGNED_ACCESS.  */
    2171              : 
    2172              : bool
    2173      3551236 : default_slow_unaligned_access (machine_mode, unsigned int)
    2174              : {
    2175      3551236 :   return STRICT_ALIGNMENT;
    2176              : }
    2177              : 
    2178              : /* The default implementation of TARGET_ESTIMATED_POLY_VALUE.  */
    2179              : 
    2180              : HOST_WIDE_INT
    2181            0 : default_estimated_poly_value (poly_int64 x, poly_value_estimate_kind)
    2182              : {
    2183            0 :   return x.coeffs[0];
    2184              : }
    2185              : 
    2186              : /* For hooks which use the MOVE_RATIO macro, this gives the legacy default
    2187              :    behavior.  SPEED_P is true if we are compiling for speed.  */
    2188              : 
    2189              : unsigned int
    2190      1767687 : get_move_ratio (bool speed_p ATTRIBUTE_UNUSED)
    2191              : {
    2192      1767687 :   unsigned int move_ratio;
    2193              : #ifdef MOVE_RATIO
    2194      1767687 :   move_ratio = (unsigned int) MOVE_RATIO (speed_p);
    2195              : #else
    2196              : #if defined (HAVE_cpymemqi) || defined (HAVE_cpymemhi) || defined (HAVE_cpymemsi) || defined (HAVE_cpymemdi) || defined (HAVE_cpymemti)
    2197              :   move_ratio = 2;
    2198              : #else /* No cpymem patterns, pick a default.  */
    2199              :   move_ratio = ((speed_p) ? 15 : 3);
    2200              : #endif
    2201              : #endif
    2202      1767687 :   return move_ratio;
    2203              : }
    2204              : 
    2205              : /* Return TRUE if the move_by_pieces/set_by_pieces infrastructure should be
    2206              :    used; return FALSE if the cpymem/setmem optab should be expanded, or
    2207              :    a call to memcpy emitted.  */
    2208              : 
    2209              : bool
    2210      1210237 : default_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size,
    2211              :                                         unsigned int alignment,
    2212              :                                         enum by_pieces_operation op,
    2213              :                                         bool speed_p)
    2214              : {
    2215      1210237 :   unsigned int max_size = 0;
    2216      1210237 :   unsigned int ratio = 0;
    2217              : 
    2218      1210237 :   switch (op)
    2219              :     {
    2220        94725 :     case CLEAR_BY_PIECES:
    2221        94725 :       max_size = STORE_MAX_PIECES;
    2222        94725 :       ratio = CLEAR_RATIO (speed_p);
    2223              :       break;
    2224       901538 :     case MOVE_BY_PIECES:
    2225       901538 :       max_size = MOVE_MAX_PIECES;
    2226       901538 :       ratio = get_move_ratio (speed_p);
    2227       901538 :       break;
    2228        53513 :     case SET_BY_PIECES:
    2229        53513 :       max_size = STORE_MAX_PIECES;
    2230        53513 :       ratio = SET_RATIO (speed_p);
    2231              :       break;
    2232        91618 :     case STORE_BY_PIECES:
    2233        91618 :       max_size = STORE_MAX_PIECES;
    2234        91618 :       ratio = get_move_ratio (speed_p);
    2235        91618 :       break;
    2236        68843 :     case COMPARE_BY_PIECES:
    2237        68843 :       max_size = COMPARE_MAX_PIECES;
    2238              :       /* Pick a likely default, just as in get_move_ratio.  */
    2239        68843 :       ratio = speed_p ? 15 : 3;
    2240              :       break;
    2241              :     }
    2242              : 
    2243      1210237 :   return by_pieces_ninsns (size, alignment, max_size + 1, op) < ratio;
    2244              : }
    2245              : 
    2246              : /* This hook controls code generation for expanding a memcmp operation by
    2247              :    pieces.  Return 1 for the normal pattern of compare/jump after each pair
    2248              :    of loads, or a higher number to reduce the number of branches.  */
    2249              : 
    2250              : int
    2251            0 : default_compare_by_pieces_branch_ratio (machine_mode)
    2252              : {
    2253            0 :   return 1;
    2254              : }
    2255              : 
    2256              : /* Write PATCH_AREA_SIZE NOPs into the asm outfile FILE around a function
    2257              :    entry.  If RECORD_P is true and the target supports named sections,
    2258              :    the location of the NOPs will be recorded in a special object section
    2259              :    called "__patchable_function_entries".  This routine may be called
    2260              :    twice per function to put NOPs before and after the function
    2261              :    entry.  */
    2262              : 
    2263              : void
    2264           59 : default_print_patchable_function_entry (FILE *file,
    2265              :                                         unsigned HOST_WIDE_INT patch_area_size,
    2266              :                                         bool record_p)
    2267              : {
    2268           59 :   const char *nop_templ = 0;
    2269           59 :   int code_num;
    2270           59 :   rtx_insn *my_nop = make_insn_raw (gen_nop ());
    2271              : 
    2272              :   /* We use the template alone, relying on the (currently sane) assumption
    2273              :      that the NOP template does not have variable operands.  */
    2274           59 :   code_num = recog_memoized (my_nop);
    2275           59 :   nop_templ = get_insn_template (code_num, my_nop);
    2276              : 
    2277           59 :   if (record_p && targetm_common.have_named_sections)
    2278              :     {
    2279           53 :       char buf[256];
    2280           53 :       section *previous_section = in_section;
    2281           53 :       const char *asm_op = integer_asm_op (POINTER_SIZE_UNITS, false);
    2282              : 
    2283           53 :       gcc_assert (asm_op != NULL);
    2284              :       /* If SECTION_LINK_ORDER is supported, this internal label will
    2285              :          be filled as the symbol for linked_to section.  */
    2286           53 :       ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE", current_function_funcdef_no);
    2287              : 
    2288           53 :       unsigned int flags = SECTION_WRITE | SECTION_RELRO;
    2289           53 :       if (HAVE_GAS_SECTION_LINK_ORDER)
    2290           53 :         flags |= SECTION_LINK_ORDER;
    2291              : 
    2292           53 :       section *sect = get_section ("__patchable_function_entries",
    2293              :                                   flags, current_function_decl);
    2294           53 :       if (HAVE_COMDAT_GROUP && DECL_COMDAT_GROUP (current_function_decl))
    2295           12 :         switch_to_comdat_section (sect, current_function_decl);
    2296              :       else
    2297           41 :         switch_to_section (sect);
    2298           53 :       assemble_align (POINTER_SIZE);
    2299           53 :       fputs (asm_op, file);
    2300           53 :       assemble_name_raw (file, buf);
    2301           53 :       fputc ('\n', file);
    2302              : 
    2303           53 :       switch_to_section (previous_section);
    2304           53 :       ASM_OUTPUT_LABEL (file, buf);
    2305              :     }
    2306              : 
    2307           59 :   unsigned i;
    2308          136 :   for (i = 0; i < patch_area_size; ++i)
    2309           77 :     output_asm_insn (nop_templ, NULL);
    2310           59 : }
    2311              : 
    2312              : bool
    2313            0 : default_profile_before_prologue (void)
    2314              : {
    2315              : #ifdef PROFILE_BEFORE_PROLOGUE
    2316              :   return true;
    2317              : #else
    2318            0 :   return false;
    2319              : #endif
    2320              : }
    2321              : 
    2322              : /* The default implementation of TARGET_PREFERRED_RELOAD_CLASS.  */
    2323              : 
    2324              : reg_class_t
    2325            0 : default_preferred_reload_class (rtx x ATTRIBUTE_UNUSED,
    2326              :                                 reg_class_t rclass)
    2327              : {
    2328              : #ifdef PREFERRED_RELOAD_CLASS
    2329              :   return (reg_class_t) PREFERRED_RELOAD_CLASS (x, (enum reg_class) rclass);
    2330              : #else
    2331            0 :   return rclass;
    2332              : #endif
    2333              : }
    2334              : 
    2335              : /* The default implementation of TARGET_OUTPUT_PREFERRED_RELOAD_CLASS.  */
    2336              : 
    2337              : reg_class_t
    2338            0 : default_preferred_output_reload_class (rtx x ATTRIBUTE_UNUSED,
    2339              :                                        reg_class_t rclass)
    2340              : {
    2341            0 :   return rclass;
    2342              : }
    2343              : 
    2344              : /* The default implementation of TARGET_BASE_REG_CLASS.  */
    2345              : 
    2346              : reg_class_t
    2347            0 : default_base_reg_class (machine_mode mode ATTRIBUTE_UNUSED,
    2348              :                         addr_space_t as ATTRIBUTE_UNUSED,
    2349              :                         enum rtx_code outer_code ATTRIBUTE_UNUSED,
    2350              :                         enum rtx_code index_code ATTRIBUTE_UNUSED,
    2351              :                         rtx mem ATTRIBUTE_UNUSED,
    2352              :                         rtx_insn *insn ATTRIBUTE_UNUSED)
    2353              : {
    2354              : #ifdef MODE_CODE_BASE_REG_CLASS
    2355              :   return MODE_CODE_BASE_REG_CLASS (MACRO_MODE (mode), as, outer_code,
    2356              :                                    index_code);
    2357              : #else
    2358              : #ifdef MODE_BASE_REG_REG_CLASS
    2359              :   if (index_code == REG)
    2360              :     return MODE_BASE_REG_REG_CLASS (MACRO_MODE (mode));
    2361              : #endif
    2362              : #ifdef MODE_BASE_REG_CLASS
    2363              :   return MODE_BASE_REG_CLASS (MACRO_MODE (mode));
    2364              : #elif defined (BASE_REG_CLASS)
    2365            0 :   return BASE_REG_CLASS;
    2366              : #else
    2367              :   /* No target that leaves TARGET_BASE_REG_CLASS at its default also fails
    2368              :      to define BASE_REG_CLASS or one of the other macros above; a target
    2369              :      that defines none of them must override the hook directly instead.  */
    2370              :   gcc_unreachable ();
    2371              : #endif
    2372              : #endif
    2373              : }
    2374              : 
    2375              : /* The default implementation of TARGET_PREFERRED_RENAME_CLASS.  */
    2376              : reg_class_t
    2377      1014549 : default_preferred_rename_class (reg_class_t rclass ATTRIBUTE_UNUSED)
    2378              : {
    2379      1014549 :   return NO_REGS;
    2380              : }
    2381              : 
    2382              : /* The default implementation of TARGET_CLASS_LIKELY_SPILLED_P.  */
    2383              : 
    2384              : bool
    2385            0 : default_class_likely_spilled_p (reg_class_t rclass)
    2386              : {
    2387            0 :   return (reg_class_size[(int) rclass] == 1);
    2388              : }
    2389              : 
    2390              : /* The default implementation of TARGET_CLASS_MAX_NREGS.  */
    2391              : 
    2392              : unsigned char
    2393            0 : default_class_max_nregs (reg_class_t rclass ATTRIBUTE_UNUSED,
    2394              :                          machine_mode mode ATTRIBUTE_UNUSED)
    2395              : {
    2396              : #ifdef CLASS_MAX_NREGS
    2397              :   return (unsigned char) CLASS_MAX_NREGS ((enum reg_class) rclass,
    2398              :                                           MACRO_MODE (mode));
    2399              : #else
    2400              :   /* Targets with variable-sized modes must provide their own definition
    2401              :      of this hook.  */
    2402            0 :   unsigned int size = GET_MODE_SIZE (mode).to_constant ();
    2403            0 :   return (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
    2404              : #endif
    2405              : }
    2406              : 
    2407              : /* The default implementation of TARGET_AVOID_STORE_FORWARDING_P.  */
    2408              : 
    2409              : bool
    2410           16 : default_avoid_store_forwarding_p (vec<store_fwd_info>, rtx, int total_cost,
    2411              :                                   bool)
    2412              : {
    2413              :   /* Use a simple cost heurstic base on param_store_forwarding_max_distance.
    2414              :      In general the distance should be somewhat correlated to the store
    2415              :      forwarding penalty; if the penalty is large then it is justified to
    2416              :      increase the window size.  Use this to reject sequences that are clearly
    2417              :      unprofitable.
    2418              :      Skip the cost check if param_store_forwarding_max_distance is 0.  */
    2419           16 :   int max_cost = COSTS_N_INSNS (param_store_forwarding_max_distance / 2);
    2420           16 :   const bool unlimited_cost = (param_store_forwarding_max_distance == 0);
    2421           16 :   if (!unlimited_cost && total_cost > max_cost && max_cost)
    2422              :     {
    2423            5 :       if (dump_file)
    2424            0 :         fprintf (dump_file, "Not transformed due to cost: %d > %d.\n",
    2425              :                  total_cost, max_cost);
    2426              : 
    2427              :       return false;
    2428              :     }
    2429              : 
    2430              :   return true;
    2431              : }
    2432              : 
    2433              : /* Determine the debugging unwind mechanism for the target.  */
    2434              : 
    2435              : enum unwind_info_type
    2436      1320296 : default_debug_unwind_info (void)
    2437              : {
    2438              :   /* If the target wants to force the use of dwarf2 unwind info, let it.  */
    2439              :   /* ??? Change all users to the hook, then poison this.  */
    2440              : #ifdef DWARF2_FRAME_INFO
    2441              :   if (DWARF2_FRAME_INFO)
    2442              :     return UI_DWARF2;
    2443              : #endif
    2444              : 
    2445              :   /* Otherwise, only turn it on if dwarf2 debugging is enabled.  */
    2446              : #ifdef DWARF2_DEBUGGING_INFO
    2447      1320296 :   if (dwarf_debuginfo_p ())
    2448       667869 :     return UI_DWARF2;
    2449              : #endif
    2450              : 
    2451              :   return UI_NONE;
    2452              : }
    2453              : 
    2454              : /* Targets that set NUM_POLY_INT_COEFFS to something greater than 1
    2455              :    must define this hook.  */
    2456              : 
    2457              : unsigned int
    2458            0 : default_dwarf_poly_indeterminate_value (unsigned int, unsigned int *, int *)
    2459              : {
    2460            0 :   gcc_unreachable ();
    2461              : }
    2462              : 
    2463              : /* Determine the correct mode for a Dwarf frame register that represents
    2464              :    register REGNO.  */
    2465              : 
    2466              : machine_mode
    2467          752 : default_dwarf_frame_reg_mode (int regno)
    2468              : {
    2469          752 :   machine_mode save_mode = reg_raw_mode[regno];
    2470              : 
    2471          752 :   if (targetm.hard_regno_call_part_clobbered (eh_edge_abi.id (),
    2472              :                                               regno, save_mode))
    2473            0 :     save_mode = choose_hard_reg_mode (regno, 1, &eh_edge_abi);
    2474          752 :   return save_mode;
    2475              : }
    2476              : 
    2477              : /* To be used by targets where reg_raw_mode doesn't return the right
    2478              :    mode for registers used in apply_builtin_return and apply_builtin_arg.  */
    2479              : 
    2480              : fixed_size_mode
    2481         7530 : default_get_reg_raw_mode (int regno)
    2482              : {
    2483              :   /* Targets must override this hook if the underlying register is
    2484              :      variable-sized.  */
    2485         7530 :   return as_a <fixed_size_mode> (reg_raw_mode[regno]);
    2486              : }
    2487              : 
    2488              : /* Return true if a leaf function should stay leaf even with profiling
    2489              :    enabled.  */
    2490              : 
    2491              : bool
    2492          624 : default_keep_leaf_when_profiled ()
    2493              : {
    2494          624 :   return false;
    2495              : }
    2496              : 
    2497              : /* Return true if the state of option OPTION should be stored in PCH files
    2498              :    and checked by default_pch_valid_p.  Store the option's current state
    2499              :    in STATE if so.  */
    2500              : 
    2501              : static inline bool
    2502     47257990 : option_affects_pch_p (int option, struct cl_option_state *state)
    2503              : {
    2504     47257990 :   if ((cl_options[option].flags & CL_TARGET) == 0)
    2505              :     return false;
    2506      3869584 :   if ((cl_options[option].flags & CL_PCH_IGNORE) != 0)
    2507              :     return false;
    2508      3869584 :   if (option_flag_var (option, &global_options) == &target_flags)
    2509       640414 :     if (targetm.check_pch_target_flags)
    2510              :       return false;
    2511      3869584 :   return get_option_state (&global_options, option, state);
    2512              : }
    2513              : 
    2514              : /* Default version of get_pch_validity.
    2515              :    By default, every flag difference is fatal; that will be mostly right for
    2516              :    most targets, but completely right for very few.  */
    2517              : 
    2518              : void *
    2519          428 : default_get_pch_validity (size_t *sz)
    2520              : {
    2521          428 :   struct cl_option_state state;
    2522          428 :   size_t i;
    2523          428 :   char *result, *r;
    2524              : 
    2525          428 :   *sz = 2;
    2526          428 :   if (targetm.check_pch_target_flags)
    2527            0 :     *sz += sizeof (target_flags);
    2528      1112800 :   for (i = 0; i < cl_options_count; i++)
    2529      1112372 :     if (option_affects_pch_p (i, &state))
    2530       101008 :       *sz += state.size;
    2531              : 
    2532          428 :   result = r = XNEWVEC (char, *sz);
    2533          428 :   r[0] = flag_pic;
    2534          428 :   r[1] = flag_pie;
    2535          428 :   r += 2;
    2536          428 :   if (targetm.check_pch_target_flags)
    2537              :     {
    2538            0 :       memcpy (r, &target_flags, sizeof (target_flags));
    2539            0 :       r += sizeof (target_flags);
    2540              :     }
    2541              : 
    2542      1112800 :   for (i = 0; i < cl_options_count; i++)
    2543      1112372 :     if (option_affects_pch_p (i, &state))
    2544              :       {
    2545       101008 :         memcpy (r, state.data, state.size);
    2546       101008 :         r += state.size;
    2547              :       }
    2548              : 
    2549          428 :   return result;
    2550              : }
    2551              : 
    2552              : /* Return a message which says that a PCH file was created with a different
    2553              :    setting of OPTION.  */
    2554              : 
    2555              : static const char *
    2556        18526 : pch_option_mismatch (const char *option)
    2557              : {
    2558        18526 :   return xasprintf (_("created and used with differing settings of '%s'"),
    2559        18526 :                     option);
    2560              : }
    2561              : 
    2562              : /* Default version of pch_valid_p.  */
    2563              : 
    2564              : const char *
    2565        18888 : default_pch_valid_p (const void *data_p, size_t len ATTRIBUTE_UNUSED)
    2566              : {
    2567        18888 :   struct cl_option_state state;
    2568        18888 :   const char *data = (const char *)data_p;
    2569        18888 :   size_t i;
    2570              : 
    2571              :   /* -fpic and -fpie also usually make a PCH invalid.  */
    2572        18888 :   if (data[0] != flag_pic)
    2573            0 :     return _("created and used with different settings of %<-fpic%>");
    2574        18888 :   if (data[1] != flag_pie)
    2575            0 :     return _("created and used with different settings of %<-fpie%>");
    2576        18888 :   data += 2;
    2577              : 
    2578              :   /* Check target_flags.  */
    2579        18888 :   if (targetm.check_pch_target_flags)
    2580              :     {
    2581            0 :       int tf;
    2582            0 :       const char *r;
    2583              : 
    2584            0 :       memcpy (&tf, data, sizeof (target_flags));
    2585            0 :       data += sizeof (target_flags);
    2586            0 :       r = targetm.check_pch_target_flags (tf);
    2587            0 :       if (r != NULL)
    2588              :         return r;
    2589              :     }
    2590              : 
    2591     45033608 :   for (i = 0; i < cl_options_count; i++)
    2592     45033246 :     if (option_affects_pch_p (i, &state))
    2593              :       {
    2594      3587358 :         if (memcmp (data, state.data, state.size) != 0)
    2595        18526 :           return pch_option_mismatch (cl_options[i].opt_text);
    2596      3568832 :         data += state.size;
    2597              :       }
    2598              : 
    2599              :   return NULL;
    2600              : }
    2601              : 
    2602              : /* Default version of cstore_mode.  */
    2603              : 
    2604              : scalar_int_mode
    2605       753849 : default_cstore_mode (enum insn_code icode)
    2606              : {
    2607       753849 :   return as_a <scalar_int_mode> (insn_data[(int) icode].operand[0].mode);
    2608              : }
    2609              : 
    2610              : /* Default version of member_type_forces_blk.  */
    2611              : 
    2612              : bool
    2613            0 : default_member_type_forces_blk (const_tree, machine_mode)
    2614              : {
    2615            0 :   return false;
    2616              : }
    2617              : 
    2618              : /* Default version of canonicalize_comparison.  */
    2619              : 
    2620              : void
    2621            0 : default_canonicalize_comparison (int *, rtx *, rtx *, bool)
    2622              : {
    2623            0 : }
    2624              : 
    2625              : /* Default implementation of TARGET_ATOMIC_ASSIGN_EXPAND_FENV.  */
    2626              : 
    2627              : void
    2628            0 : default_atomic_assign_expand_fenv (tree *, tree *, tree *)
    2629              : {
    2630            0 : }
    2631              : 
    2632              : #ifndef PAD_VARARGS_DOWN
    2633              : #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN
    2634              : #endif
    2635              : 
    2636              : /* Build an indirect-ref expression over the given TREE, which represents a
    2637              :    piece of a va_arg() expansion.  */
    2638              : tree
    2639        55192 : build_va_arg_indirect_ref (tree addr)
    2640              : {
    2641        55192 :   addr = build_simple_mem_ref_loc (EXPR_LOCATION (addr), addr);
    2642        55192 :   return addr;
    2643              : }
    2644              : 
    2645              : /* The "standard" implementation of va_arg: read the value from the
    2646              :    current (padded) address and increment by the (padded) size.  */
    2647              : 
    2648              : tree
    2649          272 : std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
    2650              :                           gimple_seq *post_p)
    2651              : {
    2652          272 :   tree addr, t, type_size, rounded_size, valist_tmp;
    2653          272 :   unsigned HOST_WIDE_INT align, boundary;
    2654          272 :   bool indirect;
    2655              : 
    2656              :   /* All of the alignment and movement below is for args-grow-up machines.
    2657              :      As of 2004, there are only 3 ARGS_GROW_DOWNWARD targets, and they all
    2658              :      implement their own specialized gimplify_va_arg_expr routines.  */
    2659          272 :   if (ARGS_GROW_DOWNWARD)
    2660              :     gcc_unreachable ();
    2661              : 
    2662          272 :   indirect = pass_va_arg_by_reference (type);
    2663          272 :   if (indirect)
    2664            0 :     type = build_pointer_type (type);
    2665              : 
    2666          272 :   if (targetm.calls.split_complex_arg
    2667            0 :       && TREE_CODE (type) == COMPLEX_TYPE
    2668          272 :       && targetm.calls.split_complex_arg (type))
    2669              :     {
    2670            0 :       tree real_part, imag_part;
    2671              : 
    2672            0 :       real_part = std_gimplify_va_arg_expr (valist,
    2673            0 :                                             TREE_TYPE (type), pre_p, NULL);
    2674            0 :       real_part = get_initialized_tmp_var (real_part, pre_p);
    2675              : 
    2676            0 :       imag_part = std_gimplify_va_arg_expr (unshare_expr (valist),
    2677            0 :                                             TREE_TYPE (type), pre_p, NULL);
    2678            0 :       imag_part = get_initialized_tmp_var (imag_part, pre_p);
    2679              : 
    2680            0 :       return build2 (COMPLEX_EXPR, type, real_part, imag_part);
    2681              :    }
    2682              : 
    2683          272 :   align = PARM_BOUNDARY / BITS_PER_UNIT;
    2684          272 :   boundary = targetm.calls.function_arg_boundary (TYPE_MODE (type), type);
    2685              : 
    2686              :   /* When we align parameter on stack for caller, if the parameter
    2687              :      alignment is beyond MAX_SUPPORTED_STACK_ALIGNMENT, it will be
    2688              :      aligned at MAX_SUPPORTED_STACK_ALIGNMENT.  We will match callee
    2689              :      here with caller.  */
    2690          272 :   if (boundary > MAX_SUPPORTED_STACK_ALIGNMENT)
    2691              :     boundary = MAX_SUPPORTED_STACK_ALIGNMENT;
    2692              : 
    2693          272 :   boundary /= BITS_PER_UNIT;
    2694              : 
    2695              :   /* Hoist the valist value into a temporary for the moment.  */
    2696          272 :   valist_tmp = get_initialized_tmp_var (valist, pre_p);
    2697              : 
    2698              :   /* va_list pointer is aligned to PARM_BOUNDARY.  If argument actually
    2699              :      requires greater alignment, we must perform dynamic alignment.  */
    2700          272 :   if (boundary > align
    2701            4 :       && !TYPE_EMPTY_P (type)
    2702          276 :       && !integer_zerop (TYPE_SIZE (type)))
    2703              :     {
    2704            4 :       t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
    2705            4 :                   fold_build_pointer_plus_hwi (valist_tmp, boundary - 1));
    2706            4 :       gimplify_and_add (t, pre_p);
    2707              : 
    2708            8 :       t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
    2709            8 :                   fold_build2 (BIT_AND_EXPR, TREE_TYPE (valist),
    2710              :                                valist_tmp,
    2711              :                                build_int_cst (TREE_TYPE (valist), -boundary)));
    2712            4 :       gimplify_and_add (t, pre_p);
    2713              :     }
    2714              :   else
    2715              :     boundary = align;
    2716              : 
    2717              :   /* If the actual alignment is less than the alignment of the type,
    2718              :      adjust the type accordingly so that we don't assume strict alignment
    2719              :      when dereferencing the pointer.  */
    2720          272 :   boundary *= BITS_PER_UNIT;
    2721          272 :   if (boundary < TYPE_ALIGN (type))
    2722              :     {
    2723           22 :       type = build_variant_type_copy (type);
    2724           22 :       SET_TYPE_ALIGN (type, boundary);
    2725              :     }
    2726              : 
    2727              :   /* Compute the rounded size of the type.  */
    2728          272 :   type_size = arg_size_in_bytes (type);
    2729          272 :   rounded_size = round_up (type_size, align);
    2730              : 
    2731              :   /* Reduce rounded_size so it's sharable with the postqueue.  */
    2732          272 :   gimplify_expr (&rounded_size, pre_p, post_p, is_gimple_val, fb_rvalue);
    2733              : 
    2734              :   /* Get AP.  */
    2735          272 :   addr = valist_tmp;
    2736          272 :   if (PAD_VARARGS_DOWN && !integer_zerop (rounded_size))
    2737              :     {
    2738              :       /* Small args are padded downward.  */
    2739              :       t = fold_build2_loc (input_location, GT_EXPR, sizetype,
    2740              :                        rounded_size, size_int (align));
    2741              :       t = fold_build3 (COND_EXPR, sizetype, t, size_zero_node,
    2742              :                        size_binop (MINUS_EXPR, rounded_size, type_size));
    2743              :       addr = fold_build_pointer_plus (addr, t);
    2744              :     }
    2745              : 
    2746              :   /* Compute new value for AP.  */
    2747          272 :   t = fold_build_pointer_plus (valist_tmp, rounded_size);
    2748          272 :   t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
    2749          272 :   gimplify_and_add (t, pre_p);
    2750              : 
    2751          272 :   addr = fold_convert (build_pointer_type (type), addr);
    2752              : 
    2753          272 :   if (indirect)
    2754            0 :     addr = build_va_arg_indirect_ref (addr);
    2755              : 
    2756          272 :   return build_va_arg_indirect_ref (addr);
    2757              : }
    2758              : 
    2759              : /* An implementation of TARGET_CAN_USE_DOLOOP_P for targets that do
    2760              :    not support nested low-overhead loops.  */
    2761              : 
    2762              : bool
    2763            0 : can_use_doloop_if_innermost (const widest_int &, const widest_int &,
    2764              :                              unsigned int loop_depth, bool)
    2765              : {
    2766            0 :   return loop_depth == 1;
    2767              : }
    2768              : 
    2769              : /* Default implementation of TARGET_OPTAB_SUPPORTED_P.  */
    2770              : 
    2771              : bool
    2772            0 : default_optab_supported_p (int, machine_mode, machine_mode, optimization_type)
    2773              : {
    2774            0 :   return true;
    2775              : }
    2776              : 
    2777              : /* Default implementation of TARGET_MAX_NOCE_IFCVT_SEQ_COST.  */
    2778              : 
    2779              : unsigned int
    2780            0 : default_max_noce_ifcvt_seq_cost (edge e)
    2781              : {
    2782            0 :   bool predictable_p = predictable_edge_p (e);
    2783              : 
    2784            0 :   if (predictable_p)
    2785              :     {
    2786            0 :       if (OPTION_SET_P (param_max_rtl_if_conversion_predictable_cost))
    2787            0 :         return param_max_rtl_if_conversion_predictable_cost;
    2788              :     }
    2789              :   else
    2790              :     {
    2791            0 :       if (OPTION_SET_P (param_max_rtl_if_conversion_unpredictable_cost))
    2792            0 :         return param_max_rtl_if_conversion_unpredictable_cost;
    2793              :     }
    2794              : 
    2795            0 :   return BRANCH_COST (true, predictable_p) * COSTS_N_INSNS (3);
    2796              : }
    2797              : 
    2798              : /* Default implementation of TARGET_MIN_ARITHMETIC_PRECISION.  */
    2799              : 
    2800              : unsigned int
    2801        72950 : default_min_arithmetic_precision (void)
    2802              : {
    2803        72950 :   return WORD_REGISTER_OPERATIONS ? BITS_PER_WORD : BITS_PER_UNIT;
    2804              : }
    2805              : 
    2806              : /* Default implementation of TARGET_C_EXCESS_PRECISION.  */
    2807              : 
    2808              : enum flt_eval_method
    2809            0 : default_excess_precision (enum excess_precision_type ATTRIBUTE_UNUSED)
    2810              : {
    2811            0 :   return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
    2812              : }
    2813              : 
    2814              : /* Return true if _BitInt(N) is supported and fill details about it into
    2815              :    *INFO.  */
    2816              : bool
    2817            0 : default_bitint_type_info (int, struct bitint_info *)
    2818              : {
    2819            0 :   return false;
    2820              : }
    2821              : 
    2822              : /* Default implementation for
    2823              :   TARGET_STACK_CLASH_PROTECTION_ALLOCA_PROBE_RANGE.  */
    2824              : HOST_WIDE_INT
    2825           16 : default_stack_clash_protection_alloca_probe_range (void)
    2826              : {
    2827           16 :   return 0;
    2828              : }
    2829              : 
    2830              : /* The default implementation of TARGET_EARLY_REMAT_MODES.  */
    2831              : 
    2832              : void
    2833            0 : default_select_early_remat_modes (sbitmap)
    2834              : {
    2835            0 : }
    2836              : 
    2837              : /* The default implementation of TARGET_PREFERRED_ELSE_VALUE.  */
    2838              : 
    2839              : tree
    2840          550 : default_preferred_else_value (unsigned, tree type, unsigned, tree *)
    2841              : {
    2842          550 :   return build_zero_cst (type);
    2843              : }
    2844              : 
    2845              : /* The default implementation of TARGET_INSTRUCTION_SELECTION.  */
    2846              : 
    2847              : bool
    2848    101931155 : default_instruction_selection (function *, gimple_stmt_iterator *)
    2849              : {
    2850    101931155 :   return false;
    2851              : }
    2852              : 
    2853              : /* Default implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE.  */
    2854              : bool
    2855       214921 : default_have_speculation_safe_value (bool active ATTRIBUTE_UNUSED)
    2856              : {
    2857              : #ifdef HAVE_speculation_barrier
    2858       214921 :   return active ? HAVE_speculation_barrier : true;
    2859              : #else
    2860              :   return false;
    2861              : #endif
    2862              : }
    2863              : /* Alternative implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE
    2864              :    that can be used on targets that never have speculative execution.  */
    2865              : bool
    2866            0 : speculation_safe_value_not_needed (bool active)
    2867              : {
    2868            0 :   return !active;
    2869              : }
    2870              : 
    2871              : /* Default implementation of the speculation-safe-load builtin.  This
    2872              :    implementation simply copies val to result and generates a
    2873              :    speculation_barrier insn, if such a pattern is defined.  */
    2874              : rtx
    2875           34 : default_speculation_safe_value (machine_mode mode ATTRIBUTE_UNUSED,
    2876              :                                 rtx result, rtx val,
    2877              :                                 rtx failval ATTRIBUTE_UNUSED)
    2878              : {
    2879           34 :   emit_move_insn (result, val);
    2880              : 
    2881              : #ifdef HAVE_speculation_barrier
    2882              :   /* Assume the target knows what it is doing: if it defines a
    2883              :      speculation barrier, but it is not enabled, then assume that one
    2884              :      isn't needed.  */
    2885           34 :   if (HAVE_speculation_barrier)
    2886           34 :     emit_insn (gen_speculation_barrier ());
    2887              : #endif
    2888              : 
    2889           34 :   return result;
    2890              : }
    2891              : 
    2892              : /* How many bits to shift in order to access the tag bits.
    2893              :    The default is to store the tag in the top 8 bits of a 64 bit pointer, hence
    2894              :    shifting 56 bits will leave just the tag.  */
    2895              : #define HWASAN_SHIFT (GET_MODE_PRECISION (Pmode) - 8)
    2896              : #define HWASAN_SHIFT_RTX GEN_INT (HWASAN_SHIFT)
    2897              : 
    2898              : bool
    2899            0 : default_memtag_can_tag_addresses ()
    2900              : {
    2901            0 :   return false;
    2902              : }
    2903              : 
    2904              : uint8_t
    2905            0 : default_memtag_tag_bitsize ()
    2906              : {
    2907            0 :   return 8;
    2908              : }
    2909              : 
    2910              : uint8_t
    2911         1806 : default_memtag_granule_size ()
    2912              : {
    2913         1806 :   return 16;
    2914              : }
    2915              : 
    2916              : /* The default implementation of TARGET_MEMTAG_INSERT_RANDOM_TAG.  */
    2917              : rtx
    2918           60 : default_memtag_insert_random_tag (rtx untagged, rtx target)
    2919              : {
    2920           60 :   gcc_assert (param_hwasan_instrument_stack);
    2921           60 :   if (param_hwasan_random_frame_tag)
    2922              :     {
    2923           16 :       rtx fn = init_one_libfunc ("__hwasan_generate_tag");
    2924           16 :       rtx new_tag = emit_library_call_value (fn, NULL_RTX, LCT_NORMAL, QImode);
    2925           16 :       return targetm.memtag.set_tag (untagged, new_tag, target);
    2926              :     }
    2927              :   else
    2928              :     {
    2929              :       /* NOTE: The kernel API does not have __hwasan_generate_tag exposed.
    2930              :          In the future we may add the option emit random tags with inline
    2931              :          instrumentation instead of function calls.  This would be the same
    2932              :          between the kernel and userland.  */
    2933              :       return untagged;
    2934              :     }
    2935              : }
    2936              : 
    2937              : /* The default implementation of TARGET_MEMTAG_ADD_TAG.  */
    2938              : rtx
    2939            0 : default_memtag_add_tag (rtx base, poly_int64 offset, uint8_t tag_offset)
    2940              : {
    2941              :   /* Need to look into what the most efficient code sequence is.
    2942              :      This is a code sequence that would be emitted *many* times, so we
    2943              :      want it as small as possible.
    2944              : 
    2945              :      There are two places where tag overflow is a question:
    2946              :        - Tagging the shadow stack.
    2947              :           (both tagging and untagging).
    2948              :        - Tagging addressable pointers.
    2949              : 
    2950              :      We need to ensure both behaviors are the same (i.e. that the tag that
    2951              :      ends up in a pointer after "overflowing" the tag bits with a tag addition
    2952              :      is the same that ends up in the shadow space).
    2953              : 
    2954              :      The aim is that the behavior of tag addition should follow modulo
    2955              :      wrapping in both instances.
    2956              : 
    2957              :      The libhwasan code doesn't have any path that increments a pointer's tag,
    2958              :      which means it has no opinion on what happens when a tag increment
    2959              :      overflows (and hence we can choose our own behavior).  */
    2960              : 
    2961            0 :   offset += ((uint64_t)tag_offset << HWASAN_SHIFT);
    2962            0 :   return plus_constant (Pmode, base, offset);
    2963              : }
    2964              : 
    2965              : /* The default implementation of TARGET_MEMTAG_SET_TAG.  */
    2966              : rtx
    2967            0 : default_memtag_set_tag (rtx untagged, rtx tag, rtx target)
    2968              : {
    2969            0 :   gcc_assert (GET_MODE (untagged) == Pmode && GET_MODE (tag) == QImode);
    2970            0 :   tag = expand_simple_binop (Pmode, ASHIFT, tag, HWASAN_SHIFT_RTX, NULL_RTX,
    2971              :                              /* unsignedp = */1, OPTAB_WIDEN);
    2972            0 :   rtx ret = expand_simple_binop (Pmode, IOR, untagged, tag, target,
    2973              :                                  /* unsignedp = */1, OPTAB_DIRECT);
    2974            0 :   gcc_assert (ret);
    2975            0 :   return ret;
    2976              : }
    2977              : 
    2978              : /* The default implementation of TARGET_MEMTAG_EXTRACT_TAG.  */
    2979              : rtx
    2980            0 : default_memtag_extract_tag (rtx tagged_pointer, rtx target)
    2981              : {
    2982            0 :   rtx tag = expand_simple_binop (Pmode, LSHIFTRT, tagged_pointer,
    2983            0 :                                  HWASAN_SHIFT_RTX, target,
    2984              :                                  /* unsignedp = */0,
    2985              :                                  OPTAB_DIRECT);
    2986            0 :   rtx ret = gen_lowpart (QImode, tag);
    2987            0 :   gcc_assert (ret);
    2988            0 :   return ret;
    2989              : }
    2990              : 
    2991              : /* The default implementation of TARGET_MEMTAG_UNTAGGED_POINTER.  */
    2992              : rtx
    2993            0 : default_memtag_untagged_pointer (rtx tagged_pointer, rtx target)
    2994              : {
    2995            0 :   rtx tag_mask = gen_int_mode ((HOST_WIDE_INT_1U << HWASAN_SHIFT) - 1, Pmode);
    2996            0 :   rtx untagged_base = expand_simple_binop (Pmode, AND, tagged_pointer,
    2997              :                                            tag_mask, target, true,
    2998              :                                            OPTAB_DIRECT);
    2999            0 :   gcc_assert (untagged_base);
    3000            0 :   return untagged_base;
    3001              : }
    3002              : 
    3003              : /* The default implementation of TARGET_SCHED_REASSOCIATION_WIDTH.  */
    3004              : int
    3005            0 : default_reassociation_width (tree_code, machine_mode)
    3006              : {
    3007            0 :   return 1;
    3008              : }
    3009              : 
    3010              : #include "gt-targhooks.h"
        

Generated by: LCOV version 2.5.0-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.