@@ -19,12 +19,6 @@ include "llvm/TableGen/SearchableTable.td"
1919
2020class SysReg<string name, bits<12> op> {
2121 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 = "";
2822 bits<12> Encoding = op;
2923 // FIXME: add these additional fields when needed.
3024 // Privilege Access: Read and Write = 0, 1, 2; Read-Only = 3.
@@ -37,14 +31,16 @@ class SysReg<string name, bits<12> op> {
3731 // bits<6> Number = op{5 - 0};
3832 code FeaturesRequired = [{ {} }];
3933 bit isRV32Only = 0;
34+ bit isAltName = 0;
35+ bit isDeprecatedName = 0;
4036}
4137
4238def SysRegsList : GenericTable {
4339 let FilterClass = "SysReg";
4440 // FIXME: add "ReadWrite", "Mode", "Extra", "Number" fields when needed.
4541 let Fields = [
46- "Name", "AltName", "DeprecatedName", " Encoding", "FeaturesRequired",
47- "isRV32Only",
42+ "Name", "Encoding", "FeaturesRequired",
43+ "isRV32Only", "isAltName", "isDeprecatedName"
4844 ];
4945
5046 let PrimaryKey = [ "Encoding" ];
@@ -57,16 +53,6 @@ def lookupSysRegByName : SearchIndex {
5753 let Key = [ "Name" ];
5854}
5955
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-
7056// The following CSR encodings match those given in Tables 2.2,
7157// 2.3, 2.4, 2.5 and 2.6 in the RISC-V Instruction Set Manual
7258// Volume II: Privileged Architecture.
@@ -123,15 +109,17 @@ def : SysReg<"senvcfg", 0x10A>;
123109def : SysReg<"sscratch", 0x140>;
124110def : SysReg<"sepc", 0x141>;
125111def : SysReg<"scause", 0x142>;
126- let DeprecatedName = "sbadaddr" in
127112def : SysReg<"stval", 0x143>;
113+ let isDeprecatedName = 1 in
114+ def : SysReg<"sbadaddr", 0x143>;
128115def : SysReg<"sip", 0x144>;
129116
130117//===----------------------------------------------------------------------===//
131118// Supervisor Protection and Translation
132119//===----------------------------------------------------------------------===//
133- let DeprecatedName = "sptbr" in
134120def : SysReg<"satp", 0x180>;
121+ let isDeprecatedName = 1 in
122+ def : SysReg<"sptbr", 0x180>;
135123
136124//===----------------------------------------------------------------------===//
137125// Quality-of-Service(QoS) Identifiers (Ssqosid)
@@ -245,8 +233,9 @@ def : SysReg<"mstatush", 0x310>;
245233def : SysReg<"mscratch", 0x340>;
246234def : SysReg<"mepc", 0x341>;
247235def : SysReg<"mcause", 0x342>;
248- let DeprecatedName = "mbadaddr" in
249236def : SysReg<"mtval", 0x343>;
237+ let isDeprecatedName = 1 in
238+ def : SysReg<"mbadaddr", 0x343>;
250239def : SysReg<"mip", 0x344>;
251240def : SysReg<"mtinst", 0x34A>;
252241def : SysReg<"mtval2", 0x34B>;
@@ -298,8 +287,9 @@ foreach i = 3...31 in
298287//===----------------------------------------------------------------------===//
299288// Machine Counter Setup
300289//===----------------------------------------------------------------------===//
301- let AltName = "mucounteren" in // Privileged spec v1.9.1 Name
302290def : SysReg<"mcountinhibit", 0x320>;
291+ let isAltName = 1 in
292+ def : SysReg<"mucounteren", 0x320>;
303293
304294// mhpmevent3-mhpmevent31 at 0x323-0x33F.
305295foreach i = 3...31 in
@@ -336,8 +326,9 @@ def : SysReg<"dpc", 0x7B1>;
336326
337327// "dscratch" is an alternative name for "dscratch0" which appeared in earlier
338328// drafts of the RISC-V debug spec
339- let AltName = "dscratch" in
340329def : SysReg<"dscratch0", 0x7B2>;
330+ let isAltName = 1 in
331+ def : SysReg<"dscratch", 0x7B2>;
341332def : SysReg<"dscratch1", 0x7B3>;
342333
343334//===----------------------------------------------------------------------===//
0 commit comments