LCOV - code coverage report
Current view: top level - backends - m68k_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.191 Lines: 36 36 100.0 %
Date: 2024-06-28 20:06:08 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 8 87.5 %

           Branch data     Line data    Source code
       1                 :            : /* Register names and numbers for M68K DWARF.
       2                 :            :    This file is part of elfutils.
       3                 :            : 
       4                 :            :    This file is free software; you can redistribute it and/or modify
       5                 :            :    it under the terms of either
       6                 :            : 
       7                 :            :      * the GNU Lesser General Public License as published by the Free
       8                 :            :        Software Foundation; either version 3 of the License, or (at
       9                 :            :        your option) any later version
      10                 :            : 
      11                 :            :    or
      12                 :            : 
      13                 :            :      * the GNU General Public License as published by the Free
      14                 :            :        Software Foundation; either version 2 of the License, or (at
      15                 :            :        your option) any later version
      16                 :            : 
      17                 :            :    or both in parallel, as here.
      18                 :            : 
      19                 :            :    elfutils is distributed in the hope that it will be useful, but
      20                 :            :    WITHOUT ANY WARRANTY; without even the implied warranty of
      21                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      22                 :            :    General Public License for more details.
      23                 :            : 
      24                 :            :    You should have received copies of the GNU General Public License and
      25                 :            :    the GNU Lesser General Public License along with this program.  If
      26                 :            :    not, see <http://www.gnu.org/licenses/>.  */
      27                 :            : 
      28                 :            : #ifdef HAVE_CONFIG_H
      29                 :            : # include <config.h>
      30                 :            : #endif
      31                 :            : 
      32                 :            : #include <stdio.h>
      33                 :            : #include <string.h>
      34                 :            : #include <dwarf.h>
      35                 :            : 
      36                 :            : #define BACKEND m68k_
      37                 :            : #include "libebl_CPU.h"
      38                 :            : 
      39                 :            : ssize_t
      40                 :        156 : m68k_register_info (Ebl *ebl __attribute__ ((unused)),
      41                 :            :                     int regno, char *name, size_t namelen,
      42                 :            :                     const char **prefix, const char **setname,
      43                 :            :                     int *bits, int *type)
      44                 :            : {
      45         [ +  + ]:        156 :   if (name == NULL)
      46                 :            :     return 25;
      47                 :            : 
      48         [ +  - ]:        150 :   if (regno < 0 || regno > 24 || namelen < 5)
      49                 :            :     return -1;
      50                 :            : 
      51                 :        150 :   *prefix = "%";
      52                 :        150 :   *setname = "integer";
      53                 :        150 :   *bits = 32;
      54                 :            : 
      55   [ +  +  +  + ]:        150 :   switch (regno)
      56                 :            :     {
      57                 :         48 :     case 0 ... 7:
      58                 :         48 :       *type = DW_ATE_signed;
      59                 :         48 :       name[0] = 'd';
      60                 :         48 :       name[1] = regno + '0';
      61                 :         48 :       namelen = 2;
      62                 :         48 :       break;
      63                 :            : 
      64                 :         48 :     case 8 ... 15:
      65                 :         48 :       *type = DW_ATE_address;
      66                 :         48 :       name[0] = 'a';
      67                 :         48 :       name[1] = regno - 8 + '0';
      68                 :         48 :       namelen = 2;
      69                 :         48 :       break;
      70                 :            : 
      71                 :         48 :     case 16 ... 23:
      72                 :         48 :       *type = DW_ATE_float;
      73                 :         48 :       *setname = "FPU";
      74                 :         48 :       *bits = 96;
      75                 :         48 :       name[0] = 'f';
      76                 :         48 :       name[1] = 'p';
      77                 :         48 :       name[2] = regno - 16 + '0';
      78                 :         48 :       namelen = 3;
      79                 :         48 :       break;
      80                 :            : 
      81                 :          6 :     case 24:
      82                 :          6 :       *type = DW_ATE_address;
      83                 :          6 :       name[0] = 'p';
      84                 :          6 :       name[1] = 'c';
      85                 :          6 :       namelen = 2;
      86                 :          6 :       break;
      87                 :            : 
      88                 :            :     /* Can't happen.  */
      89                 :            :     default:
      90                 :            :       *setname = NULL;
      91                 :            :       return 0;
      92                 :            :     }
      93                 :            : 
      94                 :        150 :   name[namelen++] = '\0';
      95                 :        150 :   return namelen;
      96                 :            : }

Generated by: LCOV version 1.16