Coverage Report

Created: 2026-02-24 06:49

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