@@ -19,12 +19,6 @@ include "llvm/TableGen/SearchableTable.td"
19
19
20
20
class SysReg<string name, bits<12> op> {
21
21
string Name = name;
22
- // A maximum of one alias is supported right now.
23
- string AltName = name;
24
- // A maximum of one deprecated name is supported right now. Unlike the
25
- // `AltName` alias, a `DeprecatedName` generates a diagnostic when the name is
26
- // used to encourage software to migrate away from the name.
27
- string DeprecatedName = "";
28
22
bits<12> Encoding = op;
29
23
// FIXME: add these additional fields when needed.
30
24
// Privilege Access: Read and Write = 0, 1, 2; Read-Only = 3.
@@ -37,14 +31,16 @@ class SysReg<string name, bits<12> op> {
37
31
// bits<6> Number = op{5 - 0};
38
32
code FeaturesRequired = [{ {} }];
39
33
bit isRV32Only = 0;
34
+ bit isAltName = 0;
35
+ bit isDeprecatedName = 0;
40
36
}
41
37
42
38
def SysRegsList : GenericTable {
43
39
let FilterClass = "SysReg";
44
40
// FIXME: add "ReadWrite", "Mode", "Extra", "Number" fields when needed.
45
41
let Fields = [
46
- "Name", "AltName", "DeprecatedName", " Encoding", "FeaturesRequired",
47
- "isRV32Only",
42
+ "Name", "Encoding", "FeaturesRequired",
43
+ "isRV32Only", "isAltName", "isDeprecatedName"
48
44
];
49
45
50
46
let PrimaryKey = [ "Encoding" ];
@@ -57,16 +53,6 @@ def lookupSysRegByName : SearchIndex {
57
53
let Key = [ "Name" ];
58
54
}
59
55
60
- def lookupSysRegByAltName : SearchIndex {
61
- let Table = SysRegsList;
62
- let Key = [ "AltName" ];
63
- }
64
-
65
- def lookupSysRegByDeprecatedName : SearchIndex {
66
- let Table = SysRegsList;
67
- let Key = [ "DeprecatedName" ];
68
- }
69
-
70
56
// The following CSR encodings match those given in Tables 2.2,
71
57
// 2.3, 2.4, 2.5 and 2.6 in the RISC-V Instruction Set Manual
72
58
// Volume II: Privileged Architecture.
@@ -123,15 +109,17 @@ def : SysReg<"senvcfg", 0x10A>;
123
109
def : SysReg<"sscratch", 0x140>;
124
110
def : SysReg<"sepc", 0x141>;
125
111
def : SysReg<"scause", 0x142>;
126
- let DeprecatedName = "sbadaddr" in
127
112
def : SysReg<"stval", 0x143>;
113
+ let isDeprecatedName = 1 in
114
+ def : SysReg<"sbadaddr", 0x143>;
128
115
def : SysReg<"sip", 0x144>;
129
116
130
117
//===----------------------------------------------------------------------===//
131
118
// Supervisor Protection and Translation
132
119
//===----------------------------------------------------------------------===//
133
- let DeprecatedName = "sptbr" in
134
120
def : SysReg<"satp", 0x180>;
121
+ let isDeprecatedName = 1 in
122
+ def : SysReg<"sptbr", 0x180>;
135
123
136
124
//===----------------------------------------------------------------------===//
137
125
// Quality-of-Service(QoS) Identifiers (Ssqosid)
@@ -245,8 +233,9 @@ def : SysReg<"mstatush", 0x310>;
245
233
def : SysReg<"mscratch", 0x340>;
246
234
def : SysReg<"mepc", 0x341>;
247
235
def : SysReg<"mcause", 0x342>;
248
- let DeprecatedName = "mbadaddr" in
249
236
def : SysReg<"mtval", 0x343>;
237
+ let isDeprecatedName = 1 in
238
+ def : SysReg<"mbadaddr", 0x343>;
250
239
def : SysReg<"mip", 0x344>;
251
240
def : SysReg<"mtinst", 0x34A>;
252
241
def : SysReg<"mtval2", 0x34B>;
@@ -298,8 +287,9 @@ foreach i = 3...31 in
298
287
//===----------------------------------------------------------------------===//
299
288
// Machine Counter Setup
300
289
//===----------------------------------------------------------------------===//
301
- let AltName = "mucounteren" in // Privileged spec v1.9.1 Name
302
290
def : SysReg<"mcountinhibit", 0x320>;
291
+ let isAltName = 1 in
292
+ def : SysReg<"mucounteren", 0x320>;
303
293
304
294
// mhpmevent3-mhpmevent31 at 0x323-0x33F.
305
295
foreach i = 3...31 in
@@ -336,8 +326,9 @@ def : SysReg<"dpc", 0x7B1>;
336
326
337
327
// "dscratch" is an alternative name for "dscratch0" which appeared in earlier
338
328
// drafts of the RISC-V debug spec
339
- let AltName = "dscratch" in
340
329
def : SysReg<"dscratch0", 0x7B2>;
330
+ let isAltName = 1 in
331
+ def : SysReg<"dscratch", 0x7B2>;
341
332
def : SysReg<"dscratch1", 0x7B3>;
342
333
343
334
//===----------------------------------------------------------------------===//
0 commit comments