LCOV - code coverage report
Current view: top level - backends - m68k_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.178 Lines: 36 39 92.3 %
Date: 2019-11-26 23:55:16 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          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          86 : 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          86 :   if (name == NULL)
      46             :     return 25;
      47             : 
      48          83 :   if (regno < 0 || regno > 24 || namelen < 5)
      49             :     return -1;
      50             : 
      51          83 :   *prefix = "%";
      52          83 :   *setname = "integer";
      53          83 :   *bits = 32;
      54             : 
      55          83 :   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          28 :     case 8 ... 15:
      65          28 :       *type = DW_ATE_address;
      66          28 :       name[0] = 'a';
      67          28 :       name[1] = regno - 8 + '0';
      68          28 :       namelen = 2;
      69          28 :       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           7 :     case 24:
      82           7 :       *type = DW_ATE_address;
      83           7 :       name[0] = 'p';
      84           7 :       name[1] = 'c';
      85           7 :       namelen = 2;
      86           7 :       break;
      87             : 
      88             :     /* Can't happen.  */
      89           0 :     default:
      90           0 :       *setname = NULL;
      91           0 :       return 0;
      92             :     }
      93             : 
      94          83 :   name[namelen++] = '\0';
      95          83 :   return namelen;
      96             : }

Generated by: LCOV version 1.13