LCOV - code coverage report
Current view: top level - gcc - cselib.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 10 10
Test Date: 2026-12-05 16:10:02 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Common subexpression elimination for GNU compiler.
       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              : #ifndef GCC_CSELIB_H
      21              : #define GCC_CSELIB_H
      22              : 
      23              : /* Describe a value.  */
      24              : struct cselib_val
      25              : {
      26              :   /* The hash value.  */
      27              :   unsigned int hash;
      28              : 
      29              :   /* True if this value is entered in cselib_preserved_hash_table.  */
      30              :   unsigned int in_preserved_table_p : 1;
      31              : 
      32              :   /* True if every value referenced by every element of LOCS is known
      33              :      to be a preserved value.  */
      34              :   unsigned int all_locs_preserved_p : 1;
      35              : 
      36              :   /* A VALUE rtx that points back to this structure.  */
      37              :   rtx val_rtx;
      38              : 
      39              :   /* All rtl expressions that hold this value at the current time during a
      40              :      scan.  */
      41              :   struct elt_loc_list *locs;
      42              : 
      43              :   /* If this value is used as an address, points to a list of values that
      44              :      use it as an address in a MEM.  The MEMs can be in any address space.
      45              :      Each MEM, with its address space, is in the locs of its value.  */
      46              :   struct elt_list *addr_list;
      47              : 
      48              :   struct cselib_val *next_containing_mem;
      49              : };
      50              : 
      51              : /* A list of rtl expressions that hold the same value.  */
      52              : struct elt_loc_list {
      53              :   /* Next element in the list.  */
      54              :   struct elt_loc_list *next;
      55              :   /* An rtl expression that holds the value.  */
      56              :   rtx loc;
      57              :   /* The insn that made the equivalence.  */
      58              :   rtx_insn *setting_insn;
      59              : };
      60              : 
      61              : /* Describe a single set that is part of an insn.  */
      62              : struct cselib_set
      63              : {
      64              :   rtx src;
      65              :   rtx dest;
      66              :   cselib_val *src_elt;
      67              :   cselib_val *dest_addr_elt;
      68              : };
      69              : 
      70              : enum cselib_record_what
      71              : {
      72              :   CSELIB_RECORD_MEMORY = 1,
      73              :   CSELIB_PRESERVE_CONSTANTS = 2
      74              : };
      75              : 
      76              : extern void (*cselib_discard_hook) (cselib_val *);
      77              : extern void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets,
      78              :                                         int n_sets);
      79              : 
      80              : extern cselib_val *cselib_lookup (rtx, machine_mode,
      81              :                                   int, machine_mode);
      82              : extern cselib_val *cselib_lookup_from_insn (rtx, machine_mode,
      83              :                                             int, machine_mode, rtx_insn *);
      84              : extern void cselib_lookup_mem_other_modes (rtx, vec<cselib_val *> &);
      85              : extern void cselib_init (int);
      86              : extern void cselib_clear_table (void);
      87              : extern void cselib_finish (void);
      88              : extern void cselib_process_insn (rtx_insn *);
      89              : extern bool fp_setter_insn (rtx_insn *);
      90              : extern machine_mode cselib_reg_set_mode (const_rtx);
      91              : extern bool rtx_equal_for_cselib_1 (rtx, rtx, machine_mode, int);
      92              : extern bool cselib_redundant_set_p (rtx);
      93              : extern bool references_value_p (const_rtx);
      94              : extern rtx cselib_expand_value_rtx (rtx, bitmap, int);
      95              : typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *);
      96              : extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int,
      97              :                                        cselib_expand_callback, void *);
      98              : extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int,
      99              :                                               cselib_expand_callback, void *);
     100              : extern rtx cselib_subst_to_values (rtx, machine_mode);
     101              : extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *);
     102              : extern void cselib_invalidate_rtx (rtx);
     103              : 
     104              : extern void cselib_reset_table (unsigned int);
     105              : extern unsigned int cselib_get_next_uid (void);
     106              : extern void cselib_preserve_value (cselib_val *);
     107              : extern bool cselib_preserved_value_p (cselib_val *);
     108              : extern void cselib_preserve_only_values (void);
     109              : extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int);
     110              : extern void cselib_add_permanent_equiv (cselib_val *, rtx, rtx_insn *);
     111              : extern bool cselib_have_permanent_equivalences (void);
     112              : extern void cselib_set_value_sp_based (cselib_val *);
     113              : extern bool cselib_sp_based_value_p (cselib_val *);
     114              : extern void cselib_record_sp_cfa_base_equiv (HOST_WIDE_INT, rtx_insn *);
     115              : extern bool cselib_sp_derived_value_p (cselib_val *);
     116              : 
     117              : extern void dump_cselib_table (FILE *);
     118              : 
     119              : /* Return the canonical value for VAL, following the equivalence chain
     120              :    towards the earliest (== lowest uid) equivalent value.  */
     121              : 
     122              : inline cselib_val *
     123   2577220160 : canonical_cselib_val (cselib_val *val)
     124              : {
     125   2577220160 :   cselib_val *canon;
     126              : 
     127   1845535389 :   if (!val->locs || val->locs->next
     128    938048526 :       || !val->locs->loc || GET_CODE (val->locs->loc) != VALUE
     129   2596818940 :       || CSELIB_VAL_UID (val->val_rtx) < CSELIB_VAL_UID (val->locs->loc))
     130              :     return val;
     131              : 
     132     19589118 :   canon = CSELIB_VAL_PTR (val->locs->loc);
     133     19589118 :   gcc_checking_assert (canonical_cselib_val (canon) == canon);
     134              :   return canon;
     135              : }
     136              : 
     137              : /* Return true if we can prove that X and Y contain the same value, taking
     138              :    our gathered information into account.  */
     139              : 
     140              : inline bool
     141     56621400 : rtx_equal_for_cselib_p (rtx x, rtx y)
     142              : {
     143     56621400 :   if (x == y)
     144              :     return true;
     145              : 
     146     56606367 :   return rtx_equal_for_cselib_1 (x, y, VOIDmode, 0);
     147              : }
     148              : 
     149              : #endif /* GCC_CSELIB_H */
        

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