LCOV - code coverage report
Current view: top level - gcc - targhooks.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 53.5 % 901 482
Test Date: 2026-12-05 16:10:02 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        27632 : default_external_libcall (rtx fun ATTRIBUTE_UNUSED)
     118              : {
     119              : #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
     120        27632 :   ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
     121              : #endif
     122        27632 : }
     123              : 
     124              : int
     125      3930604 : default_unspec_may_trap_p (const_rtx x, unsigned flags)
     126              : {
     127      3930604 :   int i;
     128              : 
     129              :   /* Any floating arithmetic may trap.  */
     130      3930604 :   if ((SCALAR_FLOAT_MODE_P (GET_MODE (x)) && flag_trapping_math))
     131              :     return 1;
     132              : 
     133      7886973 :   for (i = 0; i < XVECLEN (x, 0); ++i)
     134              :     {
     135      5308408 :       if (may_trap_p_1 (XVECEXP (x, 0, i), flags))
     136              :         return 1;
     137              :     }
     138              : 
     139              :   return 0;
     140              : }
     141              : 
     142              : machine_mode
     143     16460943 : 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     16460943 :   if (type != NULL_TREE && for_return == 2)
     150      3720436 :     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       534311 : default_eh_return_filter_mode (void)
     256              : {
     257       534311 :   return targetm.unwind_word_mode ();
     258              : }
     259              : 
     260              : scalar_int_mode
     261        45794 : default_libgcc_cmp_return_mode (void)
     262              : {
     263        45794 :   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       781461 : default_unwind_word_mode (void)
     274              : {
     275       781461 :   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       215737 : default_min_divisions_for_recip_mul (machine_mode mode ATTRIBUTE_UNUSED)
     290              : {
     291       215737 :   return have_insn_for (DIV, mode) ? 3 : 2;
     292              : }
     293              : 
     294              : /* The default implementation of TARGET_MODE_REP_EXTENDED.  */
     295              : 
     296              : int
     297     22801864 : default_mode_rep_extended (scalar_int_mode, scalar_int_mode)
     298              : {
     299     22801864 :   return UNKNOWN;
     300              : }
     301              : 
     302              : /* Generic hook that takes a CUMULATIVE_ARGS pointer and returns true.  */
     303              : 
     304              : bool
     305      6088134 : hook_bool_CUMULATIVE_ARGS_true (cumulative_args_t a ATTRIBUTE_UNUSED)
     306              : {
     307      6088134 :   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      3198259 : default_mode_for_floating_type (enum tree_index ti)
     323              : {
     324      3198259 :   if (ti == TI_FLOAT_TYPE)
     325              :     return SFmode;
     326      1578648 :   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         4834 : default_cxx_guard_type (void)
     333              : {
     334         4834 :   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        86507 : default_cxx_get_cookie_size (tree type)
     343              : {
     344        86507 :   tree cookie_size;
     345              : 
     346              :   /* We need to allocate an additional max (sizeof (size_t), alignof
     347              :      (true_type)) bytes.  */
     348        86507 :   tree sizetype_size;
     349        86507 :   tree type_align;
     350              : 
     351        86507 :   sizetype_size = size_in_bytes (sizetype);
     352        86507 :   type_align = size_int (TYPE_ALIGN_UNIT (type));
     353        86507 :   if (tree_int_cst_lt (type_align, sizetype_size))
     354              :     cookie_size = sizetype_size;
     355              :   else
     356        20288 :     cookie_size = type_align;
     357              : 
     358        86507 :   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       547994 : default_mangle_assembler_name (const char *name ATTRIBUTE_UNUSED)
     440              : {
     441       547994 :   const char *skipped = name + (*name == '*' ? 1 : 0);
     442       547994 :   const char *stripped = targetm.strip_name_encoding (skipped);
     443       547994 :   if (*name != '*' && user_label_prefix[0])
     444            0 :     stripped = ACONCAT ((user_label_prefix, stripped, NULL));
     445       547994 :   return get_identifier (stripped);
     446              : }
     447              : 
     448              : /* The default implementation of TARGET_TRANSLATE_MODE_ATTRIBUTE.  */
     449              : 
     450              : machine_mode
     451        55438 : default_translate_mode_attribute (machine_mode mode)
     452              : {
     453        55438 :   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      4053494 : default_scalar_mode_supported_p (scalar_mode mode)
     467              : {
     468      4053494 :   int precision = GET_MODE_PRECISION (mode);
     469              : 
     470      4053494 :   switch (GET_MODE_CLASS (mode))
     471              :     {
     472      2737453 :     case MODE_PARTIAL_INT:
     473      2737453 :     case MODE_INT:
     474      2737453 :       if (precision == CHAR_TYPE_SIZE)
     475              :         return true;
     476      2643416 :       if (precision == SHORT_TYPE_SIZE)
     477              :         return true;
     478      2562449 :       if (precision == INT_TYPE_SIZE)
     479              :         return true;
     480      2322106 :       if (precision == LONG_TYPE_SIZE)
     481              :         return true;
     482      1484992 :       if (precision == LONG_LONG_TYPE_SIZE)
     483              :         return true;
     484      1507152 :       if (precision == 2 * BITS_PER_WORD)
     485      1321757 :         return true;
     486              :       return false;
     487              : 
     488      1316041 :     case MODE_FLOAT:
     489      1316041 :       if (mode == targetm.c.mode_for_floating_type (TI_FLOAT_TYPE))
     490              :         return true;
     491       978099 :       if (mode == targetm.c.mode_for_floating_type (TI_DOUBLE_TYPE))
     492              :         return true;
     493       337488 :       if (mode == targetm.c.mode_for_floating_type (TI_LONG_DOUBLE_TYPE))
     494       337466 :         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      1649073 : default_libgcc_floating_mode_supported_p (scalar_float_mode mode)
     514              : {
     515      1649073 :   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      2118739 : default_floatn_mode (int n, bool extended)
     541              : {
     542      2118739 :   if (extended)
     543              :     {
     544       908031 :       opt_scalar_float_mode cand1, cand2;
     545       908031 :       scalar_float_mode mode;
     546       908031 :       switch (n)
     547              :         {
     548       302677 :         case 32:
     549              : #ifdef HAVE_DFmode
     550       302677 :           cand1 = DFmode;
     551              : #endif
     552       302677 :           break;
     553              : 
     554       302677 :         case 64:
     555              : #ifdef HAVE_XFmode
     556       302677 :           cand1 = XFmode;
     557              : #endif
     558              : #ifdef HAVE_TFmode
     559       302677 :           cand2 = TFmode;
     560              : #endif
     561       302677 :           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       908031 :       if (cand1.exists (&mode)
     571       605354 :           && REAL_MODE_FORMAT (mode)->ieee_bits > n
     572       605354 :           && targetm.scalar_mode_supported_p (mode)
     573       605332 :           && targetm.libgcc_floating_mode_supported_p (mode))
     574       605332 :         return cand1;
     575       302699 :       if (cand2.exists (&mode)
     576           22 :           && REAL_MODE_FORMAT (mode)->ieee_bits > n
     577       302699 :           && targetm.scalar_mode_supported_p (mode)
     578           22 :           && targetm.libgcc_floating_mode_supported_p (mode))
     579           22 :         return cand2;
     580              :     }
     581              :   else
     582              :     {
     583      1210708 :       opt_scalar_float_mode cand;
     584      1210708 :       scalar_float_mode mode;
     585      1210708 :       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      1210708 :       if (cand.exists (&mode)
     618      1210708 :           && REAL_MODE_FORMAT (mode)->ieee_bits == n
     619      1210708 :           && targetm.scalar_mode_supported_p (mode)
     620      1210708 :           && targetm.libgcc_floating_mode_supported_p (mode))
     621      1210708 :         return cand;
     622              :     }
     623       302677 :   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    143473302 : default_floatn_builtin_p (int func ATTRIBUTE_UNUSED)
     635              : {
     636    143473302 :   static bool first_time_p = true;
     637    143473302 :   static bool c_or_objective_c;
     638              : 
     639    143473302 :   if (first_time_p)
     640              :     {
     641       246942 :       first_time_p = false;
     642       362983 :       c_or_objective_c = lang_GNU_C () || lang_GNU_OBJC ();
     643              :     }
     644              : 
     645    143473302 :   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       219342 : targhook_float_words_big_endian (void)
     657              : {
     658       219342 :   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      1289683 : default_decimal_float_supported_p (void)
     678              : {
     679      1289683 :   return ENABLE_DECIMAL_FLOAT;
     680              : }
     681              : 
     682              : /* True if the target supports fixed-point arithmetic.  */
     683              : 
     684              : bool
     685       334539 : default_fixed_point_supported_p (void)
     686              : {
     687       334539 :   return ENABLE_FIXED_POINT;
     688              : }
     689              : 
     690              : /* True if the target supports GNU indirect functions.  */
     691              : 
     692              : bool
     693          619 : default_has_ifunc_p (void)
     694              : {
     695          619 :   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       519403 : default_predict_doloop_p (class loop *loop ATTRIBUTE_UNUSED)
     707              : {
     708       519403 :   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     12754457 : hook_int_CUMULATIVE_ARGS_arg_info_0 (cumulative_args_t,
     824              :                                      const function_arg_info &)
     825              : {
     826     12754457 :   return 0;
     827              : }
     828              : 
     829              : void
     830     12391448 : hook_void_CUMULATIVE_ARGS (cumulative_args_t)
     831              : {
     832     12391448 : }
     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     12030792 : hook_void_CUMULATIVE_ARGS_rtx_tree (cumulative_args_t, rtx, tree)
     842              : {
     843     12030792 : }
     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      5520147 : default_function_arg_offset (machine_mode, const_tree)
     867              : {
     868      5520147 :   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     12532758 : default_function_arg_padding (machine_mode mode, const_tree type)
     876              : {
     877     12532758 :   if (!BYTES_BIG_ENDIAN)
     878     12532758 :     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      5520147 : default_function_arg_round_boundary (machine_mode mode ATTRIBUTE_UNUSED,
     919              :                                      const_tree type ATTRIBUTE_UNUSED)
     920              : {
     921      5520147 :   return PARM_BOUNDARY;
     922              : }
     923              : 
     924              : void
     925            0 : hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED)
     926              : {
     927            0 : }
     928              : 
     929              : const char *
     930       793014 : 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       793014 :   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           78 : default_stack_protect_guard (void)
     945              : {
     946           78 :   tree t = stack_chk_guard_decl;
     947              : 
     948           78 :   if (t == NULL)
     949              :     {
     950           41 :       rtx x;
     951              : 
     952           41 :       if (UINTPTR_TYPE && targetm.stack_protect_guard_symbol_p ())
     953              :         /* Get unsigned integer type for uintptr_t.  */
     954           41 :         t = unsigned_integer_tree_node_for_type (UINTPTR_TYPE);
     955              :       else
     956            0 :         t = ptr_type_node;
     957           41 :       t = build_decl (UNKNOWN_LOCATION,
     958              :                       VAR_DECL, get_identifier ("__stack_chk_guard"), t);
     959           41 :       TREE_STATIC (t) = 1;
     960           41 :       TREE_PUBLIC (t) = 1;
     961           41 :       DECL_EXTERNAL (t) = 1;
     962           41 :       TREE_USED (t) = 1;
     963           41 :       TREE_THIS_VOLATILE (t) = 1;
     964           41 :       DECL_ARTIFICIAL (t) = 1;
     965           41 :       DECL_IGNORED_P (t) = 1;
     966              : 
     967              :       /* Do not share RTL as the declaration is visible outside of
     968              :          current function.  */
     969           41 :       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           35 :           x = DECL_RTL (t);
     975           35 :           RTX_FLAG (x, used) = 1;
     976              :         }
     977              : 
     978           41 :       stack_chk_guard_decl = t;
     979              :     }
     980              : 
     981           78 :   return t;
     982              : }
     983              : 
     984              : static GTY(()) tree stack_chk_fail_decl;
     985              : 
     986              : tree
     987          341 : default_external_stack_protect_fail (void)
     988              : {
     989          341 :   tree t = stack_chk_fail_decl;
     990              : 
     991          341 :   if (t == NULL_TREE)
     992              :     {
     993          190 :       t = build_function_type_list (void_type_node, NULL_TREE);
     994          190 :       t = build_decl (UNKNOWN_LOCATION,
     995              :                       FUNCTION_DECL, get_identifier ("__stack_chk_fail"), t);
     996          190 :       TREE_STATIC (t) = 1;
     997          190 :       TREE_PUBLIC (t) = 1;
     998          190 :       DECL_EXTERNAL (t) = 1;
     999          190 :       TREE_USED (t) = 1;
    1000          190 :       TREE_THIS_VOLATILE (t) = 1;
    1001          190 :       TREE_NOTHROW (t) = 1;
    1002          190 :       DECL_ARTIFICIAL (t) = 1;
    1003          190 :       DECL_IGNORED_P (t) = 1;
    1004          190 :       DECL_VISIBILITY (t) = VISIBILITY_DEFAULT;
    1005          190 :       DECL_VISIBILITY_SPECIFIED (t) = 1;
    1006              : 
    1007          190 :       stack_chk_fail_decl = t;
    1008              :     }
    1009              : 
    1010          341 :   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     74285363 : hook_bool_const_rtx_commutative_p (const_rtx x,
    1049              :                                    int outer_code ATTRIBUTE_UNUSED)
    1050              : {
    1051     74285363 :   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       112970 : default_libcall_value (machine_mode mode ATTRIBUTE_UNUSED,
    1073              :                        const_rtx fun ATTRIBUTE_UNUSED)
    1074              : {
    1075              : #ifdef LIBCALL_VALUE
    1076       112970 :   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     51471211 : 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     51471211 :   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    317033757 : default_lra_p (void)
    1353              : {
    1354    317033757 :   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      5023732 : default_different_addr_displacement_p (void)
    1371              : {
    1372      5023732 :   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        16128 : default_generate_pic_addr_diff_vec (void)
    1485              : {
    1486        16128 :   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     72194583 : default_vector_alignment (const_tree type)
    1548              : {
    1549     72194583 :   unsigned HOST_WIDE_INT align = MAX_OFILE_ALIGNMENT;
    1550     72194583 :   tree size = TYPE_SIZE (type);
    1551     72194583 :   if (tree_fits_uhwi_p (size))
    1552     72194583 :     align = tree_to_uhwi (size);
    1553     72194583 :   if (align >= MAX_OFILE_ALIGNMENT)
    1554              :     return MAX_OFILE_ALIGNMENT;
    1555     72194576 :   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      5940385 : default_preferred_vector_alignment (const_tree type)
    1563              : {
    1564      5940385 :   return TYPE_ALIGN (type);
    1565              : }
    1566              : 
    1567              : /* The default implementation of
    1568              :    TARGET_VECTORIZE_PREFERRED_DIV_AS_SHIFTS_OVER_MULT.  */
    1569              : 
    1570              : bool
    1571        19414 : default_preferred_div_as_shifts_over_mult (const_tree type)
    1572              : {
    1573        19414 :   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       259606 : default_builtin_vector_alignment_reachable (const_tree /*type*/, bool is_packed)
    1580              : {
    1581       259606 :   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      1444611 : 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      1444611 :   if (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing)
    1597      1444416 :     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     34406089 : default_vectorize_related_mode (machine_mode vector_mode,
    1630              :                                 scalar_mode element_mode,
    1631              :                                 poly_uint64 nunits)
    1632              : {
    1633     34406089 :   machine_mode result_mode;
    1634     34406089 :   if ((maybe_ne (nunits, 0U)
    1635     89680815 :        || multiple_p (GET_MODE_SIZE (vector_mode),
    1636              :                       GET_MODE_SIZE (element_mode), &nunits))
    1637     32055892 :       && mode_for_vector (element_mode, nunits).exists (&result_mode)
    1638     31786115 :       && VECTOR_MODE_P (result_mode)
    1639     66190774 :       && targetm.vector_mode_supported_p (result_mode))
    1640     31770177 :     return result_mode;
    1641              : 
    1642      2635912 :   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         9345 : default_conditional_operation_is_expensive (unsigned ifn)
    1657              : {
    1658         9345 :   return ifn == IFN_MASK_STORE;
    1659              : }
    1660              : 
    1661              : /* By default consider masked stores to be expensive.  */
    1662              : 
    1663              : bool
    1664          509 : default_empty_mask_is_expensive (unsigned ifn)
    1665              : {
    1666          509 :   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      7415179 : default_valid_pointer_mode (scalar_int_mode mode)
    1683              : {
    1684      7415179 :   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      8702377 : default_ref_may_alias_errno (ao_ref *ref)
    1691              : {
    1692      8702377 :   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      8702377 :   if (TYPE_UNSIGNED (TREE_TYPE (base))
    1698      8702377 :       || 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       399420 :   if (DECL_P (base)
    1704       260814 :       && DECL_EXTERNAL (base)
    1705       401515 :       && !TREE_STATIC (base))
    1706              :     return true;
    1707       399327 :   else if (TREE_CODE (base) == MEM_REF
    1708       399327 :            && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
    1709              :     {
    1710       123854 :       const pt_solution *pt = ssa_name_pt_solution (TREE_OPERAND (base, 0));
    1711              :       /* The pointer may point to errno if its points-to set includes
    1712              :          unknown global memory, or if it names a variable that may be
    1713              :          defined outside this unit, which PTA marks as interposable.
    1714              :          Variables known to be defined here, and restrict tags, cannot
    1715              :          be errno.  */
    1716       121482 :       return (!pt || pt->anything || pt->nonlocal
    1717       217267 :               || pt->vars_contains_interposable);
    1718              :     }
    1719              :   return false;
    1720              : }
    1721              : 
    1722              : /* Return the mode for a pointer to a given ADDRSPACE,
    1723              :    defaulting to ptr_mode for all address spaces.  */
    1724              : 
    1725              : scalar_int_mode
    1726   3235362077 : default_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED)
    1727              : {
    1728   3235362077 :   return ptr_mode;
    1729              : }
    1730              : 
    1731              : /* Return the mode for an address in a given ADDRSPACE,
    1732              :    defaulting to Pmode for all address spaces.  */
    1733              : 
    1734              : scalar_int_mode
    1735    101389016 : default_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED)
    1736              : {
    1737    101389016 :   return Pmode;
    1738              : }
    1739              : 
    1740              : /* Named address space version of valid_pointer_mode.
    1741              :    To match the above, the same modes apply to all address spaces.  */
    1742              : 
    1743              : bool
    1744      7415179 : default_addr_space_valid_pointer_mode (machine_mode mode,
    1745              :                                        addr_space_t as ATTRIBUTE_UNUSED)
    1746              : {
    1747      7415179 :   if (! SCALAR_INT_MODE_P (mode))
    1748              :     return false;
    1749              : 
    1750      7415179 :   return targetm.valid_pointer_mode (as_a <scalar_int_mode> (mode));
    1751              : }
    1752              : 
    1753              : /* Some places still assume that all pointer or address modes are the
    1754              :    standard Pmode and ptr_mode.  These optimizations become invalid if
    1755              :    the target actually supports multiple different modes.  For now,
    1756              :    we disable such optimizations on such targets, using this function.  */
    1757              : 
    1758              : bool
    1759    745123529 : target_default_pointer_address_modes_p (void)
    1760              : {
    1761    745123529 :   if (targetm.addr_space.address_mode != default_addr_space_address_mode)
    1762              :     return false;
    1763    745123529 :   if (targetm.addr_space.pointer_mode != default_addr_space_pointer_mode)
    1764            0 :     return false;
    1765              : 
    1766              :   return true;
    1767              : }
    1768              : 
    1769              : /* Named address space version of legitimate_address_p.
    1770              :    By default, all address spaces have the same form.  */
    1771              : 
    1772              : bool
    1773   1508964725 : default_addr_space_legitimate_address_p (machine_mode mode, rtx mem,
    1774              :                                          bool strict,
    1775              :                                          addr_space_t as ATTRIBUTE_UNUSED,
    1776              :                                          code_helper code)
    1777              : {
    1778   1508964725 :   return targetm.legitimate_address_p (mode, mem, strict, code);
    1779              : }
    1780              : 
    1781              : /* Named address space version of LEGITIMIZE_ADDRESS.
    1782              :    By default, all address spaces have the same form.  */
    1783              : 
    1784              : rtx
    1785       704335 : default_addr_space_legitimize_address (rtx x, rtx oldx, machine_mode mode,
    1786              :                                        addr_space_t as ATTRIBUTE_UNUSED)
    1787              : {
    1788       704335 :   return targetm.legitimize_address (x, oldx, mode);
    1789              : }
    1790              : 
    1791              : /* The default hook for determining if one named address space is a subset of
    1792              :    another and to return which address space to use as the common address
    1793              :    space.  */
    1794              : 
    1795              : bool
    1796            3 : default_addr_space_subset_p (addr_space_t subset, addr_space_t superset)
    1797              : {
    1798            3 :   return (subset == superset);
    1799              : }
    1800              : 
    1801              : /* The default hook for determining if 0 within a named address
    1802              :    space is a valid address.  */
    1803              : 
    1804              : bool
    1805            0 : default_addr_space_zero_address_valid (addr_space_t as ATTRIBUTE_UNUSED)
    1806              : {
    1807            0 :   return false;
    1808              : }
    1809              : 
    1810              : /* The default hook for debugging the address space is to return the
    1811              :    address space number to indicate DW_AT_address_class.  */
    1812              : int
    1813            3 : default_addr_space_debug (addr_space_t as)
    1814              : {
    1815            3 :   return as;
    1816              : }
    1817              : 
    1818              : /* The default hook implementation for TARGET_ADDR_SPACE_DIAGNOSE_USAGE.
    1819              :    Don't complain about any address space.  */
    1820              : 
    1821              : void
    1822          185 : default_addr_space_diagnose_usage (addr_space_t, location_t)
    1823              : {
    1824          185 : }
    1825              : 
    1826              : 
    1827              : /* The default hook for TARGET_ADDR_SPACE_CONVERT. This hook should never be
    1828              :    called for targets with only a generic address space.  */
    1829              : 
    1830              : rtx
    1831            0 : default_addr_space_convert (rtx op ATTRIBUTE_UNUSED,
    1832              :                             tree from_type ATTRIBUTE_UNUSED,
    1833              :                             tree to_type ATTRIBUTE_UNUSED)
    1834              : {
    1835            0 :   gcc_unreachable ();
    1836              : }
    1837              : 
    1838              : 
    1839              : /* The default hook for TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA.  */
    1840              : 
    1841              : addr_space_t
    1842          505 : default_addr_space_for_artificial_rodata (tree, artificial_rodata)
    1843              : {
    1844          505 :   return ADDR_SPACE_GENERIC;
    1845              : }
    1846              : 
    1847              : 
    1848              : /* The default implementation of TARGET_HARD_REGNO_NREGS.  */
    1849              : 
    1850              : unsigned int
    1851            0 : default_hard_regno_nregs (unsigned int, machine_mode mode)
    1852              : {
    1853              :   /* Targets with variable-sized modes must provide their own definition
    1854              :      of this hook.  */
    1855            0 :   return CEIL (GET_MODE_SIZE (mode).to_constant (), UNITS_PER_WORD);
    1856              : }
    1857              : 
    1858              : bool
    1859            0 : default_hard_regno_scratch_ok (unsigned int regno ATTRIBUTE_UNUSED)
    1860              : {
    1861            0 :   return true;
    1862              : }
    1863              : 
    1864              : /* The default implementation of TARGET_MODE_DEPENDENT_ADDRESS_P.  */
    1865              : 
    1866              : bool
    1867     36917225 : default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED,
    1868              :                                   addr_space_t addrspace ATTRIBUTE_UNUSED)
    1869              : {
    1870     36917225 :   return false;
    1871              : }
    1872              : 
    1873              : extern bool default_new_address_profitable_p (rtx, rtx);
    1874              : 
    1875              : 
    1876              : /* The default implementation of TARGET_NEW_ADDRESS_PROFITABLE_P.  */
    1877              : 
    1878              : bool
    1879      1146523 : default_new_address_profitable_p (rtx memref ATTRIBUTE_UNUSED,
    1880              :                                   rtx_insn *insn ATTRIBUTE_UNUSED,
    1881              :                                   rtx new_addr ATTRIBUTE_UNUSED)
    1882              : {
    1883      1146523 :   return true;
    1884              : }
    1885              : 
    1886              : bool
    1887            0 : default_target_option_valid_attribute_p (tree ARG_UNUSED (fndecl),
    1888              :                                          tree ARG_UNUSED (name),
    1889              :                                          tree ARG_UNUSED (args),
    1890              :                                          int ARG_UNUSED (flags))
    1891              : {
    1892            0 :   warning (OPT_Wattributes,
    1893              :            "%<target%> attribute is not supported on this machine");
    1894              : 
    1895            0 :   return false;
    1896              : }
    1897              : 
    1898              : bool
    1899            0 : default_target_option_valid_version_attribute_p (tree ARG_UNUSED (fndecl),
    1900              :                                                  tree ARG_UNUSED (name),
    1901              :                                                  tree ARG_UNUSED (args),
    1902              :                                                  int ARG_UNUSED (flags))
    1903              : {
    1904            0 :   warning (OPT_Wattributes,
    1905              :            "%<target_version%> attribute is not supported on this machine");
    1906              : 
    1907            0 :   return false;
    1908              : }
    1909              : 
    1910              : bool
    1911            0 : default_target_option_pragma_parse (tree ARG_UNUSED (args),
    1912              :                                     tree ARG_UNUSED (pop_target))
    1913              : {
    1914              :   /* If args is NULL the caller is handle_pragma_pop_options ().  In that case,
    1915              :      emit no warning because "#pragma GCC pop_target" is valid on targets that
    1916              :      do not have the "target" pragma.  */
    1917            0 :   if (args)
    1918            0 :     warning (OPT_Wpragmas,
    1919              :              "%<#pragma GCC target%> is not supported for this machine");
    1920              : 
    1921            0 :   return false;
    1922              : }
    1923              : 
    1924              : bool
    1925            0 : default_target_can_inline_p (tree caller, tree callee)
    1926              : {
    1927            0 :   tree callee_opts = DECL_FUNCTION_SPECIFIC_TARGET (callee);
    1928            0 :   tree caller_opts = DECL_FUNCTION_SPECIFIC_TARGET (caller);
    1929            0 :   if (! callee_opts)
    1930            0 :     callee_opts = target_option_default_node;
    1931            0 :   if (! caller_opts)
    1932            0 :     caller_opts = target_option_default_node;
    1933              : 
    1934              :   /* If both caller and callee have attributes, assume that if the
    1935              :      pointer is different, the two functions have different target
    1936              :      options since build_target_option_node uses a hash table for the
    1937              :      options.  */
    1938            0 :   return callee_opts == caller_opts;
    1939              : }
    1940              : 
    1941              : /* By default, return false to not need to collect any target information
    1942              :    for inlining.  Target maintainer should re-define the hook if the
    1943              :    target want to take advantage of it.  */
    1944              : 
    1945              : bool
    1946      5950950 : default_need_ipa_fn_target_info (const_tree, unsigned int &)
    1947              : {
    1948      5950950 :   return false;
    1949              : }
    1950              : 
    1951              : bool
    1952            0 : default_update_ipa_fn_target_info (unsigned int &, const gimple *)
    1953              : {
    1954            0 :   return false;
    1955              : }
    1956              : 
    1957              : /* If the machine does not have a case insn that compares the bounds,
    1958              :    this means extra overhead for dispatch tables, which raises the
    1959              :    threshold for using them.  */
    1960              : 
    1961              : unsigned int
    1962      6773751 : default_case_values_threshold (void)
    1963              : {
    1964      6773751 :   return (targetm.have_casesi () ? 4 : 5);
    1965              : }
    1966              : 
    1967              : bool
    1968    121875356 : default_have_conditional_execution (void)
    1969              : {
    1970    121875356 :   return HAVE_conditional_execution;
    1971              : }
    1972              : 
    1973              : bool
    1974            0 : default_have_ccmp (void)
    1975              : {
    1976            0 :   return targetm.gen_ccmp_first != NULL;
    1977              : }
    1978              : 
    1979              : /* Default implementation of TARGET_CCMP_FIRST_PREFERENCE.  */
    1980              : 
    1981              : ccmp_first_kind
    1982            2 : default_ccmp_first_preference (machine_mode, tree_code, const_tree,
    1983              :                                const_tree)
    1984              : {
    1985            2 :   return CCMP_FIRST_UNSUPPORTED;
    1986              : }
    1987              : 
    1988              : /* By default we assume that c99 functions are present at the runtime,
    1989              :    but sincos is not.  */
    1990              : bool
    1991            0 : default_libc_has_function (enum function_class fn_class,
    1992              :                            tree type ATTRIBUTE_UNUSED)
    1993              : {
    1994            0 :   if (fn_class == function_c94
    1995              :       || fn_class == function_c99_misc
    1996              :       || fn_class == function_c99_math_complex)
    1997            0 :     return true;
    1998              : 
    1999              :   return false;
    2000              : }
    2001              : 
    2002              : /* By default assume that libc has not a fast implementation.  */
    2003              : 
    2004              : bool
    2005            0 : default_libc_has_fast_function (int fcode ATTRIBUTE_UNUSED)
    2006              : {
    2007            0 :   return false;
    2008              : }
    2009              : 
    2010              : bool
    2011            0 : gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED,
    2012              :                        tree type ATTRIBUTE_UNUSED)
    2013              : {
    2014            0 :   return true;
    2015              : }
    2016              : 
    2017              : bool
    2018            0 : no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED,
    2019              :                           tree type ATTRIBUTE_UNUSED)
    2020              : {
    2021            0 :   return false;
    2022              : }
    2023              : 
    2024              : /* Assume some c99 functions are present at the runtime including sincos.  */
    2025              : bool
    2026            0 : bsd_libc_has_function (enum function_class fn_class,
    2027              :                        tree type ATTRIBUTE_UNUSED)
    2028              : {
    2029            0 :   if (fn_class == function_c94
    2030            0 :       || fn_class == function_c99_misc
    2031            0 :       || fn_class == function_sincos)
    2032              :     return true;
    2033              : 
    2034              :   return false;
    2035              : }
    2036              : 
    2037              : /* By default, -fhardened will add -D_FORTIFY_SOURCE=2.  */
    2038              : 
    2039              : unsigned
    2040            0 : default_fortify_source_default_level ()
    2041              : {
    2042            0 :   return 2;
    2043              : }
    2044              : 
    2045              : unsigned
    2046          124 : default_libm_function_max_error (unsigned, machine_mode, bool)
    2047              : {
    2048          124 :   return ~0U;
    2049              : }
    2050              : 
    2051              : unsigned
    2052        77337 : glibc_linux_libm_function_max_error (unsigned cfn, machine_mode mode,
    2053              :                                      bool boundary_p)
    2054              : {
    2055              :   /* Let's use
    2056              :      https://www.gnu.org/software/libc/manual/2.22/html_node/Errors-in-Math-Functions.html
    2057              :      https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
    2058              :      with usual values recorded here and significant outliers handled in
    2059              :      target CPU specific overriders.  The tables only record default
    2060              :      rounding to nearest, for -frounding-math let's add some extra ulps.
    2061              :      For boundary_p values (say finite results outside of [-1.,1.] for
    2062              :      sin/cos, or [-0.,+Inf] for sqrt etc. let's use custom random testers.  */
    2063        77337 :   int rnd = flag_rounding_math ? 4 : 0;
    2064        77337 :   bool sf = (REAL_MODE_FORMAT (mode) == &ieee_single_format
    2065        57346 :              || REAL_MODE_FORMAT (mode) == &mips_single_format
    2066       134683 :              || REAL_MODE_FORMAT (mode) == &motorola_single_format);
    2067        77337 :   bool df = (REAL_MODE_FORMAT (mode) == &ieee_double_format
    2068        37763 :              || REAL_MODE_FORMAT (mode) == &mips_double_format
    2069       115100 :              || REAL_MODE_FORMAT (mode) == &motorola_double_format);
    2070        77337 :   bool xf = (REAL_MODE_FORMAT (mode) == &ieee_extended_intel_96_format
    2071        74204 :              || REAL_MODE_FORMAT (mode) == &ieee_extended_intel_128_format
    2072       138798 :              || REAL_MODE_FORMAT (mode) == &ieee_extended_motorola_format);
    2073        77337 :   bool tf = (REAL_MODE_FORMAT (mode) == &ieee_quad_format
    2074        77337 :              || REAL_MODE_FORMAT (mode) == &mips_quad_format);
    2075              : 
    2076        77337 :   switch (cfn)
    2077              :     {
    2078        51254 :     CASE_CFN_SQRT:
    2079        51254 :     CASE_CFN_SQRT_FN:
    2080        51254 :       if (boundary_p)
    2081              :         /* https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616595.html */
    2082              :         return 0;
    2083        25627 :       if (sf || df || xf || tf)
    2084        25503 :         return 0 + rnd;
    2085              :       break;
    2086         7974 :     CASE_CFN_COS:
    2087         7974 :     CASE_CFN_COS_FN:
    2088              :       /* cos is generally errors like sin, but far more arches have 2ulps
    2089              :          for double.  */
    2090         7974 :       if (!boundary_p && df)
    2091         1543 :         return 2 + rnd;
    2092        24540 :       gcc_fallthrough ();
    2093        24540 :     CASE_CFN_SIN:
    2094        24540 :     CASE_CFN_SIN_FN:
    2095        24540 :       if (boundary_p)
    2096              :         /* According to
    2097              :            https://sourceware.org/pipermail/gcc-patches/2023-April/616315.html
    2098              :            seems default rounding sin/cos stay strictly in [-1.,1.] range,
    2099              :            with rounding to infinity it can be 1ulp larger/smaller.  */
    2100        14193 :         return flag_rounding_math ? 1 : 0;
    2101        10347 :       if (sf || df)
    2102         6684 :         return 1 + rnd;
    2103         3663 :       if (xf || tf)
    2104         3663 :         return 2 + rnd;
    2105              :       break;
    2106              :     default:
    2107              :       break;
    2108              :     }
    2109              : 
    2110          124 :   return default_libm_function_max_error (cfn, mode, boundary_p);
    2111              : }
    2112              : 
    2113              : tree
    2114            0 : default_builtin_tm_load_store (tree ARG_UNUSED (type))
    2115              : {
    2116            0 :   return NULL_TREE;
    2117              : }
    2118              : 
    2119              : /* Compute cost of moving registers to/from memory.  */
    2120              : 
    2121              : int
    2122            0 : default_memory_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
    2123              :                           reg_class_t rclass ATTRIBUTE_UNUSED,
    2124              :                           bool in ATTRIBUTE_UNUSED)
    2125              : {
    2126              : #ifndef MEMORY_MOVE_COST
    2127            0 :     return (4 + memory_move_secondary_cost (mode, (enum reg_class) rclass, in));
    2128              : #else
    2129              :     return MEMORY_MOVE_COST (MACRO_MODE (mode), (enum reg_class) rclass, in);
    2130              : #endif
    2131              : }
    2132              : 
    2133              : /* Compute cost of moving data from a register of class FROM to one of
    2134              :    TO, using MODE.  */
    2135              : 
    2136              : int
    2137            0 : default_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
    2138              :                             reg_class_t from ATTRIBUTE_UNUSED,
    2139              :                             reg_class_t to ATTRIBUTE_UNUSED)
    2140              : {
    2141              : #ifndef REGISTER_MOVE_COST
    2142            0 :   return 2;
    2143              : #else
    2144              :   return REGISTER_MOVE_COST (MACRO_MODE (mode),
    2145              :                              (enum reg_class) from, (enum reg_class) to);
    2146              : #endif
    2147              : }
    2148              : 
    2149              : /* The default implementation of TARGET_CALLEE_SAVE_COST.  */
    2150              : 
    2151              : int
    2152            0 : default_callee_save_cost (spill_cost_type spill_type, unsigned int,
    2153              :                           machine_mode, unsigned int, int mem_cost,
    2154              :                           const HARD_REG_SET &callee_saved_regs,
    2155              :                           bool existing_spills_p)
    2156              : {
    2157            0 :   if (!existing_spills_p)
    2158              :     {
    2159            0 :       auto frame_type = (spill_type == spill_cost_type::SAVE
    2160            0 :                          ? frame_cost_type::ALLOCATION
    2161              :                          : frame_cost_type::DEALLOCATION);
    2162            0 :       mem_cost += targetm.frame_allocation_cost (frame_type,
    2163              :                                                  callee_saved_regs);
    2164              :     }
    2165            0 :   return mem_cost;
    2166              : }
    2167              : 
    2168              : /* The default implementation of TARGET_FRAME_ALLOCATION_COST.  */
    2169              : 
    2170              : int
    2171     16982178 : default_frame_allocation_cost (frame_cost_type, const HARD_REG_SET &)
    2172              : {
    2173     16982178 :   return 0;
    2174              : }
    2175              : 
    2176              : /* The default implementation of TARGET_SLOW_UNALIGNED_ACCESS.  */
    2177              : 
    2178              : bool
    2179      3571349 : default_slow_unaligned_access (machine_mode, unsigned int)
    2180              : {
    2181      3571349 :   return STRICT_ALIGNMENT;
    2182              : }
    2183              : 
    2184              : /* The default implementation of TARGET_ESTIMATED_POLY_VALUE.  */
    2185              : 
    2186              : HOST_WIDE_INT
    2187            0 : default_estimated_poly_value (poly_int64 x, poly_value_estimate_kind)
    2188              : {
    2189            0 :   return x.coeffs[0];
    2190              : }
    2191              : 
    2192              : /* For hooks which use the MOVE_RATIO macro, this gives the legacy default
    2193              :    behavior.  SPEED_P is true if we are compiling for speed.  */
    2194              : 
    2195              : unsigned int
    2196      1772849 : get_move_ratio (bool speed_p ATTRIBUTE_UNUSED)
    2197              : {
    2198      1772849 :   unsigned int move_ratio;
    2199              : #ifdef MOVE_RATIO
    2200      1772849 :   move_ratio = (unsigned int) MOVE_RATIO (speed_p);
    2201              : #else
    2202              : #if defined (HAVE_cpymemqi) || defined (HAVE_cpymemhi) || defined (HAVE_cpymemsi) || defined (HAVE_cpymemdi) || defined (HAVE_cpymemti)
    2203              :   move_ratio = 2;
    2204              : #else /* No cpymem patterns, pick a default.  */
    2205              :   move_ratio = ((speed_p) ? 15 : 3);
    2206              : #endif
    2207              : #endif
    2208      1772849 :   return move_ratio;
    2209              : }
    2210              : 
    2211              : /* Return TRUE if the move_by_pieces/set_by_pieces infrastructure should be
    2212              :    used; return FALSE if the cpymem/setmem optab should be expanded, or
    2213              :    a call to memcpy emitted.  */
    2214              : 
    2215              : bool
    2216      1219540 : default_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size,
    2217              :                                         unsigned int alignment,
    2218              :                                         enum by_pieces_operation op,
    2219              :                                         bool speed_p)
    2220              : {
    2221      1219540 :   unsigned int max_size = 0;
    2222      1219540 :   unsigned int ratio = 0;
    2223              : 
    2224      1219540 :   switch (op)
    2225              :     {
    2226        96442 :     case CLEAR_BY_PIECES:
    2227        96442 :       max_size = STORE_MAX_PIECES;
    2228        96442 :       ratio = CLEAR_RATIO (speed_p);
    2229              :       break;
    2230       903419 :     case MOVE_BY_PIECES:
    2231       903419 :       max_size = MOVE_MAX_PIECES;
    2232       903419 :       ratio = get_move_ratio (speed_p);
    2233       903419 :       break;
    2234        57275 :     case SET_BY_PIECES:
    2235        57275 :       max_size = STORE_MAX_PIECES;
    2236        57275 :       ratio = SET_RATIO (speed_p);
    2237              :       break;
    2238        93163 :     case STORE_BY_PIECES:
    2239        93163 :       max_size = STORE_MAX_PIECES;
    2240        93163 :       ratio = get_move_ratio (speed_p);
    2241        93163 :       break;
    2242        69241 :     case COMPARE_BY_PIECES:
    2243        69241 :       max_size = COMPARE_MAX_PIECES;
    2244              :       /* Pick a likely default, just as in get_move_ratio.  */
    2245        69241 :       ratio = speed_p ? 15 : 3;
    2246              :       break;
    2247              :     }
    2248              : 
    2249      1219540 :   return by_pieces_ninsns (size, alignment, max_size + 1, op) < ratio;
    2250              : }
    2251              : 
    2252              : /* This hook controls code generation for expanding a memcmp operation by
    2253              :    pieces.  Return 1 for the normal pattern of compare/jump after each pair
    2254              :    of loads, or a higher number to reduce the number of branches.  */
    2255              : 
    2256              : int
    2257            0 : default_compare_by_pieces_branch_ratio (machine_mode)
    2258              : {
    2259            0 :   return 1;
    2260              : }
    2261              : 
    2262              : /* Write PATCH_AREA_SIZE NOPs into the asm outfile FILE around a function
    2263              :    entry.  If RECORD_P is true and the target supports named sections,
    2264              :    the location of the NOPs will be recorded in a special object section
    2265              :    called "__patchable_function_entries".  This routine may be called
    2266              :    twice per function to put NOPs before and after the function
    2267              :    entry.  */
    2268              : 
    2269              : void
    2270           63 : default_print_patchable_function_entry (FILE *file,
    2271              :                                         unsigned HOST_WIDE_INT patch_area_size,
    2272              :                                         bool record_p)
    2273              : {
    2274           63 :   const char *nop_templ = 0;
    2275           63 :   int code_num;
    2276           63 :   rtx_insn *my_nop = make_insn_raw (gen_nop ());
    2277              : 
    2278              :   /* We use the template alone, relying on the (currently sane) assumption
    2279              :      that the NOP template does not have variable operands.  */
    2280           63 :   code_num = recog_memoized (my_nop);
    2281           63 :   nop_templ = get_insn_template (code_num, my_nop);
    2282              : 
    2283           63 :   if (record_p && targetm_common.have_named_sections)
    2284              :     {
    2285           57 :       char buf[256];
    2286           57 :       section *previous_section = in_section;
    2287           57 :       const char *asm_op = integer_asm_op (POINTER_SIZE_UNITS, false);
    2288              : 
    2289           57 :       gcc_assert (asm_op != NULL);
    2290              :       /* If SECTION_LINK_ORDER is supported, this internal label will
    2291              :          be filled as the symbol for linked_to section.  */
    2292           57 :       ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE", current_function_funcdef_no);
    2293              : 
    2294           57 :       unsigned int flags = SECTION_WRITE | SECTION_RELRO;
    2295           57 :       if (HAVE_GAS_SECTION_LINK_ORDER)
    2296           57 :         flags |= SECTION_LINK_ORDER;
    2297              : 
    2298           57 :       section *sect = get_section ("__patchable_function_entries",
    2299              :                                   flags, current_function_decl);
    2300           57 :       if (HAVE_COMDAT_GROUP && DECL_COMDAT_GROUP (current_function_decl))
    2301           12 :         switch_to_comdat_section (sect, current_function_decl);
    2302              :       else
    2303           45 :         switch_to_section (sect);
    2304           57 :       assemble_align (POINTER_SIZE);
    2305           57 :       fputs (asm_op, file);
    2306           57 :       assemble_name_raw (file, buf);
    2307           57 :       fputc ('\n', file);
    2308              : 
    2309           57 :       switch_to_section (previous_section);
    2310           57 :       ASM_OUTPUT_LABEL (file, buf);
    2311              :     }
    2312              : 
    2313           63 :   unsigned i;
    2314          148 :   for (i = 0; i < patch_area_size; ++i)
    2315           85 :     output_asm_insn (nop_templ, NULL);
    2316           63 : }
    2317              : 
    2318              : bool
    2319            0 : default_profile_before_prologue (void)
    2320              : {
    2321              : #ifdef PROFILE_BEFORE_PROLOGUE
    2322              :   return true;
    2323              : #else
    2324            0 :   return false;
    2325              : #endif
    2326              : }
    2327              : 
    2328              : /* The default implementation of TARGET_PREFERRED_RELOAD_CLASS.  */
    2329              : 
    2330              : reg_class_t
    2331            0 : default_preferred_reload_class (rtx x ATTRIBUTE_UNUSED,
    2332              :                                 reg_class_t rclass)
    2333              : {
    2334              : #ifdef PREFERRED_RELOAD_CLASS
    2335              :   return (reg_class_t) PREFERRED_RELOAD_CLASS (x, (enum reg_class) rclass);
    2336              : #else
    2337            0 :   return rclass;
    2338              : #endif
    2339              : }
    2340              : 
    2341              : /* The default implementation of TARGET_OUTPUT_PREFERRED_RELOAD_CLASS.  */
    2342              : 
    2343              : reg_class_t
    2344            0 : default_preferred_output_reload_class (rtx x ATTRIBUTE_UNUSED,
    2345              :                                        reg_class_t rclass)
    2346              : {
    2347            0 :   return rclass;
    2348              : }
    2349              : 
    2350              : /* The default implementation of TARGET_BASE_REG_CLASS.  */
    2351              : 
    2352              : reg_class_t
    2353            0 : default_base_reg_class (machine_mode mode ATTRIBUTE_UNUSED,
    2354              :                         addr_space_t as ATTRIBUTE_UNUSED,
    2355              :                         enum rtx_code outer_code ATTRIBUTE_UNUSED,
    2356              :                         enum rtx_code index_code ATTRIBUTE_UNUSED,
    2357              :                         rtx mem ATTRIBUTE_UNUSED,
    2358              :                         rtx_insn *insn ATTRIBUTE_UNUSED)
    2359              : {
    2360              : #ifdef MODE_CODE_BASE_REG_CLASS
    2361              :   return MODE_CODE_BASE_REG_CLASS (MACRO_MODE (mode), as, outer_code,
    2362              :                                    index_code);
    2363              : #else
    2364              : #ifdef MODE_BASE_REG_REG_CLASS
    2365              :   if (index_code == REG)
    2366              :     return MODE_BASE_REG_REG_CLASS (MACRO_MODE (mode));
    2367              : #endif
    2368              : #ifdef MODE_BASE_REG_CLASS
    2369              :   return MODE_BASE_REG_CLASS (MACRO_MODE (mode));
    2370              : #elif defined (BASE_REG_CLASS)
    2371            0 :   return BASE_REG_CLASS;
    2372              : #else
    2373              :   /* No target that leaves TARGET_BASE_REG_CLASS at its default also fails
    2374              :      to define BASE_REG_CLASS or one of the other macros above; a target
    2375              :      that defines none of them must override the hook directly instead.  */
    2376              :   gcc_unreachable ();
    2377              : #endif
    2378              : #endif
    2379              : }
    2380              : 
    2381              : /* The default implementation of TARGET_PREFERRED_RENAME_CLASS.  */
    2382              : reg_class_t
    2383      1029780 : default_preferred_rename_class (reg_class_t rclass ATTRIBUTE_UNUSED)
    2384              : {
    2385      1029780 :   return NO_REGS;
    2386              : }
    2387              : 
    2388              : /* The default implementation of TARGET_CLASS_LIKELY_SPILLED_P.  */
    2389              : 
    2390              : bool
    2391            0 : default_class_likely_spilled_p (reg_class_t rclass)
    2392              : {
    2393            0 :   return (reg_class_size[(int) rclass] == 1);
    2394              : }
    2395              : 
    2396              : /* The default implementation of TARGET_CLASS_MAX_NREGS.  */
    2397              : 
    2398              : unsigned char
    2399            0 : default_class_max_nregs (reg_class_t rclass ATTRIBUTE_UNUSED,
    2400              :                          machine_mode mode ATTRIBUTE_UNUSED)
    2401              : {
    2402              : #ifdef CLASS_MAX_NREGS
    2403              :   return (unsigned char) CLASS_MAX_NREGS ((enum reg_class) rclass,
    2404              :                                           MACRO_MODE (mode));
    2405              : #else
    2406              :   /* Targets with variable-sized modes must provide their own definition
    2407              :      of this hook.  */
    2408            0 :   unsigned int size = GET_MODE_SIZE (mode).to_constant ();
    2409            0 :   return (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
    2410              : #endif
    2411              : }
    2412              : 
    2413              : /* The default implementation of TARGET_AVOID_STORE_FORWARDING_P.  */
    2414              : 
    2415              : bool
    2416           16 : default_avoid_store_forwarding_p (vec<store_fwd_info>, rtx, int total_cost,
    2417              :                                   bool)
    2418              : {
    2419              :   /* Use a simple cost heurstic base on param_store_forwarding_max_distance.
    2420              :      In general the distance should be somewhat correlated to the store
    2421              :      forwarding penalty; if the penalty is large then it is justified to
    2422              :      increase the window size.  Use this to reject sequences that are clearly
    2423              :      unprofitable.
    2424              :      Skip the cost check if param_store_forwarding_max_distance is 0.  */
    2425           16 :   int max_cost = COSTS_N_INSNS (param_store_forwarding_max_distance / 2);
    2426           16 :   const bool unlimited_cost = (param_store_forwarding_max_distance == 0);
    2427           16 :   if (!unlimited_cost && total_cost > max_cost && max_cost)
    2428              :     {
    2429            5 :       if (dump_file)
    2430            0 :         fprintf (dump_file, "Not transformed due to cost: %d > %d.\n",
    2431              :                  total_cost, max_cost);
    2432              : 
    2433              :       return false;
    2434              :     }
    2435              : 
    2436              :   return true;
    2437              : }
    2438              : 
    2439              : /* Determine the debugging unwind mechanism for the target.  */
    2440              : 
    2441              : enum unwind_info_type
    2442      1335989 : default_debug_unwind_info (void)
    2443              : {
    2444              :   /* If the target wants to force the use of dwarf2 unwind info, let it.  */
    2445              :   /* ??? Change all users to the hook, then poison this.  */
    2446              : #ifdef DWARF2_FRAME_INFO
    2447              :   if (DWARF2_FRAME_INFO)
    2448              :     return UI_DWARF2;
    2449              : #endif
    2450              : 
    2451              :   /* Otherwise, only turn it on if dwarf2 debugging is enabled.  */
    2452              : #ifdef DWARF2_DEBUGGING_INFO
    2453      1335989 :   if (dwarf_debuginfo_p ())
    2454       670387 :     return UI_DWARF2;
    2455              : #endif
    2456              : 
    2457              :   return UI_NONE;
    2458              : }
    2459              : 
    2460              : /* Targets that set NUM_POLY_INT_COEFFS to something greater than 1
    2461              :    must define this hook.  */
    2462              : 
    2463              : unsigned int
    2464            0 : default_dwarf_poly_indeterminate_value (unsigned int, unsigned int *, int *)
    2465              : {
    2466            0 :   gcc_unreachable ();
    2467              : }
    2468              : 
    2469              : /* Determine the correct mode for a Dwarf frame register that represents
    2470              :    register REGNO.  */
    2471              : 
    2472              : machine_mode
    2473          752 : default_dwarf_frame_reg_mode (int regno)
    2474              : {
    2475          752 :   machine_mode save_mode = reg_raw_mode[regno];
    2476              : 
    2477          752 :   if (targetm.hard_regno_call_part_clobbered (eh_edge_abi.id (),
    2478              :                                               regno, save_mode))
    2479            0 :     save_mode = choose_hard_reg_mode (regno, 1, &eh_edge_abi);
    2480          752 :   return save_mode;
    2481              : }
    2482              : 
    2483              : /* To be used by targets where reg_raw_mode doesn't return the right
    2484              :    mode for registers used in apply_builtin_return and apply_builtin_arg.  */
    2485              : 
    2486              : fixed_size_mode
    2487         7530 : default_get_reg_raw_mode (int regno)
    2488              : {
    2489              :   /* Targets must override this hook if the underlying register is
    2490              :      variable-sized.  */
    2491         7530 :   return as_a <fixed_size_mode> (reg_raw_mode[regno]);
    2492              : }
    2493              : 
    2494              : /* Return true if a leaf function should stay leaf even with profiling
    2495              :    enabled.  */
    2496              : 
    2497              : bool
    2498          790 : default_keep_leaf_when_profiled ()
    2499              : {
    2500          790 :   return false;
    2501              : }
    2502              : 
    2503              : /* Return true if the state of option OPTION should be stored in PCH files
    2504              :    and checked by default_pch_valid_p.  Store the option's current state
    2505              :    in STATE if so.  */
    2506              : 
    2507              : static inline bool
    2508     47517474 : option_affects_pch_p (int option, struct cl_option_state *state)
    2509              : {
    2510     47517474 :   if ((cl_options[option].flags & CL_TARGET) == 0)
    2511              :     return false;
    2512      3886740 :   if ((cl_options[option].flags & CL_PCH_IGNORE) != 0)
    2513              :     return false;
    2514      3886740 :   if (option_flag_var (option, &global_options) == &target_flags)
    2515       643178 :     if (targetm.check_pch_target_flags)
    2516              :       return false;
    2517      3886740 :   return get_option_state (&global_options, option, state);
    2518              : }
    2519              : 
    2520              : /* Default version of get_pch_validity.
    2521              :    By default, every flag difference is fatal; that will be mostly right for
    2522              :    most targets, but completely right for very few.  */
    2523              : 
    2524              : void *
    2525          470 : default_get_pch_validity (size_t *sz)
    2526              : {
    2527          470 :   struct cl_option_state state;
    2528          470 :   size_t i;
    2529          470 :   char *result, *r;
    2530              : 
    2531          470 :   *sz = 2;
    2532          470 :   if (targetm.check_pch_target_flags)
    2533            0 :     *sz += sizeof (target_flags);
    2534      1223880 :   for (i = 0; i < cl_options_count; i++)
    2535      1223410 :     if (option_affects_pch_p (i, &state))
    2536       110920 :       *sz += state.size;
    2537              : 
    2538          470 :   result = r = XNEWVEC (char, *sz);
    2539          470 :   r[0] = flag_pic;
    2540          470 :   r[1] = flag_pie;
    2541          470 :   r += 2;
    2542          470 :   if (targetm.check_pch_target_flags)
    2543              :     {
    2544            0 :       memcpy (r, &target_flags, sizeof (target_flags));
    2545            0 :       r += sizeof (target_flags);
    2546              :     }
    2547              : 
    2548      1223880 :   for (i = 0; i < cl_options_count; i++)
    2549      1223410 :     if (option_affects_pch_p (i, &state))
    2550              :       {
    2551       110920 :         memcpy (r, state.data, state.size);
    2552       110920 :         r += state.size;
    2553              :       }
    2554              : 
    2555          470 :   return result;
    2556              : }
    2557              : 
    2558              : /* Return a message which says that a PCH file was created with a different
    2559              :    setting of OPTION.  */
    2560              : 
    2561              : static const char *
    2562        18510 : pch_option_mismatch (const char *option)
    2563              : {
    2564        18510 :   return xasprintf (_("created and used with differing settings of '%s'"),
    2565        18510 :                     option);
    2566              : }
    2567              : 
    2568              : /* Default version of pch_valid_p.  */
    2569              : 
    2570              : const char *
    2571        18872 : default_pch_valid_p (const void *data_p, size_t len ATTRIBUTE_UNUSED)
    2572              : {
    2573        18872 :   struct cl_option_state state;
    2574        18872 :   const char *data = (const char *)data_p;
    2575        18872 :   size_t i;
    2576              : 
    2577              :   /* -fpic and -fpie also usually make a PCH invalid.  */
    2578        18872 :   if (data[0] != flag_pic)
    2579            0 :     return _("created and used with different settings of %<-fpic%>");
    2580        18872 :   if (data[1] != flag_pie)
    2581            0 :     return _("created and used with different settings of %<-fpie%>");
    2582        18872 :   data += 2;
    2583              : 
    2584              :   /* Check target_flags.  */
    2585        18872 :   if (targetm.check_pch_target_flags)
    2586              :     {
    2587            0 :       int tf;
    2588            0 :       const char *r;
    2589              : 
    2590            0 :       memcpy (&tf, data, sizeof (target_flags));
    2591            0 :       data += sizeof (target_flags);
    2592            0 :       r = targetm.check_pch_target_flags (tf);
    2593            0 :       if (r != NULL)
    2594              :         return r;
    2595              :     }
    2596              : 
    2597     45071016 :   for (i = 0; i < cl_options_count; i++)
    2598     45070654 :     if (option_affects_pch_p (i, &state))
    2599              :       {
    2600      3584334 :         if (memcmp (data, state.data, state.size) != 0)
    2601        18510 :           return pch_option_mismatch (cl_options[i].opt_text);
    2602      3565824 :         data += state.size;
    2603              :       }
    2604              : 
    2605              :   return NULL;
    2606              : }
    2607              : 
    2608              : /* Default version of cstore_mode.  */
    2609              : 
    2610              : scalar_int_mode
    2611       761614 : default_cstore_mode (enum insn_code icode)
    2612              : {
    2613       761614 :   return as_a <scalar_int_mode> (insn_data[(int) icode].operand[0].mode);
    2614              : }
    2615              : 
    2616              : /* Default version of member_type_forces_blk.  */
    2617              : 
    2618              : bool
    2619            0 : default_member_type_forces_blk (const_tree, machine_mode)
    2620              : {
    2621            0 :   return false;
    2622              : }
    2623              : 
    2624              : /* Default version of canonicalize_comparison.  */
    2625              : 
    2626              : void
    2627            0 : default_canonicalize_comparison (int *, rtx *, rtx *, bool)
    2628              : {
    2629            0 : }
    2630              : 
    2631              : /* Default implementation of TARGET_ATOMIC_ASSIGN_EXPAND_FENV.  */
    2632              : 
    2633              : void
    2634            0 : default_atomic_assign_expand_fenv (tree *, tree *, tree *)
    2635              : {
    2636            0 : }
    2637              : 
    2638              : #ifndef PAD_VARARGS_DOWN
    2639              : #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN
    2640              : #endif
    2641              : 
    2642              : /* Build an indirect-ref expression over the given TREE, which represents a
    2643              :    piece of a va_arg() expansion.  */
    2644              : tree
    2645        55208 : build_va_arg_indirect_ref (tree addr)
    2646              : {
    2647        55208 :   addr = build_simple_mem_ref_loc (EXPR_LOCATION (addr), addr);
    2648        55208 :   return addr;
    2649              : }
    2650              : 
    2651              : /* The "standard" implementation of va_arg: read the value from the
    2652              :    current (padded) address and increment by the (padded) size.  */
    2653              : 
    2654              : tree
    2655          272 : std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
    2656              :                           gimple_seq *post_p)
    2657              : {
    2658          272 :   tree addr, t, type_size, rounded_size, valist_tmp;
    2659          272 :   unsigned HOST_WIDE_INT align, boundary;
    2660          272 :   bool indirect;
    2661              : 
    2662              :   /* All of the alignment and movement below is for args-grow-up machines.
    2663              :      As of 2004, there are only 3 ARGS_GROW_DOWNWARD targets, and they all
    2664              :      implement their own specialized gimplify_va_arg_expr routines.  */
    2665          272 :   if (ARGS_GROW_DOWNWARD)
    2666              :     gcc_unreachable ();
    2667              : 
    2668          272 :   indirect = pass_va_arg_by_reference (type);
    2669          272 :   if (indirect)
    2670            0 :     type = build_pointer_type (type);
    2671              : 
    2672          272 :   if (targetm.calls.split_complex_arg
    2673            0 :       && TREE_CODE (type) == COMPLEX_TYPE
    2674          272 :       && targetm.calls.split_complex_arg (type))
    2675              :     {
    2676            0 :       tree real_part, imag_part;
    2677              : 
    2678            0 :       real_part = std_gimplify_va_arg_expr (valist,
    2679            0 :                                             TREE_TYPE (type), pre_p, NULL);
    2680            0 :       real_part = get_initialized_tmp_var (real_part, pre_p);
    2681              : 
    2682            0 :       imag_part = std_gimplify_va_arg_expr (unshare_expr (valist),
    2683            0 :                                             TREE_TYPE (type), pre_p, NULL);
    2684            0 :       imag_part = get_initialized_tmp_var (imag_part, pre_p);
    2685              : 
    2686            0 :       return build2 (COMPLEX_EXPR, type, real_part, imag_part);
    2687              :    }
    2688              : 
    2689          272 :   align = PARM_BOUNDARY / BITS_PER_UNIT;
    2690          272 :   boundary = targetm.calls.function_arg_boundary (TYPE_MODE (type), type);
    2691              : 
    2692              :   /* When we align parameter on stack for caller, if the parameter
    2693              :      alignment is beyond MAX_SUPPORTED_STACK_ALIGNMENT, it will be
    2694              :      aligned at MAX_SUPPORTED_STACK_ALIGNMENT.  We will match callee
    2695              :      here with caller.  */
    2696          272 :   if (boundary > MAX_SUPPORTED_STACK_ALIGNMENT)
    2697              :     boundary = MAX_SUPPORTED_STACK_ALIGNMENT;
    2698              : 
    2699          272 :   boundary /= BITS_PER_UNIT;
    2700              : 
    2701              :   /* Hoist the valist value into a temporary for the moment.  */
    2702          272 :   valist_tmp = get_initialized_tmp_var (valist, pre_p);
    2703              : 
    2704              :   /* va_list pointer is aligned to PARM_BOUNDARY.  If argument actually
    2705              :      requires greater alignment, we must perform dynamic alignment.  */
    2706          272 :   if (boundary > align
    2707            4 :       && !TYPE_EMPTY_P (type)
    2708          276 :       && !integer_zerop (TYPE_SIZE (type)))
    2709              :     {
    2710            4 :       t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
    2711            4 :                   fold_build_pointer_plus_hwi (valist_tmp, boundary - 1));
    2712            4 :       gimplify_and_add (t, pre_p);
    2713              : 
    2714            8 :       t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
    2715            8 :                   fold_build2 (BIT_AND_EXPR, TREE_TYPE (valist),
    2716              :                                valist_tmp,
    2717              :                                build_int_cst (TREE_TYPE (valist), -boundary)));
    2718            4 :       gimplify_and_add (t, pre_p);
    2719              :     }
    2720              :   else
    2721              :     boundary = align;
    2722              : 
    2723              :   /* If the actual alignment is less than the alignment of the type,
    2724              :      adjust the type accordingly so that we don't assume strict alignment
    2725              :      when dereferencing the pointer.  */
    2726          272 :   boundary *= BITS_PER_UNIT;
    2727          272 :   if (boundary < TYPE_ALIGN (type))
    2728              :     {
    2729           22 :       type = build_variant_type_copy (type);
    2730           22 :       SET_TYPE_ALIGN (type, boundary);
    2731              :     }
    2732              : 
    2733              :   /* Compute the rounded size of the type.  */
    2734          272 :   type_size = arg_size_in_bytes (type);
    2735          272 :   rounded_size = round_up (type_size, align);
    2736              : 
    2737              :   /* Reduce rounded_size so it's sharable with the postqueue.  */
    2738          272 :   gimplify_expr (&rounded_size, pre_p, post_p, is_gimple_val, fb_rvalue);
    2739              : 
    2740              :   /* Get AP.  */
    2741          272 :   addr = valist_tmp;
    2742          272 :   if (PAD_VARARGS_DOWN && !integer_zerop (rounded_size))
    2743              :     {
    2744              :       /* Small args are padded downward.  */
    2745              :       t = fold_build2_loc (input_location, GT_EXPR, sizetype,
    2746              :                        rounded_size, size_int (align));
    2747              :       t = fold_build3 (COND_EXPR, sizetype, t, size_zero_node,
    2748              :                        size_binop (MINUS_EXPR, rounded_size, type_size));
    2749              :       addr = fold_build_pointer_plus (addr, t);
    2750              :     }
    2751              : 
    2752              :   /* Compute new value for AP.  */
    2753          272 :   t = fold_build_pointer_plus (valist_tmp, rounded_size);
    2754          272 :   t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
    2755          272 :   gimplify_and_add (t, pre_p);
    2756              : 
    2757          272 :   addr = fold_convert (build_pointer_type (type), addr);
    2758              : 
    2759          272 :   if (indirect)
    2760            0 :     addr = build_va_arg_indirect_ref (addr);
    2761              : 
    2762          272 :   return build_va_arg_indirect_ref (addr);
    2763              : }
    2764              : 
    2765              : /* An implementation of TARGET_CAN_USE_DOLOOP_P for targets that do
    2766              :    not support nested low-overhead loops.  */
    2767              : 
    2768              : bool
    2769            0 : can_use_doloop_if_innermost (const widest_int &, const widest_int &,
    2770              :                              unsigned int loop_depth, bool)
    2771              : {
    2772            0 :   return loop_depth == 1;
    2773              : }
    2774              : 
    2775              : /* Default implementation of TARGET_OPTAB_SUPPORTED_P.  */
    2776              : 
    2777              : bool
    2778            0 : default_optab_supported_p (int, machine_mode, machine_mode, optimization_type)
    2779              : {
    2780            0 :   return true;
    2781              : }
    2782              : 
    2783              : /* Default implementation of TARGET_MAX_NOCE_IFCVT_SEQ_COST.  */
    2784              : 
    2785              : unsigned int
    2786            0 : default_max_noce_ifcvt_seq_cost (edge e)
    2787              : {
    2788            0 :   bool predictable_p = predictable_edge_p (e);
    2789              : 
    2790            0 :   if (predictable_p)
    2791              :     {
    2792            0 :       if (OPTION_SET_P (param_max_rtl_if_conversion_predictable_cost))
    2793            0 :         return param_max_rtl_if_conversion_predictable_cost;
    2794              :     }
    2795              :   else
    2796              :     {
    2797            0 :       if (OPTION_SET_P (param_max_rtl_if_conversion_unpredictable_cost))
    2798            0 :         return param_max_rtl_if_conversion_unpredictable_cost;
    2799              :     }
    2800              : 
    2801            0 :   return BRANCH_COST (true, predictable_p) * COSTS_N_INSNS (3);
    2802              : }
    2803              : 
    2804              : /* Default implementation of TARGET_MIN_ARITHMETIC_PRECISION.  */
    2805              : 
    2806              : unsigned int
    2807        72982 : default_min_arithmetic_precision (void)
    2808              : {
    2809        72982 :   return WORD_REGISTER_OPERATIONS ? BITS_PER_WORD : BITS_PER_UNIT;
    2810              : }
    2811              : 
    2812              : /* Default implementation of TARGET_C_EXCESS_PRECISION.  */
    2813              : 
    2814              : enum flt_eval_method
    2815            0 : default_excess_precision (enum excess_precision_type ATTRIBUTE_UNUSED)
    2816              : {
    2817            0 :   return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
    2818              : }
    2819              : 
    2820              : /* Return true if _BitInt(N) is supported and fill details about it into
    2821              :    *INFO.  */
    2822              : bool
    2823            0 : default_bitint_type_info (int, struct bitint_info *)
    2824              : {
    2825            0 :   return false;
    2826              : }
    2827              : 
    2828              : /* Default implementation for
    2829              :   TARGET_STACK_CLASH_PROTECTION_ALLOCA_PROBE_RANGE.  */
    2830              : HOST_WIDE_INT
    2831           16 : default_stack_clash_protection_alloca_probe_range (void)
    2832              : {
    2833           16 :   return 0;
    2834              : }
    2835              : 
    2836              : /* The default implementation of TARGET_EARLY_REMAT_MODES.  */
    2837              : 
    2838              : void
    2839            0 : default_select_early_remat_modes (sbitmap)
    2840              : {
    2841            0 : }
    2842              : 
    2843              : /* The default implementation of TARGET_PREFERRED_ELSE_VALUE.  */
    2844              : 
    2845              : tree
    2846          550 : default_preferred_else_value (unsigned, tree type, unsigned, tree *)
    2847              : {
    2848          550 :   return build_zero_cst (type);
    2849              : }
    2850              : 
    2851              : /* The default implementation of TARGET_INSTRUCTION_SELECTION.  */
    2852              : 
    2853              : bool
    2854    102010042 : default_instruction_selection (function *, gimple_stmt_iterator *)
    2855              : {
    2856    102010042 :   return false;
    2857              : }
    2858              : 
    2859              : /* Default implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE.  */
    2860              : bool
    2861       218223 : default_have_speculation_safe_value (bool active ATTRIBUTE_UNUSED)
    2862              : {
    2863              : #ifdef HAVE_speculation_barrier
    2864       218223 :   return active ? HAVE_speculation_barrier : true;
    2865              : #else
    2866              :   return false;
    2867              : #endif
    2868              : }
    2869              : /* Alternative implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE
    2870              :    that can be used on targets that never have speculative execution.  */
    2871              : bool
    2872            0 : speculation_safe_value_not_needed (bool active)
    2873              : {
    2874            0 :   return !active;
    2875              : }
    2876              : 
    2877              : /* Default implementation of the speculation-safe-load builtin.  This
    2878              :    implementation simply copies val to result and generates a
    2879              :    speculation_barrier insn, if such a pattern is defined.  */
    2880              : rtx
    2881           35 : default_speculation_safe_value (machine_mode mode ATTRIBUTE_UNUSED,
    2882              :                                 rtx result, rtx val,
    2883              :                                 rtx failval ATTRIBUTE_UNUSED)
    2884              : {
    2885           35 :   emit_move_insn (result, val);
    2886              : 
    2887              : #ifdef HAVE_speculation_barrier
    2888              :   /* Assume the target knows what it is doing: if it defines a
    2889              :      speculation barrier, but it is not enabled, then assume that one
    2890              :      isn't needed.  */
    2891           35 :   if (HAVE_speculation_barrier)
    2892           35 :     emit_insn (gen_speculation_barrier ());
    2893              : #endif
    2894              : 
    2895           35 :   return result;
    2896              : }
    2897              : 
    2898              : /* How many bits to shift in order to access the tag bits.
    2899              :    The default is to store the tag in the top 8 bits of a 64 bit pointer, hence
    2900              :    shifting 56 bits will leave just the tag.  */
    2901              : #define HWASAN_SHIFT (GET_MODE_PRECISION (Pmode) - 8)
    2902              : #define HWASAN_SHIFT_RTX GEN_INT (HWASAN_SHIFT)
    2903              : 
    2904              : bool
    2905            0 : default_memtag_can_tag_addresses ()
    2906              : {
    2907            0 :   return false;
    2908              : }
    2909              : 
    2910              : uint8_t
    2911            0 : default_memtag_tag_bitsize ()
    2912              : {
    2913            0 :   return 8;
    2914              : }
    2915              : 
    2916              : uint8_t
    2917         1828 : default_memtag_granule_size ()
    2918              : {
    2919         1828 :   return 16;
    2920              : }
    2921              : 
    2922              : /* The default implementation of TARGET_MEMTAG_INSERT_RANDOM_TAG.  */
    2923              : rtx
    2924           62 : default_memtag_insert_random_tag (rtx untagged, rtx target)
    2925              : {
    2926           62 :   gcc_assert (param_hwasan_instrument_stack);
    2927           62 :   if (param_hwasan_random_frame_tag)
    2928              :     {
    2929           16 :       rtx fn = init_one_libfunc ("__hwasan_generate_tag");
    2930           16 :       rtx new_tag = emit_library_call_value (fn, NULL_RTX, LCT_NORMAL, QImode);
    2931           16 :       return targetm.memtag.set_tag (untagged, new_tag, target);
    2932              :     }
    2933              :   else
    2934              :     {
    2935              :       /* NOTE: The kernel API does not have __hwasan_generate_tag exposed.
    2936              :          In the future we may add the option emit random tags with inline
    2937              :          instrumentation instead of function calls.  This would be the same
    2938              :          between the kernel and userland.  */
    2939              :       return untagged;
    2940              :     }
    2941              : }
    2942              : 
    2943              : /* The default implementation of TARGET_MEMTAG_ADD_TAG.  */
    2944              : rtx
    2945            0 : default_memtag_add_tag (rtx base, poly_int64 offset, uint8_t tag_offset)
    2946              : {
    2947              :   /* Need to look into what the most efficient code sequence is.
    2948              :      This is a code sequence that would be emitted *many* times, so we
    2949              :      want it as small as possible.
    2950              : 
    2951              :      There are two places where tag overflow is a question:
    2952              :        - Tagging the shadow stack.
    2953              :           (both tagging and untagging).
    2954              :        - Tagging addressable pointers.
    2955              : 
    2956              :      We need to ensure both behaviors are the same (i.e. that the tag that
    2957              :      ends up in a pointer after "overflowing" the tag bits with a tag addition
    2958              :      is the same that ends up in the shadow space).
    2959              : 
    2960              :      The aim is that the behavior of tag addition should follow modulo
    2961              :      wrapping in both instances.
    2962              : 
    2963              :      The libhwasan code doesn't have any path that increments a pointer's tag,
    2964              :      which means it has no opinion on what happens when a tag increment
    2965              :      overflows (and hence we can choose our own behavior).  */
    2966              : 
    2967            0 :   offset += ((uint64_t)tag_offset << HWASAN_SHIFT);
    2968            0 :   return plus_constant (Pmode, base, offset);
    2969              : }
    2970              : 
    2971              : /* The default implementation of TARGET_MEMTAG_SET_TAG.  */
    2972              : rtx
    2973            0 : default_memtag_set_tag (rtx untagged, rtx tag, rtx target)
    2974              : {
    2975            0 :   gcc_assert (GET_MODE (untagged) == Pmode && GET_MODE (tag) == QImode);
    2976            0 :   tag = expand_simple_binop (Pmode, ASHIFT, tag, HWASAN_SHIFT_RTX, NULL_RTX,
    2977              :                              /* unsignedp = */1, OPTAB_WIDEN);
    2978            0 :   rtx ret = expand_simple_binop (Pmode, IOR, untagged, tag, target,
    2979              :                                  /* unsignedp = */1, OPTAB_DIRECT);
    2980            0 :   gcc_assert (ret);
    2981            0 :   return ret;
    2982              : }
    2983              : 
    2984              : /* The default implementation of TARGET_MEMTAG_EXTRACT_TAG.  */
    2985              : rtx
    2986            0 : default_memtag_extract_tag (rtx tagged_pointer, rtx target)
    2987              : {
    2988            0 :   rtx tag = expand_simple_binop (Pmode, LSHIFTRT, tagged_pointer,
    2989            0 :                                  HWASAN_SHIFT_RTX, target,
    2990              :                                  /* unsignedp = */0,
    2991              :                                  OPTAB_DIRECT);
    2992            0 :   rtx ret = gen_lowpart (QImode, tag);
    2993            0 :   gcc_assert (ret);
    2994            0 :   return ret;
    2995              : }
    2996              : 
    2997              : /* The default implementation of TARGET_MEMTAG_UNTAGGED_POINTER.  */
    2998              : rtx
    2999            0 : default_memtag_untagged_pointer (rtx tagged_pointer, rtx target)
    3000              : {
    3001            0 :   rtx tag_mask = gen_int_mode ((HOST_WIDE_INT_1U << HWASAN_SHIFT) - 1, Pmode);
    3002            0 :   rtx untagged_base = expand_simple_binop (Pmode, AND, tagged_pointer,
    3003              :                                            tag_mask, target, true,
    3004              :                                            OPTAB_DIRECT);
    3005            0 :   gcc_assert (untagged_base);
    3006            0 :   return untagged_base;
    3007              : }
    3008              : 
    3009              : /* The default implementation of TARGET_SCHED_REASSOCIATION_WIDTH.  */
    3010              : int
    3011            0 : default_reassociation_width (tree_code, machine_mode)
    3012              : {
    3013            0 :   return 1;
    3014              : }
    3015              : 
    3016              : #include "gt-targhooks.h"
        

Generated by: LCOV version 2.6-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.