LCOV - code coverage report
Current view: top level - gcc - rtlhash.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 66.7 % 51 34
Test Date: 2024-04-13 14:00:49 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* RTL hash functions.
       2                 :             :    Copyright (C) 1987-2024 Free Software Foundation, Inc.
       3                 :             : 
       4                 :             : This file is part of GCC.
       5                 :             : 
       6                 :             : GCC is free software; you can redistribute it and/or modify it under
       7                 :             : the terms of the GNU General Public License as published by the Free
       8                 :             : Software Foundation; either version 3, or (at your option) any later
       9                 :             : version.
      10                 :             : 
      11                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14                 :             : for more details.
      15                 :             : 
      16                 :             : You should have received a copy of the GNU General Public License
      17                 :             : along with GCC; see the file COPYING3.  If not see
      18                 :             : <http://www.gnu.org/licenses/>.  */
      19                 :             : 
      20                 :             : #include "config.h"
      21                 :             : #include "system.h"
      22                 :             : #include "coretypes.h"
      23                 :             : #include "tm.h"
      24                 :             : #include "rtl.h"
      25                 :             : #include "rtlhash.h"
      26                 :             : 
      27                 :             : namespace inchash
      28                 :             : {
      29                 :             : 
      30                 :             : /* Iteratively hash rtx X into HSTATE.  */
      31                 :             : 
      32                 :             : void
      33                 :      596529 : add_rtx (const_rtx x, hash &hstate)
      34                 :             : {
      35                 :      596529 :   enum rtx_code code;
      36                 :      596529 :   machine_mode mode;
      37                 :      596529 :   int i, j;
      38                 :      596529 :   const char *fmt;
      39                 :             : 
      40                 :      596529 :   if (x == NULL_RTX)
      41                 :      466177 :     return;
      42                 :      596529 :   code = GET_CODE (x);
      43                 :      596529 :   hstate.add_object (code);
      44                 :      596529 :   mode = GET_MODE (x);
      45                 :      596529 :   hstate.add_object (mode);
      46                 :      596529 :   switch (code)
      47                 :             :     {
      48                 :           0 :     case REG:
      49                 :           0 :       hstate.add_int (REGNO (x));
      50                 :           0 :       return;
      51                 :       64127 :     case CONST_INT:
      52                 :       64127 :       hstate.add_object (INTVAL (x));
      53                 :       64127 :       return;
      54                 :             :     case CONST_WIDE_INT:
      55                 :           0 :       for (i = 0; i < CONST_WIDE_INT_NUNITS (x); i++)
      56                 :           0 :         hstate.add_object (CONST_WIDE_INT_ELT (x, i));
      57                 :             :       return;
      58                 :             :     case CONST_POLY_INT:
      59                 :           0 :       for (i = 0; i < NUM_POLY_INT_COEFFS; ++i)
      60                 :           0 :         hstate.add_wide_int (CONST_POLY_INT_COEFFS (x)[i]);
      61                 :             :       break;
      62                 :      402042 :     case SYMBOL_REF:
      63                 :      402042 :       if (XSTR (x, 0))
      64                 :      402042 :         hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
      65                 :             :       return;
      66                 :             :     case LABEL_REF:
      67                 :             :     case DEBUG_EXPR:
      68                 :             :     case VALUE:
      69                 :             :     case SCRATCH:
      70                 :             :     case CONST_DOUBLE:
      71                 :             :     case CONST_FIXED:
      72                 :             :     case DEBUG_IMPLICIT_PTR:
      73                 :             :     case DEBUG_PARAMETER_REF:
      74                 :             :       return;
      75                 :             :     default:
      76                 :             :       break;
      77                 :             :     }
      78                 :             : 
      79                 :      130352 :   fmt = GET_RTX_FORMAT (code);
      80                 :      326242 :   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
      81                 :      195890 :     switch (fmt[i])
      82                 :             :       {
      83                 :           0 :       case 'w':
      84                 :           0 :         hstate.add_hwi (XWINT (x, i));
      85                 :           0 :         break;
      86                 :        1411 :       case 'n':
      87                 :        1411 :       case 'i':
      88                 :        1411 :         hstate.add_int (XINT (x, i));
      89                 :        1411 :         break;
      90                 :           0 :       case 'p':
      91                 :           0 :         hstate.add_poly_int (SUBREG_BYTE (x));
      92                 :           0 :         break;
      93                 :        1411 :       case 'V':
      94                 :        1411 :       case 'E':
      95                 :        1411 :         j = XVECLEN (x, i);
      96                 :        1411 :         hstate.add_int (j);
      97                 :        2822 :         for (j = 0; j < XVECLEN (x, i); j++)
      98                 :        1411 :           inchash::add_rtx (XVECEXP (x, i, j), hstate);
      99                 :             :         break;
     100                 :      193068 :       case 'e':
     101                 :      193068 :         inchash::add_rtx (XEXP (x, i), hstate);
     102                 :      193068 :         break;
     103                 :           0 :       case 'S':
     104                 :           0 :       case 's':
     105                 :           0 :         if (XSTR (x, i))
     106                 :           0 :           hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
     107                 :             :         break;
     108                 :             :       default:
     109                 :             :         break;
     110                 :             :       }
     111                 :             : }
     112                 :             : 
     113                 :             : }
        

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.