ARMSystemRegister.td 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. //===-- ARMSystemRegister.td - ARM Register defs -------------*- tablegen -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. include "llvm/TableGen/SearchableTable.td"
  9. //===----------------------------------------------------------------------===//
  10. // Declarations that describe the ARM system-registers
  11. //===----------------------------------------------------------------------===//
  12. // M-Class System Registers.
  13. // 'Mask' bits create unique keys for searches.
  14. //
  15. class MClassSysReg<bits<1> UniqMask1,
  16. bits<1> UniqMask2,
  17. bits<1> UniqMask3,
  18. bits<12> Enc12,
  19. string name> : SearchableTable {
  20. let SearchableFields = ["Name", "M1Encoding12", "M2M3Encoding8", "Encoding"];
  21. string Name;
  22. bits<13> M1Encoding12;
  23. bits<10> M2M3Encoding8;
  24. bits<12> Encoding;
  25. let Name = name;
  26. let EnumValueField = "M1Encoding12";
  27. let EnumValueField = "M2M3Encoding8";
  28. let EnumValueField = "Encoding";
  29. let M1Encoding12{12} = UniqMask1;
  30. let M1Encoding12{11-00} = Enc12;
  31. let Encoding = Enc12;
  32. let M2M3Encoding8{9} = UniqMask2;
  33. let M2M3Encoding8{8} = UniqMask3;
  34. let M2M3Encoding8{7-0} = Enc12{7-0};
  35. code Requires = [{ {} }];
  36. }
  37. // [|i|e|x]apsr_nzcvq has alias [|i|e|x]apsr.
  38. // Mask1 Mask2 Mask3 Enc12, Name
  39. let Requires = [{ {ARM::FeatureDSP} }] in {
  40. def : MClassSysReg<0, 0, 0, 0x400, "apsr_g">;
  41. def : MClassSysReg<0, 1, 1, 0xc00, "apsr_nzcvqg">;
  42. def : MClassSysReg<0, 0, 0, 0x401, "iapsr_g">;
  43. def : MClassSysReg<0, 1, 1, 0xc01, "iapsr_nzcvqg">;
  44. def : MClassSysReg<0, 0, 0, 0x402, "eapsr_g">;
  45. def : MClassSysReg<0, 1, 1, 0xc02, "eapsr_nzcvqg">;
  46. def : MClassSysReg<0, 0, 0, 0x403, "xpsr_g">;
  47. def : MClassSysReg<0, 1, 1, 0xc03, "xpsr_nzcvqg">;
  48. }
  49. def : MClassSysReg<0, 0, 1, 0x800, "apsr">;
  50. def : MClassSysReg<1, 1, 0, 0x800, "apsr_nzcvq">;
  51. def : MClassSysReg<0, 0, 1, 0x801, "iapsr">;
  52. def : MClassSysReg<1, 1, 0, 0x801, "iapsr_nzcvq">;
  53. def : MClassSysReg<0, 0, 1, 0x802, "eapsr">;
  54. def : MClassSysReg<1, 1, 0, 0x802, "eapsr_nzcvq">;
  55. def : MClassSysReg<0, 0, 1, 0x803, "xpsr">;
  56. def : MClassSysReg<1, 1, 0, 0x803, "xpsr_nzcvq">;
  57. def : MClassSysReg<0, 0, 1, 0x805, "ipsr">;
  58. def : MClassSysReg<0, 0, 1, 0x806, "epsr">;
  59. def : MClassSysReg<0, 0, 1, 0x807, "iepsr">;
  60. def : MClassSysReg<0, 0, 1, 0x808, "msp">;
  61. def : MClassSysReg<0, 0, 1, 0x809, "psp">;
  62. let Requires = [{ {ARM::HasV8MBaselineOps} }] in {
  63. def : MClassSysReg<0, 0, 1, 0x80a, "msplim">;
  64. def : MClassSysReg<0, 0, 1, 0x80b, "psplim">;
  65. }
  66. def : MClassSysReg<0, 0, 1, 0x810, "primask">;
  67. let Requires = [{ {ARM::HasV7Ops} }] in {
  68. def : MClassSysReg<0, 0, 1, 0x811, "basepri">;
  69. def : MClassSysReg<0, 0, 1, 0x812, "basepri_max">;
  70. def : MClassSysReg<0, 0, 1, 0x813, "faultmask">;
  71. }
  72. def : MClassSysReg<0, 0, 1, 0x814, "control">;
  73. let Requires = [{ {ARM::Feature8MSecExt} }] in {
  74. def : MClassSysReg<0, 0, 1, 0x888, "msp_ns">;
  75. def : MClassSysReg<0, 0, 1, 0x889, "psp_ns">;
  76. }
  77. let Requires = [{ {ARM::Feature8MSecExt, ARM::HasV8MBaselineOps} }] in {
  78. def : MClassSysReg<0, 0, 1, 0x88a, "msplim_ns">;
  79. def : MClassSysReg<0, 0, 1, 0x88b, "psplim_ns">;
  80. }
  81. def : MClassSysReg<0, 0, 1, 0x890, "primask_ns">;
  82. let Requires = [{ {ARM::Feature8MSecExt, ARM::HasV7Ops} }] in {
  83. def : MClassSysReg<0, 0, 1, 0x891, "basepri_ns">;
  84. def : MClassSysReg<0, 0, 1, 0x893, "faultmask_ns">;
  85. }
  86. let Requires = [{ {ARM::Feature8MSecExt} }] in {
  87. def : MClassSysReg<0, 0, 1, 0x894, "control_ns">;
  88. def : MClassSysReg<0, 0, 1, 0x898, "sp_ns">;
  89. }
  90. let Requires = [{ {ARM::FeaturePACBTI} }] in {
  91. def : MClassSysReg<0, 0, 1, 0x820, "pac_key_p_0">;
  92. def : MClassSysReg<0, 0, 1, 0x821, "pac_key_p_1">;
  93. def : MClassSysReg<0, 0, 1, 0x822, "pac_key_p_2">;
  94. def : MClassSysReg<0, 0, 1, 0x823, "pac_key_p_3">;
  95. def : MClassSysReg<0, 0, 1, 0x824, "pac_key_u_0">;
  96. def : MClassSysReg<0, 0, 1, 0x825, "pac_key_u_1">;
  97. def : MClassSysReg<0, 0, 1, 0x826, "pac_key_u_2">;
  98. def : MClassSysReg<0, 0, 1, 0x827, "pac_key_u_3">;
  99. def : MClassSysReg<0, 0, 1, 0x8a0, "pac_key_p_0_ns">;
  100. def : MClassSysReg<0, 0, 1, 0x8a1, "pac_key_p_1_ns">;
  101. def : MClassSysReg<0, 0, 1, 0x8a2, "pac_key_p_2_ns">;
  102. def : MClassSysReg<0, 0, 1, 0x8a3, "pac_key_p_3_ns">;
  103. def : MClassSysReg<0, 0, 1, 0x8a4, "pac_key_u_0_ns">;
  104. def : MClassSysReg<0, 0, 1, 0x8a5, "pac_key_u_1_ns">;
  105. def : MClassSysReg<0, 0, 1, 0x8a6, "pac_key_u_2_ns">;
  106. def : MClassSysReg<0, 0, 1, 0x8a7, "pac_key_u_3_ns">;
  107. }
  108. // Banked Registers
  109. //
  110. class BankedReg<string name, bits<8> enc>
  111. : SearchableTable {
  112. string Name;
  113. bits<8> Encoding;
  114. let Name = name;
  115. let Encoding = enc;
  116. let SearchableFields = ["Name", "Encoding"];
  117. }
  118. // The values here come from B9.2.3 of the ARM ARM, where bits 4-0 are SysM
  119. // and bit 5 is R.
  120. def : BankedReg<"r8_usr", 0x00>;
  121. def : BankedReg<"r9_usr", 0x01>;
  122. def : BankedReg<"r10_usr", 0x02>;
  123. def : BankedReg<"r11_usr", 0x03>;
  124. def : BankedReg<"r12_usr", 0x04>;
  125. def : BankedReg<"sp_usr", 0x05>;
  126. def : BankedReg<"lr_usr", 0x06>;
  127. def : BankedReg<"r8_fiq", 0x08>;
  128. def : BankedReg<"r9_fiq", 0x09>;
  129. def : BankedReg<"r10_fiq", 0x0a>;
  130. def : BankedReg<"r11_fiq", 0x0b>;
  131. def : BankedReg<"r12_fiq", 0x0c>;
  132. def : BankedReg<"sp_fiq", 0x0d>;
  133. def : BankedReg<"lr_fiq", 0x0e>;
  134. def : BankedReg<"lr_irq", 0x10>;
  135. def : BankedReg<"sp_irq", 0x11>;
  136. def : BankedReg<"lr_svc", 0x12>;
  137. def : BankedReg<"sp_svc", 0x13>;
  138. def : BankedReg<"lr_abt", 0x14>;
  139. def : BankedReg<"sp_abt", 0x15>;
  140. def : BankedReg<"lr_und", 0x16>;
  141. def : BankedReg<"sp_und", 0x17>;
  142. def : BankedReg<"lr_mon", 0x1c>;
  143. def : BankedReg<"sp_mon", 0x1d>;
  144. def : BankedReg<"elr_hyp", 0x1e>;
  145. def : BankedReg<"sp_hyp", 0x1f>;
  146. def : BankedReg<"spsr_fiq", 0x2e>;
  147. def : BankedReg<"spsr_irq", 0x30>;
  148. def : BankedReg<"spsr_svc", 0x32>;
  149. def : BankedReg<"spsr_abt", 0x34>;
  150. def : BankedReg<"spsr_und", 0x36>;
  151. def : BankedReg<"spsr_mon", 0x3c>;
  152. def : BankedReg<"spsr_hyp", 0x3e>;