LCOV - code coverage report
Current view: top level - backends - alpha_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.191 Lines: 86 86 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: 25 26 96.2 %

           Branch data     Line data    Source code
       1                 :            : /* Register names and numbers for Alpha DWARF.
       2                 :            :    Copyright (C) 2007 Red Hat, Inc.
       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 alpha_
      37                 :            : #include "libebl_CPU.h"
      38                 :            : 
      39                 :            : ssize_t
      40                 :        136 : alpha_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         [ +  + ]:        136 :   if (name == NULL)
      46                 :            :     return 67;
      47                 :            : 
      48         [ +  - ]:        134 :   if (regno < 0 || regno > 66 || namelen < 7)
      49                 :            :     return -1;
      50                 :            : 
      51                 :        134 :   *prefix = "$";
      52                 :            : 
      53                 :        134 :   *bits = 64;
      54                 :        134 :   *type = DW_ATE_signed;
      55                 :        134 :   *setname = "integer";
      56         [ +  + ]:        134 :   if (regno >= 32 && regno < 64)
      57                 :            :     {
      58                 :         64 :       *setname = "FPU";
      59                 :         64 :       *type = DW_ATE_float;
      60                 :            :     }
      61                 :            : 
      62   [ +  +  +  +  :        134 :   switch (regno)
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
                      + ]
      63                 :            :     {
      64                 :          2 :     case 0:
      65                 :          2 :       name[0] = 'v';
      66                 :          2 :       name[1] = '0';
      67                 :          2 :       namelen = 2;
      68                 :          2 :       break;
      69                 :            : 
      70                 :         16 :     case 1 ... 8:
      71                 :         16 :       name[0] = 't';
      72                 :         16 :       name[1] = regno - 1 + '0';
      73                 :         16 :       namelen = 2;
      74                 :         16 :       break;
      75                 :            : 
      76                 :         14 :     case 9 ... 15:
      77                 :         14 :       name[0] = 's';
      78                 :         14 :       name[1] = regno - 9 + '0';
      79                 :         14 :       namelen = 2;
      80                 :         14 :       break;
      81                 :            : 
      82                 :         12 :     case 16 ... 21:
      83                 :         12 :       name[0] = 'a';
      84                 :         12 :       name[1] = regno - 16 + '0';
      85                 :         12 :       namelen = 2;
      86                 :         12 :       break;
      87                 :            : 
      88                 :          4 :     case 22 ... 23:
      89                 :          4 :       name[0] = 't';
      90                 :          4 :       name[1] = regno - 22 + '8';
      91                 :          4 :       namelen = 2;
      92                 :          4 :       break;
      93                 :            : 
      94                 :          4 :     case 24 ... 25:
      95                 :          4 :       name[0] = 't';
      96                 :          4 :       name[1] = '1';
      97                 :          4 :       name[2] = regno - 24 + '0';
      98                 :          4 :       namelen = 3;
      99                 :          4 :       break;
     100                 :            : 
     101                 :          2 :     case 26:
     102                 :          2 :       *type = DW_ATE_address;
     103                 :          2 :       return stpcpy (name, "ra") + 1 - name;
     104                 :            : 
     105                 :            :     case 27:
     106                 :          2 :       return stpcpy (name, "t12") + 1 - name;
     107                 :            : 
     108                 :            :     case 28:
     109                 :          2 :       return stpcpy (name, "at") + 1 - name;
     110                 :            : 
     111                 :          2 :     case 29:
     112                 :          2 :       *type = DW_ATE_address;
     113                 :          2 :       return stpcpy (name, "gp") + 1 - name;
     114                 :            : 
     115                 :          2 :     case 30:
     116                 :          2 :       *type = DW_ATE_address;
     117                 :          2 :       return stpcpy (name, "sp") + 1 - name;
     118                 :            : 
     119                 :            :     case 31:
     120                 :          2 :       return stpcpy (name, "zero") + 1 - name;
     121                 :            : 
     122                 :         20 :     case 32 ... 32 + 9:
     123                 :         20 :       name[0] = 'f';
     124                 :         20 :       name[1] = regno - 32 + '0';
     125                 :         20 :       namelen = 2;
     126                 :         20 :       break;
     127                 :            : 
     128                 :         20 :     case 32 + 10 ... 32 + 19:
     129                 :         20 :       name[0] = 'f';
     130                 :         20 :       name[1] = '1';
     131                 :         20 :       name[2] = regno - 32 - 10 + '0';
     132                 :         20 :       namelen = 3;
     133                 :         20 :       break;
     134                 :            : 
     135                 :         20 :     case 32 + 20 ... 32 + 29:
     136                 :         20 :       name[0] = 'f';
     137                 :         20 :       name[1] = '2';
     138                 :         20 :       name[2] = regno - 32 - 20 + '0';
     139                 :         20 :       namelen = 3;
     140                 :         20 :       break;
     141                 :            : 
     142                 :            :     case 32 + 30:
     143                 :          2 :       return stpcpy (name, "f30") + 1 - name;
     144                 :            : 
     145                 :          2 :     case 32 + 31:
     146                 :          2 :       *type = DW_ATE_unsigned;
     147                 :          2 :       return stpcpy (name, "fpcr") + 1 - name;
     148                 :            : 
     149                 :          2 :     case 64:
     150                 :          2 :       *type = DW_ATE_address;
     151                 :          2 :       return stpcpy (name, "pc") + 1 - name;
     152                 :            : 
     153                 :          2 :     case 66:
     154                 :          2 :       *type = DW_ATE_address;
     155                 :          2 :       return stpcpy (name, "unique") + 1 - name;
     156                 :            : 
     157                 :          2 :     default:
     158                 :          2 :       *setname = NULL;
     159                 :          2 :       return 0;
     160                 :            :     }
     161                 :            : 
     162                 :        112 :   name[namelen++] = '\0';
     163                 :        112 :   return namelen;
     164                 :            : }

Generated by: LCOV version 1.16