LCOV - code coverage report
Current view: top level - backends - csky_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.191 Lines: 37 37 100.0 %
Date: 2024-03-29 01:01:25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 10 100.0 %

           Branch data     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                 :         94 : 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         [ +  + ]:         94 :   if (name == NULL)
      46                 :            :     return 38;
      47                 :            : 
      48                 :         92 :   *prefix = "";
      49                 :         92 :   *bits = 32;
      50                 :         92 :   *type = DW_ATE_signed;
      51                 :         92 :   *setname = "integer";
      52                 :            : 
      53   [ +  +  +  +  :         92 :   switch (regno)
             +  +  +  + ]
      54                 :            :     {
      55                 :         20 :     case 0 ... 9:
      56                 :         20 :       name[0] = 'r';
      57                 :         20 :       name[1] = regno + '0';
      58                 :         20 :       namelen = 2;
      59                 :         20 :       break;
      60                 :            : 
      61                 :         38 :     case 10 ... 13:
      62                 :            :     case 16 ... 30:
      63                 :         38 :       name[0] = 'r';
      64                 :         38 :       name[1] = regno / 10 + '0';
      65                 :         38 :       name[2] = regno % 10 + '0';
      66                 :         38 :       namelen = 3;
      67                 :         38 :       break;
      68                 :            : 
      69                 :            :     case 14:
      70                 :         10 :       stpcpy (name, "sp");
      71                 :         10 :       namelen = 2;
      72                 :         10 :       break;
      73                 :            : 
      74                 :            :     case 15:
      75                 :         10 :       stpcpy (name, "lr");
      76                 :         10 :       namelen = 2;
      77                 :         10 :       break;
      78                 :            : 
      79                 :            :     case 31:
      80                 :          2 :       stpcpy (name, "tls");
      81                 :          2 :       namelen = 3;
      82                 :          2 :       break;
      83                 :            : 
      84                 :            :     case 36:
      85                 :          2 :       stpcpy (name, "hi");
      86                 :            :       namelen = 2;
      87                 :          2 :       break;
      88                 :            : 
      89                 :            :     case 37:
      90                 :          2 :       stpcpy (name, "lo");
      91                 :          2 :       namelen = 2;
      92                 :          2 :       break;
      93                 :            : 
      94                 :          8 :     default:
      95                 :          8 :       *setname = NULL;
      96                 :          8 :       return 0;
      97                 :            :     }
      98                 :            : 
      99                 :         84 :   name[namelen++] = '\0';
     100                 :         84 :   return namelen;
     101                 :            : }

Generated by: LCOV version 1.16