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

Generated by: LCOV version 2.5.0-beta

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