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

             Branch data     Line data    Source code
       1                 :             : /* Data structures and function declarations for the SSA value propagation
       2                 :             :    engine.
       3                 :             :    Copyright (C) 2004-2024 Free Software Foundation, Inc.
       4                 :             :    Contributed by Diego Novillo <dnovillo@redhat.com>
       5                 :             : 
       6                 :             : This file is part of GCC.
       7                 :             : 
       8                 :             : GCC is free software; you can redistribute it and/or modify
       9                 :             : it under the terms of the GNU General Public License as published by
      10                 :             : the Free Software Foundation; either version 3, or (at your option)
      11                 :             : any later version.
      12                 :             : 
      13                 :             : GCC is distributed in the hope that it will be useful,
      14                 :             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      15                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16                 :             : GNU General Public License for more details.
      17                 :             : 
      18                 :             : You should have received a copy of the GNU General Public License
      19                 :             : along with GCC; see the file COPYING3.  If not see
      20                 :             : <http://www.gnu.org/licenses/>.  */
      21                 :             : 
      22                 :             : #ifndef _TREE_SSA_PROPAGATE_H
      23                 :             : #define _TREE_SSA_PROPAGATE_H 1
      24                 :             : 
      25                 :             : #include "value-query.h"
      26                 :             : 
      27                 :             : /* If SIM_P is true, statement S will be simulated again.  */
      28                 :             : 
      29                 :             : inline void
      30                 :   706827052 : prop_set_simulate_again (gimple *s, bool visit_p)
      31                 :             : {
      32                 :   706827052 :   gimple_set_visited (s, visit_p);
      33                 :   235861849 : }
      34                 :             : 
      35                 :             : /* Return true if statement T should be simulated again.  */
      36                 :             : 
      37                 :             : inline bool
      38                 :  3952023466 : prop_simulate_again_p (gimple *s)
      39                 :             : {
      40                 :  3952023466 :   return gimple_visited_p (s);
      41                 :             : }
      42                 :             : 
      43                 :             : /* Lattice values used for propagation purposes.  Specific instances
      44                 :             :    of a propagation engine must return these values from the statement
      45                 :             :    and PHI visit functions to direct the engine.  */
      46                 :             : enum ssa_prop_result {
      47                 :             :     /* The statement produces nothing of interest.  No edges will be
      48                 :             :        added to the work lists.  */
      49                 :             :     SSA_PROP_NOT_INTERESTING,
      50                 :             : 
      51                 :             :     /* The statement produces an interesting value.  The set SSA_NAMEs
      52                 :             :        returned by SSA_PROP_VISIT_STMT should be added to
      53                 :             :        INTERESTING_SSA_EDGES.  If the statement being visited is a
      54                 :             :        conditional jump, SSA_PROP_VISIT_STMT should indicate which edge
      55                 :             :        out of the basic block should be marked executable.  */
      56                 :             :     SSA_PROP_INTERESTING,
      57                 :             : 
      58                 :             :     /* The statement produces a varying (i.e., useless) value and
      59                 :             :        should not be simulated again.  If the statement being visited
      60                 :             :        is a conditional jump, all the edges coming out of the block
      61                 :             :        will be considered executable.  */
      62                 :             :     SSA_PROP_VARYING
      63                 :             : };
      64                 :             : 
      65                 :             : 
      66                 :             : extern void move_ssa_defining_stmt_for_defs (gimple *, gimple *);
      67                 :             : extern bool stmt_makes_single_store (gimple *);
      68                 :             : extern bool may_propagate_copy (tree, tree, bool = false);
      69                 :             : extern bool may_propagate_copy_into_stmt (gimple *, tree);
      70                 :             : extern bool may_propagate_copy_into_asm (tree);
      71                 :             : extern void propagate_value (use_operand_p, tree);
      72                 :             : extern void replace_exp (use_operand_p, tree);
      73                 :             : extern void propagate_tree_value (tree *, tree);
      74                 :             : extern void propagate_tree_value_into_stmt (gimple_stmt_iterator *, tree);
      75                 :             : 
      76                 :             : /* Public interface into the SSA propagation engine.  Clients should inherit
      77                 :             :    from this class and provide their own visitors.  */
      78                 :             : 
      79                 :             : class ssa_propagation_engine
      80                 :             : {
      81                 :             :  public:
      82                 :             : 
      83                 :     7246000 :   virtual ~ssa_propagation_engine (void) { }
      84                 :             : 
      85                 :             :   /* Virtual functions the clients must provide to visit statements
      86                 :             :      and phi nodes respectively.  */
      87                 :             :   virtual enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) = 0;
      88                 :             :   virtual enum ssa_prop_result visit_phi (gphi *) = 0;
      89                 :             : 
      90                 :             :   /* Main interface into the propagation engine.  */
      91                 :             :   void ssa_propagate (void);
      92                 :             : 
      93                 :             :  private:
      94                 :             :   /* Internal implementation details.  */
      95                 :             :   void simulate_stmt (gimple *stmt);
      96                 :             :   void simulate_block (basic_block);
      97                 :             : };
      98                 :             : 
      99                 :             : class substitute_and_fold_engine : public range_query
     100                 :             : {
     101                 :             :  public:
     102                 :    11100399 :   substitute_and_fold_engine (bool fold_all_stmts = false)
     103                 :    11100399 :     : fold_all_stmts (fold_all_stmts) { }
     104                 :             : 
     105                 :             :   virtual tree value_of_expr (tree expr, gimple * = NULL) = 0;
     106                 :             :   virtual tree value_on_edge (edge, tree expr) override;
     107                 :             :   virtual tree value_of_stmt (gimple *, tree name = NULL) override;
     108                 :             :   virtual bool range_of_expr (vrange &r, tree expr, gimple * = NULL);
     109                 :             : 
     110                 :    11100399 :   virtual ~substitute_and_fold_engine (void) { }
     111                 :   171375593 :   virtual bool fold_stmt (gimple_stmt_iterator *) { return false; }
     112                 :             : 
     113                 :             :   bool substitute_and_fold (basic_block = NULL);
     114                 :             :   bool replace_uses_in (gimple *);
     115                 :             :   bool replace_phi_args_in (gphi *);
     116                 :             : 
     117                 :    72490865 :   virtual void pre_fold_bb (basic_block) { }
     118                 :    72490865 :   virtual void post_fold_bb (basic_block) { }
     119                 :   456455322 :   virtual void pre_fold_stmt (gimple *) { }
     120                 :       58232 :   virtual void post_new_stmt (gimple *) { }
     121                 :             : 
     122                 :             :   bool propagate_into_phi_args (basic_block);
     123                 :             : 
     124                 :             :   /* Users like VRP can set this when they want to perform
     125                 :             :      folding for every propagation.  */
     126                 :             :   bool fold_all_stmts;
     127                 :             : };
     128                 :             : 
     129                 :             : #endif /* _TREE_SSA_PROPAGATE_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.