LCOV - code coverage report
Current view: top level - backends - csky_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.179 Lines: 38 38 100.0 %
Date: 2020-03-30 14:24:38 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13