LCOV - code coverage report
Current view: top level - backends - alpha_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.178 Lines: 86 86 100.0 %
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 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          68 : 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          68 :   if (name == NULL)
      46             :     return 67;
      47             : 
      48          67 :   if (regno < 0 || regno > 66 || namelen < 7)
      49             :     return -1;
      50             : 
      51          67 :   *prefix = "$";
      52             : 
      53          67 :   *bits = 64;
      54          67 :   *type = DW_ATE_signed;
      55          67 :   *setname = "integer";
      56          67 :   if (regno >= 32 && regno < 64)
      57             :     {
      58          32 :       *setname = "FPU";
      59          32 :       *type = DW_ATE_float;
      60             :     }
      61             : 
      62          67 :   switch (regno)
      63             :     {
      64           1 :     case 0:
      65           1 :       name[0] = 'v';
      66           1 :       name[1] = '0';
      67           1 :       namelen = 2;
      68           1 :       break;
      69             : 
      70           8 :     case 1 ... 8:
      71           8 :       name[0] = 't';
      72           8 :       name[1] = regno - 1 + '0';
      73           8 :       namelen = 2;
      74           8 :       break;
      75             : 
      76           7 :     case 9 ... 15:
      77           7 :       name[0] = 's';
      78           7 :       name[1] = regno - 9 + '0';
      79           7 :       namelen = 2;
      80           7 :       break;
      81             : 
      82           6 :     case 16 ... 21:
      83           6 :       name[0] = 'a';
      84           6 :       name[1] = regno - 16 + '0';
      85           6 :       namelen = 2;
      86           6 :       break;
      87             : 
      88           2 :     case 22 ... 23:
      89           2 :       name[0] = 't';
      90           2 :       name[1] = regno - 22 + '8';
      91           2 :       namelen = 2;
      92           2 :       break;
      93             : 
      94           2 :     case 24 ... 25:
      95           2 :       name[0] = 't';
      96           2 :       name[1] = '1';
      97           2 :       name[2] = regno - 24 + '0';
      98           2 :       namelen = 3;
      99           2 :       break;
     100             : 
     101           1 :     case 26:
     102           1 :       *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           1 :     case 29:
     112           1 :       *type = DW_ATE_address;
     113           2 :       return stpcpy (name, "gp") + 1 - name;
     114             : 
     115           1 :     case 30:
     116           1 :       *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          10 :     case 32 ... 32 + 9:
     123          10 :       name[0] = 'f';
     124          10 :       name[1] = regno - 32 + '0';
     125          10 :       namelen = 2;
     126          10 :       break;
     127             : 
     128          10 :     case 32 + 10 ... 32 + 19:
     129          10 :       name[0] = 'f';
     130          10 :       name[1] = '1';
     131          10 :       name[2] = regno - 32 - 10 + '0';
     132          10 :       namelen = 3;
     133          10 :       break;
     134             : 
     135          10 :     case 32 + 20 ... 32 + 29:
     136          10 :       name[0] = 'f';
     137          10 :       name[1] = '2';
     138          10 :       name[2] = regno - 32 - 20 + '0';
     139          10 :       namelen = 3;
     140          10 :       break;
     141             : 
     142             :     case 32 + 30:
     143           2 :       return stpcpy (name, "f30") + 1 - name;
     144             : 
     145           1 :     case 32 + 31:
     146           1 :       *type = DW_ATE_unsigned;
     147           2 :       return stpcpy (name, "fpcr") + 1 - name;
     148             : 
     149           1 :     case 64:
     150           1 :       *type = DW_ATE_address;
     151           2 :       return stpcpy (name, "pc") + 1 - name;
     152             : 
     153           1 :     case 66:
     154           1 :       *type = DW_ATE_address;
     155           2 :       return stpcpy (name, "unique") + 1 - name;
     156             : 
     157           1 :     default:
     158           1 :       *setname = NULL;
     159           1 :       return 0;
     160             :     }
     161             : 
     162          56 :   name[namelen++] = '\0';
     163          56 :   return namelen;
     164             : }

Generated by: LCOV version 1.13