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

           Branch data     Line data    Source code
       1                 :            : /* Alignment-related classes.
       2                 :            :    Copyright (C) 2018-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                 :            : /* Align flags tuple with alignment in log form and with a maximum skip.  */
      21                 :            : 
      22                 :            : struct align_flags_tuple
      23                 :            : {
      24                 :            :   /* Values of the -falign-* flags: how much to align labels in code.
      25                 :            :      log is "align to 2^log" (so 0 means no alignment).
      26                 :            :      maxskip is the maximum allowed amount of padding to insert.  */
      27                 :            :   int log;
      28                 :            :   int maxskip;
      29                 :            : 
      30                 :            :   /* Normalize filled values so that maxskip is not bigger than 1 << log.  */
      31                 :   61442990 :   void normalize ()
      32                 :            :   {
      33                 :   61442990 :     int n = (1 << log);
      34                 :   61442990 :     if (maxskip > n)
      35                 :          0 :       maxskip = n - 1;
      36                 :            :   }
      37                 :            : 
      38                 :            :   /* Return original value of an alignment flag.  */
      39                 :            :   int get_value ()
      40                 :            :   {
      41                 :            :     return maxskip + 1;
      42                 :            :   }
      43                 :            : };
      44                 :            : 
      45                 :            : /* Alignment flags is structure used as value of -align-* options.
      46                 :            :    It's used in target-dependant code.  */
      47                 :            : 
      48                 :            : class align_flags
      49                 :            : {
      50                 :            : public:
      51                 :            :   /* Default constructor.  */
      52                 :   30497400 :   align_flags (int log0 = 0, int maxskip0 = 0, int log1 = 0, int maxskip1 = 0)
      53                 :   30497400 :   {
      54                 :   30497400 :     levels[0].log = log0;
      55                 :   30497400 :     levels[0].maxskip = maxskip0;
      56                 :   30497400 :     levels[1].log = log1;
      57                 :   30497400 :     levels[1].maxskip = maxskip1;
      58                 :   18828600 :     normalize ();
      59                 :            :   }
      60                 :            : 
      61                 :            :   /* Normalize both components of align_flags.  */
      62                 :   30497400 :   void normalize ()
      63                 :            :   {
      64                 :   91492300 :     for (unsigned i = 0; i < 2; i++)
      65                 :   60994800 :       levels[i].normalize ();
      66                 :            :   }
      67                 :            : 
      68                 :            :   /* Get alignment that is common bigger alignment of alignments F0 and F1.  */
      69                 :   11668800 :   static align_flags max (const align_flags f0, const align_flags f1)
      70                 :            :     {
      71                 :   11668800 :       int log0 = MAX (f0.levels[0].log, f1.levels[0].log);
      72                 :   11668800 :       int maxskip0 = MAX (f0.levels[0].maxskip, f1.levels[0].maxskip);
      73                 :   11668800 :       int log1 = MAX (f0.levels[1].log, f1.levels[1].log);
      74                 :   11668800 :       int maxskip1 = MAX (f0.levels[1].maxskip, f1.levels[1].maxskip);
      75                 :   11668800 :       return align_flags (log0, maxskip0, log1, maxskip1);
      76                 :            :     }
      77                 :            : 
      78                 :            :   align_flags_tuple levels[2];
      79                 :            : };
      80                 :            : 
      81                 :            : /* Define maximum supported code alignment.  */
      82                 :            : #define MAX_CODE_ALIGN 16
      83                 :            : #define MAX_CODE_ALIGN_VALUE (1 << MAX_CODE_ALIGN)

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.