LCOV - code coverage report
Current view: top level - backends - arm_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.191 Lines: 61 61 100.0 %
Date: 2024-03-27 15:13:09 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 13 92.3 %

           Branch data     Line data    Source code
       1                 :            : /* Register names and numbers for ARM DWARF.
       2                 :            :    Copyright (C) 2009 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 arm_
      37                 :            : #include "libebl_CPU.h"
      38                 :            : 
      39                 :            : ssize_t
      40                 :       1518 : arm_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         [ +  + ]:       1518 :   if (name == NULL)
      46                 :            :     return 320;
      47                 :            : 
      48         [ +  - ]:       1508 :   if (regno < 0 || regno > 320 || namelen < 5)
      49                 :            :     return -1;
      50                 :            : 
      51                 :       1508 :   *prefix = "";
      52                 :       1508 :   *bits = 32;
      53                 :       1508 :   *type = DW_ATE_signed;
      54                 :       1508 :   *setname = "integer";
      55                 :            : 
      56   [ +  +  +  +  :       1508 :   switch (regno)
             +  +  +  +  
                      + ]
      57                 :            :     {
      58                 :         80 :     case 0 ... 9:
      59                 :         80 :       name[0] = 'r';
      60                 :         80 :       name[1] = regno + '0';
      61                 :         80 :       namelen = 2;
      62                 :         80 :       break;
      63                 :            : 
      64                 :         24 :     case 10 ... 12:
      65                 :         24 :       name[0] = 'r';
      66                 :         24 :       name[1] = '1';
      67                 :         24 :       name[2] = regno % 10 + '0';
      68                 :         24 :       namelen = 3;
      69                 :         24 :       break;
      70                 :            : 
      71                 :         24 :     case 13 ... 15:
      72                 :         24 :       *type = DW_ATE_address;
      73                 :         24 :       name[0] = "slp"[regno - 13];
      74                 :         24 :       name[1] = "prc"[regno - 13];
      75                 :         24 :       namelen = 2;
      76                 :         24 :       break;
      77                 :            : 
      78                 :         32 :     case 16 + 0 ... 16 + 7:
      79                 :         32 :       regno += 96 - 16;
      80                 :         96 :       FALLTHROUGH;
      81                 :         96 :     case 96 + 0 ... 96 + 7:
      82                 :         96 :       *setname = "FPA";
      83                 :         96 :       *type = DW_ATE_float;
      84                 :         96 :       *bits = 96;
      85                 :         96 :       name[0] = 'f';
      86                 :         96 :       name[1] = regno - 96 + '0';
      87                 :         96 :       namelen = 2;
      88                 :         96 :       break;
      89                 :            : 
      90                 :          8 :     case 128:
      91                 :          8 :       *type = DW_ATE_unsigned;
      92                 :          8 :       return stpcpy (name, "spsr") + 1 - name;
      93                 :            : 
      94                 :         80 :     case 256 + 0 ... 256 + 9:
      95                 :         80 :       *setname = "VFP";
      96                 :         80 :       *type = DW_ATE_float;
      97                 :         80 :       *bits = 64;
      98                 :         80 :       name[0] = 'd';
      99                 :         80 :       name[1] = regno - 256 + '0';
     100                 :         80 :       namelen = 2;
     101                 :         80 :       break;
     102                 :            : 
     103                 :        176 :     case 256 + 10 ... 256 + 31:
     104                 :        176 :       *setname = "VFP";
     105                 :        176 :       *type = DW_ATE_float;
     106                 :        176 :       *bits = 64;
     107                 :        176 :       name[0] = 'd';
     108                 :        176 :       name[1] = (regno - 256) / 10 + '0';
     109                 :        176 :       name[2] = (regno - 256) % 10 + '0';
     110                 :        176 :       namelen = 3;
     111                 :        176 :       break;
     112                 :            : 
     113                 :       1020 :     default:
     114                 :       1020 :       *setname = NULL;
     115                 :       1020 :       return 0;
     116                 :            :     }
     117                 :            : 
     118                 :        480 :   name[namelen++] = '\0';
     119                 :        480 :   return namelen;
     120                 :            : }

Generated by: LCOV version 1.16