LCOV - code coverage report
Current view: top level - backends - arm_regs.c (source / functions) Hit Total Coverage
Test: elfutils-0.178 Lines: 61 61 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 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         759 : 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         759 :   if (name == NULL)
      46             :     return 320;
      47             : 
      48         754 :   if (regno < 0 || regno > 320 || namelen < 5)
      49             :     return -1;
      50             : 
      51         754 :   *prefix = "";
      52         754 :   *bits = 32;
      53         754 :   *type = DW_ATE_signed;
      54         754 :   *setname = "integer";
      55             : 
      56         754 :   switch (regno)
      57             :     {
      58          40 :     case 0 ... 9:
      59          40 :       name[0] = 'r';
      60          40 :       name[1] = regno + '0';
      61          40 :       namelen = 2;
      62          40 :       break;
      63             : 
      64          12 :     case 10 ... 12:
      65          12 :       name[0] = 'r';
      66          12 :       name[1] = '1';
      67          12 :       name[2] = regno % 10 + '0';
      68          12 :       namelen = 3;
      69          12 :       break;
      70             : 
      71          12 :     case 13 ... 15:
      72          12 :       *type = DW_ATE_address;
      73          12 :       name[0] = "slp"[regno - 13];
      74          12 :       name[1] = "prc"[regno - 13];
      75          12 :       namelen = 2;
      76          12 :       break;
      77             : 
      78          16 :     case 16 + 0 ... 16 + 7:
      79          16 :       regno += 96 - 16;
      80          48 :       FALLTHROUGH;
      81          48 :     case 96 + 0 ... 96 + 7:
      82          48 :       *setname = "FPA";
      83          48 :       *type = DW_ATE_float;
      84          48 :       *bits = 96;
      85          48 :       name[0] = 'f';
      86          48 :       name[1] = regno - 96 + '0';
      87          48 :       namelen = 2;
      88          48 :       break;
      89             : 
      90           4 :     case 128:
      91           4 :       *type = DW_ATE_unsigned;
      92           8 :       return stpcpy (name, "spsr") + 1 - name;
      93             : 
      94          40 :     case 256 + 0 ... 256 + 9:
      95          40 :       *setname = "VFP";
      96          40 :       *type = DW_ATE_float;
      97          40 :       *bits = 64;
      98          40 :       name[0] = 'd';
      99          40 :       name[1] = regno - 256 + '0';
     100          40 :       namelen = 2;
     101          40 :       break;
     102             : 
     103          88 :     case 256 + 10 ... 256 + 31:
     104          88 :       *setname = "VFP";
     105          88 :       *type = DW_ATE_float;
     106          88 :       *bits = 64;
     107          88 :       name[0] = 'd';
     108          88 :       name[1] = (regno - 256) / 10 + '0';
     109          88 :       name[2] = (regno - 256) % 10 + '0';
     110          88 :       namelen = 3;
     111          88 :       break;
     112             : 
     113         510 :     default:
     114         510 :       *setname = NULL;
     115         510 :       return 0;
     116             :     }
     117             : 
     118         240 :   name[namelen++] = '\0';
     119         240 :   return namelen;
     120             : }

Generated by: LCOV version 1.13