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: 2026-02-28 14:20:25 Functions: 100.0 % 28 28
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Header file for SSA iterators.
       2              :    Copyright (C) 2013-2026 Free Software Foundation, Inc.
       3              : 
       4              : This file is part of GCC.
       5              : 
       6              : GCC is free software; you can redistribute it and/or modify it under
       7              : the terms of the GNU General Public License as published by the Free
       8              : Software Foundation; either version 3, or (at your option) any later
       9              : version.
      10              : 
      11              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14              :  for more details.
      15              : 
      16              : You should have received a copy of the GNU General Public License
      17              : along with GCC; see the file COPYING3.  If not see
      18              : <http://www.gnu.org/licenses/>.  */
      19              : 
      20              : #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   1020097377 :   auto_end_imm_use_fast_traverse (imm_use_iterator *imm)
      83   1020097377 :   : imm (imm) {}
      84   1020097377 :   ~auto_end_imm_use_fast_traverse ()
      85   1006237256 :   { 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    107161251 :   auto_end_imm_use_stmt_traverse (imm_use_iterator *imm)
     106    107161251 :   : imm (imm) {}
     107    107161251 :   ~auto_end_imm_use_stmt_traverse ()
     108    107161251 :   { 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    735386888 : delink_imm_use (ssa_use_operand_t *linknode)
     273              : {
     274              :   /* Return if this node is not in a list.  */
     275    735386888 :   if (linknode->prev == NULL)
     276              :     return;
     277              : 
     278              : #if defined ENABLE_GIMPLE_CHECKING
     279    434098433 :   if (linknode->loc.stmt
     280              :       /* update_stmt on constant/removed uses.  */
     281    434098433 :       && USE_FROM_PTR (linknode)
     282    859895925 :       && TREE_CODE (USE_FROM_PTR (linknode)) == SSA_NAME)
     283              :     {
     284    421683959 :       tree var = USE_FROM_PTR (linknode);
     285    421683959 :       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    434098433 :   linknode->prev->next = linknode->next;
     293    434098433 :   linknode->next->prev = linknode->prev;
     294    434098433 :   linknode->prev = NULL;
     295    434098433 :   linknode->next = NULL;
     296              : }
     297              : 
     298              : /* Link ssa_imm_use node LINKNODE into the chain for LIST.  */
     299              : inline void
     300    531159436 : 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    531159436 :   linknode->prev = list;
     305    531159436 :   linknode->next = list->next;
     306    531159436 :   list->next->prev = linknode;
     307    531159436 :   list->next = linknode;
     308    529900363 : }
     309              : 
     310              : /* Link ssa_imm_use node LINKNODE into the chain for DEF.  */
     311              : inline void
     312    724987033 : link_imm_use (ssa_use_operand_t *linknode, tree def)
     313              : {
     314    724987033 :   ssa_use_operand_t *root;
     315              : 
     316    724987033 :   if (!def || TREE_CODE (def) != SSA_NAME)
     317    195086670 :     linknode->prev = NULL;
     318              :   else
     319              :     {
     320    529900363 :       root = &(SSA_NAME_IMM_USE_NODE (def));
     321    529900363 :       if (linknode->use)
     322    529900363 :         gcc_checking_assert (*(linknode->use) == def);
     323    529900363 :       link_imm_use_to_list (linknode, root);
     324              :     }
     325    724987033 : }
     326              : 
     327              : /* Set the value of a use pointed to by USE to VAL.  */
     328              : inline void
     329    412510265 : set_ssa_use_from_ptr (use_operand_p use, tree val)
     330              : {
     331    412510265 :   delink_imm_use (use);
     332    412510265 :   *(use->use) = val;
     333    412510265 :   link_imm_use (use, val);
     334    412510265 : }
     335              : 
     336              : /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
     337              :    in STMT.  */
     338              : inline void
     339    312476768 : link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple *stmt)
     340              : {
     341    312476768 :   if (stmt)
     342    312476768 :     link_imm_use (linknode, def);
     343              :   else
     344            0 :     link_imm_use (linknode, NULL);
     345    312476768 :   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     59925848 : 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     59925848 :   gcc_checking_assert (*(old->use) == *(node->use));
     354     59925848 :   node->prev = old->prev;
     355     59925848 :   node->next = old->next;
     356     59925848 :   if (old->prev)
     357              :     {
     358     47952376 :       old->prev->next = node;
     359     47952376 :       old->next->prev = node;
     360              :       /* Remove the old node from the list.  */
     361     47952376 :       old->prev = NULL;
     362              :     }
     363     59925848 : }
     364              : 
     365              : /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
     366              :    in STMT.  */
     367              : inline void
     368      4757140 : relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old,
     369              :                      gimple *stmt)
     370              : {
     371      4757140 :   if (stmt)
     372      4757140 :     relink_imm_use (linknode, old);
     373              :   else
     374              :     link_imm_use (linknode, NULL);
     375      4757140 :   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   4215394151 : end_readonly_imm_use_p (const imm_use_iterator *imm)
     382              : {
     383   2617745764 :   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   1020097377 : first_readonly_imm_use (imm_use_iterator *imm, tree var)
     389              : {
     390              : #if defined ENABLE_GIMPLE_CHECKING
     391   1020097377 :   var->ssa_name.fast_iteration_depth++;
     392              : #endif
     393   1020097377 :   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
     394   1020097377 :   imm->imm_use = imm->end_p->next;
     395   1020097377 :   imm->next_stmt_use = imm->imm_use->next;
     396   1020097377 :   imm->name = var;
     397   1020097377 :   if (end_readonly_imm_use_p (imm))
     398     91159236 :     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   1597648387 : next_readonly_imm_use (imm_use_iterator *imm)
     405              : {
     406   1597648387 :   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   1597648387 :   if (flag_checking)
     413              :     {
     414   1597643505 :       gcc_assert (imm->next_stmt_use == old->next);
     415   1597643505 :       imm->next_stmt_use = old->next->next;
     416              :     }
     417              : 
     418   1597648387 :   imm->imm_use = old->next;
     419   1597648387 :   if (end_readonly_imm_use_p (imm))
     420    841017215 :     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    803336749 : has_zero_uses (const_tree var)
     428              : {
     429    803336749 :   const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
     430    803336749 :   const ssa_use_operand_t *ptr;
     431              : 
     432    835992109 :   for (ptr = head->next; ptr != head; ptr = ptr->next)
     433    789977260 :     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    931009897 : has_single_use (const_tree var)
     442              : {
     443    931009897 :   const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
     444    931009897 :   const ssa_use_operand_t *ptr;
     445    931009897 :   bool single = false;
     446              : 
     447   2032224735 :   for (ptr = head->next; ptr != head; ptr = ptr->next)
     448   1577914134 :     if (USE_STMT(ptr) && !is_gimple_debug (USE_STMT (ptr)))
     449              :       {
     450   1407123411 :         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    322370876 : single_imm_use (const_tree var, use_operand_p *use_p, gimple **stmt)
     463              : {
     464    322370876 :   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    322370876 :   if (ptr == ptr->next)
     468              :     {
     469       147079 :     return_false:
     470       151201 :       *use_p = NULL_USE_OPERAND_P;
     471       151201 :       *stmt = NULL;
     472       151201 :       return false;
     473              :     }
     474              : 
     475              :   /* If there's a single use, check that it's not a debug stmt.  */
     476    322223797 :   if (ptr == ptr->next->next)
     477              :     {
     478    276300552 :       if (USE_STMT (ptr->next) && !is_gimple_debug (USE_STMT (ptr->next)))
     479              :         {
     480    276296430 :           *use_p = ptr->next;
     481    276296430 :           *stmt = ptr->next->loc.stmt;
     482    276296430 :           return true;
     483              :         }
     484              :       else
     485         4122 :         goto return_false;
     486              :     }
     487              : 
     488     45923245 :   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         4161 : num_imm_uses (const_tree var)
     494              : {
     495         4161 :   const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var));
     496         4161 :   const ssa_use_operand_t *ptr;
     497         4161 :   unsigned int num = 0;
     498              : 
     499         4161 :   if (!MAY_HAVE_DEBUG_BIND_STMTS)
     500              :     {
     501        11119 :       for (ptr = start->next; ptr != start; ptr = ptr->next)
     502         7582 :         if (USE_STMT (ptr))
     503         7582 :           num++;
     504              :     }
     505              :   else
     506         1948 :     for (ptr = start->next; ptr != start; ptr = ptr->next)
     507         1324 :       if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
     508         1324 :         num++;
     509              : 
     510         4161 :   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  64859680234 : op_iter_done (const ssa_op_iter *ptr)
     521              : {
     522  64033371069 :   return ptr->done;
     523              : }
     524              : 
     525              : /* Get the next iterator use value for PTR.  */
     526              : inline use_operand_p
     527  42882366721 : op_iter_next_use (ssa_op_iter *ptr)
     528              : {
     529  42882366721 :   use_operand_p use_p;
     530  42882366721 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_use);
     531  42882366721 :   if (ptr->uses)
     532              :     {
     533  17633578473 :       use_p = USE_OP_PTR (ptr->uses);
     534  17633578473 :       ptr->uses = ptr->uses->next;
     535  17633578473 :       return use_p;
     536              :     }
     537  25248788248 :   if (ptr->i < ptr->numops)
     538              :     {
     539    210908240 :       return PHI_ARG_DEF_PTR (ptr->stmt, (ptr->i)++);
     540              :     }
     541  25037880008 :   ptr->done = true;
     542  25037880008 :   return NULL_USE_OPERAND_P;
     543              : }
     544              : 
     545              : /* Get the next iterator def value for PTR.  */
     546              : inline def_operand_p
     547   1661054282 : op_iter_next_def (ssa_op_iter *ptr)
     548              : {
     549   1661054282 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_def);
     550   1661054282 :   if (ptr->flags & SSA_OP_VDEF)
     551              :     {
     552    159077746 :       tree *p;
     553    159077746 :       ptr->flags &= ~SSA_OP_VDEF;
     554    159077746 :       p = gimple_vdef_ptr (ptr->stmt);
     555    159077746 :       if (p && *p)
     556              :         return p;
     557              :     }
     558   1558582428 :   if (ptr->flags & SSA_OP_DEF)
     559              :     {
     560    904057851 :       while (ptr->i < ptr->numops)
     561              :         {
     562    452548783 :           tree *val = gimple_op_ptr (ptr->stmt, ptr->i);
     563    452548783 :           ptr->i++;
     564    452548783 :           if (*val)
     565              :             {
     566    406931243 :               if (TREE_CODE (*val) == TREE_LIST)
     567       854095 :                 val = &TREE_VALUE (*val);
     568    406931243 :               if (TREE_CODE (*val) == SSA_NAME
     569    406931243 :                   || is_gimple_reg (*val))
     570    281650175 :                 return val;
     571              :             }
     572              :         }
     573    451509068 :       ptr->flags &= ~SSA_OP_DEF;
     574              :     }
     575              : 
     576   1276932253 :   ptr->done = true;
     577   1276932253 :   return NULL_DEF_OPERAND_P;
     578              : }
     579              : 
     580              : /* Get the next iterator tree value for PTR.  */
     581              : inline tree
     582  20301685648 : op_iter_next_tree (ssa_op_iter *ptr)
     583              : {
     584  20301685648 :   tree val;
     585  20301685648 :   gcc_checking_assert (ptr->iter_type == ssa_op_iter_tree);
     586  20301685648 :   if (ptr->uses)
     587              :     {
     588   1156103640 :       val = USE_OP (ptr->uses);
     589   1156103640 :       ptr->uses = ptr->uses->next;
     590   1156103640 :       return val;
     591              :     }
     592  19145582008 :   if (ptr->flags & SSA_OP_VDEF)
     593              :     {
     594   5397705012 :       ptr->flags &= ~SSA_OP_VDEF;
     595  10795410024 :       if ((val = gimple_vdef (ptr->stmt)))
     596              :         return val;
     597              :     }
     598  16814536173 :   if (ptr->flags & SSA_OP_DEF)
     599              :     {
     600  11824413554 :       while (ptr->i < ptr->numops)
     601              :         {
     602   5911114515 :           val = gimple_op (ptr->stmt, ptr->i);
     603   5911114515 :           ptr->i++;
     604   5911114515 :           if (val)
     605              :             {
     606   5249673915 :               if (TREE_CODE (val) == TREE_LIST)
     607     12273733 :                 val = TREE_VALUE (val);
     608   5249673915 :               if (TREE_CODE (val) == SSA_NAME
     609   5249673915 :                   || is_gimple_reg (val))
     610   3578511043 :                 return val;
     611              :             }
     612              :         }
     613   5913299039 :       ptr->flags &= ~SSA_OP_DEF;
     614              :     }
     615              : 
     616  13236025130 :   ptr->done = true;
     617  13236025130 :   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     60179297 : clear_and_done_ssa_iter (ssa_op_iter *ptr)
     627              : {
     628     60179297 :   ptr->i = 0;
     629     60179297 :   ptr->numops = 0;
     630     60179297 :   ptr->uses = NULL;
     631     60179297 :   ptr->iter_type = ssa_op_iter_none;
     632     60179297 :   ptr->stmt = NULL;
     633     60179297 :   ptr->done = true;
     634     60179297 :   ptr->flags = 0;
     635              : }
     636              : 
     637              : /* Initialize the iterator PTR to the virtual defs in STMT.  */
     638              : inline void
     639  39678381184 : 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  39678381184 :   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  39678381184 :   ptr->numops = 0;
     648  39678381184 :   if (flags & (SSA_OP_DEF | SSA_OP_VDEF))
     649              :     {
     650  13483999020 :       switch (gimple_code (stmt))
     651              :         {
     652   6350785689 :           case GIMPLE_ASSIGN:
     653   6350785689 :           case GIMPLE_CALL:
     654   6350785689 :             ptr->numops = 1;
     655   6350785689 :             break;
     656     15684566 :           case GIMPLE_ASM:
     657     15684566 :             ptr->numops = gimple_asm_noutputs (as_a <gasm *> (stmt));
     658     15684566 :             break;
     659        32766 :           case GIMPLE_TRANSACTION:
     660        32766 :             ptr->numops = 0;
     661        32766 :             flags &= ~SSA_OP_DEF;
     662        32766 :             break;
     663   7117495999 :           default:
     664   7117495999 :             ptr->numops = 0;
     665   7117495999 :             flags &= ~(SSA_OP_DEF | SSA_OP_VDEF);
     666   7117495999 :             break;
     667              :         }
     668              :     }
     669  39678381184 :   ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL;
     670  39678381184 :   if (!(flags & SSA_OP_VUSE)
     671  28200362034 :       && ptr->uses
     672  46105270951 :       && gimple_vuse (stmt) != NULL_TREE)
     673   4088951393 :     ptr->uses = ptr->uses->next;
     674  39678381184 :   ptr->done = false;
     675  39678381184 :   ptr->i = 0;
     676              : 
     677  39678381184 :   ptr->stmt = stmt;
     678  39678381184 :   ptr->flags = flags;
     679  39678381184 : }
     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  25124473717 : op_iter_init_use (ssa_op_iter *ptr, gimple *stmt, int flags)
     685              : {
     686  25124473717 :   gcc_checking_assert ((flags & SSA_OP_ALL_DEFS) == 0
     687              :                        && (flags & SSA_OP_USE));
     688  25124473717 :   op_iter_init (ptr, stmt, flags);
     689  25124473717 :   ptr->iter_type = ssa_op_iter_use;
     690  25124473717 :   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   1270811484 : op_iter_init_def (ssa_op_iter *ptr, gimple *stmt, int flags)
     697              : {
     698   1270811484 :   gcc_checking_assert ((flags & SSA_OP_ALL_USES) == 0
     699              :                        && (flags & SSA_OP_DEF));
     700   1270811484 :   op_iter_init (ptr, stmt, flags);
     701   1270811484 :   ptr->iter_type = ssa_op_iter_def;
     702   1270811484 :   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  13283095983 : op_iter_init_tree (ssa_op_iter *ptr, gimple *stmt, int flags)
     709              : {
     710  13283095983 :   op_iter_init (ptr, stmt, flags);
     711  13283095983 :   ptr->iter_type = ssa_op_iter_tree;
     712  13283095983 :   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     83398721 : single_ssa_tree_operand (gimple *stmt, int flags)
     720              : {
     721     83398721 :   tree var;
     722     83398721 :   ssa_op_iter iter;
     723              : 
     724     83398721 :   var = op_iter_init_tree (&iter, stmt, flags);
     725     83398721 :   if (op_iter_done (&iter))
     726              :     return NULL_TREE;
     727     76550261 :   op_iter_next_tree (&iter);
     728     76550261 :   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        90779 : single_ssa_use_operand (gimple *stmt, int flags)
     738              : {
     739        90779 :   use_operand_p var;
     740        90779 :   ssa_op_iter iter;
     741              : 
     742        90779 :   var = op_iter_init_use (&iter, stmt, flags);
     743        90779 :   if (op_iter_done (&iter))
     744              :     return NULL_USE_OPERAND_P;
     745        90276 :   op_iter_next_use (&iter);
     746        90276 :   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       196078 : ssa_vuse_operand (gimple *stmt)
     755              : {
     756       345790 :   if (! gimple_vuse (stmt))
     757              :     return NULL_USE_OPERAND_P;
     758        14612 :   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    367414084 : single_ssa_def_operand (gimple *stmt, int flags)
     766              : {
     767    367414084 :   def_operand_p var;
     768    367414084 :   ssa_op_iter iter;
     769              : 
     770    367414084 :   var = op_iter_init_def (&iter, stmt, flags);
     771    367414084 :   if (op_iter_done (&iter))
     772              :     return NULL_DEF_OPERAND_P;
     773    128405192 :   op_iter_next_def (&iter);
     774    128405192 :   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     10792361 : zero_ssa_operands (gimple *stmt, int flags)
     784              : {
     785     10792361 :   ssa_op_iter iter;
     786              : 
     787     10792361 :   op_iter_init_tree (&iter, stmt, flags);
     788     10792361 :   return op_iter_done (&iter);
     789              : }
     790              : 
     791              : 
     792              : /* Return the number of operands matching FLAGS in STMT.  */
     793              : inline int
     794     47742136 : num_ssa_operands (gimple *stmt, int flags)
     795              : {
     796     47742136 :   ssa_op_iter iter;
     797     47742136 :   tree t;
     798     47742136 :   int num = 0;
     799              : 
     800     47742136 :   gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI);
     801    116556641 :   FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags)
     802     68814505 :     num++;
     803     47742136 :   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     47595732 : op_iter_init_phiuse (ssa_op_iter *ptr, gphi *phi, int flags)
     823              : {
     824     47595732 :   tree phi_def = gimple_phi_result (phi);
     825     47595732 :   int comp;
     826              : 
     827     47595732 :   clear_and_done_ssa_iter (ptr);
     828     47595732 :   ptr->done = false;
     829              : 
     830     47595732 :   gcc_checking_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
     831              : 
     832     47595732 :   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     47595732 :   if ((flags & comp) == 0)
     836              :     {
     837      3284024 :       ptr->done = true;
     838      3284024 :       return NULL_USE_OPERAND_P;
     839              :     }
     840              : 
     841     44311708 :   ptr->stmt = phi;
     842     44311708 :   ptr->numops = gimple_phi_num_args (phi);
     843     44311708 :   ptr->iter_type = ssa_op_iter_use;
     844     44311708 :   ptr->flags = flags;
     845     44311708 :   return op_iter_next_use (ptr);
     846              : }
     847              : 
     848              : 
     849              : /* Start an iterator for a PHI definition.  */
     850              : 
     851              : inline def_operand_p
     852     12583565 : op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags)
     853              : {
     854     12583565 :   tree phi_def = gimple_phi_result (phi);
     855     12583565 :   int comp;
     856              : 
     857     12583565 :   clear_and_done_ssa_iter (ptr);
     858     12583565 :   ptr->done = false;
     859              : 
     860     12583565 :   gcc_checking_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
     861              : 
     862     12583565 :   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     12583565 :   if ((flags & comp) == 0)
     867              :     {
     868      5441989 :       ptr->done = true;
     869      5441989 :       return NULL_DEF_OPERAND_P;
     870              :     }
     871              : 
     872      7141576 :   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      7141576 :   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    406100247 : end_imm_use_stmt_p (const imm_use_iterator *imm)
     883              : {
     884    256630749 :   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    107161251 : end_imm_use_stmt_traverse (imm_use_iterator * ARG_UNUSED (imm))
     892              : {
     893              : #if defined ENABLE_GIMPLE_CHECKING
     894     96977160 :   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    165546399 : move_use_after_head (use_operand_p use_p, use_operand_p head,
     906              :                       use_operand_p last_p)
     907              : {
     908    165546399 :   gcc_checking_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
     909              :   /* Skip head when we find it.  */
     910    165546399 :   if (use_p != head)
     911              :     {
     912              :       /* If use_p is already linked in after last_p, continue.  */
     913      2264614 :       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      1259073 :           delink_imm_use (use_p);
     919      1259073 :           link_imm_use_to_list (use_p, last_p);
     920      1259073 :           last_p = use_p;
     921              :         }
     922              :     }
     923    165546399 :   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    163281785 : link_use_stmts_after (use_operand_p head, imm_use_iterator *)
     933              : {
     934    163281785 :   use_operand_p use_p;
     935    163281785 :   use_operand_p last_p = head;
     936    163281785 :   gimple *head_stmt = USE_STMT (head);
     937    163281785 :   tree use = USE_FROM_PTR (head);
     938    163281785 :   ssa_op_iter op_iter;
     939    163281785 :   int flag;
     940              : 
     941              :   /* Only look at virtual or real uses, depending on the type of HEAD.  */
     942    163281785 :   flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
     943              : 
     944    163281785 :   if (gphi *phi = dyn_cast <gphi *> (head_stmt))
     945              :     {
     946    172683281 :       FOR_EACH_PHI_ARG (use_p, phi, op_iter, flag)
     947    154856753 :         if (USE_FROM_PTR (use_p) == use)
     948     19828464 :           last_p = move_use_after_head (use_p, head, last_p);
     949              :     }
     950              :   else
     951              :     {
     952    145455257 :       if (flag == SSA_OP_USE)
     953              :         {
     954    194510362 :           FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag)
     955    117135253 :             if (USE_FROM_PTR (use_p) == use)
     956     77637787 :               last_p = move_use_after_head (use_p, head, last_p);
     957              :         }
     958     68080148 :       else if ((use_p = gimple_vuse_op (head_stmt)) != NULL_USE_OPERAND_P)
     959              :         {
     960     68080148 :           if (USE_FROM_PTR (use_p) == use)
     961     68080148 :             last_p = move_use_after_head (use_p, head, last_p);
     962              :         }
     963              :     }
     964    163281785 :   return last_p;
     965              : }
     966              : 
     967              : /* Initialize IMM to traverse over uses of VAR.  Return the first statement.  */
     968              : inline gimple *
     969    107161251 : first_imm_use_stmt (imm_use_iterator *imm, tree var)
     970              : {
     971              : #if defined ENABLE_GIMPLE_CHECKING
     972    107161251 :   gcc_assert (var->ssa_name.active_iterated_stmt == NULL
     973              :               && var->ssa_name.fast_iteration_depth == 0);
     974              : #endif
     975    107161251 :   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
     976    107161251 :   imm->imm_use = imm->end_p->next;
     977    107161251 :   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    107161251 :   imm->next_stmt_use = NULL_USE_OPERAND_P;
     982    107161251 :   imm->name = var;
     983              : 
     984    107161251 :   if (end_imm_use_stmt_p (imm))
     985              :     return NULL;
     986              : 
     987    103882419 :   imm->next_stmt_use = link_use_stmts_after (imm->imm_use, imm)->next;
     988              : 
     989              : #if defined ENABLE_GIMPLE_CHECKING
     990    103882419 :   var->ssa_name.active_iterated_stmt = USE_STMT (imm->imm_use);
     991              : #endif
     992    103882419 :   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    149469498 : next_imm_use_stmt (imm_use_iterator *imm)
     999              : {
    1000    149469498 :   imm->imm_use = imm->next_stmt_use;
    1001    149469498 :   if (end_imm_use_stmt_p (imm))
    1002              :     return NULL;
    1003              : 
    1004              : #if defined ENABLE_GIMPLE_CHECKING
    1005     59399366 :   imm->name->ssa_name.active_iterated_stmt = USE_STMT (imm->imm_use);
    1006              : #endif
    1007     59399366 :   imm->next_stmt_use = link_use_stmts_after (imm->imm_use, imm)->next;
    1008     59399366 :   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     45614226 : first_imm_use_on_stmt (imm_use_iterator *imm)
    1016              : {
    1017     45614226 :   imm->next_imm_name = imm->imm_use->next;
    1018     45611403 :   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     92482897 : end_imm_use_on_stmt_p (const imm_use_iterator *imm)
    1025              : {
    1026     92482897 :   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     46868671 : next_imm_use_on_stmt (imm_use_iterator *imm)
    1033              : {
    1034     46868671 :   imm->imm_use = imm->next_imm_name;
    1035     46868671 :   if (end_imm_use_on_stmt_p (imm))
    1036              :     return NULL_USE_OPERAND_P;
    1037              :   else
    1038              :     {
    1039      1257268 :       imm->next_imm_name = imm->imm_use->next;
    1040      1257268 :       return imm->imm_use;
    1041              :     }
    1042              : }
    1043              : 
    1044              : /* Delink all immediate_use information for STMT.  */
    1045              : inline void
    1046    168490405 : delink_stmt_imm_use (gimple *stmt)
    1047              : {
    1048    168490405 :    ssa_op_iter iter;
    1049    168490405 :    use_operand_p use_p;
    1050              : 
    1051    168490405 :    if (ssa_operands_active (cfun))
    1052    359870450 :      FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_ALL_USES)
    1053     78616670 :        delink_imm_use (use_p);
    1054    168490405 : }
    1055              : 
    1056              : #endif /* GCC_TREE_SSA_ITERATORS_H */
        

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