LCOV - code coverage report
Current view: top level - gcc - tree-iterator.h (source / functions) Hit Total Coverage
Test: gcc.info Lines: 24 24 100.0 %
Date: 2020-03-28 11:57:23 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* Iterator routines for manipulating GENERIC tree statement list.
       2                 :            :    Copyright (C) 2003-2020 Free Software Foundation, Inc.
       3                 :            :    Contributed by Andrew MacLeod  <amacleod@redhat.com>
       4                 :            : 
       5                 :            : This file is part of GCC.
       6                 :            : 
       7                 :            : GCC is free software; you can redistribute it and/or modify
       8                 :            : it under the terms of the GNU General Public License as published by
       9                 :            : the Free Software Foundation; either version 3, or (at your option)
      10                 :            : any later version.
      11                 :            : 
      12                 :            : GCC is distributed in the hope that it will be useful,
      13                 :            : but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :            : GNU General Public License for more details.
      16                 :            : 
      17                 :            : You should have received a copy of the GNU General Public License
      18                 :            : along with GCC; see the file COPYING3.  If not see
      19                 :            : <http://www.gnu.org/licenses/>.  */
      20                 :            : 
      21                 :            : 
      22                 :            : /* This file is dependent upon the implementation of tree's. It provides an
      23                 :            :    abstract interface to the tree objects such that if all tree creation and
      24                 :            :    manipulations are done through this interface, we can easily change the
      25                 :            :    implementation of tree's, and not impact other code.  */
      26                 :            : 
      27                 :            : #ifndef GCC_TREE_ITERATOR_H
      28                 :            : #define GCC_TREE_ITERATOR_H 1
      29                 :            : 
      30                 :            : /* Iterator object for GENERIC or GIMPLE TREE statements.  */
      31                 :            : 
      32                 :            : struct tree_stmt_iterator {
      33                 :            :   struct tree_statement_list_node *ptr;
      34                 :            :   tree container;
      35                 :            : };
      36                 :            : 
      37                 :            : static inline tree_stmt_iterator
      38                 :  175221551 : tsi_start (tree t)
      39                 :            : {
      40                 :  175221551 :   tree_stmt_iterator i;
      41                 :            : 
      42                 :  175221551 :   i.ptr = STATEMENT_LIST_HEAD (t);
      43                 :  175221551 :   i.container = t;
      44                 :            : 
      45                 :  175221551 :   return i;
      46                 :            : }
      47                 :            : 
      48                 :            : static inline tree_stmt_iterator
      49                 :  167517307 : tsi_last (tree t)
      50                 :            : {
      51                 :  167517307 :   tree_stmt_iterator i;
      52                 :            : 
      53                 :  167517307 :   i.ptr = STATEMENT_LIST_TAIL (t);
      54                 :  167517307 :   i.container = t;
      55                 :            : 
      56                 :  167517307 :   return i;
      57                 :            : }
      58                 :            : 
      59                 :            : static inline bool
      60                 :  304452883 : tsi_end_p (tree_stmt_iterator i)
      61                 :            : {
      62                 :  304409250 :   return i.ptr == NULL;
      63                 :            : }
      64                 :            : 
      65                 :            : static inline bool
      66                 :  112404686 : tsi_one_before_end_p (tree_stmt_iterator i)
      67                 :            : {
      68                 :  112404686 :   return i.ptr != NULL && i.ptr->next == NULL;
      69                 :            : }
      70                 :            : 
      71                 :            : static inline void
      72                 :  175865846 : tsi_next (tree_stmt_iterator *i)
      73                 :            : {
      74                 :  161382882 :   i->ptr = i->ptr->next;
      75                 :  164559278 : }
      76                 :            : 
      77                 :            : static inline void
      78                 :        270 : tsi_prev (tree_stmt_iterator *i)
      79                 :            : {
      80                 :        270 :   i->ptr = i->ptr->prev;
      81                 :        270 : }
      82                 :            : 
      83                 :            : static inline tree *
      84                 :  136952199 : tsi_stmt_ptr (tree_stmt_iterator i)
      85                 :            : {
      86                 :  136952199 :   return &i.ptr->stmt;
      87                 :            : }
      88                 :            : 
      89                 :            : static inline tree
      90                 :  219260003 : tsi_stmt (tree_stmt_iterator i)
      91                 :            : {
      92                 :  208031637 :   return i.ptr->stmt;
      93                 :            : }
      94                 :            : 
      95                 :            : enum tsi_iterator_update
      96                 :            : {
      97                 :            :   TSI_NEW_STMT,         /* Only valid when single statement is added, move
      98                 :            :                            iterator to it.  */
      99                 :            :   TSI_SAME_STMT,        /* Leave the iterator at the same statement.  */
     100                 :            :   TSI_CHAIN_START,      /* Only valid when chain of statements is added, move
     101                 :            :                            iterator to the first statement in the chain.  */
     102                 :            :   TSI_CHAIN_END,        /* Only valid when chain of statements is added, move
     103                 :            :                            iterator to the last statement in the chain.  */
     104                 :            :   TSI_CONTINUE_LINKING  /* Move iterator to whatever position is suitable for
     105                 :            :                            linking other statements/chains of statements in
     106                 :            :                            the same direction.  */
     107                 :            : };
     108                 :            : 
     109                 :            : extern void tsi_link_before (tree_stmt_iterator *, tree,
     110                 :            :                              enum tsi_iterator_update);
     111                 :            : extern void tsi_link_after (tree_stmt_iterator *, tree,
     112                 :            :                             enum tsi_iterator_update);
     113                 :            : 
     114                 :            : extern void tsi_delink (tree_stmt_iterator *);
     115                 :            : 
     116                 :            : extern tree alloc_stmt_list (void);
     117                 :            : extern void free_stmt_list (tree);
     118                 :            : extern void append_to_statement_list (tree, tree *);
     119                 :            : extern void append_to_statement_list_force (tree, tree *);
     120                 :            : extern tree expr_first (tree);
     121                 :            : extern tree expr_last (tree);
     122                 :            : 
     123                 :            : #endif /* GCC_TREE_ITERATOR_H  */

Generated by: LCOV version 1.0

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 --enable-host-shared. GCC test suite is run with the built compiler.