LCOV - code coverage report
Current view: top level - gcc - tree-hasher.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 87.5 % 8 7
Test Date: 2024-04-13 14:00:49 Functions: - 0 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Hash Table Helper for Trees
       2                 :             :    Copyright (C) 2012-2024 Free Software Foundation, Inc.
       3                 :             :    Contributed by Lawrence Crowl <crowl@google.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                 :             : #ifndef GCC_TREE_HASHER_H
      22                 :             : #define GCC_TREE_HASHER_H 1
      23                 :             : 
      24                 :             : struct int_tree_map {
      25                 :             :   unsigned int uid;
      26                 :             :   tree to;
      27                 :             : };
      28                 :             : 
      29                 :             : /* Hashtable helpers.  */
      30                 :             : 
      31                 :             : struct int_tree_hasher
      32                 :             : {
      33                 :             :   typedef int_tree_map value_type;
      34                 :             :   typedef int_tree_map compare_type;
      35                 :             :   static inline hashval_t hash (const value_type &);
      36                 :             :   static inline bool equal (const value_type &, const compare_type &);
      37                 :      240784 :   static bool is_deleted (const value_type &v)
      38                 :             :     {
      39                 :      240784 :       return v.to == reinterpret_cast<tree> (1);
      40                 :             :     }
      41                 :             :   static void mark_deleted (value_type &v) { v.to = reinterpret_cast<tree> (0x1); }
      42                 :      949392 :   static bool is_empty (const value_type &v) { return v.to == NULL; }
      43                 :             :   static const bool empty_zero_p = true;
      44                 :           0 :   static void mark_empty (value_type &v) { v.to = NULL; }
      45                 :             :   static void remove (value_type &) {}
      46                 :             : };
      47                 :             : 
      48                 :             : /* Hash a UID in a int_tree_map.  */
      49                 :             : 
      50                 :             : inline hashval_t
      51                 :      187202 : int_tree_hasher::hash (const value_type &item)
      52                 :             : {
      53                 :      187202 :   return item.uid;
      54                 :             : }
      55                 :             : 
      56                 :             : /* Return true if the uid in both int tree maps are equal.  */
      57                 :             : 
      58                 :             : inline bool
      59                 :      213650 : int_tree_hasher::equal (const value_type &a, const compare_type &b)
      60                 :             : {
      61                 :      213650 :   return (a.uid == b.uid);
      62                 :             : }
      63                 :             : 
      64                 :             : typedef hash_table <int_tree_hasher> int_tree_htab_type;
      65                 :             : 
      66                 :             : #endif /* GCC_TREE_HASHER_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.