LCOV - code coverage report
Current view: top level - gcc - rtlhash.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 63.0 % 54 34
Test Date: 2026-02-28 14:20:25 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* RTL hash functions.
       2              :    Copyright (C) 1987-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              : #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       888987 : add_rtx (const_rtx x, hash &hstate)
      34              : {
      35       888987 :   enum rtx_code code;
      36       888987 :   machine_mode mode;
      37       888987 :   int i, j;
      38       888987 :   const char *fmt;
      39              : 
      40       888987 :   if (x == NULL_RTX)
      41       668851 :     return;
      42       888987 :   code = GET_CODE (x);
      43       888987 :   hstate.add_object (code);
      44       888987 :   mode = GET_MODE (x);
      45       888987 :   hstate.add_object (mode);
      46       888987 :   switch (code)
      47              :     {
      48            0 :     case REG:
      49            0 :       hstate.add_int (REGNO (x));
      50            0 :       return;
      51       109185 :     case CONST_INT:
      52       109185 :       hstate.add_object (INTVAL (x));
      53       109185 :       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       559658 :     case SYMBOL_REF:
      63       559658 :       if (XSTR (x, 0))
      64       559658 :         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       220136 :   fmt = GET_RTX_FORMAT (code);
      80       550686 :   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
      81       330550 :     switch (fmt[i])
      82              :       {
      83            0 :       case 'w':
      84            0 :         hstate.add_hwi (XWINT (x, i));
      85            0 :         break;
      86         1229 :       case 'n':
      87         1229 :       case 'i':
      88         1229 :         hstate.add_int (XINT (x, i));
      89         1229 :         break;
      90            0 :       case 'L':
      91            0 :         hstate.add_hwi (XLOC (x, i));
      92            0 :         break;
      93            0 :       case 'p':
      94            0 :         hstate.add_poly_int (SUBREG_BYTE (x));
      95            0 :         break;
      96         1229 :       case 'V':
      97         1229 :       case 'E':
      98         1229 :         j = XVECLEN (x, i);
      99         1229 :         hstate.add_int (j);
     100         2458 :         for (j = 0; j < XVECLEN (x, i); j++)
     101         1229 :           inchash::add_rtx (XVECEXP (x, i, j), hstate);
     102              :         break;
     103       328092 :       case 'e':
     104       328092 :         inchash::add_rtx (XEXP (x, i), hstate);
     105       328092 :         break;
     106            0 :       case 'S':
     107            0 :       case 's':
     108            0 :         if (XSTR (x, i))
     109            0 :           hstate.add (XSTR (x, 0), strlen (XSTR (x, 0)) + 1);
     110              :         break;
     111              :       default:
     112              :         break;
     113              :       }
     114              : }
     115              : 
     116              : }
        

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.