LCOV - code coverage report
Current view: top level - gcc - int-vector-builder.h (source / functions) Hit Total Coverage
Test: gcc.info Lines: 16 16 100.0 %
Date: 2020-04-04 11:58:09 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* A class for building vector integer constants.
       2                 :            :    Copyright (C) 2017-2020 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_INT_VECTOR_BUILDER_H
      21                 :            : #define GCC_INT_VECTOR_BUILDER_H 1
      22                 :            : 
      23                 :            : #include "vector-builder.h"
      24                 :            : 
      25                 :            : /* This class is used to build vectors of integer type T using the same
      26                 :            :    encoding as tree and rtx constants.  See vector_builder for more
      27                 :            :    details.  */
      28                 :            : template<typename T>
      29                 :    2231969 : class int_vector_builder : public vector_builder<T, poly_uint64,
      30                 :            :                                                  int_vector_builder<T> >
      31                 :            : {
      32                 :            :   typedef vector_builder<T, poly_uint64, int_vector_builder> parent;
      33                 :            :   friend class vector_builder<T, poly_uint64, int_vector_builder>;
      34                 :            : 
      35                 :            : public:
      36                 :    1441894 :   int_vector_builder () {}
      37                 :            :   int_vector_builder (poly_uint64, unsigned int, unsigned int);
      38                 :            : 
      39                 :            :   using parent::new_vector;
      40                 :            : 
      41                 :            : private:
      42                 :            :   bool equal_p (T, T) const;
      43                 :     869768 :   bool allow_steps_p () const { return true; }
      44                 :    1510870 :   bool integral_p (T) const { return true; }
      45                 :            :   T step (T, T) const;
      46                 :            :   T apply_step (T, unsigned int, T) const;
      47                 :    1021870 :   bool can_elide_p (T) const { return true; }
      48                 :    1154030 :   void note_representative (T *, T) {}
      49                 :            : 
      50                 :            :   static poly_uint64 shape_nelts (poly_uint64 x) { return x; }
      51                 :            : };
      52                 :            : 
      53                 :            : /* Create a new builder for a vector with FULL_NELTS elements.
      54                 :            :    Initially encode the value as NPATTERNS interleaved patterns with
      55                 :            :    NELTS_PER_PATTERN elements each.  */
      56                 :            : 
      57                 :            : template<typename T>
      58                 :            : inline
      59                 :      29255 : int_vector_builder<T>::int_vector_builder (poly_uint64 full_nelts,
      60                 :            :                                            unsigned int npatterns,
      61                 :      29255 :                                            unsigned int nelts_per_pattern)
      62                 :            : {
      63                 :      29255 :   new_vector (full_nelts, npatterns, nelts_per_pattern);
      64                 :        325 : }
      65                 :            : 
      66                 :            : /* Return true if elements ELT1 and ELT2 are equal.  */
      67                 :            : 
      68                 :            : template<typename T>
      69                 :            : inline bool
      70                 :    3957880 : int_vector_builder<T>::equal_p (T elt1, T elt2) const
      71                 :            : {
      72                 :    3957880 :   return known_eq (elt1, elt2);
      73                 :            : }
      74                 :            : 
      75                 :            : /* Return the value of element ELT2 minus the value of element ELT1.  */
      76                 :            : 
      77                 :            : template<typename T>
      78                 :            : inline T
      79                 :    2483529 : int_vector_builder<T>::step (T elt1, T elt2) const
      80                 :            : {
      81                 :    2483529 :   return elt2 - elt1;
      82                 :            : }
      83                 :            : 
      84                 :            : /* Return a vector element with the value BASE + FACTOR * STEP.  */
      85                 :            : 
      86                 :            : template<typename T>
      87                 :            : inline T
      88                 :     972659 : int_vector_builder<T>::apply_step (T base, unsigned int factor, T step) const
      89                 :            : {
      90                 :     972659 :   return base + factor * step;
      91                 :            : }
      92                 :            : 
      93                 :            : #endif

Generated by: LCOV version 1.0

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 --enable-host-shared. GCC test suite is run with the built compiler.