1 //===-- ARMSystemRegister.td - ARM Register defs -------------*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 include "llvm/TableGen/SearchableTable.td"
11 //===----------------------------------------------------------------------===//
12 // Declarations that describe the ARM system-registers
13 //===----------------------------------------------------------------------===//
15 // M-Class System Registers.
16 // 'Mask' bits create unique keys for searches.
18 class MClassSysReg<bits<1> UniqMask1,
22 string name> : SearchableTable {
23 let SearchableFields = ["Name", "M1Encoding12", "M2M3Encoding8", "Encoding"];
25 bits<13> M1Encoding12;
26 bits<10> M2M3Encoding8;
30 let EnumValueField = "M1Encoding12";
31 let EnumValueField = "M2M3Encoding8";
32 let EnumValueField = "Encoding";
34 let M1Encoding12{12} = UniqMask1;
35 let M1Encoding12{11-00} = Enc12;
38 let M2M3Encoding8{9} = UniqMask2;
39 let M2M3Encoding8{8} = UniqMask3;
40 let M2M3Encoding8{7-0} = Enc12{7-0};
41 code Requires = [{ {} }];
44 // [|i|e|x]apsr_nzcvq has alias [|i|e|x]apsr.
45 // Mask1 Mask2 Mask3 Enc12, Name
46 let Requires = [{ {ARM::FeatureDSP} }] in {
47 def : MClassSysReg<0, 0, 0, 0x400, "apsr_g">;
48 def : MClassSysReg<0, 1, 1, 0xc00, "apsr_nzcvqg">;
49 def : MClassSysReg<0, 0, 0, 0x401, "iapsr_g">;
50 def : MClassSysReg<0, 1, 1, 0xc01, "iapsr_nzcvqg">;
51 def : MClassSysReg<0, 0, 0, 0x402, "eapsr_g">;
52 def : MClassSysReg<0, 1, 1, 0xc02, "eapsr_nzcvqg">;
53 def : MClassSysReg<0, 0, 0, 0x403, "xpsr_g">;
54 def : MClassSysReg<0, 1, 1, 0xc03, "xpsr_nzcvqg">;
57 def : MClassSysReg<0, 0, 1, 0x800, "apsr">;
58 def : MClassSysReg<1, 1, 0, 0x800, "apsr_nzcvq">;
59 def : MClassSysReg<0, 0, 1, 0x801, "iapsr">;
60 def : MClassSysReg<1, 1, 0, 0x801, "iapsr_nzcvq">;
61 def : MClassSysReg<0, 0, 1, 0x802, "eapsr">;
62 def : MClassSysReg<1, 1, 0, 0x802, "eapsr_nzcvq">;
63 def : MClassSysReg<0, 0, 1, 0x803, "xpsr">;
64 def : MClassSysReg<1, 1, 0, 0x803, "xpsr_nzcvq">;
66 def : MClassSysReg<0, 0, 1, 0x805, "ipsr">;
67 def : MClassSysReg<0, 0, 1, 0x806, "epsr">;
68 def : MClassSysReg<0, 0, 1, 0x807, "iepsr">;
69 def : MClassSysReg<0, 0, 1, 0x808, "msp">;
70 def : MClassSysReg<0, 0, 1, 0x809, "psp">;
72 let Requires = [{ {ARM::HasV8MBaselineOps} }] in {
73 def : MClassSysReg<0, 0, 1, 0x80a, "msplim">;
74 def : MClassSysReg<0, 0, 1, 0x80b, "psplim">;
77 def : MClassSysReg<0, 0, 1, 0x810, "primask">;
79 let Requires = [{ {ARM::HasV7Ops} }] in {
80 def : MClassSysReg<0, 0, 1, 0x811, "basepri">;
81 def : MClassSysReg<0, 0, 1, 0x812, "basepri_max">;
82 def : MClassSysReg<0, 0, 1, 0x813, "faultmask">;
85 def : MClassSysReg<0, 0, 1, 0x814, "control">;
87 let Requires = [{ {ARM::Feature8MSecExt} }] in {
88 def : MClassSysReg<0, 0, 1, 0x888, "msp_ns">;
89 def : MClassSysReg<0, 0, 1, 0x889, "psp_ns">;
92 let Requires = [{ {ARM::Feature8MSecExt, ARM::HasV8MBaselineOps} }] in {
93 def : MClassSysReg<0, 0, 1, 0x88a, "msplim_ns">;
94 def : MClassSysReg<0, 0, 1, 0x88b, "psplim_ns">;
97 def : MClassSysReg<0, 0, 1, 0x890, "primask_ns">;
99 let Requires = [{ {ARM::Feature8MSecExt, ARM::HasV7Ops} }] in {
100 def : MClassSysReg<0, 0, 1, 0x891, "basepri_ns">;
101 def : MClassSysReg<0, 0, 1, 0x893, "faultmask_ns">;
104 let Requires = [{ {ARM::Feature8MSecExt} }] in {
105 def : MClassSysReg<0, 0, 1, 0x894, "control_ns">;
106 def : MClassSysReg<0, 0, 1, 0x898, "sp_ns">;
112 class BankedReg<string name, bits<8> enc>
118 let SearchableFields = ["Name", "Encoding"];
121 // The values here come from B9.2.3 of the ARM ARM, where bits 4-0 are SysM
123 def : BankedReg<"r8_usr", 0x00>;
124 def : BankedReg<"r9_usr", 0x01>;
125 def : BankedReg<"r10_usr", 0x02>;
126 def : BankedReg<"r11_usr", 0x03>;
127 def : BankedReg<"r12_usr", 0x04>;
128 def : BankedReg<"sp_usr", 0x05>;
129 def : BankedReg<"lr_usr", 0x06>;
130 def : BankedReg<"r8_fiq", 0x08>;
131 def : BankedReg<"r9_fiq", 0x09>;
132 def : BankedReg<"r10_fiq", 0x0a>;
133 def : BankedReg<"r11_fiq", 0x0b>;
134 def : BankedReg<"r12_fiq", 0x0c>;
135 def : BankedReg<"sp_fiq", 0x0d>;
136 def : BankedReg<"lr_fiq", 0x0e>;
137 def : BankedReg<"lr_irq", 0x10>;
138 def : BankedReg<"sp_irq", 0x11>;
139 def : BankedReg<"lr_svc", 0x12>;
140 def : BankedReg<"sp_svc", 0x13>;
141 def : BankedReg<"lr_abt", 0x14>;
142 def : BankedReg<"sp_abt", 0x15>;
143 def : BankedReg<"lr_und", 0x16>;
144 def : BankedReg<"sp_und", 0x17>;
145 def : BankedReg<"lr_mon", 0x1c>;
146 def : BankedReg<"sp_mon", 0x1d>;
147 def : BankedReg<"elr_hyp", 0x1e>;
148 def : BankedReg<"sp_hyp", 0x1f>;
149 def : BankedReg<"spsr_fiq", 0x2e>;
150 def : BankedReg<"spsr_irq", 0x30>;
151 def : BankedReg<"spsr_svc", 0x32>;
152 def : BankedReg<"spsr_abt", 0x34>;
153 def : BankedReg<"spsr_und", 0x36>;
154 def : BankedReg<"spsr_mon", 0x3c>;
155 def : BankedReg<"spsr_hyp", 0x3e>;