Line data Source code
1 : /* Register names and numbers for TILE-Gx DWARF.
2 : Copyright (C) 2012 Tilera Corporation
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 <stdio.h>
34 : #include <string.h>
35 : #include <dwarf.h>
36 :
37 : #define BACKEND tilegx_
38 : #include "libebl_CPU.h"
39 :
40 : ssize_t
41 66 : tilegx_register_info (Ebl *ebl __attribute__ ((unused)),
42 : int regno, char *name, size_t namelen,
43 : const char **prefix, const char **setname,
44 : int *bits, int *type)
45 : {
46 66 : if (name == NULL)
47 : return 65;
48 :
49 65 : if (regno < 0 || regno > 64 || namelen < 5)
50 : return -1;
51 :
52 65 : *prefix = "";
53 65 : *setname = "integer";
54 65 : *bits = 64;
55 :
56 65 : switch (regno)
57 : {
58 10 : case 0 ... 9:
59 10 : *type = DW_ATE_signed;
60 10 : name[0] = 'r';
61 10 : name[1] = regno + '0';
62 10 : namelen = 2;
63 10 : break;
64 :
65 43 : case 10 ... 52:
66 43 : *type = DW_ATE_signed;
67 43 : name[0] = 'r';
68 43 : name[1] = regno / 10 + '0';
69 43 : name[2] = regno % 10 + '0';
70 43 : namelen = 3;
71 43 : break;
72 :
73 1 : case 53:
74 1 : *type = DW_ATE_address;
75 2 : return stpcpy (name, "tp") + 1 - name;
76 :
77 1 : case 54:
78 1 : *type = DW_ATE_address;
79 2 : return stpcpy (name, "sp") + 1 - name;
80 :
81 1 : case 55:
82 1 : *type = DW_ATE_address;
83 2 : return stpcpy (name, "lr") + 1 - name;
84 :
85 1 : case 56:
86 1 : *type = DW_ATE_unsigned;
87 2 : return stpcpy (name, "sn") + 1 - name;
88 :
89 1 : case 57:
90 1 : *type = DW_ATE_unsigned;
91 2 : return stpcpy (name, "idn0") + 1 - name;
92 :
93 1 : case 58:
94 1 : *type = DW_ATE_unsigned;
95 2 : return stpcpy (name, "idn1") + 1 - name;
96 :
97 1 : case 59:
98 1 : *type = DW_ATE_unsigned;
99 2 : return stpcpy (name, "udn0") + 1 - name;
100 :
101 1 : case 60:
102 1 : *type = DW_ATE_unsigned;
103 2 : return stpcpy (name, "udn1") + 1 - name;
104 :
105 1 : case 61:
106 1 : *type = DW_ATE_unsigned;
107 2 : return stpcpy (name, "udn2") + 1 - name;
108 :
109 1 : case 62:
110 1 : *type = DW_ATE_unsigned;
111 2 : return stpcpy (name, "udn3") + 1 - name;
112 :
113 1 : case 63:
114 1 : *type = DW_ATE_unsigned;
115 2 : return stpcpy (name, "zero") + 1 - name;
116 :
117 1 : case 64:
118 1 : *type = DW_ATE_address;
119 2 : return stpcpy (name, "pc") + 1 - name;
120 :
121 : /* Can't happen. */
122 0 : default:
123 0 : *setname = NULL;
124 0 : return 0;
125 : }
126 :
127 53 : name[namelen++] = '\0';
128 53 : return namelen;
129 : }
|