LCOV - code coverage report
Current view: top level - gcc - ssa-iterators.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 99.4 % 345 343
Test Date: 2024-03-23 14:05:01 Functions: 100.0 % 34 34
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Header file for SSA iterators.
       2                 :             :    Copyright (C) 2013-2024 Free Software Foundation, Inc.
       3                 :             : 
       4                 :             : This file is part of GCC.
       5                 :             : 
       6                 :             : GCC is free software; you can redistribute it and/or modify it under
       7                 :             : the terms of the GNU General Public License as published by the Free
       8                 :             : Software Foundation; either version 3, or (at your option) any later
       9                 :             : version.
      10                 :             : 
      11                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14                 :             :  for more details.
      15                 :             : 
      16                 :             : You should have received a copy of the GNU General Public License
      17                 :             : along with GCC; see the file COPYING3.  If not see
      18                 :             : <http://www.gnu.org/licenses/>.  */
      19                 :             : 
      20                 :             : #ifndef GCC_SSA_ITERATORS_H
      21                 :             : #define GCC_SSA_ITERATORS_H
      22                 :             : 
      23                 :             : /* Immediate use lists are used to directly access all uses for an SSA
      24                 :             :    name and get pointers to the statement for each use.
      25                 :             : 
      26                 :             :    The structure ssa_use_operand_t consists of PREV and NEXT pointers
      27                 :             :    to maintain the list.  A USE pointer, which points to address where
      28                 :             :    the use is located and a LOC pointer which can point to the
      29                 :             :    statement where the use is located, or, in the case of the root
      30                 :             :    node, it points to the SSA name itself.
      31                 :             : 
      32                 :             :    The list is anchored by an occurrence of ssa_operand_d *in* the
      33                 :             :    ssa_name node itself (named 'imm_uses').  This node is uniquely
      34                 :             :    identified by having a NULL USE pointer. and the LOC pointer
      35                 :             :    pointing back to the ssa_name node itself.  This node forms the
      36                 :             :    base for a circular list, and initially this is the only node in
      37                 :             :    the list.
      38                 :             : 
      39                 :             :    Fast iteration allows each use to be examined, but does not allow
      40                 :             :    any modifications to the uses or stmts.
      41                 :             : 
      42                 :             :    Normal iteration allows insertion, deletion, and modification. the
      43                 :             :    iterator manages this by inserting a marker node into the list
      44                 :             :    immediately before the node currently being examined in the list.
      45                 :             :    this marker node is uniquely identified by having null stmt *and* a
      46                 :             :    null use pointer.
      47                 :             : 
      48                 :             :    When iterating to the next use, the iteration routines check to see
      49                 :             :    if the node after the marker has changed. if it has, then the node
      50                 :             :    following the marker is now the next one to be visited. if not, the
      51                 :             :    marker node is moved past that node in the list (visualize it as
      52                 :             :    bumping the marker node through the list).  this continues until
      53                 :             :    the marker node is moved to the original anchor position. the
      54                 :             :    marker node is then removed from the list.
      55                 :             : 
      56                 :             :    If iteration is halted early, the marker node must be removed from
      57                 :             :    the list before continuing.  */
      58                 :             : struct imm_use_iterator
      59                 :             : {
      60                 :             :   /* This is the current use the iterator is processing.  */
      61                 :             :   ssa_use_operand_t *imm_use;
      62                 :             :   /* This marks the last use in the list (use node from SSA_NAME)  */
      63                 :             :   ssa_use_operand_t *end_p;
      64                 :             :   /* This node is inserted and used to mark the end of the uses for a stmt.  */
      65                 :             :   ssa_use_operand_t iter_node;
      66                 :             :   /* This is the next ssa_name to visit.  IMM_USE may get removed before
      67                 :             :      the next one is traversed to, so it must be cached early.  */
      68                 :             :   ssa_use_operand_t *next_imm_name;
      69                 :             : };
      70                 :             : 
      71                 :             : 
      72                 :             : /* Use this iterator when simply looking at stmts.  Adding, deleting or
      73                 :             :    modifying stmts will cause this iterator to malfunction.  */
      74                 :             : 
      75                 :             : #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)               \
      76                 :             :   for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR)); \
      77                 :             :        !end_readonly_imm_use_p (&(ITER));                   \
      78                 :             :        (void) ((DEST) = next_readonly_imm_use (&(ITER))))
      79                 :             : 
      80                 :             : /* Forward declare for use in the class below.  */
      81                 :             : inline void end_imm_use_stmt_traverse (imm_use_iterator *);
      82                 :             : 
      83                 :             : /* arrange to automatically call, upon descruction, end_imm_use_stmt_traverse
      84                 :             :    with a given pointer to imm_use_iterator.  */
      85                 :             : struct auto_end_imm_use_stmt_traverse
      86                 :             : {
      87                 :             :   imm_use_iterator *imm;
      88                 :   263880592 :   auto_end_imm_use_stmt_traverse (imm_use_iterator *imm)
      89                 :   263861414 :   : imm (imm) {}
      90                 :   263880592 :   ~auto_end_imm_use_stmt_traverse ()
      91                 :   527761184 :   { end_imm_use_stmt_traverse (imm); }
      92                 :             : };
      93                 :             : 
      94                 :             : /* Use this iterator to visit each stmt which has a use of SSAVAR.  The
      95                 :             :    destructor of the auto_end_imm_use_stmt_traverse object deals with removing
      96                 :             :    ITER from SSAVAR's IMM_USE list even when leaving the scope early.  */
      97                 :             : 
      98                 :             : #define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR)               \
      99                 :             :   for (struct auto_end_imm_use_stmt_traverse                    \
     100                 :             :          auto_end_imm_use_stmt_traverse                         \
     101                 :             :            ((((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR))),     \
     102                 :             :              &(ITER)));                                             \
     103                 :             :        !end_imm_use_stmt_p (&(ITER));                               \
     104                 :             :        (void) ((STMT) = next_imm_use_stmt (&(ITER))))
     105                 :             : 
     106                 :             : /* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to
     107                 :             :    get access to each occurrence of ssavar on the stmt returned by
     108                 :             :    that iterator..  for instance:
     109                 :             : 
     110                 :             :      FOR_EACH_IMM_USE_STMT (stmt, iter, ssavar)
     111                 :             :        {
     112                 :             :          FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
     113                 :             :            {
     114                 :             :              SET_USE (use_p, blah);
     115                 :             :            }
     116                 :             :          update_stmt (stmt);
     117                 :             :        }                                                         */
     118                 :             : 
     119                 :             : #define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER)                    \
     120                 :             :   for ((DEST) = first_imm_use_on_stmt (&(ITER));            \
     121                 :             :        !end_imm_use_on_stmt_p (&(ITER));                    \
     122                 :             :        (void) ((DEST) = next_imm_use_on_stmt (&(ITER))))
     123                 :             : 
     124                 :             : 
     125                 :             : 
     126                 :             : extern bool single_imm_use_1 (const ssa_use_operand_t *head,
     127                 :             :                               use_operand_p *use_p, gimple **stmt);
     128                 :             : 
     129                 :             : 
     130                 :             : enum ssa_op_iter_type {
     131                 :             :   ssa_op_iter_none = 0,
     132                 :             :   ssa_op_iter_tree,
     133                 :             :   ssa_op_iter_use,
     134                 :             :   ssa_op_iter_def
     135                 :             : };
     136                 :             : 
     137                 :             : /* This structure is used in the operand iterator loops.  It contains the
     138                 :             :    items required to determine which operand is retrieved next.  During
     139                 :             :    optimization, this structure is scalarized, and any unused fields are
     140                 :             :    optimized away, resulting in little overhead.  */
     141                 :             : 
     142                 :             : struct ssa_op_iter
     143                 :             : {
     144                 :             :   enum ssa_op_iter_type iter_type;
     145                 :             :   bool done;
     146                 :             :   int flags;
     147                 :             :   unsigned i;
     148                 :             :   unsigned numops;
     149                 :             :   use_optype_p uses;
     150                 :             :   gimple *stmt;
     151                 :             : };
     152                 :             : 
     153                 :             : /* NOTE: Keep these in sync with doc/tree-ssa.texi.  */
     154                 :             : /* These flags are used to determine which operands are returned during
     155                 :             :    execution of the loop.  */
     156                 :             : #define SSA_OP_USE              0x01    /* Real USE operands.  */
     157                 :             : #define SSA_OP_DEF              0x02    /* Real DEF operands.  */
     158                 :             : #define SSA_OP_VUSE             0x04    /* VUSE operands.  */
     159                 :             : #define SSA_OP_VDEF             0x08    /* VDEF operands.  */
     160                 :             : /* These are commonly grouped operand flags.  */
     161                 :             : #define SSA_OP_VIRTUAL_USES     (SSA_OP_VUSE)
     162                 :             : #define SSA_OP_VIRTUAL_DEFS     (SSA_OP_VDEF)
     163                 :             : #define SSA_OP_ALL_VIRTUALS     (SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_DEFS)
     164                 :             : #define SSA_OP_ALL_USES         (SSA_OP_VIRTUAL_USES | SSA_OP_USE)
     165                 :             : #define SSA_OP_ALL_DEFS         (SSA_OP_VIRTUAL_DEFS | SSA_OP_DEF)
     166                 :             : #define SSA_OP_ALL_OPERANDS     (SSA_OP_ALL_USES | SSA_OP_ALL_DEFS)
     167                 :             : 
     168                 :             : /* This macro executes a loop over the operands of STMT specified in FLAG,
     169                 :             :    returning each operand as a 'tree' in the variable TREEVAR.  ITER is an
     170                 :             :    ssa_op_iter structure used to control the loop.  */
     171                 :             : #define FOR_EACH_SSA_TREE_OPERAND(TREEVAR, STMT, ITER, FLAGS)   \
     172                 :             :   for (TREEVAR = op_iter_init_tree (&(ITER), STMT, FLAGS);  \
     173                 :             :        !op_iter_done (&(ITER));                                     \
     174                 :             :        (void) (TREEVAR = op_iter_next_tree (&(ITER))))
     175                 :             : 
     176                 :             : /* This macro executes a loop over the operands of STMT specified in FLAG,
     177                 :             :    returning each operand as a 'use_operand_p' in the variable USEVAR.
     178                 :             :    ITER is an ssa_op_iter structure used to control the loop.  */
     179                 :             : #define FOR_EACH_SSA_USE_OPERAND(USEVAR, STMT, ITER, FLAGS)     \
     180                 :             :   for (USEVAR = op_iter_init_use (&(ITER), STMT, FLAGS);    \
     181                 :             :        !op_iter_done (&(ITER));                                     \
     182                 :             :        USEVAR = op_iter_next_use (&(ITER)))
     183                 :             : 
     184                 :             : /* This macro executes a loop over the operands of STMT specified in FLAG,
     185                 :             :    returning each operand as a 'def_operand_p' in the variable DEFVAR.
     186                 :             :    ITER is an ssa_op_iter structure used to control the loop.  */
     187                 :             : #define FOR_EACH_SSA_DEF_OPERAND(DEFVAR, STMT, ITER, FLAGS)     \
     188                 :             :   for (DEFVAR = op_iter_init_def (&(ITER), STMT, FLAGS);    \
     189                 :             :        !op_iter_done (&(ITER));                                     \
     190                 :             :        DEFVAR = op_iter_next_def (&(ITER)))
     191                 :             : 
     192                 :             : /* This macro will execute a loop over all the arguments of a PHI which
     193                 :             :    match FLAGS.   A use_operand_p is always returned via USEVAR.  FLAGS
     194                 :             :    can be either SSA_OP_USE or SSA_OP_VIRTUAL_USES or SSA_OP_ALL_USES.  */
     195                 :             : #define FOR_EACH_PHI_ARG(USEVAR, STMT, ITER, FLAGS)             \
     196                 :             :   for ((USEVAR) = op_iter_init_phiuse (&(ITER), STMT, FLAGS);       \
     197                 :             :        !op_iter_done (&(ITER));                                     \
     198                 :             :        (USEVAR) = op_iter_next_use (&(ITER)))
     199                 :             : 
     200                 :             : 
     201                 :             : /* This macro will execute a loop over a stmt, regardless of whether it is
     202                 :             :    a real stmt or a PHI node, looking at the USE nodes matching FLAGS.  */
     203                 :             : #define FOR_EACH_PHI_OR_STMT_USE(USEVAR, STMT, ITER, FLAGS)     \
     204                 :             :   for ((USEVAR) = (gimple_code (STMT) == GIMPLE_PHI             \
     205                 :             :                    ? op_iter_init_phiuse (&(ITER),              \
     206                 :             :                                           as_a <gphi *> (STMT), \
     207                 :             :                                           FLAGS)                \
     208                 :             :                    : op_iter_init_use (&(ITER), STMT, FLAGS));      \
     209                 :             :        !op_iter_done (&(ITER));                                     \
     210                 :             :        (USEVAR) = op_iter_next_use (&(ITER)))
     211                 :             : 
     212                 :             : /* This macro will execute a loop over a stmt, regardless of whether it is
     213                 :             :    a real stmt or a PHI node, looking at the DEF nodes matching FLAGS.  */
     214                 :             : #define FOR_EACH_PHI_OR_STMT_DEF(DEFVAR, STMT, ITER, FLAGS)     \
     215                 :             :   for ((DEFVAR) = (gimple_code (STMT) == GIMPLE_PHI             \
     216                 :             :                    ? op_iter_init_phidef (&(ITER),          \
     217                 :             :                                           as_a <gphi *> (STMT), \
     218                 :             :                                           FLAGS)                \
     219                 :             :                    : op_iter_init_def (&(ITER), STMT, FLAGS));      \
     220                 :             :        !op_iter_done (&(ITER));                                     \
     221                 :             :        (DEFVAR) = op_iter_next_def (&(ITER)))
     222                 :             : 
     223                 :             : /* This macro returns an operand in STMT as a tree if it is the ONLY
     224                 :             :    operand matching FLAGS.  If there are 0 or more than 1 operand matching
     225                 :             :    FLAGS, then NULL_TREE is returned.  */
     226                 :             : #define SINGLE_SSA_TREE_OPERAND(STMT, FLAGS)                    \
     227                 :             :   single_ssa_tree_operand (STMT, FLAGS)
     228                 :             : 
     229                 :             : /* This macro returns an operand in STMT as a use_operand_p if it is the ONLY
     230                 :             :    operand matching FLAGS.  If there are 0 or more than 1 operand matching
     231                 :             :    FLAGS, then NULL_USE_OPERAND_P is returned.  */
     232                 :             : #define SINGLE_SSA_USE_OPERAND(STMT, FLAGS)                     \
     233                 :             :   single_ssa_use_operand (STMT, FLAGS)
     234                 :             : 
     235                 :             : /* This macro returns an operand in STMT as a def_operand_p if it is the ONLY
     236                 :             :    operand matching FLAGS.  If there are 0 or more than 1 operand matching
     237                 :             :    FLAGS, then NULL_DEF_OPERAND_P is returned.  */
     238                 :             : #define SINGLE_SSA_DEF_OPERAND(STMT, FLAGS)                     \
     239                 :             :   single_ssa_def_operand (STMT, FLAGS)
     240                 :             : 
     241                 :             : /* This macro returns TRUE if there are no operands matching FLAGS in STMT.  */
     242                 :             : #define ZERO_SSA_OPERANDS(STMT, FLAGS)  zero_ssa_operands (STMT, FLAGS)
     243                 :             : 
     244                 :             : /* This macro counts the number of operands in STMT matching FLAGS.  */
     245                 :             : #define NUM_SSA_OPERANDS(STMT, FLAGS)   num_ssa_operands (STMT, FLAGS)
     246                 :             : 
     247                 :             : 
     248                 :             : /* Delink an immediate_uses node from its chain.  */
     249                 :             : inline void
     250                 :  1172368889 : delink_imm_use (ssa_use_operand_t *linknode)
     251                 :             : {
     252                 :             :   /* Return if this node is not in a list.  */
     253                 :  1045448732 :   if (linknode->prev == NULL)
     254                 :             :     return;
     255                 :             : 
     256                 :   692195841 :   linknode->prev->next = linknode->next;
     257                 :   692195841 :   linknode->next->prev = linknode->prev;
     258                 :   692195841 :   linknode->prev = NULL;
     259                 :   397247425 :   linknode->next = NULL;
     260                 :             : }
     261                 :             : 
     262                 :             : /* Link ssa_imm_use node LINKNODE into the chain for LIST.  */
     263                 :             : inline void
     264                 :   778857247 : link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list)
     265                 :             : {
     266                 :             :   /* Link the new node at the head of the list.  If we are in the process of
     267                 :             :      traversing the list, we won't visit any new nodes added to it.  */
     268                 :   778857247 :   linknode->prev = list;
     269                 :   778857247 :   linknode->next = list->next;
     270                 :   778857247 :   list->next->prev = linknode;
     271                 :   778857247 :   list->next = linknode;
     272                 :   444910688 : }
     273                 :             : 
     274                 :             : /* Link ssa_imm_use node LINKNODE into the chain for DEF.  */
     275                 :             : inline void
     276                 :   611846431 : link_imm_use (ssa_use_operand_t *linknode, tree def)
     277                 :             : {
     278                 :   611846431 :   ssa_use_operand_t *root;
     279                 :             : 
     280                 :   611846431 :   if (!def || TREE_CODE (def) != SSA_NAME)
     281                 :   166935743 :     linknode->prev = NULL;
     282                 :             :   else
     283                 :             :     {
     284                 :   444910688 :       root = &(SSA_NAME_IMM_USE_NODE (def));
     285                 :   444910688 :       if (linknode->use)
     286                 :   444910688 :         gcc_checking_assert (*(linknode->use) == def);
     287                 :   444910688 :       link_imm_use_to_list (linknode, root);
     288                 :             :     }
     289                 :   611846431 : }
     290                 :             : 
     291                 :             : /* Set the value of a use pointed to by USE to VAL.  */
     292                 :             : inline void
     293                 :   347726892 : set_ssa_use_from_ptr (use_operand_p use, tree val)
     294                 :             : {
     295                 :   347726892 :   delink_imm_use (use);
     296                 :   347726892 :   *(use->use) = val;
     297                 :   347726892 :   link_imm_use (use, val);
     298                 :   347726892 : }
     299                 :             : 
     300                 :             : /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
     301                 :             :    in STMT.  */
     302                 :             : inline void
     303                 :   264119539 : link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple *stmt)
     304                 :             : {
     305                 :   264119539 :   if (stmt)
     306                 :   264119539 :     link_imm_use (linknode, def);
     307                 :             :   else
     308                 :           0 :     link_imm_use (linknode, NULL);
     309                 :   264119539 :   linknode->loc.stmt = stmt;
     310                 :           0 : }
     311                 :             : 
     312                 :             : /* Relink a new node in place of an old node in the list.  */
     313                 :             : inline void
     314                 :    49311137 : relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
     315                 :             : {
     316                 :             :   /* The node one had better be in the same list.  */
     317                 :    49311137 :   gcc_checking_assert (*(old->use) == *(node->use));
     318                 :    49311137 :   node->prev = old->prev;
     319                 :    49311137 :   node->next = old->next;
     320                 :    49311137 :   if (old->prev)
     321                 :             :     {
     322                 :    39745503 :       old->prev->next = node;
     323                 :    39745503 :       old->next->prev = node;
     324                 :             :       /* Remove the old node from the list.  */
     325                 :    39745503 :       old->prev = NULL;
     326                 :             :     }
     327                 :    49311137 : }
     328                 :             : 
     329                 :             : /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
     330                 :             :    in STMT.  */
     331                 :             : inline void
     332                 :     3908881 : relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old,
     333                 :             :                      gimple *stmt)
     334                 :             : {
     335                 :     3908881 :   if (stmt)
     336                 :     3908881 :     relink_imm_use (linknode, old);
     337                 :             :   else
     338                 :             :     link_imm_use (linknode, NULL);
     339                 :     3908881 :   linknode->loc.stmt = stmt;
     340                 :             : }
     341                 :             : 
     342                 :             : 
     343                 :             : /* Return true is IMM has reached the end of the immediate use list.  */
     344                 :             : inline bool
     345                 :  2649218067 : end_readonly_imm_use_p (const imm_use_iterator *imm)
     346                 :             : {
     347                 :  1630487058 :   return (imm->imm_use == imm->end_p);
     348                 :             : }
     349                 :             : 
     350                 :             : /* Initialize iterator IMM to process the list for VAR.  */
     351                 :             : inline use_operand_p
     352                 :   620209441 : first_readonly_imm_use (imm_use_iterator *imm, tree var)
     353                 :             : {
     354                 :   620209441 :   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
     355                 :   620209441 :   imm->imm_use = imm->end_p->next;
     356                 :   620209441 :   imm->iter_node.next = imm->imm_use->next;
     357                 :   620209441 :   if (end_readonly_imm_use_p (imm))
     358                 :    81468436 :     return NULL_USE_OPERAND_P;
     359                 :             :   return imm->imm_use;
     360                 :             : }
     361                 :             : 
     362                 :             : /* Bump IMM to the next use in the list.  */
     363                 :             : inline use_operand_p
     364                 :  1014504313 : next_readonly_imm_use (imm_use_iterator *imm)
     365                 :             : {
     366                 :  1014504313 :   use_operand_p old = imm->imm_use;
     367                 :             : 
     368                 :             :   /* If this assertion fails, it indicates the 'next' pointer has changed
     369                 :             :      since the last bump.  This indicates that the list is being modified
     370                 :             :      via stmt changes, or SET_USE, or somesuch thing, and you need to be
     371                 :             :      using the SAFE version of the iterator.  */
     372                 :  1014504313 :   if (flag_checking)
     373                 :             :     {
     374                 :  1014500058 :       gcc_assert (imm->iter_node.next == old->next);
     375                 :  1014500058 :       imm->iter_node.next = old->next->next;
     376                 :             :     }
     377                 :             : 
     378                 :  1014504313 :   imm->imm_use = old->next;
     379                 :  1014504313 :   if (end_readonly_imm_use_p (imm))
     380                 :   484698300 :     return NULL_USE_OPERAND_P;
     381                 :             :   return imm->imm_use;
     382                 :             : }
     383                 :             : 
     384                 :             : 
     385                 :             : /* Return true if VAR has no nondebug uses.  */
     386                 :             : inline bool
     387                 :   653479388 : has_zero_uses (const_tree var)
     388                 :             : {
     389                 :   653479388 :   const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
     390                 :   653479388 :   const ssa_use_operand_t *ptr;
     391                 :             : 
     392                 :   678348014 :   for (ptr = head->next; ptr != head; ptr = ptr->next)
     393                 :   639198990 :     if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
     394                 :             :       return false;
     395                 :             : 
     396                 :             :   return true;
     397                 :             : }
     398                 :             : 
     399                 :             : /* Return true if VAR has a single nondebug use.  */
     400                 :             : inline bool
     401                 :   691797332 : has_single_use (const_tree var)
     402                 :             : {
     403                 :   691797332 :   const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
     404                 :   691797332 :   const ssa_use_operand_t *ptr;
     405                 :   691797332 :   bool single = false;
     406                 :             :    
     407                 :  1484988607 :   for (ptr = head->next; ptr != head; ptr = ptr->next)
     408                 :  1139564843 :     if (USE_STMT(ptr) && !is_gimple_debug (USE_STMT (ptr)))
     409                 :             :       {
     410                 :  1037823019 :         if (single)
     411                 :             :           return false;
     412                 :             :         else 
     413                 :             :           single = true;
     414                 :             :       }
     415                 :             : 
     416                 :             :   return single;
     417                 :             : }
     418                 :             :     
     419                 :             : /* If VAR has only a single immediate nondebug use, return true, and
     420                 :             :    set USE_P and STMT to the use pointer and stmt of occurrence.  */
     421                 :             : inline bool
     422                 :   221943698 : single_imm_use (const_tree var, use_operand_p *use_p, gimple **stmt)
     423                 :             : {
     424                 :   221943698 :   const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
     425                 :             : 
     426                 :             :   /* If there aren't any uses whatsoever, we're done.  */
     427                 :   221943698 :   if (ptr == ptr->next)
     428                 :             :     {
     429                 :      117640 :     return_false:
     430                 :      123151 :       *use_p = NULL_USE_OPERAND_P;
     431                 :      123151 :       *stmt = NULL;
     432                 :      123151 :       return false;
     433                 :             :     }
     434                 :             : 
     435                 :             :   /* If there's a single use, check that it's not a debug stmt.  */
     436                 :   221826058 :   if (ptr == ptr->next->next)
     437                 :             :     {
     438                 :   196766810 :       if (USE_STMT (ptr->next) && !is_gimple_debug (USE_STMT (ptr->next)))
     439                 :             :         {
     440                 :   196761299 :           *use_p = ptr->next;
     441                 :   196761299 :           *stmt = ptr->next->loc.stmt;
     442                 :   196761299 :           return true;
     443                 :             :         }
     444                 :             :       else
     445                 :        5511 :         goto return_false;
     446                 :             :     }
     447                 :             : 
     448                 :    25059248 :   return single_imm_use_1 (ptr, use_p, stmt);
     449                 :             : }
     450                 :             : 
     451                 :             : /* Return the number of nondebug immediate uses of VAR.  */
     452                 :             : inline unsigned int
     453                 :         508 : num_imm_uses (const_tree var)
     454                 :             : {
     455                 :         508 :   const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var));
     456                 :         508 :   const ssa_use_operand_t *ptr;
     457                 :         508 :   unsigned int num = 0;
     458                 :             : 
     459                 :         508 :   if (!MAY_HAVE_DEBUG_BIND_STMTS)
     460                 :             :     {
     461                 :         236 :       for (ptr = start->next; ptr != start; ptr = ptr->next)
     462                 :         165 :         if (USE_STMT (ptr))
     463                 :         165 :           num++;
     464                 :             :     }
     465                 :             :   else
     466                 :        2029 :     for (ptr = start->next; ptr != start; ptr = ptr->next)
     467                 :        1592 :       if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
     468                 :        1592 :         num++;
     469                 :             : 
     470                 :         508 :   return num;
     471                 :             : }
     472                 :             : 
     473                 :             : /*  -----------------------------------------------------------------------  */
     474                 :             : 
     475                 :             : /* The following set of routines are used to iterator over various type of
     476                 :             :    SSA operands.  */
     477                 :             : 
     478                 :             : /* Return true if PTR is finished iterating.  */
     479                 :             : inline bool
     480                 : 55286156149 : op_iter_done (const ssa_op_iter *ptr)
     481                 :             : {
     482                 : 54310160667 :   return ptr->done;
     483                 :             : }
     484                 :             : 
     485                 :             : /* Get the next iterator use value for PTR.  */
     486                 :             : inline use_operand_p
     487                 : 36547550088 : op_iter_next_use (ssa_op_iter *ptr)
     488                 :             : {
     489                 : 36547550088 :   use_operand_p use_p;
     490                 : 36547550088 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_use);
     491                 : 36547550088 :   if (ptr->uses)
     492                 :             :     {
     493                 : 15445601568 :       use_p = USE_OP_PTR (ptr->uses);
     494                 : 15445601568 :       ptr->uses = ptr->uses->next;
     495                 : 15445601568 :       return use_p;
     496                 :             :     }
     497                 : 21101948520 :   if (ptr->i < ptr->numops)
     498                 :             :     {
     499                 :   246205423 :       return PHI_ARG_DEF_PTR (ptr->stmt, (ptr->i)++);
     500                 :             :     }
     501                 : 20855743097 :   ptr->done = true;
     502                 : 20855743097 :   return NULL_USE_OPERAND_P;
     503                 :             : }
     504                 :             : 
     505                 :             : /* Get the next iterator def value for PTR.  */
     506                 :             : inline def_operand_p
     507                 :  1366534225 : op_iter_next_def (ssa_op_iter *ptr)
     508                 :             : {
     509                 :  1366534225 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_def);
     510                 :  1366534225 :   if (ptr->flags & SSA_OP_VDEF)
     511                 :             :     {
     512                 :   143797161 :       tree *p;
     513                 :   143797161 :       ptr->flags &= ~SSA_OP_VDEF;
     514                 :   143797161 :       p = gimple_vdef_ptr (ptr->stmt);
     515                 :   143797161 :       if (p && *p)
     516                 :             :         return p;
     517                 :             :     }
     518                 :  1272784438 :   if (ptr->flags & SSA_OP_DEF)
     519                 :             :     {
     520                 :   805400212 :       while (ptr->i < ptr->numops)
     521                 :             :         {
     522                 :   403231387 :           tree *val = gimple_op_ptr (ptr->stmt, ptr->i);
     523                 :   403231387 :           ptr->i++;
     524                 :   403231387 :           if (*val)
     525                 :             :             {
     526                 :   363201672 :               if (TREE_CODE (*val) == TREE_LIST)
     527                 :     1082120 :                 val = &TREE_VALUE (*val);
     528                 :   363201672 :               if (TREE_CODE (*val) == SSA_NAME
     529                 :   363201672 :                   || is_gimple_reg (*val))
     530                 :   250228663 :                 return val;
     531                 :             :             }
     532                 :             :         }
     533                 :   402168825 :       ptr->flags &= ~SSA_OP_DEF;
     534                 :             :     }
     535                 :             : 
     536                 :  1022555775 :   ptr->done = true;
     537                 :  1022555775 :   return NULL_DEF_OPERAND_P;
     538                 :             : }
     539                 :             : 
     540                 :             : /* Get the next iterator tree value for PTR.  */
     541                 :             : inline tree
     542                 : 17359531738 : op_iter_next_tree (ssa_op_iter *ptr)
     543                 :             : {
     544                 : 17359531738 :   tree val;
     545                 : 17359531738 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_tree);
     546                 : 17359531738 :   if (ptr->uses)
     547                 :             :     {
     548                 :   916130601 :       val = USE_OP (ptr->uses);
     549                 :   916130601 :       ptr->uses = ptr->uses->next;
     550                 :   916130601 :       return val;
     551                 :             :     }
     552                 : 16443401137 :   if (ptr->flags & SSA_OP_VDEF)
     553                 :             :     {
     554                 :  4861815033 :       ptr->flags &= ~SSA_OP_VDEF;
     555                 :  9723630066 :       if ((val = gimple_vdef (ptr->stmt)))
     556                 :             :         return val;
     557                 :             :     }
     558                 : 14311414929 :   if (ptr->flags & SSA_OP_DEF)
     559                 :             :     {
     560                 : 10658850404 :       while (ptr->i < ptr->numops)
     561                 :             :         {
     562                 :  5329445618 :           val = gimple_op (ptr->stmt, ptr->i);
     563                 :  5329445618 :           ptr->i++;
     564                 :  5329445618 :           if (val)
     565                 :             :             {
     566                 :  4740673932 :               if (TREE_CODE (val) == TREE_LIST)
     567                 :    15590209 :                 val = TREE_VALUE (val);
     568                 :  4740673932 :               if (TREE_CODE (val) == SSA_NAME
     569                 :  4740673932 :                   || is_gimple_reg (val))
     570                 :  3209818752 :                 return val;
     571                 :             :             }
     572                 :             :         }
     573                 :  5329404786 :       ptr->flags &= ~SSA_OP_DEF;
     574                 :             :     }
     575                 :             : 
     576                 : 11101596177 :   ptr->done = true;
     577                 : 11101596177 :   return NULL_TREE;
     578                 :             : }
     579                 :             : 
     580                 :             : 
     581                 :             : /* This functions clears the iterator PTR, and marks it done.  This is normally
     582                 :             :    used to prevent warnings in the compile about might be uninitialized
     583                 :             :    components.  */
     584                 :             : 
     585                 :             : inline void
     586                 :    65274138 : clear_and_done_ssa_iter (ssa_op_iter *ptr)
     587                 :             : {
     588                 :    65274138 :   ptr->i = 0;
     589                 :    65274138 :   ptr->numops = 0;
     590                 :    65274138 :   ptr->uses = NULL;
     591                 :    65274138 :   ptr->iter_type = ssa_op_iter_none;
     592                 :    65274138 :   ptr->stmt = NULL;
     593                 :    65274138 :   ptr->done = true;
     594                 :    65274138 :   ptr->flags = 0;
     595                 :             : }
     596                 :             : 
     597                 :             : /* Initialize the iterator PTR to the virtual defs in STMT.  */
     598                 :             : inline void
     599                 : 33079328868 : op_iter_init (ssa_op_iter *ptr, gimple *stmt, int flags)
     600                 :             : {
     601                 :             :   /* PHI nodes require a different iterator initialization path.  We
     602                 :             :      do not support iterating over virtual defs or uses without
     603                 :             :      iterating over defs or uses at the same time.  */
     604                 : 33079328868 :   gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI
     605                 :             :                        && (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF))
     606                 :             :                        && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE)));
     607                 : 33079328868 :   ptr->numops = 0;
     608                 : 33079328868 :   if (flags & (SSA_OP_DEF | SSA_OP_VDEF))
     609                 :             :     {
     610                 : 11337317209 :       switch (gimple_code (stmt))
     611                 :             :         {
     612                 :  5716227014 :           case GIMPLE_ASSIGN:
     613                 :  5716227014 :           case GIMPLE_CALL:
     614                 :  5716227014 :             ptr->numops = 1;
     615                 :  5716227014 :             break;
     616                 :    16869588 :           case GIMPLE_ASM:
     617                 :    16869588 :             ptr->numops = gimple_asm_noutputs (as_a <gasm *> (stmt));
     618                 :    16869588 :             break;
     619                 :       37413 :           case GIMPLE_TRANSACTION:
     620                 :       37413 :             ptr->numops = 0;
     621                 :       37413 :             flags &= ~SSA_OP_DEF;
     622                 :       37413 :             break;
     623                 :  5604183194 :           default:
     624                 :  5604183194 :             ptr->numops = 0;
     625                 :  5604183194 :             flags &= ~(SSA_OP_DEF | SSA_OP_VDEF);
     626                 :  5604183194 :             break;
     627                 :             :         }
     628                 :             :     }
     629                 : 33079328868 :   ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL;
     630                 : 33079328868 :   if (!(flags & SSA_OP_VUSE)
     631                 : 23416243484 :       && ptr->uses
     632                 : 38818392980 :       && gimple_vuse (stmt) != NULL_TREE)
     633                 :  3682930787 :     ptr->uses = ptr->uses->next;
     634                 : 33079328868 :   ptr->done = false;
     635                 : 33079328868 :   ptr->i = 0;
     636                 :             : 
     637                 : 33079328868 :   ptr->stmt = stmt;
     638                 : 33079328868 :   ptr->flags = flags;
     639                 : 33079328868 : }
     640                 :             : 
     641                 :             : /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
     642                 :             :    the first use.  */
     643                 :             : inline use_operand_p
     644                 : 20916953612 : op_iter_init_use (ssa_op_iter *ptr, gimple *stmt, int flags)
     645                 :             : {
     646                 : 20916953612 :   gcc_checking_assert ((flags & SSA_OP_ALL_DEFS) == 0
     647                 :             :                        && (flags & SSA_OP_USE));
     648                 : 20916953612 :   op_iter_init (ptr, stmt, flags);
     649                 : 20916953612 :   ptr->iter_type = ssa_op_iter_use;
     650                 : 20916953612 :   return op_iter_next_use (ptr);
     651                 :             : }
     652                 :             : 
     653                 :             : /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
     654                 :             :    the first def.  */
     655                 :             : inline def_operand_p
     656                 :  1017553840 : op_iter_init_def (ssa_op_iter *ptr, gimple *stmt, int flags)
     657                 :             : {
     658                 :  1017553840 :   gcc_checking_assert ((flags & SSA_OP_ALL_USES) == 0
     659                 :             :                        && (flags & SSA_OP_DEF));
     660                 :  1017553840 :   op_iter_init (ptr, stmt, flags);
     661                 :  1017553840 :   ptr->iter_type = ssa_op_iter_def;
     662                 :  1017553840 :   return op_iter_next_def (ptr);
     663                 :             : }
     664                 :             : 
     665                 :             : /* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
     666                 :             :    the first operand as a tree.  */
     667                 :             : inline tree
     668                 : 11144821416 : op_iter_init_tree (ssa_op_iter *ptr, gimple *stmt, int flags)
     669                 :             : {
     670                 : 11144821416 :   op_iter_init (ptr, stmt, flags);
     671                 : 11144821416 :   ptr->iter_type = ssa_op_iter_tree;
     672                 : 11144821416 :   return op_iter_next_tree (ptr);
     673                 :             : }
     674                 :             : 
     675                 :             : 
     676                 :             : /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
     677                 :             :    return NULL.  */
     678                 :             : inline tree
     679                 :    74858666 : single_ssa_tree_operand (gimple *stmt, int flags)
     680                 :             : {
     681                 :    74858666 :   tree var;
     682                 :    74858666 :   ssa_op_iter iter;
     683                 :             : 
     684                 :    74858666 :   var = op_iter_init_tree (&iter, stmt, flags);
     685                 :    74858666 :   if (op_iter_done (&iter))
     686                 :             :     return NULL_TREE;
     687                 :    68562678 :   op_iter_next_tree (&iter);
     688                 :    68562678 :   if (op_iter_done (&iter))
     689                 :             :     return var;
     690                 :             :   return NULL_TREE;
     691                 :             : }
     692                 :             : 
     693                 :             : 
     694                 :             : /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
     695                 :             :    return NULL.  */
     696                 :             : inline use_operand_p
     697                 :       80959 : single_ssa_use_operand (gimple *stmt, int flags)
     698                 :             : {
     699                 :       80959 :   use_operand_p var;
     700                 :       80959 :   ssa_op_iter iter;
     701                 :             : 
     702                 :       80959 :   var = op_iter_init_use (&iter, stmt, flags);
     703                 :       80959 :   if (op_iter_done (&iter))
     704                 :             :     return NULL_USE_OPERAND_P;
     705                 :       78848 :   op_iter_next_use (&iter);
     706                 :       78848 :   if (op_iter_done (&iter))
     707                 :             :     return var;
     708                 :             :   return NULL_USE_OPERAND_P;
     709                 :             : }
     710                 :             : 
     711                 :             : /* Return the single virtual use operand in STMT if present.  Otherwise
     712                 :             :    return NULL.  */
     713                 :             : inline use_operand_p
     714                 :      117184 : ssa_vuse_operand (gimple *stmt)
     715                 :             : {
     716                 :      213617 :   if (! gimple_vuse (stmt))
     717                 :             :     return NULL_USE_OPERAND_P;
     718                 :        9734 :   return USE_OP_PTR (gimple_use_ops (stmt));
     719                 :             : }
     720                 :             : 
     721                 :             : 
     722                 :             : /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
     723                 :             :    return NULL.  */
     724                 :             : inline def_operand_p
     725                 :   299644724 : single_ssa_def_operand (gimple *stmt, int flags)
     726                 :             : {
     727                 :   299644724 :   def_operand_p var;
     728                 :   299644724 :   ssa_op_iter iter;
     729                 :             : 
     730                 :   299644724 :   var = op_iter_init_def (&iter, stmt, flags);
     731                 :   299644724 :   if (op_iter_done (&iter))
     732                 :             :     return NULL_DEF_OPERAND_P;
     733                 :   115399033 :   op_iter_next_def (&iter);
     734                 :   115399033 :   if (op_iter_done (&iter))
     735                 :             :     return var;
     736                 :             :   return NULL_DEF_OPERAND_P;
     737                 :             : }
     738                 :             : 
     739                 :             : 
     740                 :             : /* Return true if there are zero operands in STMT matching the type
     741                 :             :    given in FLAGS.  */
     742                 :             : inline bool
     743                 :    10452028 : zero_ssa_operands (gimple *stmt, int flags)
     744                 :             : {
     745                 :    10452028 :   ssa_op_iter iter;
     746                 :             : 
     747                 :    10452028 :   op_iter_init_tree (&iter, stmt, flags);
     748                 :    10452028 :   return op_iter_done (&iter);
     749                 :             : }
     750                 :             : 
     751                 :             : 
     752                 :             : /* Return the number of operands matching FLAGS in STMT.  */
     753                 :             : inline int
     754                 :    41352995 : num_ssa_operands (gimple *stmt, int flags)
     755                 :             : {
     756                 :    41352995 :   ssa_op_iter iter;
     757                 :    41352995 :   tree t;
     758                 :    41352995 :   int num = 0;
     759                 :             : 
     760                 :    41352995 :   gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI);
     761                 :   100717000 :   FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags)
     762                 :    59364005 :     num++;
     763                 :    41352995 :   return num;
     764                 :             : }
     765                 :             : 
     766                 :             : /* If there is a single DEF in the PHI node which matches FLAG, return it.
     767                 :             :    Otherwise return NULL_DEF_OPERAND_P.  */
     768                 :             : inline tree
     769                 :             : single_phi_def (gphi *stmt, int flags)
     770                 :             : {
     771                 :             :   tree def = PHI_RESULT (stmt);
     772                 :             :   if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
     773                 :             :     return def;
     774                 :             :   if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
     775                 :             :     return def;
     776                 :             :   return NULL_TREE;
     777                 :             : }
     778                 :             : 
     779                 :             : /* Initialize the iterator PTR for uses matching FLAGS in PHI.  FLAGS should
     780                 :             :    be either SSA_OP_USES or SSA_OP_VIRTUAL_USES.  */
     781                 :             : inline use_operand_p
     782                 :    54569418 : op_iter_init_phiuse (ssa_op_iter *ptr, gphi *phi, int flags)
     783                 :             : {
     784                 :    54569418 :   tree phi_def = gimple_phi_result (phi);
     785                 :    54569418 :   int comp;
     786                 :             : 
     787                 :    54569418 :   clear_and_done_ssa_iter (ptr);
     788                 :    54569418 :   ptr->done = false;
     789                 :             : 
     790                 :    54569418 :   gcc_checking_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
     791                 :             : 
     792                 :    54569418 :   comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
     793                 :             : 
     794                 :             :   /* If the PHI node doesn't the operand type we care about, we're done.  */
     795                 :    54569418 :   if ((flags & comp) == 0)
     796                 :             :     {
     797                 :     3023003 :       ptr->done = true;
     798                 :     3023003 :       return NULL_USE_OPERAND_P;
     799                 :             :     }
     800                 :             : 
     801                 :    51546415 :   ptr->stmt = phi;
     802                 :    51546415 :   ptr->numops = gimple_phi_num_args (phi);
     803                 :    51546415 :   ptr->iter_type = ssa_op_iter_use;
     804                 :    51546415 :   ptr->flags = flags;
     805                 :    51546415 :   return op_iter_next_use (ptr);
     806                 :             : }
     807                 :             : 
     808                 :             : 
     809                 :             : /* Start an iterator for a PHI definition.  */
     810                 :             : 
     811                 :             : inline def_operand_p
     812                 :    10704720 : op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
     813                 :             : {
     814                 :    10704720 :   tree phi_def = PHI_RESULT (phi);
     815                 :    10704720 :   int comp;
     816                 :             : 
     817                 :    10704720 :   clear_and_done_ssa_iter (ptr);
     818                 :    10704720 :   ptr->done = false;
     819                 :             : 
     820                 :    10704720 :   gcc_checking_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
     821                 :             : 
     822                 :    10704720 :   comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
     823                 :             : 
     824                 :             :   /* If the PHI node doesn't have the operand type we care about,
     825                 :             :      we're done.  */
     826                 :    10704720 :   if ((flags & comp) == 0)
     827                 :             :     {
     828                 :     4772710 :       ptr->done = true;
     829                 :     4772710 :       return NULL_DEF_OPERAND_P;
     830                 :             :     }
     831                 :             : 
     832                 :     5932010 :   ptr->iter_type = ssa_op_iter_def;
     833                 :             :   /* The first call to op_iter_next_def will terminate the iterator since
     834                 :             :      all the fields are NULL.  Simply return the result here as the first and
     835                 :             :      therefore only result.  */
     836                 :     5932010 :   return PHI_RESULT_PTR (phi);
     837                 :             : }
     838                 :             : 
     839                 :             : /* Return true is IMM has reached the end of the immediate use stmt list.  */
     840                 :             : 
     841                 :             : inline bool
     842                 :   854309827 : end_imm_use_stmt_p (const imm_use_iterator *imm)
     843                 :             : {
     844                 :   559347537 :   return (imm->imm_use == imm->end_p);
     845                 :             : }
     846                 :             : 
     847                 :             : /* Finished the traverse of an immediate use stmt list IMM by removing the
     848                 :             :    placeholder node from the list.  */
     849                 :             : 
     850                 :             : inline void
     851                 :   263880592 : end_imm_use_stmt_traverse (imm_use_iterator *imm)
     852                 :             : {
     853                 :   263880592 :   delink_imm_use (&(imm->iter_node));
     854                 :             : }
     855                 :             : 
     856                 :             : /* Immediate use traversal of uses within a stmt require that all the
     857                 :             :    uses on a stmt be sequentially listed.  This routine is used to build up
     858                 :             :    this sequential list by adding USE_P to the end of the current list
     859                 :             :    currently delimited by HEAD and LAST_P.  The new LAST_P value is
     860                 :             :    returned.  */
     861                 :             : 
     862                 :             : inline use_operand_p
     863                 :   335555683 : move_use_after_head (use_operand_p use_p, use_operand_p head,
     864                 :             :                       use_operand_p last_p)
     865                 :             : {
     866                 :   335555683 :   gcc_checking_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
     867                 :             :   /* Skip head when we find it.  */
     868                 :   335555683 :   if (use_p != head)
     869                 :             :     {
     870                 :             :       /* If use_p is already linked in after last_p, continue.  */
     871                 :     2657467 :       if (last_p->next == use_p)
     872                 :             :         last_p = use_p;
     873                 :             :       else
     874                 :             :         {
     875                 :             :           /* Delink from current location, and link in at last_p.  */
     876                 :     1048343 :           delink_imm_use (use_p);
     877                 :     1048343 :           link_imm_use_to_list (use_p, last_p);
     878                 :     1048343 :           last_p = use_p;
     879                 :             :         }
     880                 :             :     }
     881                 :   335555683 :   return last_p;
     882                 :             : }
     883                 :             : 
     884                 :             : 
     885                 :             : /* This routine will relink all uses with the same stmt as HEAD into the list
     886                 :             :    immediately following HEAD for iterator IMM.  */
     887                 :             : 
     888                 :             : inline void
     889                 :   332898216 : link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
     890                 :             : {
     891                 :   332898216 :   use_operand_p use_p;
     892                 :   332898216 :   use_operand_p last_p = head;
     893                 :   332898216 :   gimple *head_stmt = USE_STMT (head);
     894                 :   332898216 :   tree use = USE_FROM_PTR (head);
     895                 :   332898216 :   ssa_op_iter op_iter;
     896                 :   332898216 :   int flag;
     897                 :             : 
     898                 :             :   /* Only look at virtual or real uses, depending on the type of HEAD.  */
     899                 :   332898216 :   flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
     900                 :             : 
     901                 :   332898216 :   if (gphi *phi = dyn_cast <gphi *> (head_stmt))
     902                 :             :     {
     903                 :   220702295 :       FOR_EACH_PHI_ARG (use_p, phi, op_iter, flag)
     904                 :   193576551 :         if (USE_FROM_PTR (use_p) == use)
     905                 :    29507796 :           last_p = move_use_after_head (use_p, head, last_p);
     906                 :             :     }
     907                 :             :   else
     908                 :             :     {
     909                 :   305772472 :       if (flag == SSA_OP_USE)
     910                 :             :         {
     911                 :   189397689 :           FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag)
     912                 :   114142164 :             if (USE_FROM_PTR (use_p) == use)
     913                 :    75530940 :               last_p = move_use_after_head (use_p, head, last_p);
     914                 :             :         }
     915                 :   230516947 :       else if ((use_p = gimple_vuse_op (head_stmt)) != NULL_USE_OPERAND_P)
     916                 :             :         {
     917                 :   230516947 :           if (USE_FROM_PTR (use_p) == use)
     918                 :   230516947 :             last_p = move_use_after_head (use_p, head, last_p);
     919                 :             :         }
     920                 :             :     }
     921                 :             :   /* Link iter node in after last_p.  */
     922                 :   332898216 :   if (imm->iter_node.prev != NULL)
     923                 :    71933443 :     delink_imm_use (&imm->iter_node);
     924                 :   332898216 :   link_imm_use_to_list (&(imm->iter_node), last_p);
     925                 :   332898216 : }
     926                 :             : 
     927                 :             : /* Initialize IMM to traverse over uses of VAR.  Return the first statement.  */
     928                 :             : inline gimple *
     929                 :   263880592 : first_imm_use_stmt (imm_use_iterator *imm, tree var)
     930                 :             : {
     931                 :   263880592 :   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
     932                 :   263880592 :   imm->imm_use = imm->end_p->next;
     933                 :   263880592 :   imm->next_imm_name = NULL_USE_OPERAND_P;
     934                 :             : 
     935                 :             :   /* iter_node is used as a marker within the immediate use list to indicate
     936                 :             :      where the end of the current stmt's uses are.  Initialize it to NULL
     937                 :             :      stmt and use, which indicates a marker node.  */
     938                 :   263880592 :   imm->iter_node.prev = NULL_USE_OPERAND_P;
     939                 :   263880592 :   imm->iter_node.next = NULL_USE_OPERAND_P;
     940                 :   263880592 :   imm->iter_node.loc.stmt = NULL;
     941                 :   263880592 :   imm->iter_node.use = NULL;
     942                 :             : 
     943                 :   263880592 :   if (end_imm_use_stmt_p (imm))
     944                 :             :     return NULL;
     945                 :             : 
     946                 :   260964773 :   link_use_stmts_after (imm->imm_use, imm);
     947                 :             : 
     948                 :   260964773 :   return USE_STMT (imm->imm_use);
     949                 :             : }
     950                 :             : 
     951                 :             : /* Bump IMM to the next stmt which has a use of var.  */
     952                 :             : 
     953                 :             : inline gimple *
     954                 :   294948416 : next_imm_use_stmt (imm_use_iterator *imm)
     955                 :             : {
     956                 :   294948416 :   imm->imm_use = imm->iter_node.next;
     957                 :   294948416 :   if (end_imm_use_stmt_p (imm))
     958                 :             :     {
     959                 :   223014973 :       if (imm->iter_node.prev != NULL)
     960                 :   223014973 :         delink_imm_use (&imm->iter_node);
     961                 :   223014973 :       return NULL;
     962                 :             :     }
     963                 :             : 
     964                 :    71933443 :   link_use_stmts_after (imm->imm_use, imm);
     965                 :    71933443 :   return USE_STMT (imm->imm_use);
     966                 :             : }
     967                 :             : 
     968                 :             : /* This routine will return the first use on the stmt IMM currently refers
     969                 :             :    to.  */
     970                 :             : 
     971                 :             : inline use_operand_p
     972                 :    38498363 : first_imm_use_on_stmt (imm_use_iterator *imm)
     973                 :             : {
     974                 :    38498363 :   imm->next_imm_name = imm->imm_use->next;
     975                 :    38493743 :   return imm->imm_use;
     976                 :             : }
     977                 :             : 
     978                 :             : /*  Return TRUE if the last use on the stmt IMM refers to has been visited.  */
     979                 :             : 
     980                 :             : inline bool
     981                 :   117458221 : end_imm_use_on_stmt_p (const imm_use_iterator *imm)
     982                 :             : {
     983                 :    77981379 :   return (imm->imm_use == &(imm->iter_node));
     984                 :             : }
     985                 :             : 
     986                 :             : /* Bump to the next use on the stmt IMM refers to, return NULL if done.  */
     987                 :             : 
     988                 :             : inline use_operand_p
     989                 :    39479929 : next_imm_use_on_stmt (imm_use_iterator *imm)
     990                 :             : {
     991                 :    39479929 :   imm->imm_use = imm->next_imm_name;
     992                 :    39479929 :   if (end_imm_use_on_stmt_p (imm))
     993                 :             :     return NULL_USE_OPERAND_P;
     994                 :             :   else
     995                 :             :     {
     996                 :      986186 :       imm->next_imm_name = imm->imm_use->next;
     997                 :      986186 :       return imm->imm_use;
     998                 :             :     }
     999                 :             : }
    1000                 :             : 
    1001                 :             : /* Delink all immediate_use information for STMT.  */
    1002                 :             : inline void
    1003                 :   133315628 : delink_stmt_imm_use (gimple *stmt)
    1004                 :             : {
    1005                 :   133315628 :    ssa_op_iter iter;
    1006                 :   133315628 :    use_operand_p use_p;
    1007                 :             : 
    1008                 :   133315628 :    if (ssa_operands_active (cfun))
    1009                 :   280938264 :      FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_ALL_USES)
    1010                 :   126522043 :        delink_imm_use (use_p);
    1011                 :   133315628 : }
    1012                 :             : 
    1013                 :             : #endif /* GCC_TREE_SSA_ITERATORS_H */
        

Generated by: LCOV version 2.0-1

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.