LCOV - code coverage report
Current view: top level - gcc - ira-lives.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 96.2 % 888 854
Test Date: 2025-03-15 13:07:15 Functions: 85.4 % 48 41
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* IRA processing allocno lives to build allocno live ranges.
       2                 :             :    Copyright (C) 2006-2025 Free Software Foundation, Inc.
       3                 :             :    Contributed by Vladimir Makarov <vmakarov@redhat.com>.
       4                 :             : 
       5                 :             : This file is part of GCC.
       6                 :             : 
       7                 :             : GCC is free software; you can redistribute it and/or modify it under
       8                 :             : the terms of the GNU General Public License as published by the Free
       9                 :             : Software Foundation; either version 3, or (at your option) any later
      10                 :             : version.
      11                 :             : 
      12                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15                 :             : for more details.
      16                 :             : 
      17                 :             : You should have received a copy of the GNU General Public License
      18                 :             : along with GCC; see the file COPYING3.  If not see
      19                 :             : <http://www.gnu.org/licenses/>.  */
      20                 :             : 
      21                 :             : #include "config.h"
      22                 :             : #include "system.h"
      23                 :             : #include "coretypes.h"
      24                 :             : #include "backend.h"
      25                 :             : #include "target.h"
      26                 :             : #include "rtl.h"
      27                 :             : #include "predict.h"
      28                 :             : #include "df.h"
      29                 :             : #include "memmodel.h"
      30                 :             : #include "tm_p.h"
      31                 :             : #include "insn-config.h"
      32                 :             : #include "regs.h"
      33                 :             : #include "ira.h"
      34                 :             : #include "ira-int.h"
      35                 :             : #include "sparseset.h"
      36                 :             : #include "function-abi.h"
      37                 :             : #include "except.h"
      38                 :             : 
      39                 :             : /* The code in this file is similar to one in global but the code
      40                 :             :    works on the allocno basis and creates live ranges instead of
      41                 :             :    pseudo-register conflicts.  */
      42                 :             : 
      43                 :             : /* Program points are enumerated by numbers from range
      44                 :             :    0..IRA_MAX_POINT-1.  There are approximately two times more program
      45                 :             :    points than insns.  Program points are places in the program where
      46                 :             :    liveness info can be changed.  In most general case (there are more
      47                 :             :    complicated cases too) some program points correspond to places
      48                 :             :    where input operand dies and other ones correspond to places where
      49                 :             :    output operands are born.  */
      50                 :             : int ira_max_point;
      51                 :             : 
      52                 :             : /* Arrays of size IRA_MAX_POINT mapping a program point to the allocno
      53                 :             :    live ranges with given start/finish point.  */
      54                 :             : live_range_t *ira_start_point_ranges, *ira_finish_point_ranges;
      55                 :             : 
      56                 :             : /* Number of the current program point.  */
      57                 :             : static int curr_point;
      58                 :             : 
      59                 :             : /* Point where register pressure excess started or -1 if there is no
      60                 :             :    register pressure excess.  Excess pressure for a register class at
      61                 :             :    some point means that there are more allocnos of given register
      62                 :             :    class living at the point than number of hard-registers of the
      63                 :             :    class available for the allocation.  It is defined only for
      64                 :             :    pressure classes.  */
      65                 :             : static int high_pressure_start_point[N_REG_CLASSES];
      66                 :             : 
      67                 :             : /* Objects live at current point in the scan.  */
      68                 :             : static sparseset objects_live;
      69                 :             : 
      70                 :             : /* A temporary bitmap used in functions that wish to avoid visiting an allocno
      71                 :             :    multiple times.  */
      72                 :             : static sparseset allocnos_processed;
      73                 :             : 
      74                 :             : /* Set of hard regs (except eliminable ones) currently live.  */
      75                 :             : static HARD_REG_SET hard_regs_live;
      76                 :             : 
      77                 :             : /* The loop tree node corresponding to the current basic block.  */
      78                 :             : static ira_loop_tree_node_t curr_bb_node;
      79                 :             : 
      80                 :             : /* The number of the last processed call.  */
      81                 :             : static int last_call_num;
      82                 :             : /* The number of last call at which given allocno was saved.  */
      83                 :             : static int *allocno_saved_at_call;
      84                 :             : 
      85                 :             : /* The value returned by ira_setup_alts for the current instruction;
      86                 :             :    i.e. the set of alternatives that we should consider to be likely
      87                 :             :    candidates during reloading.  */
      88                 :             : static alternative_mask preferred_alternatives;
      89                 :             : 
      90                 :             : /* If non-NULL, the source operand of a register to register copy for which
      91                 :             :    we should not add a conflict with the copy's destination operand.  */
      92                 :             : static rtx ignore_reg_for_conflicts;
      93                 :             : 
      94                 :             : /* Record hard register REGNO as now being live.  */
      95                 :             : static void
      96                 :    37055756 : make_hard_regno_live (int regno)
      97                 :             : {
      98                 :    37055756 :   SET_HARD_REG_BIT (hard_regs_live, regno);
      99                 :    34925344 : }
     100                 :             : 
     101                 :             : /* Process the definition of hard register REGNO.  This updates
     102                 :             :    hard_regs_live and hard reg conflict information for living allocnos.  */
     103                 :             : static void
     104                 :    15826390 : make_hard_regno_dead (int regno)
     105                 :             : {
     106                 :    15826390 :   unsigned int i;
     107                 :   277222880 :   EXECUTE_IF_SET_IN_SPARSESET (objects_live, i)
     108                 :             :     {
     109                 :   261396490 :       ira_object_t obj = ira_object_id_map[i];
     110                 :             : 
     111                 :   262937849 :       if (ignore_reg_for_conflicts != NULL_RTX
     112                 :   171850807 :           && REGNO (ignore_reg_for_conflicts)
     113                 :   171850807 :              == (unsigned int) ALLOCNO_REGNO (OBJECT_ALLOCNO (obj)))
     114                 :     1541359 :         continue;
     115                 :             : 
     116                 :   259855131 :       SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
     117                 :   259855131 :       SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
     118                 :             :     }
     119                 :    15826390 :   CLEAR_HARD_REG_BIT (hard_regs_live, regno);
     120                 :    15826390 : }
     121                 :             : 
     122                 :             : /* Record object OBJ as now being live.  Set a bit for it in objects_live,
     123                 :             :    and start a new live range for it if necessary.  */
     124                 :             : static void
     125                 :   233494837 : make_object_live (ira_object_t obj)
     126                 :             : {
     127                 :   233494837 :   sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj));
     128                 :             : 
     129                 :   233494837 :   live_range_t lr = OBJECT_LIVE_RANGES (obj);
     130                 :   233494837 :   if (lr == NULL
     131                 :   198626860 :       || (lr->finish != curr_point && lr->finish + 1 != curr_point))
     132                 :    51928044 :     ira_add_live_range_to_object (obj, curr_point, -1);
     133                 :   233494837 : }
     134                 :             : 
     135                 :             : /* Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for the allocno
     136                 :             :    associated with object OBJ.  */
     137                 :             : static void
     138                 :   240508883 : update_allocno_pressure_excess_length (ira_object_t obj)
     139                 :             : {
     140                 :   240508883 :   ira_allocno_t a = OBJECT_ALLOCNO (obj);
     141                 :   240508883 :   int start, i;
     142                 :   240508883 :   enum reg_class aclass, pclass, cl;
     143                 :   240508883 :   live_range_t p;
     144                 :             : 
     145                 :   240508883 :   aclass = ALLOCNO_CLASS (a);
     146                 :   240508883 :   pclass = ira_pressure_class_translate[aclass];
     147                 :  2373210639 :   for (i = 0;
     148                 :  2373210639 :        (cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
     149                 :             :        i++)
     150                 :             :     {
     151                 :  2132701756 :       if (! ira_reg_pressure_class_p[cl])
     152                 :  1896341275 :         continue;
     153                 :   236360481 :       if (high_pressure_start_point[cl] < 0)
     154                 :    67321283 :         continue;
     155                 :   169039198 :       p = OBJECT_LIVE_RANGES (obj);
     156                 :   169039198 :       ira_assert (p != NULL);
     157                 :   169039198 :       start = (high_pressure_start_point[cl] > p->start
     158                 :   169039198 :                ? high_pressure_start_point[cl] : p->start);
     159                 :   169039198 :       ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (a) += curr_point - start + 1;
     160                 :             :     }
     161                 :   240508883 : }
     162                 :             : 
     163                 :             : /* Process the definition of object OBJ, which is associated with allocno A.
     164                 :             :    This finishes the current live range for it.  */
     165                 :             : static void
     166                 :   233494837 : make_object_dead (ira_object_t obj)
     167                 :             : {
     168                 :   233494837 :   live_range_t lr;
     169                 :   233494837 :   int regno;
     170                 :   233494837 :   int ignore_regno = -1;
     171                 :   233494837 :   int ignore_total_regno = -1;
     172                 :   233494837 :   int end_regno = -1;
     173                 :             : 
     174                 :   233494837 :   sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
     175                 :             : 
     176                 :             :   /* Check whether any part of IGNORE_REG_FOR_CONFLICTS already conflicts
     177                 :             :      with OBJ.  */
     178                 :   233494837 :   if (ignore_reg_for_conflicts != NULL_RTX
     179                 :   233494837 :       && REGNO (ignore_reg_for_conflicts) < FIRST_PSEUDO_REGISTER)
     180                 :             :     {
     181                 :     3367126 :       end_regno = END_REGNO (ignore_reg_for_conflicts);
     182                 :     3367126 :       ignore_regno = ignore_total_regno = REGNO (ignore_reg_for_conflicts);
     183                 :             : 
     184                 :     6734252 :       for (regno = ignore_regno; regno < end_regno; regno++)
     185                 :             :         {
     186                 :     3367126 :           if (TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno))
     187                 :      541526 :             ignore_regno = end_regno;
     188                 :     3367126 :           if (TEST_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno))
     189                 :      541526 :             ignore_total_regno = end_regno;
     190                 :             :         }
     191                 :             :     }
     192                 :             : 
     193                 :   933979348 :   OBJECT_CONFLICT_HARD_REGS (obj) |= hard_regs_live;
     194                 :   236320437 :   OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= hard_regs_live;
     195                 :             : 
     196                 :             :   /* If IGNORE_REG_FOR_CONFLICTS did not already conflict with OBJ, make
     197                 :             :      sure it still doesn't.  */
     198                 :   236320437 :   for (regno = ignore_regno; regno < end_regno; regno++)
     199                 :     2825600 :     CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
     200                 :   236320437 :   for (regno = ignore_total_regno; regno < end_regno; regno++)
     201                 :     2825600 :     CLEAR_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
     202                 :             : 
     203                 :   233494837 :   lr = OBJECT_LIVE_RANGES (obj);
     204                 :   233494837 :   ira_assert (lr != NULL);
     205                 :   233494837 :   lr->finish = curr_point;
     206                 :   233494837 :   update_allocno_pressure_excess_length (obj);
     207                 :   233494837 : }
     208                 :             : 
     209                 :             : /* The current register pressures for each pressure class for the current
     210                 :             :    basic block.  */
     211                 :             : static int curr_reg_pressure[N_REG_CLASSES];
     212                 :             : 
     213                 :             : /* Record that register pressure for PCLASS increased by N registers.
     214                 :             :    Update the current register pressure, maximal register pressure for
     215                 :             :    the current BB and the start point of the register pressure
     216                 :             :    excess.  */
     217                 :             : static void
     218                 :   250843720 : inc_register_pressure (enum reg_class pclass, int n)
     219                 :             : {
     220                 :   250843720 :   int i;
     221                 :   250843720 :   enum reg_class cl;
     222                 :             : 
     223                 :  2469463935 :   for (i = 0;
     224                 :  2469463935 :        (cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
     225                 :             :        i++)
     226                 :             :     {
     227                 :  2218620215 :       if (! ira_reg_pressure_class_p[cl])
     228                 :  1971708704 :         continue;
     229                 :   246911511 :       curr_reg_pressure[cl] += n;
     230                 :   246911511 :       if (high_pressure_start_point[cl] < 0
     231                 :    98826980 :           && (curr_reg_pressure[cl] > ira_class_hard_regs_num[cl]))
     232                 :     1718136 :         high_pressure_start_point[cl] = curr_point;
     233                 :   246911511 :       if (curr_bb_node->reg_pressure[cl] < curr_reg_pressure[cl])
     234                 :   212528123 :         curr_bb_node->reg_pressure[cl] = curr_reg_pressure[cl];
     235                 :             :     }
     236                 :   250843720 : }
     237                 :             : 
     238                 :             : /* Record that register pressure for PCLASS has decreased by NREGS
     239                 :             :    registers; update current register pressure, start point of the
     240                 :             :    register pressure excess, and register pressure excess length for
     241                 :             :    living allocnos.  */
     242                 :             : 
     243                 :             : static void
     244                 :    51673772 : dec_register_pressure (enum reg_class pclass, int nregs)
     245                 :             : {
     246                 :    51673772 :   int i;
     247                 :    51673772 :   unsigned int j;
     248                 :    51673772 :   enum reg_class cl;
     249                 :    51673772 :   bool set_p = false;
     250                 :             : 
     251                 :    51673772 :   for (i = 0;
     252                 :   498074779 :        (cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
     253                 :             :        i++)
     254                 :             :     {
     255                 :   446401007 :       if (! ira_reg_pressure_class_p[cl])
     256                 :   395192592 :         continue;
     257                 :    51208415 :       curr_reg_pressure[cl] -= nregs;
     258                 :    51208415 :       ira_assert (curr_reg_pressure[cl] >= 0);
     259                 :    51208415 :       if (high_pressure_start_point[cl] >= 0
     260                 :     4619561 :           && curr_reg_pressure[cl] <= ira_class_hard_regs_num[cl])
     261                 :   446401007 :         set_p = true;
     262                 :             :     }
     263                 :    51673772 :   if (set_p)
     264                 :             :     {
     265                 :     7481977 :       EXECUTE_IF_SET_IN_SPARSESET (objects_live, j)
     266                 :     7014046 :         update_allocno_pressure_excess_length (ira_object_id_map[j]);
     267                 :     4447311 :       for (i = 0;
     268                 :     4915242 :            (cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
     269                 :             :            i++)
     270                 :             :         {
     271                 :     4447311 :           if (! ira_reg_pressure_class_p[cl])
     272                 :     3979380 :             continue;
     273                 :      467931 :           if (high_pressure_start_point[cl] >= 0
     274                 :      467931 :               && curr_reg_pressure[cl] <= ira_class_hard_regs_num[cl])
     275                 :      467931 :             high_pressure_start_point[cl] = -1;
     276                 :             :         }
     277                 :             :     }
     278                 :    51673772 : }
     279                 :             : 
     280                 :             : /* Determine from the objects_live bitmap whether REGNO is currently live,
     281                 :             :    and occupies only one object.  Return false if we have no information.  */
     282                 :             : static bool
     283                 :       87928 : pseudo_regno_single_word_and_live_p (int regno)
     284                 :             : {
     285                 :       87928 :   ira_allocno_t a = ira_curr_regno_allocno_map[regno];
     286                 :       87928 :   ira_object_t obj;
     287                 :             : 
     288                 :       87928 :   if (a == NULL)
     289                 :             :     return false;
     290                 :       87928 :   if (ALLOCNO_NUM_OBJECTS (a) > 1)
     291                 :             :     return false;
     292                 :             : 
     293                 :       87928 :   obj = ALLOCNO_OBJECT (a, 0);
     294                 :             : 
     295                 :       87928 :   return sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj));
     296                 :             : }
     297                 :             : 
     298                 :             : /* Mark the pseudo register REGNO as live.  Update all information about
     299                 :             :    live ranges and register pressure.  */
     300                 :             : static void
     301                 :   214591754 : mark_pseudo_regno_live (int regno)
     302                 :             : {
     303                 :   214591754 :   ira_allocno_t a = ira_curr_regno_allocno_map[regno];
     304                 :   214591754 :   enum reg_class pclass;
     305                 :   214591754 :   int i, n, nregs;
     306                 :             : 
     307                 :   214591754 :   if (a == NULL)
     308                 :             :     return;
     309                 :             : 
     310                 :             :   /* Invalidate because it is referenced.  */
     311                 :   214591754 :   allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
     312                 :             : 
     313                 :   214591754 :   n = ALLOCNO_NUM_OBJECTS (a);
     314                 :   214591754 :   pclass = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
     315                 :   214591754 :   nregs = ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)];
     316                 :   214591754 :   if (n > 1)
     317                 :             :     {
     318                 :             :       /* We track every subobject separately.  */
     319                 :    69988045 :       gcc_assert (nregs == n);
     320                 :             :       nregs = 1;
     321                 :             :     }
     322                 :             : 
     323                 :   499171553 :   for (i = 0; i < n; i++)
     324                 :             :     {
     325                 :   284579799 :       ira_object_t obj = ALLOCNO_OBJECT (a, i);
     326                 :             : 
     327                 :   284579799 :       if (sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
     328                 :    51405809 :         continue;
     329                 :             : 
     330                 :   233173990 :       inc_register_pressure (pclass, nregs);
     331                 :   233173990 :       make_object_live (obj);
     332                 :             :     }
     333                 :             : }
     334                 :             : 
     335                 :             : /* Like mark_pseudo_regno_live, but try to only mark one subword of
     336                 :             :    the pseudo as live.  SUBWORD indicates which; a value of 0
     337                 :             :    indicates the low part.  */
     338                 :             : static void
     339                 :      845636 : mark_pseudo_regno_subword_live (int regno, int subword)
     340                 :             : {
     341                 :      845636 :   ira_allocno_t a = ira_curr_regno_allocno_map[regno];
     342                 :      845636 :   int n;
     343                 :      845636 :   enum reg_class pclass;
     344                 :      845636 :   ira_object_t obj;
     345                 :             : 
     346                 :      845636 :   if (a == NULL)
     347                 :             :     return;
     348                 :             : 
     349                 :             :   /* Invalidate because it is referenced.  */
     350                 :      845636 :   allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
     351                 :             : 
     352                 :      845636 :   n = ALLOCNO_NUM_OBJECTS (a);
     353                 :      845636 :   if (n == 1)
     354                 :             :     {
     355                 :       28073 :       mark_pseudo_regno_live (regno);
     356                 :       28073 :       return;
     357                 :             :     }
     358                 :             : 
     359                 :      817563 :   pclass = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
     360                 :      817563 :   gcc_assert
     361                 :             :     (n == ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
     362                 :      817563 :   obj = ALLOCNO_OBJECT (a, subword);
     363                 :             : 
     364                 :      817563 :   if (sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
     365                 :             :     return;
     366                 :             : 
     367                 :      320847 :   inc_register_pressure (pclass, 1);
     368                 :      320847 :   make_object_live (obj);
     369                 :             : }
     370                 :             : 
     371                 :             : /* Mark the register REG as live.  Store a 1 in hard_regs_live for
     372                 :             :    this register, record how many consecutive hardware registers it
     373                 :             :    actually needs.  */
     374                 :             : static void
     375                 :    99455507 : mark_hard_reg_live (rtx reg)
     376                 :             : {
     377                 :    99455507 :   int regno = REGNO (reg);
     378                 :             : 
     379                 :    99455507 :   if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
     380                 :             :     {
     381                 :    31633642 :       int last = END_REGNO (reg);
     382                 :    31633642 :       enum reg_class aclass, pclass;
     383                 :             : 
     384                 :    63267284 :       while (regno < last)
     385                 :             :         {
     386                 :    31633642 :           if (! TEST_HARD_REG_BIT (hard_regs_live, regno)
     387                 :    31633642 :               && ! TEST_HARD_REG_BIT (eliminable_regset, regno))
     388                 :             :             {
     389                 :    17348883 :               aclass = ira_hard_regno_allocno_class[regno];
     390                 :    17348883 :               pclass = ira_pressure_class_translate[aclass];
     391                 :    17348883 :               inc_register_pressure (pclass, 1);
     392                 :    17348883 :               make_hard_regno_live (regno);
     393                 :             :             }
     394                 :    31633642 :           regno++;
     395                 :             :         }
     396                 :             :     }
     397                 :    99455507 : }
     398                 :             : 
     399                 :             : /* Mark a pseudo, or one of its subwords, as live.  REGNO is the pseudo's
     400                 :             :    register number; ORIG_REG is the access in the insn, which may be a
     401                 :             :    subreg.  */
     402                 :             : static void
     403                 :    82443260 : mark_pseudo_reg_live (rtx orig_reg, unsigned regno)
     404                 :             : {
     405                 :    82443260 :   if (read_modify_subreg_p (orig_reg))
     406                 :             :     {
     407                 :     1264957 :       mark_pseudo_regno_subword_live (regno,
     408                 :      845636 :                                       subreg_lowpart_p (orig_reg) ? 0 : 1);
     409                 :             :     }
     410                 :             :   else
     411                 :    81597624 :     mark_pseudo_regno_live (regno);
     412                 :    82443260 : }
     413                 :             : 
     414                 :             : /* Mark the register referenced by use or def REF as live.  */
     415                 :             : static void
     416                 :   180158413 : mark_ref_live (df_ref ref)
     417                 :             : {
     418                 :   180158413 :   rtx reg = DF_REF_REG (ref);
     419                 :   180158413 :   rtx orig_reg = reg;
     420                 :             : 
     421                 :   180158413 :   if (GET_CODE (reg) == SUBREG)
     422                 :     2897545 :     reg = SUBREG_REG (reg);
     423                 :             : 
     424                 :   180158413 :   if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
     425                 :    80702906 :     mark_pseudo_reg_live (orig_reg, REGNO (reg));
     426                 :             :   else
     427                 :    99455507 :     mark_hard_reg_live (reg);
     428                 :   180158413 : }
     429                 :             : 
     430                 :             : /* Mark the pseudo register REGNO as dead.  Update all information about
     431                 :             :    live ranges and register pressure.  */
     432                 :             : static void
     433                 :    34251648 : mark_pseudo_regno_dead (int regno)
     434                 :             : {
     435                 :    34251648 :   ira_allocno_t a = ira_curr_regno_allocno_map[regno];
     436                 :    34251648 :   int n, i, nregs;
     437                 :    34251648 :   enum reg_class cl;
     438                 :             : 
     439                 :    34251648 :   if (a == NULL)
     440                 :             :     return;
     441                 :             : 
     442                 :             :   /* Invalidate because it is referenced.  */
     443                 :    34251648 :   allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
     444                 :             : 
     445                 :    34251648 :   n = ALLOCNO_NUM_OBJECTS (a);
     446                 :    34251648 :   cl = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
     447                 :    34251648 :   nregs = ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)];
     448                 :    34251648 :   if (n > 1)
     449                 :             :     {
     450                 :             :       /* We track every subobject separately.  */
     451                 :     1257183 :       gcc_assert (nregs == n);
     452                 :             :       nregs = 1;
     453                 :             :     }
     454                 :    69760479 :   for (i = 0; i < n; i++)
     455                 :             :     {
     456                 :    35508831 :       ira_object_t obj = ALLOCNO_OBJECT (a, i);
     457                 :    35508831 :       if (!sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
     458                 :        3678 :         continue;
     459                 :             : 
     460                 :    35505153 :       dec_register_pressure (cl, nregs);
     461                 :    35505153 :       make_object_dead (obj);
     462                 :             :     }
     463                 :             : }
     464                 :             : 
     465                 :             : /* Like mark_pseudo_regno_dead, but called when we know that only part of the
     466                 :             :    register dies.  SUBWORD indicates which; a value of 0 indicates the low part.  */
     467                 :             : static void
     468                 :      346176 : mark_pseudo_regno_subword_dead (int regno, int subword)
     469                 :             : {
     470                 :      346176 :   ira_allocno_t a = ira_curr_regno_allocno_map[regno];
     471                 :      346176 :   int n;
     472                 :      346176 :   enum reg_class cl;
     473                 :      346176 :   ira_object_t obj;
     474                 :             : 
     475                 :      346176 :   if (a == NULL)
     476                 :             :     return;
     477                 :             : 
     478                 :             :   /* Invalidate because it is referenced.  */
     479                 :      346176 :   allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
     480                 :             : 
     481                 :      346176 :   n = ALLOCNO_NUM_OBJECTS (a);
     482                 :      346176 :   if (n == 1)
     483                 :             :     /* The allocno as a whole doesn't die in this case.  */
     484                 :             :     return;
     485                 :             : 
     486                 :      342229 :   cl = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
     487                 :      342229 :   gcc_assert
     488                 :             :     (n == ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
     489                 :             : 
     490                 :      342229 :   obj = ALLOCNO_OBJECT (a, subword);
     491                 :      342229 :   if (!sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
     492                 :             :     return;
     493                 :             : 
     494                 :      342229 :   dec_register_pressure (cl, 1);
     495                 :      342229 :   make_object_dead (obj);
     496                 :             : }
     497                 :             : 
     498                 :             : /* Process the definition of hard register REG.  This updates hard_regs_live
     499                 :             :    and hard reg conflict information for living allocnos.  */
     500                 :             : static void
     501                 :    46170874 : mark_hard_reg_dead (rtx reg)
     502                 :             : {
     503                 :    46170874 :   int regno = REGNO (reg);
     504                 :             : 
     505                 :    46170874 :   if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
     506                 :             :     {
     507                 :    15828440 :       int last = END_REGNO (reg);
     508                 :    15828440 :       enum reg_class aclass, pclass;
     509                 :             : 
     510                 :    31656880 :       while (regno < last)
     511                 :             :         {
     512                 :    15828440 :           if (TEST_HARD_REG_BIT (hard_regs_live, regno))
     513                 :             :             {
     514                 :    15826390 :               aclass = ira_hard_regno_allocno_class[regno];
     515                 :    15826390 :               pclass = ira_pressure_class_translate[aclass];
     516                 :    15826390 :               dec_register_pressure (pclass, 1);
     517                 :    15826390 :               make_hard_regno_dead (regno);
     518                 :             :             }
     519                 :    15828440 :           regno++;
     520                 :             :         }
     521                 :             :     }
     522                 :    46170874 : }
     523                 :             : 
     524                 :             : /* Mark a pseudo, or one of its subwords, as dead.  REGNO is the pseudo's
     525                 :             :    register number; ORIG_REG is the access in the insn, which may be a
     526                 :             :    subreg.  */
     527                 :             : static void
     528                 :    34597824 : mark_pseudo_reg_dead (rtx orig_reg, unsigned regno)
     529                 :             : {
     530                 :    34597824 :   if (read_modify_subreg_p (orig_reg))
     531                 :             :     {
     532                 :      516965 :       mark_pseudo_regno_subword_dead (regno,
     533                 :      346176 :                                       subreg_lowpart_p (orig_reg) ? 0 : 1);
     534                 :             :     }
     535                 :             :   else
     536                 :    34251648 :     mark_pseudo_regno_dead (regno);
     537                 :    34597824 : }
     538                 :             : 
     539                 :             : /* Mark the register referenced by definition DEF as dead, if the
     540                 :             :    definition is a total one.  */
     541                 :             : static void
     542                 :    79033184 : mark_ref_dead (df_ref def)
     543                 :             : {
     544                 :    79033184 :   rtx reg = DF_REF_REG (def);
     545                 :    79033184 :   rtx orig_reg = reg;
     546                 :             : 
     547                 :    79033184 :   if (DF_REF_FLAGS_IS_SET (def, DF_REF_CONDITIONAL))
     548                 :             :     return;
     549                 :             : 
     550                 :    79033184 :   if (GET_CODE (reg) == SUBREG)
     551                 :      882462 :     reg = SUBREG_REG (reg);
     552                 :             : 
     553                 :    79033184 :   if (DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL)
     554                 :    79033184 :       && (GET_CODE (orig_reg) != SUBREG
     555                 :      337686 :           || REGNO (reg) < FIRST_PSEUDO_REGISTER
     556                 :      337686 :           || !read_modify_subreg_p (orig_reg)))
     557                 :        4840 :     return;
     558                 :             : 
     559                 :    79028344 :   if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
     560                 :    32857470 :     mark_pseudo_reg_dead (orig_reg, REGNO (reg));
     561                 :             :   else
     562                 :    46170874 :     mark_hard_reg_dead (reg);
     563                 :             : }
     564                 :             : 
     565                 :             : /* If REG is a pseudo or a subreg of it, and the class of its allocno
     566                 :             :    intersects CL, make a conflict with pseudo DREG.  ORIG_DREG is the
     567                 :             :    rtx actually accessed, it may be identical to DREG or a subreg of it.
     568                 :             :    Advance the current program point before making the conflict if
     569                 :             :    ADVANCE_P.  Return TRUE if we will need to advance the current
     570                 :             :    program point.  */
     571                 :             : static bool
     572                 :     2707689 : make_pseudo_conflict (rtx reg, enum reg_class cl, rtx dreg, rtx orig_dreg,
     573                 :             :                       bool advance_p)
     574                 :             : {
     575                 :     2707689 :   rtx orig_reg = reg;
     576                 :     2707689 :   ira_allocno_t a;
     577                 :             : 
     578                 :     2707689 :   if (GET_CODE (reg) == SUBREG)
     579                 :       75459 :     reg = SUBREG_REG (reg);
     580                 :             : 
     581                 :     2707689 :   if (! REG_P (reg) || REGNO (reg) < FIRST_PSEUDO_REGISTER)
     582                 :             :     return advance_p;
     583                 :             : 
     584                 :      978916 :   a = ira_curr_regno_allocno_map[REGNO (reg)];
     585                 :      978916 :   if (! reg_classes_intersect_p (cl, ALLOCNO_CLASS (a)))
     586                 :             :     return advance_p;
     587                 :             : 
     588                 :      870177 :   if (advance_p)
     589                 :      825023 :     curr_point++;
     590                 :             : 
     591                 :      870177 :   mark_pseudo_reg_live (orig_reg, REGNO (reg));
     592                 :      870177 :   mark_pseudo_reg_live (orig_dreg, REGNO (dreg));
     593                 :      870177 :   mark_pseudo_reg_dead (orig_reg, REGNO (reg));
     594                 :      870177 :   mark_pseudo_reg_dead (orig_dreg, REGNO (dreg));
     595                 :             : 
     596                 :      870177 :   return false;
     597                 :             : }
     598                 :             : 
     599                 :             : /* Check and make if necessary conflicts for pseudo DREG of class
     600                 :             :    DEF_CL of the current insn with input operand USE of class USE_CL.
     601                 :             :    ORIG_DREG is the rtx actually accessed, it may be identical to
     602                 :             :    DREG or a subreg of it.  Advance the current program point before
     603                 :             :    making the conflict if ADVANCE_P.  Return TRUE if we will need to
     604                 :             :    advance the current program point.  */
     605                 :             : static bool
     606                 :     2754980 : check_and_make_def_use_conflict (rtx dreg, rtx orig_dreg,
     607                 :             :                                  enum reg_class def_cl, int use,
     608                 :             :                                  enum reg_class use_cl, bool advance_p)
     609                 :             : {
     610                 :     2754980 :   if (! reg_classes_intersect_p (def_cl, use_cl))
     611                 :             :     return advance_p;
     612                 :             : 
     613                 :     2691900 :   advance_p = make_pseudo_conflict (recog_data.operand[use],
     614                 :             :                                     use_cl, dreg, orig_dreg, advance_p);
     615                 :             : 
     616                 :             :   /* Reload may end up swapping commutative operands, so you
     617                 :             :      have to take both orderings into account.  The
     618                 :             :      constraints for the two operands can be completely
     619                 :             :      different.  (Indeed, if the constraints for the two
     620                 :             :      operands are the same for all alternatives, there's no
     621                 :             :      point marking them as commutative.)  */
     622                 :     2691900 :   if (use < recog_data.n_operands - 1
     623                 :      976513 :       && recog_data.constraints[use][0] == '%')
     624                 :        6731 :     advance_p
     625                 :        6731 :       = make_pseudo_conflict (recog_data.operand[use + 1],
     626                 :             :                               use_cl, dreg, orig_dreg, advance_p);
     627                 :     2691900 :   if (use >= 1
     628                 :     2691675 :       && recog_data.constraints[use - 1][0] == '%')
     629                 :        9058 :     advance_p
     630                 :        9058 :       = make_pseudo_conflict (recog_data.operand[use - 1],
     631                 :             :                               use_cl, dreg, orig_dreg, advance_p);
     632                 :             :   return advance_p;
     633                 :             : }
     634                 :             : 
     635                 :             : /* Check and make if necessary conflicts for definition DEF of class
     636                 :             :    DEF_CL of the current insn with input operands.  Process only
     637                 :             :    constraints of alternative ALT.
     638                 :             : 
     639                 :             :    One of three things is true when this function is called:
     640                 :             : 
     641                 :             :    (1) DEF is an earlyclobber for alternative ALT.  Input operands then
     642                 :             :        conflict with DEF in ALT unless they explicitly match DEF via 0-9
     643                 :             :        constraints.
     644                 :             : 
     645                 :             :    (2) DEF matches (via 0-9 constraints) an operand that is an
     646                 :             :        earlyclobber for alternative ALT.  Other input operands then
     647                 :             :        conflict with DEF in ALT.
     648                 :             : 
     649                 :             :    (3) [FOR_TIE_P] Some input operand X matches DEF for alternative ALT.
     650                 :             :        Input operands with a different value from X then conflict with
     651                 :             :        DEF in ALT.
     652                 :             : 
     653                 :             :    However, there's still a judgement call to make when deciding
     654                 :             :    whether a conflict in ALT is important enough to be reflected
     655                 :             :    in the pan-alternative allocno conflict set.  */
     656                 :             : static void
     657                 :    13627126 : check_and_make_def_conflict (int alt, int def, enum reg_class def_cl,
     658                 :             :                              bool for_tie_p)
     659                 :             : {
     660                 :    13627126 :   int use, use_match;
     661                 :    13627126 :   ira_allocno_t a;
     662                 :    13627126 :   enum reg_class use_cl, acl;
     663                 :    13627126 :   bool advance_p;
     664                 :    13627126 :   rtx dreg = recog_data.operand[def];
     665                 :    13627126 :   rtx orig_dreg = dreg;
     666                 :             : 
     667                 :    13627126 :   if (def_cl == NO_REGS)
     668                 :             :     return;
     669                 :             : 
     670                 :    13627126 :   if (GET_CODE (dreg) == SUBREG)
     671                 :      116830 :     dreg = SUBREG_REG (dreg);
     672                 :             : 
     673                 :    13627126 :   if (! REG_P (dreg) || REGNO (dreg) < FIRST_PSEUDO_REGISTER)
     674                 :             :     return;
     675                 :             : 
     676                 :    11482750 :   a = ira_curr_regno_allocno_map[REGNO (dreg)];
     677                 :    11482750 :   acl = ALLOCNO_CLASS (a);
     678                 :    11482750 :   if (! reg_classes_intersect_p (acl, def_cl))
     679                 :             :     return;
     680                 :             : 
     681                 :    11294241 :   advance_p = true;
     682                 :             : 
     683                 :    11294241 :   int n_operands = recog_data.n_operands;
     684                 :    11294241 :   const operand_alternative *op_alt = &recog_op_alt[alt * n_operands];
     685                 :    46668448 :   for (use = 0; use < n_operands; use++)
     686                 :             :     {
     687                 :    35374207 :       int alt1;
     688                 :             : 
     689                 :    35374207 :       if (use == def || recog_data.operand_type[use] == OP_OUT)
     690                 :    11432512 :         continue;
     691                 :             : 
     692                 :             :       /* An earlyclobber on DEF doesn't apply to an input operand X if X
     693                 :             :          explicitly matches DEF, but it applies to other input operands
     694                 :             :          even if they happen to be the same value as X.
     695                 :             : 
     696                 :             :          In contrast, if an input operand X is tied to a non-earlyclobber
     697                 :             :          DEF, there's no conflict with other input operands that have the
     698                 :             :          same value as X.  */
     699                 :    35173387 :       if (op_alt[use].matches == def
     700                 :    23941695 :           || (for_tie_p
     701                 :    12484702 :               && rtx_equal_p (recog_data.operand[use],
     702                 :    12484702 :                               recog_data.operand[op_alt[def].matched])))
     703                 :    11231692 :         continue;
     704                 :             : 
     705                 :    12710003 :       if (op_alt[use].anything_ok)
     706                 :             :         use_cl = ALL_REGS;
     707                 :             :       else
     708                 :    11170649 :         use_cl = op_alt[use].cl;
     709                 :    11170649 :       if (use_cl == NO_REGS)
     710                 :     4543257 :         continue;
     711                 :             : 
     712                 :             :       /* If DEF is simply a tied operand, ignore cases in which this
     713                 :             :          alternative requires USE to have a likely-spilled class.
     714                 :             :          Adding a conflict would just constrain USE further if DEF
     715                 :             :          happens to be allocated first.  */
     716                 :     8166746 :       if (for_tie_p && targetm.class_likely_spilled_p (use_cl))
     717                 :      917851 :         continue;
     718                 :             : 
     719                 :             :       /* If there's any alternative that allows USE to match DEF, do not
     720                 :             :          record a conflict.  If that causes us to create an invalid
     721                 :             :          instruction due to the earlyclobber, reload must fix it up.
     722                 :             : 
     723                 :             :          Likewise, if we're treating a tied DEF like a partial earlyclobber,
     724                 :             :          do not record a conflict if there's another alternative in which
     725                 :             :          DEF is neither tied nor earlyclobber.  */
     726                 :    18583758 :       for (alt1 = 0; alt1 < recog_data.n_alternatives; alt1++)
     727                 :             :         {
     728                 :    15828779 :           if (!TEST_BIT (preferred_alternatives, alt1))
     729                 :     7204034 :             continue;
     730                 :     8624745 :           const operand_alternative *op_alt1
     731                 :     8624745 :             = &recog_op_alt[alt1 * n_operands];
     732                 :     8624745 :           if (op_alt1[use].matches == def
     733                 :     7005443 :               || (use < n_operands - 1
     734                 :     2512300 :                   && recog_data.constraints[use][0] == '%'
     735                 :        8387 :                   && op_alt1[use + 1].matches == def)
     736                 :     7005443 :               || (use >= 1
     737                 :     7003996 :                   && recog_data.constraints[use - 1][0] == '%'
     738                 :     2880697 :                   && op_alt1[use - 1].matches == def))
     739                 :             :             break;
     740                 :     4135460 :           if (for_tie_p
     741                 :     3941930 :               && !op_alt1[def].earlyclobber
     742                 :     3940840 :               && op_alt1[def].matched < 0
     743                 :       24834 :               && alternative_class (op_alt1, def) != NO_REGS
     744                 :     4160294 :               && alternative_class (op_alt1, use) != NO_REGS)
     745                 :             :             break;
     746                 :             :         }
     747                 :             : 
     748                 :     7248895 :       if (alt1 < recog_data.n_alternatives)
     749                 :     4493916 :         continue;
     750                 :             : 
     751                 :     2754979 :       advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
     752                 :             :                                                    use, use_cl, advance_p);
     753                 :             : 
     754                 :     2754979 :       if ((use_match = op_alt[use].matches) >= 0)
     755                 :             :         {
     756                 :           1 :           gcc_checking_assert (use_match != def);
     757                 :             : 
     758                 :           1 :           if (op_alt[use_match].anything_ok)
     759                 :             :             use_cl = ALL_REGS;
     760                 :             :           else
     761                 :           1 :             use_cl = op_alt[use_match].cl;
     762                 :           1 :           advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
     763                 :             :                                                        use, use_cl, advance_p);
     764                 :             :         }
     765                 :             :     }
     766                 :             : }
     767                 :             : 
     768                 :             : /* Make conflicts of early clobber pseudo registers of the current
     769                 :             :    insn with its inputs.  Avoid introducing unnecessary conflicts by
     770                 :             :    checking classes of the constraints and pseudos because otherwise
     771                 :             :    significant code degradation is possible for some targets.
     772                 :             : 
     773                 :             :    For these purposes, tying an input to an output makes that output act
     774                 :             :    like an earlyclobber for inputs with a different value, since the output
     775                 :             :    register then has a predetermined purpose on input to the instruction.  */
     776                 :             : static void
     777                 :    79638684 : make_early_clobber_and_input_conflicts (void)
     778                 :             : {
     779                 :    79638684 :   int alt;
     780                 :    79638684 :   int def, def_match;
     781                 :    79638684 :   enum reg_class def_cl;
     782                 :             : 
     783                 :    79638684 :   int n_alternatives = recog_data.n_alternatives;
     784                 :    79638684 :   int n_operands = recog_data.n_operands;
     785                 :    79638684 :   const operand_alternative *op_alt = recog_op_alt;
     786                 :  1088602984 :   for (alt = 0; alt < n_alternatives; alt++, op_alt += n_operands)
     787                 :  1008964300 :     if (TEST_BIT (preferred_alternatives, alt))
     788                 :   368712050 :       for (def = 0; def < n_operands; def++)
     789                 :             :         {
     790                 :   254478460 :           if (op_alt[def].anything_ok)
     791                 :             :             def_cl = ALL_REGS;
     792                 :             :           else
     793                 :   241077991 :             def_cl = op_alt[def].cl;
     794                 :   241077991 :           if (def_cl != NO_REGS)
     795                 :             :             {
     796                 :   201140207 :               if (op_alt[def].earlyclobber)
     797                 :      124618 :                 check_and_make_def_conflict (alt, def, def_cl, false);
     798                 :   201015589 :               else if (op_alt[def].matched >= 0
     799                 :   201015589 :                        && !targetm.class_likely_spilled_p (def_cl))
     800                 :    13466970 :                 check_and_make_def_conflict (alt, def, def_cl, true);
     801                 :             :             }
     802                 :             : 
     803                 :   254478460 :           if ((def_match = op_alt[def].matches) >= 0
     804                 :   254478460 :               && (op_alt[def_match].earlyclobber
     805                 :    14224720 :                   || op_alt[def].earlyclobber))
     806                 :             :             {
     807                 :       35538 :               if (op_alt[def_match].anything_ok)
     808                 :             :                 def_cl = ALL_REGS;
     809                 :             :               else
     810                 :       35538 :                 def_cl = op_alt[def_match].cl;
     811                 :       35538 :               check_and_make_def_conflict (alt, def, def_cl, false);
     812                 :             :             }
     813                 :             :         }
     814                 :    79638684 : }
     815                 :             : 
     816                 :             : /* Mark early clobber hard registers of the current INSN as live (if
     817                 :             :    LIVE_P) or dead.  Return true if there are such registers.  */
     818                 :             : static bool
     819                 :    89819137 : mark_hard_reg_early_clobbers (rtx_insn *insn, bool live_p)
     820                 :             : {
     821                 :    89819137 :   df_ref def;
     822                 :    89819137 :   bool set_p = false;
     823                 :             : 
     824                 :   651191592 :   FOR_EACH_INSN_DEF (def, insn)
     825                 :   561372455 :     if (DF_REF_FLAGS_IS_SET (def, DF_REF_MUST_CLOBBER))
     826                 :             :       {
     827                 :    22261020 :         rtx dreg = DF_REF_REG (def);
     828                 :             : 
     829                 :    22261020 :         if (GET_CODE (dreg) == SUBREG)
     830                 :           0 :           dreg = SUBREG_REG (dreg);
     831                 :    22261020 :         if (! REG_P (dreg) || REGNO (dreg) >= FIRST_PSEUDO_REGISTER)
     832                 :      145048 :           continue;
     833                 :             : 
     834                 :             :         /* Hard register clobbers are believed to be early clobber
     835                 :             :            because there is no way to say that non-operand hard
     836                 :             :            register clobbers are not early ones.  */
     837                 :    22115972 :         if (live_p)
     838                 :    11057986 :           mark_ref_live (def);
     839                 :             :         else
     840                 :    11057986 :           mark_ref_dead (def);
     841                 :             :         set_p = true;
     842                 :             :       }
     843                 :             : 
     844                 :    89819137 :   return set_p;
     845                 :             : }
     846                 :             : 
     847                 :             : /* Checks that CONSTRAINTS permits to use only one hard register.  If
     848                 :             :    it is so, the function returns the class of the hard register.
     849                 :             :    Otherwise it returns NO_REGS.  */
     850                 :             : static enum reg_class
     851                 :   168945402 : single_reg_class (const char *constraints, rtx op, rtx equiv_const)
     852                 :             : {
     853                 :   168945402 :   int c;
     854                 :   168945402 :   enum reg_class cl, next_cl;
     855                 :   168945402 :   enum constraint_num cn;
     856                 :             : 
     857                 :   168945402 :   cl = NO_REGS;
     858                 :   168945402 :   alternative_mask preferred = preferred_alternatives;
     859                 :   871351201 :   while ((c = *constraints))
     860                 :             :     {
     861                 :   857812623 :       if (c == '#')
     862                 :           0 :         preferred &= ~ALTERNATIVE_BIT (0);
     863                 :   857812623 :       else if (c == ',')
     864                 :   232897439 :         preferred >>= 1;
     865                 :   624915184 :       else if (preferred & 1)
     866                 :   191238532 :         switch (c)
     867                 :             :           {
     868                 :             :           case 'g':
     869                 :             :             return NO_REGS;
     870                 :             : 
     871                 :   172002534 :           default:
     872                 :             :             /* ??? Is this the best way to handle memory constraints?  */
     873                 :   172002534 :             cn = lookup_constraint (constraints);
     874                 :   172002534 :             if (insn_extra_memory_constraint (cn)
     875                 :   160790467 :                 || insn_extra_special_memory_constraint (cn)
     876                 :             :                 || insn_extra_relaxed_memory_constraint (cn)
     877                 :   332792999 :                 || insn_extra_address_constraint (cn))
     878                 :             :               return NO_REGS;
     879                 :   160237847 :             if (constraint_satisfied_p (op, cn)
     880                 :   160237847 :                 || (equiv_const != NULL_RTX
     881                 :           0 :                     && CONSTANT_P (equiv_const)
     882                 :           0 :                     && constraint_satisfied_p (equiv_const, cn)))
     883                 :    14345313 :               return NO_REGS;
     884                 :   145892534 :             next_cl = reg_class_for_constraint (cn);
     885                 :   115503849 :             if (next_cl == NO_REGS)
     886                 :             :               break;
     887                 :   112263358 :             if (cl == NO_REGS
     888                 :   112263358 :                 ? ira_class_singleton[next_cl][GET_MODE (op)] < 0
     889                 :     1033800 :                 : (ira_class_singleton[cl][GET_MODE (op)]
     890                 :     1033800 :                    != ira_class_singleton[next_cl][GET_MODE (op)]))
     891                 :             :               return NO_REGS;
     892                 :             :             cl = next_cl;
     893                 :             :             break;
     894                 :             : 
     895                 :    12344794 :           case '0': case '1': case '2': case '3': case '4':
     896                 :    12344794 :           case '5': case '6': case '7': case '8': case '9':
     897                 :    12344794 :             {
     898                 :    12344794 :               char *end;
     899                 :    12344794 :               unsigned long dup = strtoul (constraints, &end, 10);
     900                 :    12344794 :               constraints = end;
     901                 :    12344794 :               next_cl
     902                 :    12344794 :                 = single_reg_class (recog_data.constraints[dup],
     903                 :             :                                     recog_data.operand[dup], NULL_RTX);
     904                 :    12344794 :               if (cl == NO_REGS
     905                 :    12344794 :                   ? ira_class_singleton[next_cl][GET_MODE (op)] < 0
     906                 :       19339 :                   : (ira_class_singleton[cl][GET_MODE (op)]
     907                 :       19339 :                      != ira_class_singleton[next_cl][GET_MODE (op)]))
     908                 :    12060905 :                 return NO_REGS;
     909                 :      283889 :               cl = next_cl;
     910                 :      283889 :               continue;
     911                 :      283889 :             }
     912                 :             :           }
     913                 :   702121910 :       constraints += CONSTRAINT_LEN (c, constraints);
     914                 :             :    }
     915                 :             :   return cl;
     916                 :             : }
     917                 :             : 
     918                 :             : /* The function checks that operand OP_NUM of the current insn can use
     919                 :             :    only one hard register.  If it is so, the function returns the
     920                 :             :    class of the hard register.  Otherwise it returns NO_REGS.  */
     921                 :             : static enum reg_class
     922                 :   170734411 : single_reg_operand_class (int op_num)
     923                 :             : {
     924                 :   170734411 :   if (op_num < 0 || recog_data.n_alternatives == 0)
     925                 :             :     return NO_REGS;
     926                 :   156600608 :   return single_reg_class (recog_data.constraints[op_num],
     927                 :   156600608 :                            recog_data.operand[op_num], NULL_RTX);
     928                 :             : }
     929                 :             : 
     930                 :             : /* The function sets up hard register set *SET to hard registers which
     931                 :             :    might be used by insn reloads because the constraints are too
     932                 :             :    strict.  */
     933                 :             : void
     934                 :       21287 : ira_implicitly_set_insn_hard_regs (HARD_REG_SET *set,
     935                 :             :                                    alternative_mask preferred)
     936                 :             : {
     937                 :       21287 :   int i, c, regno = 0;
     938                 :       21287 :   enum reg_class cl;
     939                 :       21287 :   rtx op;
     940                 :       21287 :   machine_mode mode;
     941                 :             : 
     942                 :       21287 :   CLEAR_HARD_REG_SET (*set);
     943                 :       65469 :   for (i = 0; i < recog_data.n_operands; i++)
     944                 :             :     {
     945                 :       44182 :       op = recog_data.operand[i];
     946                 :             : 
     947                 :       44182 :       if (GET_CODE (op) == SUBREG)
     948                 :        1124 :         op = SUBREG_REG (op);
     949                 :             : 
     950                 :       44182 :       if (GET_CODE (op) == SCRATCH
     951                 :       44182 :           || (REG_P (op) && (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER))
     952                 :             :         {
     953                 :       26462 :           const char *p = recog_data.constraints[i];
     954                 :             : 
     955                 :       52924 :           mode = (GET_CODE (op) == SCRATCH
     956                 :       26462 :                   ? GET_MODE (op) : PSEUDO_REGNO_MODE (regno));
     957                 :       26462 :           cl = NO_REGS;
     958                 :      586960 :           for (; (c = *p); p += CONSTRAINT_LEN (c, p))
     959                 :      560498 :             if (c == '#')
     960                 :           0 :               preferred &= ~ALTERNATIVE_BIT (0);
     961                 :      560498 :             else if (c == ',')
     962                 :      188664 :               preferred >>= 1;
     963                 :      371834 :             else if (preferred & 1)
     964                 :             :               {
     965                 :      835660 :                 cl = reg_class_for_constraint (lookup_constraint (p));
     966                 :      125046 :                 if (cl != NO_REGS)
     967                 :             :                   {
     968                 :             :                     /* There is no register pressure problem if all of the
     969                 :             :                        regs in this class are fixed.  */
     970                 :      119122 :                     int regno = ira_class_singleton[cl][mode];
     971                 :      119122 :                     if (regno >= 0)
     972                 :        1775 :                       add_to_hard_reg_set (set, mode, regno);
     973                 :             :                   }
     974                 :             :               }
     975                 :             :         }
     976                 :             :     }
     977                 :       21287 : }
     978                 :             : /* Processes input operands, if IN_P, or output operands otherwise of
     979                 :             :    the current insn with FREQ to find allocno which can use only one
     980                 :             :    hard register and makes other currently living allocnos conflicting
     981                 :             :    with the hard register.  */
     982                 :             : static void
     983                 :   159277368 : process_single_reg_class_operands (bool in_p, int freq)
     984                 :             : {
     985                 :   159277368 :   int i, regno;
     986                 :   159277368 :   unsigned int px;
     987                 :   159277368 :   enum reg_class cl;
     988                 :   159277368 :   rtx operand;
     989                 :   159277368 :   ira_allocno_t operand_a, a;
     990                 :             : 
     991                 :   500586006 :   for (i = 0; i < recog_data.n_operands; i++)
     992                 :             :     {
     993                 :   341308638 :       operand = recog_data.operand[i];
     994                 :   341308638 :       if (in_p && recog_data.operand_type[i] != OP_IN
     995                 :    58383031 :           && recog_data.operand_type[i] != OP_INOUT)
     996                 :    58302939 :         continue;
     997                 :   170654319 :       if (! in_p && recog_data.operand_type[i] != OP_OUT
     998                 :   112351380 :           && recog_data.operand_type[i] != OP_INOUT)
     999                 :   112271288 :         continue;
    1000                 :   170734411 :       cl = single_reg_operand_class (i);
    1001                 :   170734411 :       if (cl == NO_REGS)
    1002                 :   169869163 :         continue;
    1003                 :             : 
    1004                 :      865248 :       operand_a = NULL;
    1005                 :             : 
    1006                 :      865248 :       if (GET_CODE (operand) == SUBREG)
    1007                 :       57504 :         operand = SUBREG_REG (operand);
    1008                 :             : 
    1009                 :      865248 :       if (REG_P (operand)
    1010                 :      865248 :           && (regno = REGNO (operand)) >= FIRST_PSEUDO_REGISTER)
    1011                 :             :         {
    1012                 :      861043 :           enum reg_class aclass;
    1013                 :             : 
    1014                 :      861043 :           operand_a = ira_curr_regno_allocno_map[regno];
    1015                 :      861043 :           aclass = ALLOCNO_CLASS (operand_a);
    1016                 :      861043 :           if (ira_class_subset_p[cl][aclass])
    1017                 :             :             {
    1018                 :             :               /* View the desired allocation of OPERAND as:
    1019                 :             : 
    1020                 :             :                     (REG:YMODE YREGNO),
    1021                 :             : 
    1022                 :             :                  a simplification of:
    1023                 :             : 
    1024                 :             :                     (subreg:YMODE (reg:XMODE XREGNO) OFFSET).  */
    1025                 :      851315 :               machine_mode ymode, xmode;
    1026                 :      851315 :               int xregno, yregno;
    1027                 :      851315 :               poly_int64 offset;
    1028                 :             : 
    1029                 :      851315 :               xmode = recog_data.operand_mode[i];
    1030                 :      851315 :               xregno = ira_class_singleton[cl][xmode];
    1031                 :      851315 :               gcc_assert (xregno >= 0);
    1032                 :      851315 :               ymode = ALLOCNO_MODE (operand_a);
    1033                 :      851315 :               offset = subreg_lowpart_offset (ymode, xmode);
    1034                 :      851315 :               yregno = simplify_subreg_regno (xregno, xmode, offset, ymode);
    1035                 :      851315 :               if (yregno >= 0
    1036                 :      851315 :                   && ira_class_hard_reg_index[aclass][yregno] >= 0)
    1037                 :             :                 {
    1038                 :      851315 :                   int cost;
    1039                 :             : 
    1040                 :      851315 :                   ira_allocate_and_set_costs
    1041                 :      851315 :                     (&ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a),
    1042                 :             :                      aclass, 0);
    1043                 :      851315 :                   ira_init_register_move_cost_if_necessary (xmode);
    1044                 :     1702630 :                   cost = freq * (in_p
    1045                 :      851315 :                                  ? ira_register_move_cost[xmode][aclass][cl]
    1046                 :      473639 :                                  : ira_register_move_cost[xmode][cl][aclass]);
    1047                 :      851315 :                   ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a)
    1048                 :      851315 :                     [ira_class_hard_reg_index[aclass][yregno]] -= cost;
    1049                 :             :                 }
    1050                 :             :             }
    1051                 :             :         }
    1052                 :             : 
    1053                 :    30409449 :       EXECUTE_IF_SET_IN_SPARSESET (objects_live, px)
    1054                 :             :         {
    1055                 :    29544201 :           ira_object_t obj = ira_object_id_map[px];
    1056                 :    29544201 :           a = OBJECT_ALLOCNO (obj);
    1057                 :    29544201 :           if (a != operand_a)
    1058                 :             :             {
    1059                 :             :               /* We could increase costs of A instead of making it
    1060                 :             :                  conflicting with the hard register.  But it works worse
    1061                 :             :                  because it will be spilled in reload in anyway.  */
    1062                 :   114589440 :               OBJECT_CONFLICT_HARD_REGS (obj) |= reg_class_contents[cl];
    1063                 :    29544201 :               OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= reg_class_contents[cl];
    1064                 :             :             }
    1065                 :             :         }
    1066                 :             :     }
    1067                 :   159277368 : }
    1068                 :             : 
    1069                 :             : /* Go through the operands of the extracted insn looking for operand
    1070                 :             :    alternatives that apply a register filter.  Record any such filters
    1071                 :             :    in the operand's allocno.  */
    1072                 :             : static void
    1073                 :    79638684 : process_register_constraint_filters ()
    1074                 :             : {
    1075                 :   250293003 :   for (int opno = 0; opno < recog_data.n_operands; ++opno)
    1076                 :             :     {
    1077                 :   170654319 :       rtx op = recog_data.operand[opno];
    1078                 :   170654319 :       if (SUBREG_P (op))
    1079                 :     2858213 :         op = SUBREG_REG (op);
    1080                 :   170654319 :       if (REG_P (op) && !HARD_REGISTER_P (op))
    1081                 :             :         {
    1082                 :    70407446 :           ira_allocno_t a = ira_curr_regno_allocno_map[REGNO (op)];
    1083                 :   985490435 :           for (int alt = 0; alt < recog_data.n_alternatives; alt++)
    1084                 :             :             {
    1085                 :   915082989 :               if (!TEST_BIT (preferred_alternatives, alt))
    1086                 :   798647375 :                 continue;
    1087                 :             : 
    1088                 :   116435614 :               auto *op_alt = &recog_op_alt[alt * recog_data.n_operands];
    1089                 :   116435614 :               auto cl = alternative_class (op_alt, opno);
    1090                 :             :               /* The two extremes are easy:
    1091                 :             : 
    1092                 :             :                  - We should record the filter if CL matches the
    1093                 :             :                    allocno class.
    1094                 :             : 
    1095                 :             :                  - We should ignore the filter if CL and the allocno class
    1096                 :             :                    are disjoint.  We'll either pick a different alternative
    1097                 :             :                    or reload the operand.
    1098                 :             : 
    1099                 :             :                  Things are trickier if the classes overlap.  However:
    1100                 :             : 
    1101                 :             :                  - If the allocno class includes registers that are not
    1102                 :             :                    in CL, some choices of hard register will need a reload
    1103                 :             :                    anyway.  It isn't obvious that reloads due to filters
    1104                 :             :                    are worse than reloads due to regnos being outside CL.
    1105                 :             : 
    1106                 :             :                  - Conversely, if the allocno class is a subset of CL,
    1107                 :             :                    any allocation will satisfy the class requirement.
    1108                 :             :                    We should try to make sure it satisfies the filter
    1109                 :             :                    requirement too.  This is useful if, for example,
    1110                 :             :                    an allocno needs to be in "low" registers to satisfy
    1111                 :             :                    some uses, and its allocno class is therefore those
    1112                 :             :                    low registers, but the allocno is elsewhere allowed
    1113                 :             :                    to be in any even-numbered register.  Picking an
    1114                 :             :                    even-numbered low register satisfies both types of use.  */
    1115                 :   116435614 :               if (!ira_class_subset_p[ALLOCNO_CLASS (a)][cl])
    1116                 :    27884172 :                 continue;
    1117                 :             : 
    1118                 :    88551442 :               auto filters = alternative_register_filters (op_alt, opno);
    1119                 :    88551442 :               if (!filters)
    1120                 :    88551442 :                 continue;
    1121                 :             : 
    1122                 :           0 :               filters |= ALLOCNO_REGISTER_FILTERS (a);
    1123                 :           0 :               ALLOCNO_SET_REGISTER_FILTERS (a, filters);
    1124                 :             :             }
    1125                 :             :         }
    1126                 :             :     }
    1127                 :    79638684 : }
    1128                 :             : 
    1129                 :             : /* Look through the CALL_INSN_FUNCTION_USAGE of a call insn INSN, and see if
    1130                 :             :    we find a SET rtx that we can use to deduce that a register can be cheaply
    1131                 :             :    caller-saved.  Return such a register, or NULL_RTX if none is found.  */
    1132                 :             : static rtx
    1133                 :     5747608 : find_call_crossed_cheap_reg (rtx_insn *insn)
    1134                 :             : {
    1135                 :     5747608 :   rtx cheap_reg = NULL_RTX;
    1136                 :     5747608 :   rtx exp = CALL_INSN_FUNCTION_USAGE (insn);
    1137                 :             : 
    1138                 :    16829522 :   while (exp != NULL)
    1139                 :             :     {
    1140                 :    11200350 :       rtx x = XEXP (exp, 0);
    1141                 :    11200350 :       if (GET_CODE (x) == SET)
    1142                 :             :         {
    1143                 :             :           exp = x;
    1144                 :             :           break;
    1145                 :             :         }
    1146                 :    11081914 :       exp = XEXP (exp, 1);
    1147                 :             :     }
    1148                 :     5747608 :   if (exp != NULL)
    1149                 :             :     {
    1150                 :      118436 :       basic_block bb = BLOCK_FOR_INSN (insn);
    1151                 :      118436 :       rtx reg = SET_SRC (exp);
    1152                 :      118436 :       rtx_insn *prev = PREV_INSN (insn);
    1153                 :      236872 :       while (prev && !(INSN_P (prev)
    1154                 :      118436 :                        && BLOCK_FOR_INSN (prev) != bb))
    1155                 :             :         {
    1156                 :      118436 :           if (NONDEBUG_INSN_P (prev))
    1157                 :             :             {
    1158                 :      118436 :               rtx set = single_set (prev);
    1159                 :             : 
    1160                 :      118436 :               if (set && rtx_equal_p (SET_DEST (set), reg))
    1161                 :             :                 {
    1162                 :      118436 :                   rtx src = SET_SRC (set);
    1163                 :       88248 :                   if (!REG_P (src) || HARD_REGISTER_P (src)
    1164                 :      206364 :                       || !pseudo_regno_single_word_and_live_p (REGNO (src)))
    1165                 :             :                     break;
    1166                 :       20961 :                   if (!modified_between_p (src, prev, insn))
    1167                 :     5747608 :                     cheap_reg = src;
    1168                 :             :                   break;
    1169                 :             :                 }
    1170                 :           0 :               if (set && rtx_equal_p (SET_SRC (set), reg))
    1171                 :             :                 {
    1172                 :           0 :                   rtx dest = SET_DEST (set);
    1173                 :           0 :                   if (!REG_P (dest) || HARD_REGISTER_P (dest)
    1174                 :           0 :                       || !pseudo_regno_single_word_and_live_p (REGNO (dest)))
    1175                 :             :                     break;
    1176                 :           0 :                   if (!modified_between_p (dest, prev, insn))
    1177                 :     5747608 :                     cheap_reg = dest;
    1178                 :             :                   break;
    1179                 :             :                 }
    1180                 :             : 
    1181                 :           0 :               if (reg_set_p (reg, prev))
    1182                 :             :                 break;
    1183                 :             :             }
    1184                 :           0 :           prev = PREV_INSN (prev);
    1185                 :             :         }
    1186                 :             :     }
    1187                 :     5747608 :   return cheap_reg;
    1188                 :             : }
    1189                 :             : 
    1190                 :             : /* Determine whether INSN is a register to register copy of the type where
    1191                 :             :    we do not need to make the source and destiniation registers conflict.
    1192                 :             :    If this is a copy instruction, then return the source reg.  Otherwise,
    1193                 :             :    return NULL_RTX.  */
    1194                 :             : rtx
    1195                 :   285992872 : non_conflicting_reg_copy_p (rtx_insn *insn)
    1196                 :             : {
    1197                 :             :   /* Reload has issues with overlapping pseudos being assigned to the
    1198                 :             :      same hard register, so don't allow it.  See PR87600 for details.  */
    1199                 :   285992872 :   if (!targetm.lra_p ())
    1200                 :             :     return NULL_RTX;
    1201                 :             : 
    1202                 :   285992872 :   rtx set = single_set (insn);
    1203                 :             : 
    1204                 :             :   /* Disallow anything other than a simple register to register copy
    1205                 :             :      that has no side effects.  */
    1206                 :   285992872 :   if (set == NULL_RTX
    1207                 :   271617751 :       || !REG_P (SET_DEST (set))
    1208                 :   200379257 :       || !REG_P (SET_SRC (set))
    1209                 :   352873685 :       || side_effects_p (set))
    1210                 :   219112059 :     return NULL_RTX;
    1211                 :             : 
    1212                 :    66880813 :   int dst_regno = REGNO (SET_DEST (set));
    1213                 :    66880813 :   int src_regno = REGNO (SET_SRC (set));
    1214                 :    66880813 :   machine_mode mode = GET_MODE (SET_DEST (set));
    1215                 :             : 
    1216                 :             :   /* By definition, a register does not conflict with itself, therefore we
    1217                 :             :      do not have to handle it specially.  Returning NULL_RTX now, helps
    1218                 :             :      simplify the callers of this function.  */
    1219                 :    66880813 :   if (dst_regno == src_regno)
    1220                 :             :     return NULL_RTX;
    1221                 :             : 
    1222                 :             :   /* Computing conflicts for register pairs is difficult to get right, so
    1223                 :             :      for now, disallow it.  */
    1224                 :    66880813 :   if ((HARD_REGISTER_NUM_P (dst_regno)
    1225                 :    18407138 :        && hard_regno_nregs (dst_regno, mode) != 1)
    1226                 :    85118327 :       || (HARD_REGISTER_NUM_P (src_regno)
    1227                 :     9981161 :           && hard_regno_nregs (src_regno, mode) != 1))
    1228                 :             :     return NULL_RTX;
    1229                 :             : 
    1230                 :             :   return SET_SRC (set);
    1231                 :             : }
    1232                 :             : 
    1233                 :             : #ifdef EH_RETURN_DATA_REGNO
    1234                 :             : 
    1235                 :             : /* Add EH return hard registers as conflict hard registers to allocnos
    1236                 :             :    living at end of BB.  For most allocnos it is already done in
    1237                 :             :    process_bb_node_lives when we processing input edges but it does
    1238                 :             :    not work when and EH edge is edge out of the current region.  This
    1239                 :             :    function covers such out of region edges. */
    1240                 :             : static void
    1241                 :    13614441 : process_out_of_region_eh_regs (basic_block bb)
    1242                 :             : {
    1243                 :    13614441 :   edge e;
    1244                 :    13614441 :   edge_iterator ei;
    1245                 :    13614441 :   unsigned int i;
    1246                 :    13614441 :   bitmap_iterator bi;
    1247                 :    13614441 :   bool eh_p = false;
    1248                 :             : 
    1249                 :    33029866 :   FOR_EACH_EDGE (e, ei, bb->succs)
    1250                 :    19415425 :     if ((e->flags & EDGE_EH)
    1251                 :    19415425 :         && IRA_BB_NODE (e->dest)->parent != IRA_BB_NODE (bb)->parent)
    1252                 :             :       eh_p = true;
    1253                 :             : 
    1254                 :    13614441 :   if (! eh_p)
    1255                 :    13607410 :     return;
    1256                 :             : 
    1257                 :      107163 :   EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, i, bi)
    1258                 :             :     {
    1259                 :      100132 :       ira_allocno_t a = ira_curr_regno_allocno_map[i];
    1260                 :      200964 :       for (int n = ALLOCNO_NUM_OBJECTS (a) - 1; n >= 0; n--)
    1261                 :             :         {
    1262                 :      100832 :           ira_object_t obj = ALLOCNO_OBJECT (a, n);
    1263                 :      403328 :           OBJECT_CONFLICT_HARD_REGS (obj) |= eh_return_data_regs;
    1264                 :      100832 :           OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= eh_return_data_regs;
    1265                 :             :         }
    1266                 :             :     }
    1267                 :             : }
    1268                 :             : 
    1269                 :             : #endif
    1270                 :             : 
    1271                 :             : /* Add conflicts for object OBJ from REGION landing pads using CALLEE_ABI.  */
    1272                 :             : static void
    1273                 :     3711900 : add_conflict_from_region_landing_pads (eh_region region, ira_object_t obj,
    1274                 :             :                                        function_abi callee_abi)
    1275                 :             : {
    1276                 :     3711900 :   ira_allocno_t a = OBJECT_ALLOCNO (obj);
    1277                 :     3711900 :   rtx_code_label *landing_label;
    1278                 :     3711900 :   basic_block landing_bb;
    1279                 :             : 
    1280                 :    14441563 :   for (eh_landing_pad lp = region->landing_pads; lp ; lp = lp->next_lp)
    1281                 :             :     {
    1282                 :    12962845 :       if ((landing_label = lp->landing_pad) != NULL
    1283                 :    12962845 :           && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL
    1284                 :    25925529 :           && (region->type != ERT_CLEANUP
    1285                 :    11531470 :               || bitmap_bit_p (df_get_live_in (landing_bb),
    1286                 :             :                                ALLOCNO_REGNO (a))))
    1287                 :             :         {
    1288                 :     2233182 :           HARD_REG_SET new_conflict_regs
    1289                 :     2233182 :             = callee_abi.mode_clobbers (ALLOCNO_MODE (a));
    1290                 :     8932728 :           OBJECT_CONFLICT_HARD_REGS (obj) |= new_conflict_regs;
    1291                 :     2233182 :           OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= new_conflict_regs;
    1292                 :     2233182 :           return;
    1293                 :             :         }
    1294                 :             :     }
    1295                 :             : }
    1296                 :             : 
    1297                 :             : /* Process insns of the basic block given by its LOOP_TREE_NODE to
    1298                 :             :    update allocno live ranges, allocno hard register conflicts,
    1299                 :             :    intersected calls, and register pressure info for allocnos for the
    1300                 :             :    basic block for and regions containing the basic block.  */
    1301                 :             : static void
    1302                 :    15606941 : process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
    1303                 :             : {
    1304                 :    15606941 :   int i, freq;
    1305                 :    15606941 :   unsigned int j;
    1306                 :    15606941 :   basic_block bb;
    1307                 :    15606941 :   rtx_insn *insn;
    1308                 :    15606941 :   bitmap_iterator bi;
    1309                 :    15606941 :   bitmap reg_live_out;
    1310                 :    15606941 :   unsigned int px;
    1311                 :    15606941 :   bool set_p;
    1312                 :             : 
    1313                 :    15606941 :   bb = loop_tree_node->bb;
    1314                 :    15606941 :   if (bb != NULL)
    1315                 :             :     {
    1316                 :    66894834 :       for (i = 0; i < ira_pressure_classes_num; i++)
    1317                 :             :         {
    1318                 :    53280393 :           curr_reg_pressure[ira_pressure_classes[i]] = 0;
    1319                 :    53280393 :           high_pressure_start_point[ira_pressure_classes[i]] = -1;
    1320                 :             :         }
    1321                 :    13614441 :       curr_bb_node = loop_tree_node;
    1322                 :    13614441 :       reg_live_out = df_get_live_out (bb);
    1323                 :    13614441 :       sparseset_clear (objects_live);
    1324                 :    27228882 :       REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
    1325                 :    13614441 :       hard_regs_live &= ~(eliminable_regset | ira_no_alloc_regs);
    1326                 :  1266143013 :       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
    1327                 :  1252528572 :         if (TEST_HARD_REG_BIT (hard_regs_live, i))
    1328                 :             :           {
    1329                 :     1079800 :             enum reg_class aclass, pclass, cl;
    1330                 :             : 
    1331                 :     1079800 :             aclass = ira_allocno_class_translate[REGNO_REG_CLASS (i)];
    1332                 :     1079800 :             pclass = ira_pressure_class_translate[aclass];
    1333                 :    10231134 :             for (j = 0;
    1334                 :    10231134 :                  (cl = ira_reg_class_super_classes[pclass][j])
    1335                 :    10231134 :                    != LIM_REG_CLASSES;
    1336                 :             :                  j++)
    1337                 :             :               {
    1338                 :     9151334 :                 if (! ira_reg_pressure_class_p[cl])
    1339                 :     8071534 :                   continue;
    1340                 :     1079800 :                 curr_reg_pressure[cl]++;
    1341                 :     1079800 :                 if (curr_bb_node->reg_pressure[cl] < curr_reg_pressure[cl])
    1342                 :     1079800 :                   curr_bb_node->reg_pressure[cl] = curr_reg_pressure[cl];
    1343                 :     1079800 :                 ira_assert (curr_reg_pressure[cl]
    1344                 :             :                             <= ira_class_hard_regs_num[cl]);
    1345                 :             :               }
    1346                 :             :           }
    1347                 :   146580498 :       EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi)
    1348                 :   132966057 :         mark_pseudo_regno_live (j);
    1349                 :             : 
    1350                 :             : #ifdef EH_RETURN_DATA_REGNO
    1351                 :    13614441 :       process_out_of_region_eh_regs (bb);
    1352                 :             : #endif
    1353                 :             : 
    1354                 :    13614441 :       freq = REG_FREQ_FROM_BB (bb);
    1355                 :     7980306 :       if (freq == 0)
    1356                 :     1909274 :         freq = 1;
    1357                 :             : 
    1358                 :             :       /* Invalidate all allocno_saved_at_call entries.  */
    1359                 :    13614441 :       last_call_num++;
    1360                 :             : 
    1361                 :             :       /* Scan the code of this basic block, noting which allocnos and
    1362                 :             :          hard regs are born or die.
    1363                 :             : 
    1364                 :             :          Note that this loop treats uninitialized values as live until
    1365                 :             :          the beginning of the block.  For example, if an instruction
    1366                 :             :          uses (reg:DI foo), and only (subreg:SI (reg:DI foo) 0) is ever
    1367                 :             :          set, FOO will remain live until the beginning of the block.
    1368                 :             :          Likewise if FOO is not set at all.  This is unnecessarily
    1369                 :             :          pessimistic, but it probably doesn't matter much in practice.  */
    1370                 :   158405828 :       FOR_BB_INSNS_REVERSE (bb, insn)
    1371                 :             :         {
    1372                 :   144791387 :           ira_allocno_t a;
    1373                 :   144791387 :           df_ref def, use;
    1374                 :   144791387 :           bool call_p;
    1375                 :             : 
    1376                 :   144791387 :           if (!NONDEBUG_INSN_P (insn))
    1377                 :    65152703 :             continue;
    1378                 :             : 
    1379                 :    79638684 :           if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
    1380                 :        1505 :             fprintf (ira_dump_file, "   Insn %u(l%d): point = %d\n",
    1381                 :        1505 :                      INSN_UID (insn), loop_tree_node->parent->loop_num,
    1382                 :             :                      curr_point);
    1383                 :             : 
    1384                 :    79638684 :           call_p = CALL_P (insn);
    1385                 :    79638684 :           ignore_reg_for_conflicts = non_conflicting_reg_copy_p (insn);
    1386                 :             : 
    1387                 :             :           /* Mark each defined value as live.  We need to do this for
    1388                 :             :              unused values because they still conflict with quantities
    1389                 :             :              that are live at the time of the definition.
    1390                 :             : 
    1391                 :             :              Ignore DF_REF_MAY_CLOBBERs on a call instruction.  Such
    1392                 :             :              references represent the effect of the called function
    1393                 :             :              on a call-clobbered register.  Marking the register as
    1394                 :             :              live would stop us from allocating it to a call-crossing
    1395                 :             :              allocno.  */
    1396                 :   615330706 :           FOR_EACH_INSN_DEF (def, insn)
    1397                 :   535692022 :             if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER))
    1398                 :    67975198 :               mark_ref_live (def);
    1399                 :             : 
    1400                 :             :           /* If INSN has multiple outputs, then any value used in one
    1401                 :             :              of the outputs conflicts with the other outputs.  Model this
    1402                 :             :              by making the used value live during the output phase.
    1403                 :             : 
    1404                 :             :              It is unsafe to use !single_set here since it will ignore
    1405                 :             :              an unused output.  Just because an output is unused does
    1406                 :             :              not mean the compiler can assume the side effect will not
    1407                 :             :              occur.  Consider if ALLOCNO appears in the address of an
    1408                 :             :              output and we reload the output.  If we allocate ALLOCNO
    1409                 :             :              to the same hard register as an unused output we could
    1410                 :             :              set the hard register before the output reload insn.  */
    1411                 :    79638684 :           if (GET_CODE (PATTERN (insn)) == PARALLEL && multiple_sets (insn))
    1412                 :     1837051 :             FOR_EACH_INSN_USE (use, insn)
    1413                 :             :               {
    1414                 :     1462567 :                 int i;
    1415                 :     1462567 :                 rtx reg;
    1416                 :             : 
    1417                 :     1462567 :                 reg = DF_REF_REG (use);
    1418                 :     4812797 :                 for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
    1419                 :             :                   {
    1420                 :     3857720 :                     rtx set;
    1421                 :             : 
    1422                 :     3857720 :                     set = XVECEXP (PATTERN (insn), 0, i);
    1423                 :     3857720 :                     if (GET_CODE (set) == SET
    1424                 :     3857720 :                         && reg_overlap_mentioned_p (reg, SET_DEST (set)))
    1425                 :             :                       {
    1426                 :             :                         /* After the previous loop, this is a no-op if
    1427                 :             :                            REG is contained within SET_DEST (SET).  */
    1428                 :      507490 :                         mark_ref_live (use);
    1429                 :      507490 :                         break;
    1430                 :             :                       }
    1431                 :             :                   }
    1432                 :             :               }
    1433                 :             : 
    1434                 :    79638684 :           preferred_alternatives = ira_setup_alts (insn);
    1435                 :    79638684 :           process_register_constraint_filters ();
    1436                 :    79638684 :           process_single_reg_class_operands (false, freq);
    1437                 :             : 
    1438                 :    79638684 :           if (call_p)
    1439                 :             :             {
    1440                 :             :               /* Try to find a SET in the CALL_INSN_FUNCTION_USAGE, and from
    1441                 :             :                  there, try to find a pseudo that is live across the call but
    1442                 :             :                  can be cheaply reconstructed from the return value.  */
    1443                 :     5747608 :               rtx cheap_reg = find_call_crossed_cheap_reg (insn);
    1444                 :     5747608 :               if (cheap_reg != NULL_RTX)
    1445                 :       20961 :                 add_reg_note (insn, REG_RETURNED, cheap_reg);
    1446                 :             : 
    1447                 :     5747608 :               last_call_num++;
    1448                 :     5747608 :               sparseset_clear (allocnos_processed);
    1449                 :             :               /* The current set of live allocnos are live across the call.  */
    1450                 :   466176632 :               EXECUTE_IF_SET_IN_SPARSESET (objects_live, i)
    1451                 :             :                 {
    1452                 :   227340708 :                   ira_object_t obj = ira_object_id_map[i];
    1453                 :   227340708 :                   a = OBJECT_ALLOCNO (obj);
    1454                 :   227340708 :                   int num = ALLOCNO_NUM (a);
    1455                 :   227340708 :                   function_abi callee_abi = insn_callee_abi (insn);
    1456                 :             : 
    1457                 :             :                   /* Don't allocate allocnos that cross setjmps or any
    1458                 :             :                      call, if this function receives a nonlocal
    1459                 :             :                      goto.  */
    1460                 :   227340708 :                   if (cfun->has_nonlocal_label
    1461                 :   227340708 :                       || (!targetm.setjmp_preserves_nonvolatile_regs_p ()
    1462                 :   227338143 :                           && (find_reg_note (insn, REG_SETJMP, NULL_RTX)
    1463                 :             :                               != NULL_RTX)))
    1464                 :             :                     {
    1465                 :       10467 :                       SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj));
    1466                 :   227340708 :                       SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj));
    1467                 :             :                     }
    1468                 :   227340708 :                   eh_region r;
    1469                 :   227340708 :                   if (can_throw_internal (insn)
    1470                 :   227340708 :                       && (r = get_eh_region_from_rtx (insn)) != NULL)
    1471                 :     3711900 :                     add_conflict_from_region_landing_pads (r, obj, callee_abi);
    1472                 :   227340708 :                   if (sparseset_bit_p (allocnos_processed, num))
    1473                 :   104108191 :                     continue;
    1474                 :   123232517 :                   sparseset_set_bit (allocnos_processed, num);
    1475                 :             : 
    1476                 :   123232517 :                   if (allocno_saved_at_call[num] != last_call_num)
    1477                 :             :                     /* Here we are mimicking caller-save.cc behavior
    1478                 :             :                        which does not save hard register at a call if
    1479                 :             :                        it was saved on previous call in the same basic
    1480                 :             :                        block and the hard register was not mentioned
    1481                 :             :                        between the two calls.  */
    1482                 :    38786472 :                     ALLOCNO_CALL_FREQ (a) += freq;
    1483                 :             :                   /* Mark it as saved at the next call.  */
    1484                 :   123232517 :                   allocno_saved_at_call[num] = last_call_num + 1;
    1485                 :   123232517 :                   ALLOCNO_CALLS_CROSSED_NUM (a)++;
    1486                 :   123232517 :                   ALLOCNO_CROSSED_CALLS_ABIS (a) |= 1 << callee_abi.id ();
    1487                 :   123232517 :                   ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS (a)
    1488                 :   123232517 :                     |= callee_abi.full_and_partial_reg_clobbers ();
    1489                 :   123232517 :                   if (cheap_reg != NULL_RTX
    1490                 :   123232517 :                       && ALLOCNO_REGNO (a) == (int) REGNO (cheap_reg))
    1491                 :       20961 :                     ALLOCNO_CHEAP_CALLS_CROSSED_NUM (a)++;
    1492                 :             :                 }
    1493                 :             :             }
    1494                 :             : 
    1495                 :             :           /* See which defined values die here.  Note that we include
    1496                 :             :              the call insn in the lifetimes of these values, so we don't
    1497                 :             :              mistakenly consider, for e.g. an addressing mode with a
    1498                 :             :              side-effect like a post-increment fetching the address,
    1499                 :             :              that the use happens before the call, and the def to happen
    1500                 :             :              after the call: we believe both to happen before the actual
    1501                 :             :              call.  (We don't handle return-values here.)  */
    1502                 :   615330706 :           FOR_EACH_INSN_DEF (def, insn)
    1503                 :   535692022 :             if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER))
    1504                 :    67975198 :               mark_ref_dead (def);
    1505                 :             : 
    1506                 :    79638684 :           make_early_clobber_and_input_conflicts ();
    1507                 :             : 
    1508                 :    79638684 :           curr_point++;
    1509                 :             : 
    1510                 :             :           /* Mark each used value as live.  */
    1511                 :   174429579 :           FOR_EACH_INSN_USE (use, insn)
    1512                 :    94790895 :             mark_ref_live (use);
    1513                 :             : 
    1514                 :    79638684 :           process_single_reg_class_operands (true, freq);
    1515                 :             : 
    1516                 :    79638684 :           set_p = mark_hard_reg_early_clobbers (insn, true);
    1517                 :             : 
    1518                 :    79638684 :           if (set_p)
    1519                 :             :             {
    1520                 :    10180453 :               mark_hard_reg_early_clobbers (insn, false);
    1521                 :             : 
    1522                 :             :               /* Mark each hard reg as live again.  For example, a
    1523                 :             :                  hard register can be in clobber and in an insn
    1524                 :             :                  input.  */
    1525                 :    25203216 :               FOR_EACH_INSN_USE (use, insn)
    1526                 :             :                 {
    1527                 :    15022763 :                   rtx ureg = DF_REF_REG (use);
    1528                 :             : 
    1529                 :    15022763 :                   if (GET_CODE (ureg) == SUBREG)
    1530                 :      326198 :                     ureg = SUBREG_REG (ureg);
    1531                 :    15022763 :                   if (! REG_P (ureg) || REGNO (ureg) >= FIRST_PSEUDO_REGISTER)
    1532                 :     9195919 :                     continue;
    1533                 :             : 
    1534                 :     5826844 :                   mark_ref_live (use);
    1535                 :             :                 }
    1536                 :             :             }
    1537                 :             : 
    1538                 :    79638684 :           curr_point++;
    1539                 :             :         }
    1540                 :    13614441 :       ignore_reg_for_conflicts = NULL_RTX;
    1541                 :             : 
    1542                 :    13614441 :       if (bb_has_eh_pred (bb))
    1543                 :      211118 :         for (j = 0; ; ++j)
    1544                 :             :           {
    1545                 :      633354 :             unsigned int regno = EH_RETURN_DATA_REGNO (j);
    1546                 :      422236 :             if (regno == INVALID_REGNUM)
    1547                 :             :               break;
    1548                 :      422236 :             make_hard_regno_live (regno);
    1549                 :      422236 :           }
    1550                 :             : 
    1551                 :             :       /* Allocnos can't go in stack regs at the start of a basic block
    1552                 :             :          that is reached by an abnormal edge. Likewise for registers
    1553                 :             :          that are at least partly call clobbered, because caller-save,
    1554                 :             :          fixup_abnormal_edges and possibly the table driven EH machinery
    1555                 :             :          are not quite ready to handle such allocnos live across such
    1556                 :             :          edges.  */
    1557                 :    13614441 :       if (bb_has_abnormal_pred (bb))
    1558                 :             :         {
    1559                 :             : #ifdef STACK_REGS
    1560                 :      681636 :           EXECUTE_IF_SET_IN_SPARSESET (objects_live, px)
    1561                 :             :             {
    1562                 :      468114 :               ira_allocno_t a = OBJECT_ALLOCNO (ira_object_id_map[px]);
    1563                 :             : 
    1564                 :      468114 :               ALLOCNO_NO_STACK_REG_P (a) = true;
    1565                 :      468114 :               ALLOCNO_TOTAL_NO_STACK_REG_P (a) = true;
    1566                 :             :             }
    1567                 :     1921698 :           for (px = FIRST_STACK_REG; px <= LAST_STACK_REG; px++)
    1568                 :     1708176 :             make_hard_regno_live (px);
    1569                 :             : #endif
    1570                 :             :           /* No need to record conflicts for call clobbered regs if we
    1571                 :             :              have nonlocal labels around, as we don't ever try to
    1572                 :             :              allocate such regs in this case.  */
    1573                 :      213522 :           if (!cfun->has_nonlocal_label
    1574                 :      213522 :               && has_abnormal_call_or_eh_pred_edge_p (bb))
    1575                 :    19633137 :             for (px = 0; px < FIRST_PSEUDO_REGISTER; px++)
    1576                 :    19422028 :               if (eh_edge_abi.clobbers_at_least_part_of_reg_p (px)
    1577                 :             : #ifdef REAL_PIC_OFFSET_TABLE_REGNUM
    1578                 :             :                   /* We should create a conflict of PIC pseudo with
    1579                 :             :                      PIC hard reg as PIC hard reg can have a wrong
    1580                 :             :                      value after jump described by the abnormal edge.
    1581                 :             :                      In this case we cannot allocate PIC hard reg to
    1582                 :             :                      PIC pseudo as PIC pseudo will also have a wrong
    1583                 :             :                      value.  This code is not critical as LRA can fix
    1584                 :             :                      it but it is better to have the right allocation
    1585                 :             :                      earlier.  */
    1586                 :    19587893 :                   || (px == REAL_PIC_OFFSET_TABLE_REGNUM
    1587                 :      211109 :                       && pic_offset_table_rtx != NULL_RTX
    1588                 :        7024 :                       && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER)
    1589                 :             : #endif
    1590                 :             :                   )
    1591                 :    17576461 :                 make_hard_regno_live (px);
    1592                 :             :         }
    1593                 :             : 
    1594                 :   211261896 :       EXECUTE_IF_SET_IN_SPARSESET (objects_live, i)
    1595                 :   197647455 :         make_object_dead (ira_object_id_map[i]);
    1596                 :             : 
    1597                 :    13614441 :       curr_point++;
    1598                 :             : 
    1599                 :             :     }
    1600                 :             :   /* Propagate register pressure to upper loop tree nodes.  */
    1601                 :    15606941 :   if (loop_tree_node != ira_loop_tree_root)
    1602                 :    69707521 :     for (i = 0; i < ira_pressure_classes_num; i++)
    1603                 :             :       {
    1604                 :    55532202 :         enum reg_class pclass;
    1605                 :             : 
    1606                 :    55532202 :         pclass = ira_pressure_classes[i];
    1607                 :    55532202 :         if (loop_tree_node->reg_pressure[pclass]
    1608                 :    55532202 :             > loop_tree_node->parent->reg_pressure[pclass])
    1609                 :     3986748 :           loop_tree_node->parent->reg_pressure[pclass]
    1610                 :     3986748 :             = loop_tree_node->reg_pressure[pclass];
    1611                 :             :       }
    1612                 :    15606941 : }
    1613                 :             : 
    1614                 :             : /* Create and set up IRA_START_POINT_RANGES and
    1615                 :             :    IRA_FINISH_POINT_RANGES.  */
    1616                 :             : static void
    1617                 :     3013134 : create_start_finish_chains (void)
    1618                 :             : {
    1619                 :     3013134 :   ira_object_t obj;
    1620                 :     3013134 :   ira_object_iterator oi;
    1621                 :     3013134 :   live_range_t r;
    1622                 :             : 
    1623                 :     3013134 :   ira_start_point_ranges
    1624                 :     3013134 :     = (live_range_t *) ira_allocate (ira_max_point * sizeof (live_range_t));
    1625                 :     3013134 :   memset (ira_start_point_ranges, 0, ira_max_point * sizeof (live_range_t));
    1626                 :     3013134 :   ira_finish_point_ranges
    1627                 :     3013134 :     = (live_range_t *) ira_allocate (ira_max_point * sizeof (live_range_t));
    1628                 :     3013134 :   memset (ira_finish_point_ranges, 0, ira_max_point * sizeof (live_range_t));
    1629                 :    76646842 :   FOR_EACH_OBJECT (obj, oi)
    1630                 :   173817438 :     for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
    1631                 :             :       {
    1632                 :   100183730 :         r->start_next = ira_start_point_ranges[r->start];
    1633                 :   100183730 :         ira_start_point_ranges[r->start] = r;
    1634                 :   100183730 :         r->finish_next = ira_finish_point_ranges[r->finish];
    1635                 :   100183730 :           ira_finish_point_ranges[r->finish] = r;
    1636                 :             :       }
    1637                 :     3013134 : }
    1638                 :             : 
    1639                 :             : /* Rebuild IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES after
    1640                 :             :    new live ranges and program points were added as a result if new
    1641                 :             :    insn generation.  */
    1642                 :             : void
    1643                 :     1581512 : ira_rebuild_start_finish_chains (void)
    1644                 :             : {
    1645                 :     1581512 :   ira_free (ira_finish_point_ranges);
    1646                 :     1581512 :   ira_free (ira_start_point_ranges);
    1647                 :     1581512 :   create_start_finish_chains ();
    1648                 :     1581512 : }
    1649                 :             : 
    1650                 :             : /* Compress allocno live ranges by removing program points where
    1651                 :             :    nothing happens.  */
    1652                 :             : static void
    1653                 :     1431622 : remove_some_program_points_and_update_live_ranges (void)
    1654                 :             : {
    1655                 :     1431622 :   unsigned i;
    1656                 :     1431622 :   int n;
    1657                 :     1431622 :   int *map;
    1658                 :     1431622 :   ira_object_t obj;
    1659                 :     1431622 :   ira_object_iterator oi;
    1660                 :     1431622 :   live_range_t r, prev_r, next_r;
    1661                 :     1431622 :   sbitmap_iterator sbi;
    1662                 :     1431622 :   bool born_p, dead_p, prev_born_p, prev_dead_p;
    1663                 :             : 
    1664                 :     1431622 :   auto_sbitmap born (ira_max_point);
    1665                 :     1431622 :   auto_sbitmap dead (ira_max_point);
    1666                 :     1431622 :   bitmap_clear (born);
    1667                 :     1431622 :   bitmap_clear (dead);
    1668                 :    34202502 :   FOR_EACH_OBJECT (obj, oi)
    1669                 :    83868816 :     for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
    1670                 :             :       {
    1671                 :    51097936 :         ira_assert (r->start <= r->finish);
    1672                 :    51097936 :         bitmap_set_bit (born, r->start);
    1673                 :    51097936 :         bitmap_set_bit (dead, r->finish);
    1674                 :             :       }
    1675                 :             : 
    1676                 :     1431622 :   auto_sbitmap born_or_dead (ira_max_point);
    1677                 :     1431622 :   bitmap_ior (born_or_dead, born, dead);
    1678                 :     1431622 :   map = (int *) ira_allocate (sizeof (int) * ira_max_point);
    1679                 :     1431622 :   n = -1;
    1680                 :     1431622 :   prev_born_p = prev_dead_p = false;
    1681                 :    63869971 :   EXECUTE_IF_SET_IN_BITMAP (born_or_dead, 0, i, sbi)
    1682                 :             :     {
    1683                 :    61006727 :       born_p = bitmap_bit_p (born, i);
    1684                 :    61006727 :       dead_p = bitmap_bit_p (dead, i);
    1685                 :    61006727 :       if ((prev_born_p && ! prev_dead_p && born_p && ! dead_p)
    1686                 :    55267761 :           || (prev_dead_p && ! prev_born_p && dead_p && ! born_p))
    1687                 :    15262325 :         map[i] = n;
    1688                 :             :       else
    1689                 :    45744402 :         map[i] = ++n;
    1690                 :    61006727 :       prev_born_p = born_p;
    1691                 :    61006727 :       prev_dead_p = dead_p;
    1692                 :             :     }
    1693                 :             : 
    1694                 :     1431622 :   n++;
    1695                 :     1431622 :   if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL)
    1696                 :          95 :     fprintf (ira_dump_file, "Compressing live ranges: from %d to %d - %d%%\n",
    1697                 :          95 :              ira_max_point, n, 100 * n / ira_max_point);
    1698                 :     1431622 :   ira_max_point = n;
    1699                 :             : 
    1700                 :    34202502 :   FOR_EACH_OBJECT (obj, oi)
    1701                 :    83868816 :     for (r = OBJECT_LIVE_RANGES (obj), prev_r = NULL; r != NULL; r = next_r)
    1702                 :             :       {
    1703                 :    51097936 :         next_r = r->next;
    1704                 :    51097936 :         r->start = map[r->start];
    1705                 :    51097936 :         r->finish = map[r->finish];
    1706                 :    51097936 :         if (prev_r == NULL || prev_r->start > r->finish + 1)
    1707                 :             :           {
    1708                 :    38843391 :             prev_r = r;
    1709                 :    38843391 :             continue;
    1710                 :             :           }
    1711                 :    12254545 :         prev_r->start = r->start;
    1712                 :    12254545 :         prev_r->next = next_r;
    1713                 :    12254545 :         ira_finish_live_range (r);
    1714                 :             :       }
    1715                 :             : 
    1716                 :     1431622 :   ira_free (map);
    1717                 :     1431622 : }
    1718                 :             : 
    1719                 :             : /* Print live ranges R to file F.  */
    1720                 :             : void
    1721                 :        1462 : ira_print_live_range_list (FILE *f, live_range_t r)
    1722                 :             : {
    1723                 :        3218 :   for (; r != NULL; r = r->next)
    1724                 :        1756 :     fprintf (f, " [%d..%d]", r->start, r->finish);
    1725                 :        1462 :   fprintf (f, "\n");
    1726                 :        1462 : }
    1727                 :             : 
    1728                 :             : DEBUG_FUNCTION void
    1729                 :           0 : debug (live_range &ref)
    1730                 :             : {
    1731                 :           0 :   ira_print_live_range_list (stderr, &ref);
    1732                 :           0 : }
    1733                 :             : 
    1734                 :             : DEBUG_FUNCTION void
    1735                 :           0 : debug (live_range *ptr)
    1736                 :             : {
    1737                 :           0 :   if (ptr)
    1738                 :           0 :     debug (*ptr);
    1739                 :             :   else
    1740                 :           0 :     fprintf (stderr, "<nil>\n");
    1741                 :           0 : }
    1742                 :             : 
    1743                 :             : /* Print live ranges R to stderr.  */
    1744                 :             : void
    1745                 :           0 : ira_debug_live_range_list (live_range_t r)
    1746                 :             : {
    1747                 :           0 :   ira_print_live_range_list (stderr, r);
    1748                 :           0 : }
    1749                 :             : 
    1750                 :             : /* Print live ranges of object OBJ to file F.  */
    1751                 :             : static void
    1752                 :        1328 : print_object_live_ranges (FILE *f, ira_object_t obj)
    1753                 :             : {
    1754                 :           0 :   ira_print_live_range_list (f, OBJECT_LIVE_RANGES (obj));
    1755                 :           0 : }
    1756                 :             : 
    1757                 :             : /* Print live ranges of allocno A to file F.  */
    1758                 :             : static void
    1759                 :        1328 : print_allocno_live_ranges (FILE *f, ira_allocno_t a)
    1760                 :             : {
    1761                 :        1328 :   int n = ALLOCNO_NUM_OBJECTS (a);
    1762                 :        1328 :   int i;
    1763                 :             : 
    1764                 :        2656 :   for (i = 0; i < n; i++)
    1765                 :             :     {
    1766                 :        1328 :       fprintf (f, " a%d(r%d", ALLOCNO_NUM (a), ALLOCNO_REGNO (a));
    1767                 :        1328 :       if (n > 1)
    1768                 :           0 :         fprintf (f, " [%d]", i);
    1769                 :        1328 :       fprintf (f, "):");
    1770                 :        1328 :       print_object_live_ranges (f, ALLOCNO_OBJECT (a, i));
    1771                 :             :     }
    1772                 :        1328 : }
    1773                 :             : 
    1774                 :             : /* Print live ranges of allocno A to stderr.  */
    1775                 :             : void
    1776                 :           0 : ira_debug_allocno_live_ranges (ira_allocno_t a)
    1777                 :             : {
    1778                 :           0 :   print_allocno_live_ranges (stderr, a);
    1779                 :           0 : }
    1780                 :             : 
    1781                 :             : /* Print live ranges of all allocnos to file F.  */
    1782                 :             : static void
    1783                 :         190 : print_live_ranges (FILE *f)
    1784                 :             : {
    1785                 :         190 :   ira_allocno_t a;
    1786                 :         190 :   ira_allocno_iterator ai;
    1787                 :             : 
    1788                 :        1518 :   FOR_EACH_ALLOCNO (a, ai)
    1789                 :        1328 :     print_allocno_live_ranges (f, a);
    1790                 :         190 : }
    1791                 :             : 
    1792                 :             : /* Print live ranges of all allocnos to stderr.  */
    1793                 :             : void
    1794                 :           0 : ira_debug_live_ranges (void)
    1795                 :             : {
    1796                 :           0 :   print_live_ranges (stderr);
    1797                 :           0 : }
    1798                 :             : 
    1799                 :             : /* The main entry function creates live ranges, set up
    1800                 :             :    CONFLICT_HARD_REGS and TOTAL_CONFLICT_HARD_REGS for objects, and
    1801                 :             :    calculate register pressure info.  */
    1802                 :             : void
    1803                 :     1431622 : ira_create_allocno_live_ranges (void)
    1804                 :             : {
    1805                 :     1431622 :   objects_live = sparseset_alloc (ira_objects_num);
    1806                 :     1431622 :   allocnos_processed = sparseset_alloc (ira_allocnos_num);
    1807                 :     1431622 :   curr_point = 0;
    1808                 :     1431622 :   last_call_num = 0;
    1809                 :     1431622 :   allocno_saved_at_call
    1810                 :     1431622 :     = (int *) ira_allocate (ira_allocnos_num * sizeof (int));
    1811                 :     1431622 :   memset (allocno_saved_at_call, 0, ira_allocnos_num * sizeof (int));
    1812                 :     1431622 :   ira_traverse_loop_tree (true, ira_loop_tree_root, NULL,
    1813                 :             :                           process_bb_node_lives);
    1814                 :     1431622 :   ira_max_point = curr_point;
    1815                 :     1431622 :   create_start_finish_chains ();
    1816                 :     1431622 :   if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
    1817                 :          95 :     print_live_ranges (ira_dump_file);
    1818                 :             :   /* Clean up.  */
    1819                 :     1431622 :   ira_free (allocno_saved_at_call);
    1820                 :     1431622 :   sparseset_free (objects_live);
    1821                 :     1431622 :   sparseset_free (allocnos_processed);
    1822                 :     1431622 : }
    1823                 :             : 
    1824                 :             : /* Compress allocno live ranges.  */
    1825                 :             : void
    1826                 :     1431622 : ira_compress_allocno_live_ranges (void)
    1827                 :             : {
    1828                 :     1431622 :   remove_some_program_points_and_update_live_ranges ();
    1829                 :     1431622 :   ira_rebuild_start_finish_chains ();
    1830                 :     1431622 :   if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
    1831                 :             :     {
    1832                 :          95 :       fprintf (ira_dump_file, "Ranges after the compression:\n");
    1833                 :          95 :       print_live_ranges (ira_dump_file);
    1834                 :             :     }
    1835                 :     1431622 : }
    1836                 :             : 
    1837                 :             : /* Free arrays IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES.  */
    1838                 :             : void
    1839                 :     1431622 : ira_finish_allocno_live_ranges (void)
    1840                 :             : {
    1841                 :     1431622 :   ira_free (ira_finish_point_ranges);
    1842                 :     1431622 :   ira_free (ira_start_point_ranges);
    1843                 :     1431622 : }
        

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