LCOV - code coverage report
Current view: top level - backends - m68k_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.189 Lines: 36 36 100.0 %
Date: 2023-08-29 13:46:25 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                 :         78 : 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         [ +  + ]:         78 :   if (name == NULL)
      46                 :            :     return 25;
      47                 :            : 
      48         [ +  - ]:         75 :   if (regno < 0 || regno > 24 || namelen < 5)
      49                 :            :     return -1;
      50                 :            : 
      51                 :         75 :   *prefix = "%";
      52                 :         75 :   *setname = "integer";
      53                 :         75 :   *bits = 32;
      54                 :            : 
      55   [ +  +  +  + ]:         75 :   switch (regno)
      56                 :            :     {
      57                 :         24 :     case 0 ... 7:
      58                 :         24 :       *type = DW_ATE_signed;
      59                 :         24 :       name[0] = 'd';
      60                 :         24 :       name[1] = regno + '0';
      61                 :         24 :       namelen = 2;
      62                 :         24 :       break;
      63                 :            : 
      64                 :         24 :     case 8 ... 15:
      65                 :         24 :       *type = DW_ATE_address;
      66                 :         24 :       name[0] = 'a';
      67                 :         24 :       name[1] = regno - 8 + '0';
      68                 :         24 :       namelen = 2;
      69                 :         24 :       break;
      70                 :            : 
      71                 :         24 :     case 16 ... 23:
      72                 :         24 :       *type = DW_ATE_float;
      73                 :         24 :       *setname = "FPU";
      74                 :         24 :       *bits = 96;
      75                 :         24 :       name[0] = 'f';
      76                 :         24 :       name[1] = 'p';
      77                 :         24 :       name[2] = regno - 16 + '0';
      78                 :         24 :       namelen = 3;
      79                 :         24 :       break;
      80                 :            : 
      81                 :          3 :     case 24:
      82                 :          3 :       *type = DW_ATE_address;
      83                 :          3 :       name[0] = 'p';
      84                 :          3 :       name[1] = 'c';
      85                 :          3 :       namelen = 2;
      86                 :          3 :       break;
      87                 :            : 
      88                 :            :     /* Can't happen.  */
      89                 :            :     default:
      90                 :            :       *setname = NULL;
      91                 :            :       return 0;
      92                 :            :     }
      93                 :            : 
      94                 :         75 :   name[namelen++] = '\0';
      95                 :         75 :   return namelen;
      96                 :            : }

Generated by: LCOV version 1.16