LCOV - code coverage report
Current view: top level - gcc - ssa-iterators.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 99.4 % 351 349
Test Date: 2025-11-22 14:42:49 Functions: 100.0 % 28 28
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-2025 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 via FOR_EACH_IMM_USE_FAST allows each use to be
      40                 :             :    examined, but does not allow any modifications to the uses or stmts.
      41                 :             : 
      42                 :             :    Safe iteration via FOR_EACH_IMM_USE_STMT and FOR_EACH_IMM_USE_ON_STMT
      43                 :             :    allows insertion, deletion, and modification of SSA operands within
      44                 :             :    the current stmt iterated.  The iterator manages this by re-sorting
      45                 :             :    the immediate uses to batch uses on a single stmt after each other.
      46                 :             :    If using an inner FOR_EACH_IMM_USE_ON_STMT iteration only the active
      47                 :             :    use may be manipulated.  Safety relies on new immediate uses being
      48                 :             :    inserted at the front of immediate use lists.  */
      49                 :             : 
      50                 :             : struct imm_use_iterator
      51                 :             : {
      52                 :             :   /* This is the current use the iterator is processing.  */
      53                 :             :   ssa_use_operand_t *imm_use;
      54                 :             :   /* This marks the last use in the list (use node from SSA_NAME)  */
      55                 :             :   ssa_use_operand_t *end_p;
      56                 :             :   /* This is the next ssa_name to visit in an outer FOR_EACH_IMM_USE_STMT.
      57                 :             :      Also used for fast imm use iterator checking.  */
      58                 :             :   ssa_use_operand_t *next_stmt_use;
      59                 :             :   /* This is the next ssa_name to visit.  IMM_USE may get removed before
      60                 :             :      the next one is traversed to, so it must be cached early.  */
      61                 :             :   ssa_use_operand_t *next_imm_name;
      62                 :             :   /* This is the SSA name iterated over.  */
      63                 :             :   tree name;
      64                 :             : };
      65                 :             : 
      66                 :             : 
      67                 :             : /* Use this iterator when simply looking at stmts.  Adding, deleting or
      68                 :             :    modifying stmts will cause this iterator to malfunction.  */
      69                 :             : 
      70                 :             : #if ! defined ENABLE_GIMPLE_CHECKING
      71                 :             : #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)               \
      72                 :             :   for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR)); \
      73                 :             :        !end_readonly_imm_use_p (&(ITER));                   \
      74                 :             :        (void) ((DEST) = next_readonly_imm_use (&(ITER))))
      75                 :             : #else
      76                 :             : 
      77                 :             : /* arrange to automatically call, upon descruction, with a given pointer
      78                 :             :    to imm_use_iterator.  */
      79                 :             : struct auto_end_imm_use_fast_traverse
      80                 :             : {
      81                 :             :   imm_use_iterator *imm;
      82                 :  1027126884 :   auto_end_imm_use_fast_traverse (imm_use_iterator *imm)
      83                 :  1027126884 :   : imm (imm) {}
      84                 :  1027126884 :   ~auto_end_imm_use_fast_traverse ()
      85                 :  1013085449 :   { imm->name->ssa_name.fast_iteration_depth--; }
      86                 :             : };
      87                 :             : 
      88                 :             : #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)               \
      89                 :             :   for (struct auto_end_imm_use_fast_traverse                    \
      90                 :             :          auto_end_imm_use_fast_traverse                         \
      91                 :             :            ((((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR))), \
      92                 :             :             &(ITER)));                                              \
      93                 :             :        !end_readonly_imm_use_p (&(ITER));                   \
      94                 :             :        (void) ((DEST) = next_readonly_imm_use (&(ITER))))
      95                 :             : #endif
      96                 :             : 
      97                 :             : /* Forward declare for use in the class below.  */
      98                 :             : inline void end_imm_use_stmt_traverse (imm_use_iterator *);
      99                 :             : 
     100                 :             : /* arrange to automatically call, upon descruction, end_imm_use_stmt_traverse
     101                 :             :    with a given pointer to imm_use_iterator.  */
     102                 :             : struct auto_end_imm_use_stmt_traverse
     103                 :             : {
     104                 :             :   imm_use_iterator *imm;
     105                 :   109172609 :   auto_end_imm_use_stmt_traverse (imm_use_iterator *imm)
     106                 :   109172609 :   : imm (imm) {}
     107                 :   109172609 :   ~auto_end_imm_use_stmt_traverse ()
     108                 :   109172609 :   { end_imm_use_stmt_traverse (imm); }
     109                 :             : };
     110                 :             : 
     111                 :             : /* Use this iterator to visit each stmt which has a use of SSAVAR.  The
     112                 :             :    destructor of the auto_end_imm_use_stmt_traverse object deals with removing
     113                 :             :    ITER from SSAVAR's IMM_USE list even when leaving the scope early.  */
     114                 :             : 
     115                 :             : #define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR)               \
     116                 :             :   for (struct auto_end_imm_use_stmt_traverse                    \
     117                 :             :          auto_end_imm_use_stmt_traverse                         \
     118                 :             :            ((((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR))),     \
     119                 :             :              &(ITER)));                                             \
     120                 :             :        !end_imm_use_stmt_p (&(ITER));                               \
     121                 :             :        (void) ((STMT) = next_imm_use_stmt (&(ITER))))
     122                 :             : 
     123                 :             : /* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to
     124                 :             :    get access to each occurrence of ssavar on the stmt returned by
     125                 :             :    that iterator..  for instance:
     126                 :             : 
     127                 :             :      FOR_EACH_IMM_USE_STMT (stmt, iter, ssavar)
     128                 :             :        {
     129                 :             :          FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
     130                 :             :            {
     131                 :             :              SET_USE (use_p, blah);
     132                 :             :            }
     133                 :             :          update_stmt (stmt);
     134                 :             :        }                                                         */
     135                 :             : 
     136                 :             : #define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER)                    \
     137                 :             :   for ((DEST) = first_imm_use_on_stmt (&(ITER));            \
     138                 :             :        !end_imm_use_on_stmt_p (&(ITER));                    \
     139                 :             :        (void) ((DEST) = next_imm_use_on_stmt (&(ITER))))
     140                 :             : 
     141                 :             : 
     142                 :             : /* Use this to get a vector of all gimple stmts using SSAVAR without
     143                 :             :    duplicates.  It's cheaper than FOR_EACH_IMM_USE_STMT and has no
     144                 :             :    constraints on what you are allowed to do inside an iteration
     145                 :             :    over the vector.  */
     146                 :             : extern auto_vec<gimple *, 2> gather_imm_use_stmts (tree ssavar);
     147                 :             : 
     148                 :             : extern bool single_imm_use_1 (const ssa_use_operand_t *head,
     149                 :             :                               use_operand_p *use_p, gimple **stmt);
     150                 :             : 
     151                 :             : 
     152                 :             : enum ssa_op_iter_type {
     153                 :             :   ssa_op_iter_none = 0,
     154                 :             :   ssa_op_iter_tree,
     155                 :             :   ssa_op_iter_use,
     156                 :             :   ssa_op_iter_def
     157                 :             : };
     158                 :             : 
     159                 :             : /* This structure is used in the operand iterator loops.  It contains the
     160                 :             :    items required to determine which operand is retrieved next.  During
     161                 :             :    optimization, this structure is scalarized, and any unused fields are
     162                 :             :    optimized away, resulting in little overhead.  */
     163                 :             : 
     164                 :             : struct ssa_op_iter
     165                 :             : {
     166                 :             :   enum ssa_op_iter_type iter_type;
     167                 :             :   bool done;
     168                 :             :   int flags;
     169                 :             :   unsigned i;
     170                 :             :   unsigned numops;
     171                 :             :   use_optype_p uses;
     172                 :             :   gimple *stmt;
     173                 :             : };
     174                 :             : 
     175                 :             : /* NOTE: Keep these in sync with doc/tree-ssa.texi.  */
     176                 :             : /* These flags are used to determine which operands are returned during
     177                 :             :    execution of the loop.  */
     178                 :             : #define SSA_OP_USE              0x01    /* Real USE operands.  */
     179                 :             : #define SSA_OP_DEF              0x02    /* Real DEF operands.  */
     180                 :             : #define SSA_OP_VUSE             0x04    /* VUSE operands.  */
     181                 :             : #define SSA_OP_VDEF             0x08    /* VDEF operands.  */
     182                 :             : /* These are commonly grouped operand flags.  */
     183                 :             : #define SSA_OP_VIRTUAL_USES     (SSA_OP_VUSE)
     184                 :             : #define SSA_OP_VIRTUAL_DEFS     (SSA_OP_VDEF)
     185                 :             : #define SSA_OP_ALL_VIRTUALS     (SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_DEFS)
     186                 :             : #define SSA_OP_ALL_USES         (SSA_OP_VIRTUAL_USES | SSA_OP_USE)
     187                 :             : #define SSA_OP_ALL_DEFS         (SSA_OP_VIRTUAL_DEFS | SSA_OP_DEF)
     188                 :             : #define SSA_OP_ALL_OPERANDS     (SSA_OP_ALL_USES | SSA_OP_ALL_DEFS)
     189                 :             : 
     190                 :             : /* This macro executes a loop over the operands of STMT specified in FLAG,
     191                 :             :    returning each operand as a 'tree' in the variable TREEVAR.  ITER is an
     192                 :             :    ssa_op_iter structure used to control the loop.  */
     193                 :             : #define FOR_EACH_SSA_TREE_OPERAND(TREEVAR, STMT, ITER, FLAGS)   \
     194                 :             :   for (TREEVAR = op_iter_init_tree (&(ITER), STMT, FLAGS);  \
     195                 :             :        !op_iter_done (&(ITER));                                     \
     196                 :             :        (void) (TREEVAR = op_iter_next_tree (&(ITER))))
     197                 :             : 
     198                 :             : /* This macro executes a loop over the operands of STMT specified in FLAG,
     199                 :             :    returning each operand as a 'use_operand_p' in the variable USEVAR.
     200                 :             :    ITER is an ssa_op_iter structure used to control the loop.  */
     201                 :             : #define FOR_EACH_SSA_USE_OPERAND(USEVAR, STMT, ITER, FLAGS)     \
     202                 :             :   for (USEVAR = op_iter_init_use (&(ITER), STMT, FLAGS);    \
     203                 :             :        !op_iter_done (&(ITER));                                     \
     204                 :             :        USEVAR = op_iter_next_use (&(ITER)))
     205                 :             : 
     206                 :             : /* This macro executes a loop over the operands of STMT specified in FLAG,
     207                 :             :    returning each operand as a 'def_operand_p' in the variable DEFVAR.
     208                 :             :    ITER is an ssa_op_iter structure used to control the loop.  */
     209                 :             : #define FOR_EACH_SSA_DEF_OPERAND(DEFVAR, STMT, ITER, FLAGS)     \
     210                 :             :   for (DEFVAR = op_iter_init_def (&(ITER), STMT, FLAGS);    \
     211                 :             :        !op_iter_done (&(ITER));                                     \
     212                 :             :        DEFVAR = op_iter_next_def (&(ITER)))
     213                 :             : 
     214                 :             : /* This macro will execute a loop over all the arguments of a PHI which
     215                 :             :    match FLAGS.   A use_operand_p is always returned via USEVAR.  FLAGS
     216                 :             :    can be either SSA_OP_USE or SSA_OP_VIRTUAL_USES or SSA_OP_ALL_USES.  */
     217                 :             : #define FOR_EACH_PHI_ARG(USEVAR, STMT, ITER, FLAGS)             \
     218                 :             :   for ((USEVAR) = op_iter_init_phiuse (&(ITER), STMT, FLAGS);       \
     219                 :             :        !op_iter_done (&(ITER));                                     \
     220                 :             :        (USEVAR) = op_iter_next_use (&(ITER)))
     221                 :             : 
     222                 :             : 
     223                 :             : /* This macro will execute a loop over a stmt, regardless of whether it is
     224                 :             :    a real stmt or a PHI node, looking at the USE nodes matching FLAGS.  */
     225                 :             : #define FOR_EACH_PHI_OR_STMT_USE(USEVAR, STMT, ITER, FLAGS)     \
     226                 :             :   for ((USEVAR) = (gimple_code (STMT) == GIMPLE_PHI             \
     227                 :             :                    ? op_iter_init_phiuse (&(ITER),              \
     228                 :             :                                           as_a <gphi *> (STMT), \
     229                 :             :                                           FLAGS)                \
     230                 :             :                    : op_iter_init_use (&(ITER), STMT, FLAGS));      \
     231                 :             :        !op_iter_done (&(ITER));                                     \
     232                 :             :        (USEVAR) = op_iter_next_use (&(ITER)))
     233                 :             : 
     234                 :             : /* This macro will execute a loop over a stmt, regardless of whether it is
     235                 :             :    a real stmt or a PHI node, looking at the DEF nodes matching FLAGS.  */
     236                 :             : #define FOR_EACH_PHI_OR_STMT_DEF(DEFVAR, STMT, ITER, FLAGS)     \
     237                 :             :   for ((DEFVAR) = (gimple_code (STMT) == GIMPLE_PHI             \
     238                 :             :                    ? op_iter_init_phidef (&(ITER),          \
     239                 :             :                                           as_a <gphi *> (STMT), \
     240                 :             :                                           FLAGS)                \
     241                 :             :                    : op_iter_init_def (&(ITER), STMT, FLAGS));      \
     242                 :             :        !op_iter_done (&(ITER));                                     \
     243                 :             :        (DEFVAR) = op_iter_next_def (&(ITER)))
     244                 :             : 
     245                 :             : /* This macro returns an operand in STMT as a tree if it is the ONLY
     246                 :             :    operand matching FLAGS.  If there are 0 or more than 1 operand matching
     247                 :             :    FLAGS, then NULL_TREE is returned.  */
     248                 :             : #define SINGLE_SSA_TREE_OPERAND(STMT, FLAGS)                    \
     249                 :             :   single_ssa_tree_operand (STMT, FLAGS)
     250                 :             : 
     251                 :             : /* This macro returns an operand in STMT as a use_operand_p if it is the ONLY
     252                 :             :    operand matching FLAGS.  If there are 0 or more than 1 operand matching
     253                 :             :    FLAGS, then NULL_USE_OPERAND_P is returned.  */
     254                 :             : #define SINGLE_SSA_USE_OPERAND(STMT, FLAGS)                     \
     255                 :             :   single_ssa_use_operand (STMT, FLAGS)
     256                 :             : 
     257                 :             : /* This macro returns an operand in STMT as a def_operand_p if it is the ONLY
     258                 :             :    operand matching FLAGS.  If there are 0 or more than 1 operand matching
     259                 :             :    FLAGS, then NULL_DEF_OPERAND_P is returned.  */
     260                 :             : #define SINGLE_SSA_DEF_OPERAND(STMT, FLAGS)                     \
     261                 :             :   single_ssa_def_operand (STMT, FLAGS)
     262                 :             : 
     263                 :             : /* This macro returns TRUE if there are no operands matching FLAGS in STMT.  */
     264                 :             : #define ZERO_SSA_OPERANDS(STMT, FLAGS)  zero_ssa_operands (STMT, FLAGS)
     265                 :             : 
     266                 :             : /* This macro counts the number of operands in STMT matching FLAGS.  */
     267                 :             : #define NUM_SSA_OPERANDS(STMT, FLAGS)   num_ssa_operands (STMT, FLAGS)
     268                 :             : 
     269                 :             : 
     270                 :             : /* Delink an immediate_uses node from its chain.  */
     271                 :             : inline void
     272                 :   747044166 : delink_imm_use (ssa_use_operand_t *linknode)
     273                 :             : {
     274                 :             :   /* Return if this node is not in a list.  */
     275                 :   747044166 :   if (linknode->prev == NULL)
     276                 :             :     return;
     277                 :             : 
     278                 :             : #if defined ENABLE_GIMPLE_CHECKING
     279                 :   434560064 :   if (linknode->loc.stmt
     280                 :             :       /* update_stmt on constant/removed uses.  */
     281                 :   434560064 :       && USE_FROM_PTR (linknode)
     282                 :   860764769 :       && TREE_CODE (USE_FROM_PTR (linknode)) == SSA_NAME)
     283                 :             :     {
     284                 :   422015912 :       tree var = USE_FROM_PTR (linknode);
     285                 :   422015912 :       gcc_assert (var->ssa_name.fast_iteration_depth == 0
     286                 :             :                   && (var->ssa_name.active_iterated_stmt == NULL
     287                 :             :                       || (var->ssa_name.active_iterated_stmt
     288                 :             :                           == linknode->loc.stmt)));
     289                 :             :     }
     290                 :             : #endif
     291                 :             : 
     292                 :   434560064 :   linknode->prev->next = linknode->next;
     293                 :   434560064 :   linknode->next->prev = linknode->prev;
     294                 :   434560064 :   linknode->prev = NULL;
     295                 :   434560064 :   linknode->next = NULL;
     296                 :             : }
     297                 :             : 
     298                 :             : /* Link ssa_imm_use node LINKNODE into the chain for LIST.  */
     299                 :             : inline void
     300                 :   532531399 : link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list)
     301                 :             : {
     302                 :             :   /* Link the new node at the head of the list.  If we are in the process of
     303                 :             :      traversing the list, we won't visit any new nodes added to it.  */
     304                 :   532531399 :   linknode->prev = list;
     305                 :   532531399 :   linknode->next = list->next;
     306                 :   532531399 :   list->next->prev = linknode;
     307                 :   532531399 :   list->next = linknode;
     308                 :   531694864 : }
     309                 :             : 
     310                 :             : /* Link ssa_imm_use node LINKNODE into the chain for DEF.  */
     311                 :             : inline void
     312                 :   731672483 : link_imm_use (ssa_use_operand_t *linknode, tree def)
     313                 :             : {
     314                 :   731672483 :   ssa_use_operand_t *root;
     315                 :             : 
     316                 :   731672483 :   if (!def || TREE_CODE (def) != SSA_NAME)
     317                 :   199977619 :     linknode->prev = NULL;
     318                 :             :   else
     319                 :             :     {
     320                 :   531694864 :       root = &(SSA_NAME_IMM_USE_NODE (def));
     321                 :   531694864 :       if (linknode->use)
     322                 :   531694864 :         gcc_checking_assert (*(linknode->use) == def);
     323                 :   531694864 :       link_imm_use_to_list (linknode, root);
     324                 :             :     }
     325                 :   731672483 : }
     326                 :             : 
     327                 :             : /* Set the value of a use pointed to by USE to VAL.  */
     328                 :             : inline void
     329                 :   421203653 : set_ssa_use_from_ptr (use_operand_p use, tree val)
     330                 :             : {
     331                 :   421203653 :   delink_imm_use (use);
     332                 :   421203653 :   *(use->use) = val;
     333                 :   421203653 :   link_imm_use (use, val);
     334                 :   421203653 : }
     335                 :             : 
     336                 :             : /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
     337                 :             :    in STMT.  */
     338                 :             : inline void
     339                 :   310468830 : link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple *stmt)
     340                 :             : {
     341                 :   310468830 :   if (stmt)
     342                 :   310468830 :     link_imm_use (linknode, def);
     343                 :             :   else
     344                 :           0 :     link_imm_use (linknode, NULL);
     345                 :   310468830 :   linknode->loc.stmt = stmt;
     346                 :           0 : }
     347                 :             : 
     348                 :             : /* Relink a new node in place of an old node in the list.  */
     349                 :             : inline void
     350                 :    64473556 : relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
     351                 :             : {
     352                 :             :   /* The node one had better be in the same list.  */
     353                 :    64473556 :   gcc_checking_assert (*(old->use) == *(node->use));
     354                 :    64473556 :   node->prev = old->prev;
     355                 :    64473556 :   node->next = old->next;
     356                 :    64473556 :   if (old->prev)
     357                 :             :     {
     358                 :    52032525 :       old->prev->next = node;
     359                 :    52032525 :       old->next->prev = node;
     360                 :             :       /* Remove the old node from the list.  */
     361                 :    52032525 :       old->prev = NULL;
     362                 :             :     }
     363                 :    64473556 : }
     364                 :             : 
     365                 :             : /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
     366                 :             :    in STMT.  */
     367                 :             : inline void
     368                 :     6238367 : relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old,
     369                 :             :                      gimple *stmt)
     370                 :             : {
     371                 :     6238367 :   if (stmt)
     372                 :     6238367 :     relink_imm_use (linknode, old);
     373                 :             :   else
     374                 :             :     link_imm_use (linknode, NULL);
     375                 :     6238367 :   linknode->loc.stmt = stmt;
     376                 :             : }
     377                 :             : 
     378                 :             : 
     379                 :             : /* Return true is IMM has reached the end of the immediate use list.  */
     380                 :             : inline bool
     381                 :  4211483948 : end_readonly_imm_use_p (const imm_use_iterator *imm)
     382                 :             : {
     383                 :  2619305416 :   return (imm->imm_use == imm->end_p);
     384                 :             : }
     385                 :             : 
     386                 :             : /* Initialize iterator IMM to process the list for VAR.  */
     387                 :             : inline use_operand_p
     388                 :  1027126884 : first_readonly_imm_use (imm_use_iterator *imm, tree var)
     389                 :             : {
     390                 :             : #if defined ENABLE_GIMPLE_CHECKING
     391                 :  1027126884 :   var->ssa_name.fast_iteration_depth++;
     392                 :             : #endif
     393                 :  1027126884 :   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
     394                 :  1027126884 :   imm->imm_use = imm->end_p->next;
     395                 :  1027126884 :   imm->next_stmt_use = imm->imm_use->next;
     396                 :  1027126884 :   imm->name = var;
     397                 :  1027126884 :   if (end_readonly_imm_use_p (imm))
     398                 :    92945474 :     return NULL_USE_OPERAND_P;
     399                 :             :   return imm->imm_use;
     400                 :             : }
     401                 :             : 
     402                 :             : /* Bump IMM to the next use in the list.  */
     403                 :             : inline use_operand_p
     404                 :  1592178532 : next_readonly_imm_use (imm_use_iterator *imm)
     405                 :             : {
     406                 :  1592178532 :   use_operand_p old = imm->imm_use;
     407                 :             : 
     408                 :             :   /* If this assertion fails, it indicates the 'next' pointer has changed
     409                 :             :      since the last bump.  This indicates that the list is being modified
     410                 :             :      via stmt changes, or SET_USE, or somesuch thing, and you need to be
     411                 :             :      using the SAFE version of the iterator.  */
     412                 :  1592178532 :   if (flag_checking)
     413                 :             :     {
     414                 :  1592173675 :       gcc_assert (imm->next_stmt_use == old->next);
     415                 :  1592173675 :       imm->next_stmt_use = old->next->next;
     416                 :             :     }
     417                 :             : 
     418                 :  1592178532 :   imm->imm_use = old->next;
     419                 :  1592178532 :   if (end_readonly_imm_use_p (imm))
     420                 :   845185742 :     return NULL_USE_OPERAND_P;
     421                 :             :   return imm->imm_use;
     422                 :             : }
     423                 :             : 
     424                 :             : 
     425                 :             : /* Return true if VAR has no nondebug uses.  */
     426                 :             : inline bool
     427                 :   811922580 : has_zero_uses (const_tree var)
     428                 :             : {
     429                 :   811922580 :   const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
     430                 :   811922580 :   const ssa_use_operand_t *ptr;
     431                 :             : 
     432                 :   844982894 :   for (ptr = head->next; ptr != head; ptr = ptr->next)
     433                 :   798495429 :     if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
     434                 :             :       return false;
     435                 :             : 
     436                 :             :   return true;
     437                 :             : }
     438                 :             : 
     439                 :             : /* Return true if VAR has a single nondebug use.  */
     440                 :             : inline bool
     441                 :   916270691 : has_single_use (const_tree var)
     442                 :             : {
     443                 :   916270691 :   const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
     444                 :   916270691 :   const ssa_use_operand_t *ptr;
     445                 :   916270691 :   bool single = false;
     446                 :             : 
     447                 :  1988511225 :   for (ptr = head->next; ptr != head; ptr = ptr->next)
     448                 :  1538042345 :     if (USE_STMT(ptr) && !is_gimple_debug (USE_STMT (ptr)))
     449                 :             :       {
     450                 :  1381538345 :         if (single)
     451                 :             :           return false;
     452                 :             :         else
     453                 :             :           single = true;
     454                 :             :       }
     455                 :             : 
     456                 :             :   return single;
     457                 :             : }
     458                 :             : 
     459                 :             : /* If VAR has only a single immediate nondebug use, return true, and
     460                 :             :    set USE_P and STMT to the use pointer and stmt of occurrence.  */
     461                 :             : inline bool
     462                 :   325062778 : single_imm_use (const_tree var, use_operand_p *use_p, gimple **stmt)
     463                 :             : {
     464                 :   325062778 :   const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
     465                 :             : 
     466                 :             :   /* If there aren't any uses whatsoever, we're done.  */
     467                 :   325062778 :   if (ptr == ptr->next)
     468                 :             :     {
     469                 :      140919 :     return_false:
     470                 :      145338 :       *use_p = NULL_USE_OPERAND_P;
     471                 :      145338 :       *stmt = NULL;
     472                 :      145338 :       return false;
     473                 :             :     }
     474                 :             : 
     475                 :             :   /* If there's a single use, check that it's not a debug stmt.  */
     476                 :   324921859 :   if (ptr == ptr->next->next)
     477                 :             :     {
     478                 :   278196834 :       if (USE_STMT (ptr->next) && !is_gimple_debug (USE_STMT (ptr->next)))
     479                 :             :         {
     480                 :   278192415 :           *use_p = ptr->next;
     481                 :   278192415 :           *stmt = ptr->next->loc.stmt;
     482                 :   278192415 :           return true;
     483                 :             :         }
     484                 :             :       else
     485                 :        4419 :         goto return_false;
     486                 :             :     }
     487                 :             : 
     488                 :    46725025 :   return single_imm_use_1 (ptr, use_p, stmt);
     489                 :             : }
     490                 :             : 
     491                 :             : /* Return the number of nondebug immediate uses of VAR.  */
     492                 :             : inline unsigned int
     493                 :        3908 : num_imm_uses (const_tree var)
     494                 :             : {
     495                 :        3908 :   const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var));
     496                 :        3908 :   const ssa_use_operand_t *ptr;
     497                 :        3908 :   unsigned int num = 0;
     498                 :             : 
     499                 :        3908 :   if (!MAY_HAVE_DEBUG_BIND_STMTS)
     500                 :             :     {
     501                 :       10270 :       for (ptr = start->next; ptr != start; ptr = ptr->next)
     502                 :        6988 :         if (USE_STMT (ptr))
     503                 :        6988 :           num++;
     504                 :             :     }
     505                 :             :   else
     506                 :        1958 :     for (ptr = start->next; ptr != start; ptr = ptr->next)
     507                 :        1332 :       if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
     508                 :        1332 :         num++;
     509                 :             : 
     510                 :        3908 :   return num;
     511                 :             : }
     512                 :             : 
     513                 :             : /*  -----------------------------------------------------------------------  */
     514                 :             : 
     515                 :             : /* The following set of routines are used to iterator over various type of
     516                 :             :    SSA operands.  */
     517                 :             : 
     518                 :             : /* Return true if PTR is finished iterating.  */
     519                 :             : inline bool
     520                 : 65387953510 : op_iter_done (const ssa_op_iter *ptr)
     521                 :             : {
     522                 : 64558702362 :   return ptr->done;
     523                 :             : }
     524                 :             : 
     525                 :             : /* Get the next iterator use value for PTR.  */
     526                 :             : inline use_operand_p
     527                 : 43161777009 : op_iter_next_use (ssa_op_iter *ptr)
     528                 :             : {
     529                 : 43161777009 :   use_operand_p use_p;
     530                 : 43161777009 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_use);
     531                 : 43161777009 :   if (ptr->uses)
     532                 :             :     {
     533                 : 17655983542 :       use_p = USE_OP_PTR (ptr->uses);
     534                 : 17655983542 :       ptr->uses = ptr->uses->next;
     535                 : 17655983542 :       return use_p;
     536                 :             :     }
     537                 : 25505793467 :   if (ptr->i < ptr->numops)
     538                 :             :     {
     539                 :   209393125 :       return PHI_ARG_DEF_PTR (ptr->stmt, (ptr->i)++);
     540                 :             :     }
     541                 : 25296400342 :   ptr->done = true;
     542                 : 25296400342 :   return NULL_USE_OPERAND_P;
     543                 :             : }
     544                 :             : 
     545                 :             : /* Get the next iterator def value for PTR.  */
     546                 :             : inline def_operand_p
     547                 :  1673590407 : op_iter_next_def (ssa_op_iter *ptr)
     548                 :             : {
     549                 :  1673590407 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_def);
     550                 :  1673590407 :   if (ptr->flags & SSA_OP_VDEF)
     551                 :             :     {
     552                 :   162543860 :       tree *p;
     553                 :   162543860 :       ptr->flags &= ~SSA_OP_VDEF;
     554                 :   162543860 :       p = gimple_vdef_ptr (ptr->stmt);
     555                 :   162543860 :       if (p && *p)
     556                 :             :         return p;
     557                 :             :     }
     558                 :  1568243389 :   if (ptr->flags & SSA_OP_DEF)
     559                 :             :     {
     560                 :   919153991 :       while (ptr->i < ptr->numops)
     561                 :             :         {
     562                 :   460090990 :           tree *val = gimple_op_ptr (ptr->stmt, ptr->i);
     563                 :   460090990 :           ptr->i++;
     564                 :   460090990 :           if (*val)
     565                 :             :             {
     566                 :   414263983 :               if (TREE_CODE (*val) == TREE_LIST)
     567                 :      837913 :                 val = &TREE_VALUE (*val);
     568                 :   414263983 :               if (TREE_CODE (*val) == SSA_NAME
     569                 :   414263983 :                   || is_gimple_reg (*val))
     570                 :   284414267 :                 return val;
     571                 :             :             }
     572                 :             :         }
     573                 :   459063001 :       ptr->flags &= ~SSA_OP_DEF;
     574                 :             :     }
     575                 :             : 
     576                 :  1283829122 :   ptr->done = true;
     577                 :  1283829122 :   return NULL_DEF_OPERAND_P;
     578                 :             : }
     579                 :             : 
     580                 :             : /* Get the next iterator tree value for PTR.  */
     581                 :             : inline tree
     582                 : 20537202975 : op_iter_next_tree (ssa_op_iter *ptr)
     583                 :             : {
     584                 : 20537202975 :   tree val;
     585                 : 20537202975 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_tree);
     586                 : 20537202975 :   if (ptr->uses)
     587                 :             :     {
     588                 :  1159714730 :       val = USE_OP (ptr->uses);
     589                 :  1159714730 :       ptr->uses = ptr->uses->next;
     590                 :  1159714730 :       return val;
     591                 :             :     }
     592                 : 19377488245 :   if (ptr->flags & SSA_OP_VDEF)
     593                 :             :     {
     594                 :  5470288887 :       ptr->flags &= ~SSA_OP_VDEF;
     595                 : 10940577774 :       if ((val = gimple_vdef (ptr->stmt)))
     596                 :             :         return val;
     597                 :             :     }
     598                 : 17005993762 :   if (ptr->flags & SSA_OP_DEF)
     599                 :             :     {
     600                 : 11985604841 :       while (ptr->i < ptr->numops)
     601                 :             :         {
     602                 :  5991716367 :           val = gimple_op (ptr->stmt, ptr->i);
     603                 :  5991716367 :           ptr->i++;
     604                 :  5991716367 :           if (val)
     605                 :             :             {
     606                 :  5327571071 :               if (TREE_CODE (val) == TREE_LIST)
     607                 :    12053148 :                 val = TREE_VALUE (val);
     608                 :  5327571071 :               if (TREE_CODE (val) == SSA_NAME
     609                 :  5327571071 :                   || is_gimple_reg (val))
     610                 :  3614296734 :                 return val;
     611                 :             :             }
     612                 :             :         }
     613                 :  5993888474 :       ptr->flags &= ~SSA_OP_DEF;
     614                 :             :     }
     615                 :             : 
     616                 : 13391697028 :   ptr->done = true;
     617                 : 13391697028 :   return NULL_TREE;
     618                 :             : }
     619                 :             : 
     620                 :             : 
     621                 :             : /* This functions clears the iterator PTR, and marks it done.  This is normally
     622                 :             :    used to prevent warnings in the compile about might be uninitialized
     623                 :             :    components.  */
     624                 :             : 
     625                 :             : inline void
     626                 :    61512033 : clear_and_done_ssa_iter (ssa_op_iter *ptr)
     627                 :             : {
     628                 :    61512033 :   ptr->i = 0;
     629                 :    61512033 :   ptr->numops = 0;
     630                 :    61512033 :   ptr->uses = NULL;
     631                 :    61512033 :   ptr->iter_type = ssa_op_iter_none;
     632                 :    61512033 :   ptr->stmt = NULL;
     633                 :    61512033 :   ptr->done = true;
     634                 :    61512033 :   ptr->flags = 0;
     635                 :             : }
     636                 :             : 
     637                 :             : /* Initialize the iterator PTR to the virtual defs in STMT.  */
     638                 :             : inline void
     639                 : 40096398992 : op_iter_init (ssa_op_iter *ptr, gimple *stmt, int flags)
     640                 :             : {
     641                 :             :   /* PHI nodes require a different iterator initialization path.  We
     642                 :             :      do not support iterating over virtual defs or uses without
     643                 :             :      iterating over defs or uses at the same time.  */
     644                 : 40096398992 :   gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI
     645                 :             :                        && (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF))
     646                 :             :                        && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE)));
     647                 : 40096398992 :   ptr->numops = 0;
     648                 : 40096398992 :   if (flags & (SSA_OP_DEF | SSA_OP_VDEF))
     649                 :             :     {
     650                 : 13637312908 :       switch (gimple_code (stmt))
     651                 :             :         {
     652                 :  6439168906 :           case GIMPLE_ASSIGN:
     653                 :  6439168906 :           case GIMPLE_CALL:
     654                 :  6439168906 :             ptr->numops = 1;
     655                 :  6439168906 :             break;
     656                 :    15442274 :           case GIMPLE_ASM:
     657                 :    15442274 :             ptr->numops = gimple_asm_noutputs (as_a <gasm *> (stmt));
     658                 :    15442274 :             break;
     659                 :       32766 :           case GIMPLE_TRANSACTION:
     660                 :       32766 :             ptr->numops = 0;
     661                 :       32766 :             flags &= ~SSA_OP_DEF;
     662                 :       32766 :             break;
     663                 :  7182668962 :           default:
     664                 :  7182668962 :             ptr->numops = 0;
     665                 :  7182668962 :             flags &= ~(SSA_OP_DEF | SSA_OP_VDEF);
     666                 :  7182668962 :             break;
     667                 :             :         }
     668                 :             :     }
     669                 : 40096398992 :   ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL;
     670                 : 40096398992 :   if (!(flags & SSA_OP_VUSE)
     671                 : 28499960958 :       && ptr->uses
     672                 : 46610589717 :       && gimple_vuse (stmt) != NULL_TREE)
     673                 :  4164230969 :     ptr->uses = ptr->uses->next;
     674                 : 40096398992 :   ptr->done = false;
     675                 : 40096398992 :   ptr->i = 0;
     676                 :             : 
     677                 : 40096398992 :   ptr->stmt = stmt;
     678                 : 40096398992 :   ptr->flags = flags;
     679                 : 40096398992 : }
     680                 :             : 
     681                 :             : /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
     682                 :             :    the first use.  */
     683                 :             : inline use_operand_p
     684                 : 25380347760 : op_iter_init_use (ssa_op_iter *ptr, gimple *stmt, int flags)
     685                 :             : {
     686                 : 25380347760 :   gcc_checking_assert ((flags & SSA_OP_ALL_DEFS) == 0
     687                 :             :                        && (flags & SSA_OP_USE));
     688                 : 25380347760 :   op_iter_init (ptr, stmt, flags);
     689                 : 25380347760 :   ptr->iter_type = ssa_op_iter_use;
     690                 : 25380347760 :   return op_iter_next_use (ptr);
     691                 :             : }
     692                 :             : 
     693                 :             : /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
     694                 :             :    the first def.  */
     695                 :             : inline def_operand_p
     696                 :  1277157985 : op_iter_init_def (ssa_op_iter *ptr, gimple *stmt, int flags)
     697                 :             : {
     698                 :  1277157985 :   gcc_checking_assert ((flags & SSA_OP_ALL_USES) == 0
     699                 :             :                        && (flags & SSA_OP_DEF));
     700                 :  1277157985 :   op_iter_init (ptr, stmt, flags);
     701                 :  1277157985 :   ptr->iter_type = ssa_op_iter_def;
     702                 :  1277157985 :   return op_iter_next_def (ptr);
     703                 :             : }
     704                 :             : 
     705                 :             : /* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
     706                 :             :    the first operand as a tree.  */
     707                 :             : inline tree
     708                 : 13438893247 : op_iter_init_tree (ssa_op_iter *ptr, gimple *stmt, int flags)
     709                 :             : {
     710                 : 13438893247 :   op_iter_init (ptr, stmt, flags);
     711                 : 13438893247 :   ptr->iter_type = ssa_op_iter_tree;
     712                 : 13438893247 :   return op_iter_next_tree (ptr);
     713                 :             : }
     714                 :             : 
     715                 :             : 
     716                 :             : /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
     717                 :             :    return NULL.  */
     718                 :             : inline tree
     719                 :    85101468 : single_ssa_tree_operand (gimple *stmt, int flags)
     720                 :             : {
     721                 :    85101468 :   tree var;
     722                 :    85101468 :   ssa_op_iter iter;
     723                 :             : 
     724                 :    85101468 :   var = op_iter_init_tree (&iter, stmt, flags);
     725                 :    85101468 :   if (op_iter_done (&iter))
     726                 :             :     return NULL_TREE;
     727                 :    78086765 :   op_iter_next_tree (&iter);
     728                 :    78086765 :   if (op_iter_done (&iter))
     729                 :             :     return var;
     730                 :             :   return NULL_TREE;
     731                 :             : }
     732                 :             : 
     733                 :             : 
     734                 :             : /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
     735                 :             :    return NULL.  */
     736                 :             : inline use_operand_p
     737                 :       91492 : single_ssa_use_operand (gimple *stmt, int flags)
     738                 :             : {
     739                 :       91492 :   use_operand_p var;
     740                 :       91492 :   ssa_op_iter iter;
     741                 :             : 
     742                 :       91492 :   var = op_iter_init_use (&iter, stmt, flags);
     743                 :       91492 :   if (op_iter_done (&iter))
     744                 :             :     return NULL_USE_OPERAND_P;
     745                 :       90974 :   op_iter_next_use (&iter);
     746                 :       90974 :   if (op_iter_done (&iter))
     747                 :             :     return var;
     748                 :             :   return NULL_USE_OPERAND_P;
     749                 :             : }
     750                 :             : 
     751                 :             : /* Return the single virtual use operand in STMT if present.  Otherwise
     752                 :             :    return NULL.  */
     753                 :             : inline use_operand_p
     754                 :      141278 : ssa_vuse_operand (gimple *stmt)
     755                 :             : {
     756                 :      259908 :   if (! gimple_vuse (stmt))
     757                 :             :     return NULL_USE_OPERAND_P;
     758                 :       13911 :   return USE_OP_PTR (gimple_use_ops (stmt));
     759                 :             : }
     760                 :             : 
     761                 :             : 
     762                 :             : /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
     763                 :             :    return NULL.  */
     764                 :             : inline def_operand_p
     765                 :   371871281 : single_ssa_def_operand (gimple *stmt, int flags)
     766                 :             : {
     767                 :   371871281 :   def_operand_p var;
     768                 :   371871281 :   ssa_op_iter iter;
     769                 :             : 
     770                 :   371871281 :   var = op_iter_init_def (&iter, stmt, flags);
     771                 :   371871281 :   if (op_iter_done (&iter))
     772                 :             :     return NULL_DEF_OPERAND_P;
     773                 :   130461227 :   op_iter_next_def (&iter);
     774                 :   130461227 :   if (op_iter_done (&iter))
     775                 :             :     return var;
     776                 :             :   return NULL_DEF_OPERAND_P;
     777                 :             : }
     778                 :             : 
     779                 :             : 
     780                 :             : /* Return true if there are zero operands in STMT matching the type
     781                 :             :    given in FLAGS.  */
     782                 :             : inline bool
     783                 :    11277313 : zero_ssa_operands (gimple *stmt, int flags)
     784                 :             : {
     785                 :    11277313 :   ssa_op_iter iter;
     786                 :             : 
     787                 :    11277313 :   op_iter_init_tree (&iter, stmt, flags);
     788                 :    11277313 :   return op_iter_done (&iter);
     789                 :             : }
     790                 :             : 
     791                 :             : 
     792                 :             : /* Return the number of operands matching FLAGS in STMT.  */
     793                 :             : inline int
     794                 :    48058413 : num_ssa_operands (gimple *stmt, int flags)
     795                 :             : {
     796                 :    48058413 :   ssa_op_iter iter;
     797                 :    48058413 :   tree t;
     798                 :    48058413 :   int num = 0;
     799                 :             : 
     800                 :    48058413 :   gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI);
     801                 :   117350772 :   FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags)
     802                 :    69292359 :     num++;
     803                 :    48058413 :   return num;
     804                 :             : }
     805                 :             : 
     806                 :             : /* If there is a single DEF in the PHI node which matches FLAG, return it.
     807                 :             :    Otherwise return NULL_DEF_OPERAND_P.  */
     808                 :             : inline tree
     809                 :             : single_phi_def (gphi *stmt, int flags)
     810                 :             : {
     811                 :             :   tree def = gimple_phi_result (stmt);
     812                 :             :   if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
     813                 :             :     return def;
     814                 :             :   if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
     815                 :             :     return def;
     816                 :             :   return NULL_TREE;
     817                 :             : }
     818                 :             : 
     819                 :             : /* Initialize the iterator PTR for uses matching FLAGS in PHI.  FLAGS should
     820                 :             :    be either SSA_OP_USES or SSA_OP_VIRTUAL_USES.  */
     821                 :             : inline use_operand_p
     822                 :    48269513 : op_iter_init_phiuse (ssa_op_iter *ptr, gphi *phi, int flags)
     823                 :             : {
     824                 :    48269513 :   tree phi_def = gimple_phi_result (phi);
     825                 :    48269513 :   int comp;
     826                 :             : 
     827                 :    48269513 :   clear_and_done_ssa_iter (ptr);
     828                 :    48269513 :   ptr->done = false;
     829                 :             : 
     830                 :    48269513 :   gcc_checking_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
     831                 :             : 
     832                 :    48269513 :   comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
     833                 :             : 
     834                 :             :   /* If the PHI node doesn't the operand type we care about, we're done.  */
     835                 :    48269513 :   if ((flags & comp) == 0)
     836                 :             :     {
     837                 :     3288381 :       ptr->done = true;
     838                 :     3288381 :       return NULL_USE_OPERAND_P;
     839                 :             :     }
     840                 :             : 
     841                 :    44981132 :   ptr->stmt = phi;
     842                 :    44981132 :   ptr->numops = gimple_phi_num_args (phi);
     843                 :    44981132 :   ptr->iter_type = ssa_op_iter_use;
     844                 :    44981132 :   ptr->flags = flags;
     845                 :    44981132 :   return op_iter_next_use (ptr);
     846                 :             : }
     847                 :             : 
     848                 :             : 
     849                 :             : /* Start an iterator for a PHI definition.  */
     850                 :             : 
     851                 :             : inline def_operand_p
     852                 :    13242520 : op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
     853                 :             : {
     854                 :    13242520 :   tree phi_def = gimple_phi_result (phi);
     855                 :    13242520 :   int comp;
     856                 :             : 
     857                 :    13242520 :   clear_and_done_ssa_iter (ptr);
     858                 :    13242520 :   ptr->done = false;
     859                 :             : 
     860                 :    13242520 :   gcc_checking_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
     861                 :             : 
     862                 :    13242520 :   comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
     863                 :             : 
     864                 :             :   /* If the PHI node doesn't have the operand type we care about,
     865                 :             :      we're done.  */
     866                 :    13242520 :   if ((flags & comp) == 0)
     867                 :             :     {
     868                 :     5563279 :       ptr->done = true;
     869                 :     5563279 :       return NULL_DEF_OPERAND_P;
     870                 :             :     }
     871                 :             : 
     872                 :     7679241 :   ptr->iter_type = ssa_op_iter_def;
     873                 :             :   /* The first call to op_iter_next_def will terminate the iterator since
     874                 :             :      all the fields are NULL.  Simply return the result here as the first and
     875                 :             :      therefore only result.  */
     876                 :     7679241 :   return gimple_phi_result_ptr (phi);
     877                 :             : }
     878                 :             : 
     879                 :             : /* Return true is IMM has reached the end of the immediate use stmt list.  */
     880                 :             : 
     881                 :             : inline bool
     882                 :   411781351 : end_imm_use_stmt_p (const imm_use_iterator *imm)
     883                 :             : {
     884                 :   260476980 :   return (imm->imm_use == imm->end_p);
     885                 :             : }
     886                 :             : 
     887                 :             : /* Finished the traverse of an immediate use stmt list IMM by removing the
     888                 :             :    placeholder node from the list.  */
     889                 :             : 
     890                 :             : inline void
     891                 :   109172609 : end_imm_use_stmt_traverse (imm_use_iterator * ARG_UNUSED (imm))
     892                 :             : {
     893                 :             : #if defined ENABLE_GIMPLE_CHECKING
     894                 :    98881501 :   imm->name->ssa_name.active_iterated_stmt = NULL;
     895                 :             : #endif
     896                 :             : }
     897                 :             : 
     898                 :             : /* Immediate use traversal of uses within a stmt require that all the
     899                 :             :    uses on a stmt be sequentially listed.  This routine is used to build up
     900                 :             :    this sequential list by adding USE_P to the end of the current list
     901                 :             :    currently delimited by HEAD and LAST_P.  The new LAST_P value is
     902                 :             :    returned.  */
     903                 :             : 
     904                 :             : inline use_operand_p
     905                 :   167024826 : move_use_after_head (use_operand_p use_p, use_operand_p head,
     906                 :             :                       use_operand_p last_p)
     907                 :             : {
     908                 :   167024826 :   gcc_checking_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
     909                 :             :   /* Skip head when we find it.  */
     910                 :   167024826 :   if (use_p != head)
     911                 :             :     {
     912                 :             :       /* If use_p is already linked in after last_p, continue.  */
     913                 :     1845275 :       if (last_p->next == use_p)
     914                 :             :         last_p = use_p;
     915                 :             :       else
     916                 :             :         {
     917                 :             :           /* Delink from current location, and link in at last_p.  */
     918                 :      836535 :           delink_imm_use (use_p);
     919                 :      836535 :           link_imm_use_to_list (use_p, last_p);
     920                 :      836535 :           last_p = use_p;
     921                 :             :         }
     922                 :             :     }
     923                 :   167024826 :   return last_p;
     924                 :             : }
     925                 :             : 
     926                 :             : 
     927                 :             : /* This routine will relink all uses with the same stmt as HEAD into the list
     928                 :             :    immediately following HEAD for iterator IMM and returns the last use on
     929                 :             :    that stmt.  */
     930                 :             : 
     931                 :             : inline use_operand_p
     932                 :   165179551 : link_use_stmts_after (use_operand_p head, imm_use_iterator *)
     933                 :             : {
     934                 :   165179551 :   use_operand_p use_p;
     935                 :   165179551 :   use_operand_p last_p = head;
     936                 :   165179551 :   gimple *head_stmt = USE_STMT (head);
     937                 :   165179551 :   tree use = USE_FROM_PTR (head);
     938                 :   165179551 :   ssa_op_iter op_iter;
     939                 :   165179551 :   int flag;
     940                 :             : 
     941                 :             :   /* Only look at virtual or real uses, depending on the type of HEAD.  */
     942                 :   165179551 :   flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
     943                 :             : 
     944                 :   165179551 :   if (gphi *phi = dyn_cast <gphi *> (head_stmt))
     945                 :             :     {
     946                 :   169428461 :       FOR_EACH_PHI_ARG (use_p, phi, op_iter, flag)
     947                 :   151387315 :         if (USE_FROM_PTR (use_p) == use)
     948                 :    19617156 :           last_p = move_use_after_head (use_p, head, last_p);
     949                 :             :     }
     950                 :             :   else
     951                 :             :     {
     952                 :   147138405 :       if (flag == SSA_OP_USE)
     953                 :             :         {
     954                 :   194060619 :           FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag)
     955                 :   116846223 :             if (USE_FROM_PTR (use_p) == use)
     956                 :    77483661 :               last_p = move_use_after_head (use_p, head, last_p);
     957                 :             :         }
     958                 :    69924009 :       else if ((use_p = gimple_vuse_op (head_stmt)) != NULL_USE_OPERAND_P)
     959                 :             :         {
     960                 :    69924009 :           if (USE_FROM_PTR (use_p) == use)
     961                 :    69924009 :             last_p = move_use_after_head (use_p, head, last_p);
     962                 :             :         }
     963                 :             :     }
     964                 :   165179551 :   return last_p;
     965                 :             : }
     966                 :             : 
     967                 :             : /* Initialize IMM to traverse over uses of VAR.  Return the first statement.  */
     968                 :             : inline gimple *
     969                 :   109172609 : first_imm_use_stmt (imm_use_iterator *imm, tree var)
     970                 :             : {
     971                 :             : #if defined ENABLE_GIMPLE_CHECKING
     972                 :   109172609 :   gcc_assert (var->ssa_name.active_iterated_stmt == NULL
     973                 :             :               && var->ssa_name.fast_iteration_depth == 0);
     974                 :             : #endif
     975                 :   109172609 :   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
     976                 :   109172609 :   imm->imm_use = imm->end_p->next;
     977                 :   109172609 :   imm->next_imm_name = NULL_USE_OPERAND_P;
     978                 :             : 
     979                 :             :   /* next_stmt_use is used to point to the immediate use node after
     980                 :             :      the set of uses for the current stmt.  */
     981                 :   109172609 :   imm->next_stmt_use = NULL_USE_OPERAND_P;
     982                 :   109172609 :   imm->name = var;
     983                 :             : 
     984                 :   109172609 :   if (end_imm_use_stmt_p (imm))
     985                 :             :     return NULL;
     986                 :             : 
     987                 :   105863424 :   imm->next_stmt_use = link_use_stmts_after (imm->imm_use, imm)->next;
     988                 :             : 
     989                 :             : #if defined ENABLE_GIMPLE_CHECKING
     990                 :   105863424 :   var->ssa_name.active_iterated_stmt = USE_STMT (imm->imm_use);
     991                 :             : #endif
     992                 :   105863424 :   return USE_STMT (imm->imm_use);
     993                 :             : }
     994                 :             : 
     995                 :             : /* Bump IMM to the next stmt which has a use of var.  */
     996                 :             : 
     997                 :             : inline gimple *
     998                 :   151304371 : next_imm_use_stmt (imm_use_iterator *imm)
     999                 :             : {
    1000                 :   151304371 :   imm->imm_use = imm->next_stmt_use;
    1001                 :   151304371 :   if (end_imm_use_stmt_p (imm))
    1002                 :             :     return NULL;
    1003                 :             : 
    1004                 :             : #if defined ENABLE_GIMPLE_CHECKING
    1005                 :    59316127 :   imm->name->ssa_name.active_iterated_stmt = USE_STMT (imm->imm_use);
    1006                 :             : #endif
    1007                 :    59316127 :   imm->next_stmt_use = link_use_stmts_after (imm->imm_use, imm)->next;
    1008                 :    59316127 :   return USE_STMT (imm->imm_use);
    1009                 :             : }
    1010                 :             : 
    1011                 :             : /* This routine will return the first use on the stmt IMM currently refers
    1012                 :             :    to.  */
    1013                 :             : 
    1014                 :             : inline use_operand_p
    1015                 :    46332136 : first_imm_use_on_stmt (imm_use_iterator *imm)
    1016                 :             : {
    1017                 :    46332136 :   imm->next_imm_name = imm->imm_use->next;
    1018                 :    46326878 :   return imm->imm_use;
    1019                 :             : }
    1020                 :             : 
    1021                 :             : /*  Return TRUE if the last use on the stmt IMM refers to has been visited.  */
    1022                 :             : 
    1023                 :             : inline bool
    1024                 :    93607872 : end_imm_use_on_stmt_p (const imm_use_iterator *imm)
    1025                 :             : {
    1026                 :    93607872 :   return (imm->imm_use == imm->next_stmt_use);
    1027                 :             : }
    1028                 :             : 
    1029                 :             : /* Bump to the next use on the stmt IMM refers to, return NULL if done.  */
    1030                 :             : 
    1031                 :             : inline use_operand_p
    1032                 :    47275736 : next_imm_use_on_stmt (imm_use_iterator *imm)
    1033                 :             : {
    1034                 :    47275736 :   imm->imm_use = imm->next_imm_name;
    1035                 :    47275736 :   if (end_imm_use_on_stmt_p (imm))
    1036                 :             :     return NULL_USE_OPERAND_P;
    1037                 :             :   else
    1038                 :             :     {
    1039                 :      948858 :       imm->next_imm_name = imm->imm_use->next;
    1040                 :      948858 :       return imm->imm_use;
    1041                 :             :     }
    1042                 :             : }
    1043                 :             : 
    1044                 :             : /* Delink all immediate_use information for STMT.  */
    1045                 :             : inline void
    1046                 :   167748193 : delink_stmt_imm_use (gimple *stmt)
    1047                 :             : {
    1048                 :   167748193 :    ssa_op_iter iter;
    1049                 :   167748193 :    use_operand_p use_p;
    1050                 :             : 
    1051                 :   167748193 :    if (ssa_operands_active (cfun))
    1052                 :   357607334 :      FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_ALL_USES)
    1053                 :    77855168 :        delink_imm_use (use_p);
    1054                 :   167748193 : }
    1055                 :             : 
    1056                 :             : #endif /* GCC_TREE_SSA_ITERATORS_H */
        

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.