LCOV - code coverage report
Current view: top level - gcc/sym-exec - sym-exec-condition.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 74.2 % 31 23
Test Date: 2024-12-28 13:16:48 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                 :             : /* Everything defined here is used for representing conditions for bits
       2                 :             :    and their status.
       3                 :             :    Copyright (C) 2022-2024 Free Software Foundation, Inc.
       4                 :             :    Contributed by Matevos Mehrabyan <matevosmehrabyan@gmail.com>
       5                 :             : 
       6                 :             : This file is part of GCC.
       7                 :             : 
       8                 :             : GCC is free software; you can redistribute it and/or modify it under
       9                 :             : the terms of the GNU General Public License as published by the Free
      10                 :             : Software Foundation; either version 3, or (at your option) any later
      11                 :             : version.
      12                 :             : 
      13                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      14                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      15                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      16                 :             : 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                 :             : #include "sym-exec-condition.h"
      23                 :             : 
      24                 :             : /* Constructor where the first argument is the bit left to the condition sign,
      25                 :             :    the second argument is the bit right to the condition sign and the third
      26                 :             :    argument is the code of the condition.  */
      27                 :             : 
      28                 :        6038 : bit_condition::bit_condition (value_bit *left, value_bit *right, tree_code code)
      29                 :             : {
      30                 :        6038 :   this->m_left = left;
      31                 :        6038 :   this->m_right = right;
      32                 :        6038 :   this->m_code = code;
      33                 :        6038 :   m_type = BIT_CONDITION;
      34                 :        6038 : }
      35                 :             : 
      36                 :             : 
      37                 :             : /* Copy constructor.  */
      38                 :             : 
      39                 :        6038 : bit_condition::bit_condition (const bit_condition &expr)
      40                 :             : {
      41                 :        6038 :   bit_expression::copy (&expr);
      42                 :        6038 :   m_code = expr.get_code ();
      43                 :        6038 : }
      44                 :             : 
      45                 :             : 
      46                 :             : /* Returns the condition's code.  */
      47                 :             : 
      48                 :             : tree_code
      49                 :       13817 : bit_condition::get_code () const
      50                 :             : {
      51                 :       13817 :   return m_code;
      52                 :             : }
      53                 :             : 
      54                 :             : 
      55                 :             : /* Returns a copy of the condition.  */
      56                 :             : 
      57                 :             : value_bit *
      58                 :        6038 : bit_condition::copy () const
      59                 :             : {
      60                 :        6038 :   return new bit_condition (*this);
      61                 :             : }
      62                 :             : 
      63                 :             : 
      64                 :             : /* Prints the condition's sign.  */
      65                 :             : 
      66                 :             : void
      67                 :       10560 : bit_condition::print_expr_sign ()
      68                 :             : {
      69                 :       10560 :   switch (m_code)
      70                 :             :     {
      71                 :           0 :       case GT_EXPR:
      72                 :           0 :         fprintf (dump_file, " > ");
      73                 :           0 :         break;
      74                 :           0 :       case LT_EXPR:
      75                 :           0 :         fprintf (dump_file, " < ");
      76                 :           0 :         break;
      77                 :        7584 :       case EQ_EXPR:
      78                 :        7584 :         fprintf (dump_file, " == ");
      79                 :        7584 :         break;
      80                 :        2976 :       case NE_EXPR:
      81                 :        2976 :         fprintf (dump_file, " != ");
      82                 :        2976 :         break;
      83                 :           0 :       default:
      84                 :           0 :         fprintf (dump_file, " ? ");
      85                 :             :     }
      86                 :       10560 : }
        

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.