asmjit 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/asmjit.gemspec +1 -1
  4. data/ext/asmjit/asmjit/.editorconfig +10 -0
  5. data/ext/asmjit/asmjit/.github/FUNDING.yml +1 -0
  6. data/ext/asmjit/asmjit/.github/workflows/build-config.json +47 -0
  7. data/ext/asmjit/asmjit/.github/workflows/build.yml +156 -0
  8. data/ext/asmjit/asmjit/.gitignore +6 -0
  9. data/ext/asmjit/asmjit/CMakeLists.txt +611 -0
  10. data/ext/asmjit/asmjit/LICENSE.md +17 -0
  11. data/ext/asmjit/asmjit/README.md +69 -0
  12. data/ext/asmjit/asmjit/src/asmjit/a64.h +62 -0
  13. data/ext/asmjit/asmjit/src/asmjit/arm/a64archtraits_p.h +81 -0
  14. data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.cpp +5115 -0
  15. data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.h +72 -0
  16. data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.cpp +51 -0
  17. data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.h +57 -0
  18. data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.cpp +60 -0
  19. data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.h +247 -0
  20. data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper.cpp +464 -0
  21. data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper_p.h +50 -0
  22. data/ext/asmjit/asmjit/src/asmjit/arm/a64emitter.h +1228 -0
  23. data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter.cpp +298 -0
  24. data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter_p.h +59 -0
  25. data/ext/asmjit/asmjit/src/asmjit/arm/a64func.cpp +189 -0
  26. data/ext/asmjit/asmjit/src/asmjit/arm/a64func_p.h +33 -0
  27. data/ext/asmjit/asmjit/src/asmjit/arm/a64globals.h +1894 -0
  28. data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi.cpp +278 -0
  29. data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi_p.h +41 -0
  30. data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.cpp +1957 -0
  31. data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.h +74 -0
  32. data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb_p.h +876 -0
  33. data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.cpp +85 -0
  34. data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.h +312 -0
  35. data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass.cpp +852 -0
  36. data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass_p.h +105 -0
  37. data/ext/asmjit/asmjit/src/asmjit/arm/a64utils.h +179 -0
  38. data/ext/asmjit/asmjit/src/asmjit/arm/armformatter.cpp +143 -0
  39. data/ext/asmjit/asmjit/src/asmjit/arm/armformatter_p.h +44 -0
  40. data/ext/asmjit/asmjit/src/asmjit/arm/armglobals.h +21 -0
  41. data/ext/asmjit/asmjit/src/asmjit/arm/armoperand.h +621 -0
  42. data/ext/asmjit/asmjit/src/asmjit/arm.h +62 -0
  43. data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-begin.h +17 -0
  44. data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-end.h +9 -0
  45. data/ext/asmjit/asmjit/src/asmjit/asmjit.h +33 -0
  46. data/ext/asmjit/asmjit/src/asmjit/core/api-build_p.h +55 -0
  47. data/ext/asmjit/asmjit/src/asmjit/core/api-config.h +613 -0
  48. data/ext/asmjit/asmjit/src/asmjit/core/archcommons.h +229 -0
  49. data/ext/asmjit/asmjit/src/asmjit/core/archtraits.cpp +160 -0
  50. data/ext/asmjit/asmjit/src/asmjit/core/archtraits.h +290 -0
  51. data/ext/asmjit/asmjit/src/asmjit/core/assembler.cpp +406 -0
  52. data/ext/asmjit/asmjit/src/asmjit/core/assembler.h +129 -0
  53. data/ext/asmjit/asmjit/src/asmjit/core/builder.cpp +889 -0
  54. data/ext/asmjit/asmjit/src/asmjit/core/builder.h +1391 -0
  55. data/ext/asmjit/asmjit/src/asmjit/core/codebuffer.h +113 -0
  56. data/ext/asmjit/asmjit/src/asmjit/core/codeholder.cpp +1149 -0
  57. data/ext/asmjit/asmjit/src/asmjit/core/codeholder.h +1035 -0
  58. data/ext/asmjit/asmjit/src/asmjit/core/codewriter.cpp +175 -0
  59. data/ext/asmjit/asmjit/src/asmjit/core/codewriter_p.h +179 -0
  60. data/ext/asmjit/asmjit/src/asmjit/core/compiler.cpp +582 -0
  61. data/ext/asmjit/asmjit/src/asmjit/core/compiler.h +737 -0
  62. data/ext/asmjit/asmjit/src/asmjit/core/compilerdefs.h +173 -0
  63. data/ext/asmjit/asmjit/src/asmjit/core/constpool.cpp +363 -0
  64. data/ext/asmjit/asmjit/src/asmjit/core/constpool.h +250 -0
  65. data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.cpp +1162 -0
  66. data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.h +813 -0
  67. data/ext/asmjit/asmjit/src/asmjit/core/emithelper.cpp +323 -0
  68. data/ext/asmjit/asmjit/src/asmjit/core/emithelper_p.h +58 -0
  69. data/ext/asmjit/asmjit/src/asmjit/core/emitter.cpp +333 -0
  70. data/ext/asmjit/asmjit/src/asmjit/core/emitter.h +741 -0
  71. data/ext/asmjit/asmjit/src/asmjit/core/emitterutils.cpp +129 -0
  72. data/ext/asmjit/asmjit/src/asmjit/core/emitterutils_p.h +89 -0
  73. data/ext/asmjit/asmjit/src/asmjit/core/environment.cpp +46 -0
  74. data/ext/asmjit/asmjit/src/asmjit/core/environment.h +508 -0
  75. data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.cpp +14 -0
  76. data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.h +228 -0
  77. data/ext/asmjit/asmjit/src/asmjit/core/formatter.cpp +584 -0
  78. data/ext/asmjit/asmjit/src/asmjit/core/formatter.h +247 -0
  79. data/ext/asmjit/asmjit/src/asmjit/core/formatter_p.h +34 -0
  80. data/ext/asmjit/asmjit/src/asmjit/core/func.cpp +286 -0
  81. data/ext/asmjit/asmjit/src/asmjit/core/func.h +1445 -0
  82. data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext.cpp +293 -0
  83. data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext_p.h +199 -0
  84. data/ext/asmjit/asmjit/src/asmjit/core/globals.cpp +133 -0
  85. data/ext/asmjit/asmjit/src/asmjit/core/globals.h +393 -0
  86. data/ext/asmjit/asmjit/src/asmjit/core/inst.cpp +113 -0
  87. data/ext/asmjit/asmjit/src/asmjit/core/inst.h +772 -0
  88. data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.cpp +1242 -0
  89. data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.h +261 -0
  90. data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.cpp +80 -0
  91. data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.h +89 -0
  92. data/ext/asmjit/asmjit/src/asmjit/core/logger.cpp +69 -0
  93. data/ext/asmjit/asmjit/src/asmjit/core/logger.h +198 -0
  94. data/ext/asmjit/asmjit/src/asmjit/core/misc_p.h +33 -0
  95. data/ext/asmjit/asmjit/src/asmjit/core/operand.cpp +132 -0
  96. data/ext/asmjit/asmjit/src/asmjit/core/operand.h +1611 -0
  97. data/ext/asmjit/asmjit/src/asmjit/core/osutils.cpp +84 -0
  98. data/ext/asmjit/asmjit/src/asmjit/core/osutils.h +61 -0
  99. data/ext/asmjit/asmjit/src/asmjit/core/osutils_p.h +68 -0
  100. data/ext/asmjit/asmjit/src/asmjit/core/raassignment_p.h +418 -0
  101. data/ext/asmjit/asmjit/src/asmjit/core/rabuilders_p.h +612 -0
  102. data/ext/asmjit/asmjit/src/asmjit/core/radefs_p.h +1204 -0
  103. data/ext/asmjit/asmjit/src/asmjit/core/ralocal.cpp +1166 -0
  104. data/ext/asmjit/asmjit/src/asmjit/core/ralocal_p.h +254 -0
  105. data/ext/asmjit/asmjit/src/asmjit/core/rapass.cpp +1969 -0
  106. data/ext/asmjit/asmjit/src/asmjit/core/rapass_p.h +1183 -0
  107. data/ext/asmjit/asmjit/src/asmjit/core/rastack.cpp +184 -0
  108. data/ext/asmjit/asmjit/src/asmjit/core/rastack_p.h +171 -0
  109. data/ext/asmjit/asmjit/src/asmjit/core/string.cpp +559 -0
  110. data/ext/asmjit/asmjit/src/asmjit/core/string.h +372 -0
  111. data/ext/asmjit/asmjit/src/asmjit/core/support.cpp +494 -0
  112. data/ext/asmjit/asmjit/src/asmjit/core/support.h +1773 -0
  113. data/ext/asmjit/asmjit/src/asmjit/core/target.cpp +14 -0
  114. data/ext/asmjit/asmjit/src/asmjit/core/target.h +53 -0
  115. data/ext/asmjit/asmjit/src/asmjit/core/type.cpp +74 -0
  116. data/ext/asmjit/asmjit/src/asmjit/core/type.h +419 -0
  117. data/ext/asmjit/asmjit/src/asmjit/core/virtmem.cpp +722 -0
  118. data/ext/asmjit/asmjit/src/asmjit/core/virtmem.h +242 -0
  119. data/ext/asmjit/asmjit/src/asmjit/core/zone.cpp +353 -0
  120. data/ext/asmjit/asmjit/src/asmjit/core/zone.h +615 -0
  121. data/ext/asmjit/asmjit/src/asmjit/core/zonehash.cpp +309 -0
  122. data/ext/asmjit/asmjit/src/asmjit/core/zonehash.h +186 -0
  123. data/ext/asmjit/asmjit/src/asmjit/core/zonelist.cpp +163 -0
  124. data/ext/asmjit/asmjit/src/asmjit/core/zonelist.h +209 -0
  125. data/ext/asmjit/asmjit/src/asmjit/core/zonestack.cpp +176 -0
  126. data/ext/asmjit/asmjit/src/asmjit/core/zonestack.h +239 -0
  127. data/ext/asmjit/asmjit/src/asmjit/core/zonestring.h +120 -0
  128. data/ext/asmjit/asmjit/src/asmjit/core/zonetree.cpp +99 -0
  129. data/ext/asmjit/asmjit/src/asmjit/core/zonetree.h +380 -0
  130. data/ext/asmjit/asmjit/src/asmjit/core/zonevector.cpp +356 -0
  131. data/ext/asmjit/asmjit/src/asmjit/core/zonevector.h +690 -0
  132. data/ext/asmjit/asmjit/src/asmjit/core.h +1861 -0
  133. data/ext/asmjit/asmjit/src/asmjit/x86/x86archtraits_p.h +148 -0
  134. data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.cpp +5110 -0
  135. data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.h +685 -0
  136. data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.cpp +52 -0
  137. data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.h +351 -0
  138. data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.cpp +61 -0
  139. data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.h +721 -0
  140. data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper.cpp +619 -0
  141. data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper_p.h +60 -0
  142. data/ext/asmjit/asmjit/src/asmjit/x86/x86emitter.h +4315 -0
  143. data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter.cpp +944 -0
  144. data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter_p.h +58 -0
  145. data/ext/asmjit/asmjit/src/asmjit/x86/x86func.cpp +503 -0
  146. data/ext/asmjit/asmjit/src/asmjit/x86/x86func_p.h +33 -0
  147. data/ext/asmjit/asmjit/src/asmjit/x86/x86globals.h +2169 -0
  148. data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi.cpp +1732 -0
  149. data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi_p.h +41 -0
  150. data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.cpp +4427 -0
  151. data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.h +563 -0
  152. data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb_p.h +311 -0
  153. data/ext/asmjit/asmjit/src/asmjit/x86/x86opcode_p.h +436 -0
  154. data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.cpp +231 -0
  155. data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.h +1085 -0
  156. data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass.cpp +1509 -0
  157. data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass_p.h +94 -0
  158. data/ext/asmjit/asmjit/src/asmjit/x86.h +93 -0
  159. data/ext/asmjit/asmjit/src/asmjit.natvis +245 -0
  160. data/ext/asmjit/asmjit/test/asmjit_test_assembler.cpp +84 -0
  161. data/ext/asmjit/asmjit/test/asmjit_test_assembler.h +85 -0
  162. data/ext/asmjit/asmjit/test/asmjit_test_assembler_a64.cpp +4006 -0
  163. data/ext/asmjit/asmjit/test/asmjit_test_assembler_x64.cpp +17833 -0
  164. data/ext/asmjit/asmjit/test/asmjit_test_assembler_x86.cpp +8300 -0
  165. data/ext/asmjit/asmjit/test/asmjit_test_compiler.cpp +253 -0
  166. data/ext/asmjit/asmjit/test/asmjit_test_compiler.h +73 -0
  167. data/ext/asmjit/asmjit/test/asmjit_test_compiler_a64.cpp +690 -0
  168. data/ext/asmjit/asmjit/test/asmjit_test_compiler_x86.cpp +4317 -0
  169. data/ext/asmjit/asmjit/test/asmjit_test_emitters.cpp +197 -0
  170. data/ext/asmjit/asmjit/test/asmjit_test_instinfo.cpp +181 -0
  171. data/ext/asmjit/asmjit/test/asmjit_test_misc.h +257 -0
  172. data/ext/asmjit/asmjit/test/asmjit_test_perf.cpp +62 -0
  173. data/ext/asmjit/asmjit/test/asmjit_test_perf.h +61 -0
  174. data/ext/asmjit/asmjit/test/asmjit_test_perf_a64.cpp +699 -0
  175. data/ext/asmjit/asmjit/test/asmjit_test_perf_x86.cpp +5032 -0
  176. data/ext/asmjit/asmjit/test/asmjit_test_unit.cpp +172 -0
  177. data/ext/asmjit/asmjit/test/asmjit_test_x86_sections.cpp +172 -0
  178. data/ext/asmjit/asmjit/test/asmjitutils.h +38 -0
  179. data/ext/asmjit/asmjit/test/broken.cpp +312 -0
  180. data/ext/asmjit/asmjit/test/broken.h +148 -0
  181. data/ext/asmjit/asmjit/test/cmdline.h +61 -0
  182. data/ext/asmjit/asmjit/test/performancetimer.h +41 -0
  183. data/ext/asmjit/asmjit/tools/configure-makefiles.sh +13 -0
  184. data/ext/asmjit/asmjit/tools/configure-ninja.sh +13 -0
  185. data/ext/asmjit/asmjit/tools/configure-sanitizers.sh +13 -0
  186. data/ext/asmjit/asmjit/tools/configure-vs2019-x64.bat +2 -0
  187. data/ext/asmjit/asmjit/tools/configure-vs2019-x86.bat +2 -0
  188. data/ext/asmjit/asmjit/tools/configure-vs2022-x64.bat +2 -0
  189. data/ext/asmjit/asmjit/tools/configure-vs2022-x86.bat +2 -0
  190. data/ext/asmjit/asmjit/tools/configure-xcode.sh +8 -0
  191. data/ext/asmjit/asmjit/tools/enumgen.js +417 -0
  192. data/ext/asmjit/asmjit/tools/enumgen.sh +3 -0
  193. data/ext/asmjit/asmjit/tools/tablegen-arm.js +365 -0
  194. data/ext/asmjit/asmjit/tools/tablegen-arm.sh +3 -0
  195. data/ext/asmjit/asmjit/tools/tablegen-x86.js +2638 -0
  196. data/ext/asmjit/asmjit/tools/tablegen-x86.sh +3 -0
  197. data/ext/asmjit/asmjit/tools/tablegen.js +947 -0
  198. data/ext/asmjit/asmjit/tools/tablegen.sh +4 -0
  199. data/ext/asmjit/asmjit.cc +18 -0
  200. data/lib/asmjit/version.rb +1 -1
  201. metadata +197 -2
@@ -0,0 +1,229 @@
1
+ // This file is part of AsmJit project <https://asmjit.com>
2
+ //
3
+ // See asmjit.h or LICENSE.md for license and copyright information
4
+ // SPDX-License-Identifier: Zlib
5
+
6
+ #ifndef ASMJIT_CORE_ARCHCOMMONS_H_INCLUDED
7
+ #define ASMJIT_CORE_ARCHCOMMONS_H_INCLUDED
8
+
9
+ // This file provides architecture-specific classes that are required in the core library. For example Imm operand
10
+ // allows to be created from arm::Shift in a const-expr way, so the arm::Shift must be provided. So this header file
11
+ // provides everything architecture-specific that is used by the Core API.
12
+
13
+ #include "../core/globals.h"
14
+
15
+ ASMJIT_BEGIN_SUB_NAMESPACE(arm)
16
+
17
+ //! \addtogroup asmjit_arm
18
+ //! \{
19
+
20
+ //! Condition code (both AArch32 & AArch64).
21
+ //!
22
+ //! \note This enumeration doesn't match condition code that is used in AArch32/AArch64 opcodes. In general this
23
+ //! condition code is encoded as `(cc - 2) & 0xF` so that `kAL` condition code is zero and encoded as 0xE in opcode.
24
+ //! This makes it easier to use a condition code as an instruction modifier that defaults to 'al'.
25
+ enum class CondCode : uint8_t {
26
+ kAL = 0x00u, //!< (no condition code) (always)
27
+ kNA = 0x01u, //!< (not available) (special)
28
+ kEQ = 0x02u, //!< Z==1 (any_sign ==)
29
+ kNE = 0x03u, //!< Z==0 (any_sign !=)
30
+ kCS = 0x04u, //!< C==1 (unsigned >=)
31
+ kHS = 0x04u, //!< C==1 (unsigned >=)
32
+ kCC = 0x05u, //!< C==0 (unsigned < )
33
+ kLO = 0x05u, //!< C==0 (unsigned < )
34
+ kMI = 0x06u, //!< N==1 (is negative)
35
+ kPL = 0x07u, //!< N==0 (is positive or zero)
36
+ kVS = 0x08u, //!< V==1 (is overflow)
37
+ kVC = 0x09u, //!< V==0 (no overflow)
38
+ kHI = 0x0Au, //!< C==1 & Z==0 (unsigned > )
39
+ kLS = 0x0Bu, //!< C==0 | Z==1 (unsigned <=)
40
+ kGE = 0x0Cu, //!< N==V (signed >=)
41
+ kLT = 0x0Du, //!< N!=V (signed < )
42
+ kGT = 0x0Eu, //!< Z==0 & N==V (signed > )
43
+ kLE = 0x0Fu, //!< Z==1 | N!=V (signed <=)
44
+
45
+ kSign = kMI, //!< Sign.
46
+ kNotSign = kPL, //!< Not sign.
47
+
48
+ kOverflow = kVS, //!< Signed overflow.
49
+ kNotOverflow = kVC, //!< Not signed overflow.
50
+
51
+ kEqual = kEQ, //!< Equal `a == b`.
52
+ kNotEqual = kNE, //!< Not Equal `a != b`.
53
+
54
+ kZero = kEQ, //!< Zero (alias to equal).
55
+ kNotZero = kNE, //!< Not Zero (alias to Not Equal).
56
+
57
+ kNegative = kMI, //!< Negative.
58
+ kPositive = kPL, //!< Positive or zero.
59
+
60
+ kSignedLT = kLT, //!< Signed `a < b`.
61
+ kSignedLE = kLE, //!< Signed `a <= b`.
62
+ kSignedGT = kGT, //!< Signed `a > b`.
63
+ kSignedGE = kGE, //!< Signed `a >= b`.
64
+
65
+ kUnsignedLT = kLO, //!< Unsigned `a < b`.
66
+ kUnsignedLE = kLS, //!< Unsigned `a <= b`.
67
+ kUnsignedGT = kHI, //!< Unsigned `a > b`.
68
+ kUnsignedGE = kHS, //!< Unsigned `a >= b`.
69
+
70
+ kAlways = kAL, //!< No condition code (always).
71
+
72
+ kMaxValue = 0x0Fu //!< Maximum value of `CondCode`.
73
+ };
74
+
75
+ //! Negates a condition code.
76
+ static inline constexpr CondCode negateCond(CondCode cond) noexcept { return CondCode(uint8_t(cond) ^ uint8_t(1)); }
77
+
78
+ //! Data type that can be encoded with the instruction (AArch32 only).
79
+ enum class DataType : uint32_t {
80
+ //! No data type specified (default for all general purpose instructions).
81
+ kNone = 0,
82
+ //! 8-bit signed integer, specified as `.s8` in assembly.
83
+ kS8 = 1,
84
+ //! 16-bit signed integer, specified as `.s16` in assembly.
85
+ kS16 = 2,
86
+ //! 32-bit signed integer, specified as `.s32` in assembly.
87
+ kS32 = 3,
88
+ //! 64-bit signed integer, specified as `.s64` in assembly.
89
+ kS64 = 4,
90
+ //! 8-bit unsigned integer, specified as `.u8` in assembly.
91
+ kU8 = 5,
92
+ //! 16-bit unsigned integer, specified as `.u16` in assembly.
93
+ kU16 = 6,
94
+ //! 32-bit unsigned integer, specified as `.u32` in assembly.
95
+ kU32 = 7,
96
+ //! 64-bit unsigned integer, specified as `.u64` in assembly.
97
+ kU64 = 8,
98
+ //! 16-bit floating point (half precision), specified as `.f16` in assembly.
99
+ kF16 = 10,
100
+ //! 32-bit floating point (single precision), specified as `.f32` in assembly.
101
+ kF32 = 11,
102
+ //! 64-bit floating point (double precision), specified as `.f64` in assembly.
103
+ kF64 = 12,
104
+ //! 8-bit polynomial.
105
+ kP8 = 13,
106
+ //! 64-bit polynomial.
107
+ kP64 = 15,
108
+
109
+ //! Maximum value of `DataType`.
110
+ kMaxValue = 15
111
+ };
112
+
113
+ //! Shift operation predicate (ARM) describes either SHIFT or EXTEND operation.
114
+ //!
115
+ //! \note The constants are AsmJit specific. The first 5 values describe real constants on ARM32 and AArch64 hardware,
116
+ //! however, the addition constants that describe extend modes are specific to AsmJit and would be translated to the
117
+ //! AArch64 specific constants by the assembler.
118
+ enum class ShiftOp : uint32_t {
119
+ //! Shift left logical operation (default).
120
+ //!
121
+ //! Available to all ARM architectures.
122
+ kLSL = 0x00u,
123
+
124
+ //! Shift right logical operation.
125
+ //!
126
+ //! Available to all ARM architectures.
127
+ kLSR = 0x01u,
128
+
129
+ //! Shift right arithmetic operation.
130
+ //!
131
+ //! Available to all ARM architectures.
132
+ kASR = 0x02u,
133
+
134
+ //! Rotate right operation (AArch32 only).
135
+ kROR = 0x03u,
136
+
137
+ //! Rotate right with carry operation (encoded as `ShiftOp::kROR` with zero) (AArch32 only).
138
+ kRRX = 0x04u,
139
+
140
+ //! Shift left by filling low order bits with ones.
141
+ kMSL = 0x05u,
142
+
143
+ //! UXTN extend register operation (AArch64 only).
144
+ kUXTB = 0x06u,
145
+ //! UXTH extend register operation (AArch64 only).
146
+ kUXTH = 0x07u,
147
+ //! UXTW extend register operation (AArch64 only).
148
+ kUXTW = 0x08u,
149
+ //! UXTX extend register operation (AArch64 only).
150
+ kUXTX = 0x09u,
151
+
152
+ //! SXTB extend register operation (AArch64 only).
153
+ kSXTB = 0x0Au,
154
+ //! SXTH extend register operation (AArch64 only).
155
+ kSXTH = 0x0Bu,
156
+ //! SXTW extend register operation (AArch64 only).
157
+ kSXTW = 0x0Cu,
158
+ //! SXTX extend register operation (AArch64 only).
159
+ kSXTX = 0x0Du
160
+
161
+ // NOTE: 0xE and 0xF are used by memory operand to specify POST|PRE offset mode.
162
+ };
163
+
164
+ //! Represents ARM immediate shift operation type and value.
165
+ class Shift {
166
+ public:
167
+ //! Shift operation.
168
+ ShiftOp _op;
169
+ //! Shift Value.
170
+ uint32_t _value;
171
+
172
+ //! Default constructed Shift is not initialized.
173
+ inline Shift() noexcept = default;
174
+
175
+ //! Copy constructor (default)
176
+ constexpr Shift(const Shift& other) noexcept = default;
177
+
178
+ //! Constructs Shift from operation `op` and shift `value`.
179
+ constexpr Shift(ShiftOp op, uint32_t value) noexcept
180
+ : _op(op),
181
+ _value(value) {}
182
+
183
+ //! Returns the shift operation.
184
+ constexpr ShiftOp op() const noexcept { return _op; }
185
+ //! Sets shift operation to `op`.
186
+ inline void setOp(ShiftOp op) noexcept { _op = op; }
187
+
188
+ //! Returns the shift smount.
189
+ constexpr uint32_t value() const noexcept { return _value; }
190
+ //! Sets shift amount to `value`.
191
+ inline void setValue(uint32_t value) noexcept { _value = value; }
192
+ };
193
+
194
+ //! Constructs a `LSL #value` shift (logical shift left).
195
+ static constexpr Shift lsl(uint32_t value) noexcept { return Shift(ShiftOp::kLSL, value); }
196
+ //! Constructs a `LSR #value` shift (logical shift right).
197
+ static constexpr Shift lsr(uint32_t value) noexcept { return Shift(ShiftOp::kLSR, value); }
198
+ //! Constructs a `ASR #value` shift (arithmetic shift right).
199
+ static constexpr Shift asr(uint32_t value) noexcept { return Shift(ShiftOp::kASR, value); }
200
+ //! Constructs a `ROR #value` shift (rotate right).
201
+ static constexpr Shift ror(uint32_t value) noexcept { return Shift(ShiftOp::kROR, value); }
202
+ //! Constructs a `RRX` shift (rotate with carry by 1).
203
+ static constexpr Shift rrx() noexcept { return Shift(ShiftOp::kRRX, 0); }
204
+ //! Constructs a `MSL #value` shift (logical shift left filling ones).
205
+ static constexpr Shift msl(uint32_t value) noexcept { return Shift(ShiftOp::kMSL, value); }
206
+
207
+ //! Constructs a `UXTB #value` extend and shift (unsigned byte extend).
208
+ static constexpr Shift uxtb(uint32_t value) noexcept { return Shift(ShiftOp::kUXTB, value); }
209
+ //! Constructs a `UXTH #value` extend and shift (unsigned hword extend).
210
+ static constexpr Shift uxth(uint32_t value) noexcept { return Shift(ShiftOp::kUXTH, value); }
211
+ //! Constructs a `UXTW #value` extend and shift (unsigned word extend).
212
+ static constexpr Shift uxtw(uint32_t value) noexcept { return Shift(ShiftOp::kUXTW, value); }
213
+ //! Constructs a `UXTX #value` extend and shift (unsigned dword extend).
214
+ static constexpr Shift uxtx(uint32_t value) noexcept { return Shift(ShiftOp::kUXTX, value); }
215
+
216
+ //! Constructs a `SXTB #value` extend and shift (signed byte extend).
217
+ static constexpr Shift sxtb(uint32_t value) noexcept { return Shift(ShiftOp::kSXTB, value); }
218
+ //! Constructs a `SXTH #value` extend and shift (signed hword extend).
219
+ static constexpr Shift sxth(uint32_t value) noexcept { return Shift(ShiftOp::kSXTH, value); }
220
+ //! Constructs a `SXTW #value` extend and shift (signed word extend).
221
+ static constexpr Shift sxtw(uint32_t value) noexcept { return Shift(ShiftOp::kSXTW, value); }
222
+ //! Constructs a `SXTX #value` extend and shift (signed dword extend).
223
+ static constexpr Shift sxtx(uint32_t value) noexcept { return Shift(ShiftOp::kSXTX, value); }
224
+
225
+ //! \}
226
+
227
+ ASMJIT_END_SUB_NAMESPACE
228
+
229
+ #endif // ASMJIT_CORE_ARCHCOMMONS_H_INCLUDED
@@ -0,0 +1,160 @@
1
+ // This file is part of AsmJit project <https://asmjit.com>
2
+ //
3
+ // See asmjit.h or LICENSE.md for license and copyright information
4
+ // SPDX-License-Identifier: Zlib
5
+
6
+ #include "../core/api-build_p.h"
7
+ #include "../core/archtraits.h"
8
+ #include "../core/misc_p.h"
9
+
10
+ #if !defined(ASMJIT_NO_X86)
11
+ #include "../x86/x86archtraits_p.h"
12
+ #endif
13
+
14
+ #if !defined(ASMJIT_NO_AARCH64)
15
+ #include "../arm/a64archtraits_p.h"
16
+ #endif
17
+
18
+ ASMJIT_BEGIN_NAMESPACE
19
+
20
+ static const constexpr ArchTraits noArchTraits = {
21
+ // SP/FP/LR/PC.
22
+ 0xFF, 0xFF, 0xFF, 0xFF,
23
+
24
+ // Reserved,
25
+ { 0, 0, 0 },
26
+
27
+ // HW stack alignment.
28
+ 0,
29
+
30
+ // Min/Max stack offset.
31
+ 0, 0,
32
+
33
+ // ISA features [Gp, Vec, Other0, Other1].
34
+ {{
35
+ InstHints::kNoHints,
36
+ InstHints::kNoHints,
37
+ InstHints::kNoHints,
38
+ InstHints::kNoHints
39
+ }},
40
+
41
+ // RegTypeToSignature.
42
+ #define V(index) OperandSignature{0}
43
+ {{ ASMJIT_LOOKUP_TABLE_32(V, 0) }},
44
+ #undef V
45
+
46
+ // RegTypeToTypeId.
47
+ #define V(index) TypeId::kVoid
48
+ {{ ASMJIT_LOOKUP_TABLE_32(V, 0) }},
49
+ #undef V
50
+
51
+ // TypeIdToRegType.
52
+ #define V(index) RegType::kNone
53
+ {{ ASMJIT_LOOKUP_TABLE_32(V, 0) }},
54
+ #undef V
55
+
56
+ // Word names of 8-bit, 16-bit, 32-bit, and 64-bit quantities.
57
+ {
58
+ ArchTypeNameId::kByte,
59
+ ArchTypeNameId::kHalf,
60
+ ArchTypeNameId::kWord,
61
+ ArchTypeNameId::kQuad
62
+ }
63
+ };
64
+
65
+ ASMJIT_VARAPI const ArchTraits _archTraits[uint32_t(Arch::kMaxValue) + 1] = {
66
+ // No architecture.
67
+ noArchTraits,
68
+
69
+ // X86/X86 architectures.
70
+ #if !defined(ASMJIT_NO_X86)
71
+ x86::x86ArchTraits,
72
+ x86::x64ArchTraits,
73
+ #else
74
+ noArchTraits,
75
+ noArchTraits,
76
+ #endif
77
+
78
+ // RISCV32/RISCV64 architectures.
79
+ noArchTraits,
80
+ noArchTraits,
81
+
82
+ // ARM architecture
83
+ noArchTraits,
84
+
85
+ // AArch64 architecture.
86
+ #if !defined(ASMJIT_NO_AARCH64)
87
+ a64::a64ArchTraits,
88
+ #else
89
+ noArchTraits,
90
+ #endif
91
+
92
+ // ARM/Thumb architecture.
93
+ noArchTraits,
94
+
95
+ // Reserved.
96
+ noArchTraits,
97
+
98
+ // MIPS32/MIPS64
99
+ noArchTraits,
100
+ noArchTraits
101
+ };
102
+
103
+ ASMJIT_FAVOR_SIZE Error ArchUtils::typeIdToRegSignature(Arch arch, TypeId typeId, TypeId* typeIdOut, OperandSignature* regSignatureOut) noexcept {
104
+ const ArchTraits& archTraits = ArchTraits::byArch(arch);
105
+
106
+ // TODO: Remove this, should never be used like this.
107
+ // Passed RegType instead of TypeId?
108
+ if (uint32_t(typeId) <= uint32_t(RegType::kMaxValue))
109
+ typeId = archTraits.regTypeToTypeId(RegType(uint32_t(typeId)));
110
+
111
+ if (ASMJIT_UNLIKELY(!TypeUtils::isValid(typeId)))
112
+ return DebugUtils::errored(kErrorInvalidTypeId);
113
+
114
+ // First normalize architecture dependent types.
115
+ if (TypeUtils::isAbstract(typeId)) {
116
+ bool is32Bit = Environment::is32Bit(arch);
117
+ if (typeId == TypeId::kIntPtr)
118
+ typeId = is32Bit ? TypeId::kInt32 : TypeId::kInt64;
119
+ else
120
+ typeId = is32Bit ? TypeId::kUInt32 : TypeId::kUInt64;
121
+ }
122
+
123
+ // Type size helps to construct all groups of registers.
124
+ // TypeId is invalid if the size is zero.
125
+ uint32_t size = TypeUtils::sizeOf(typeId);
126
+ if (ASMJIT_UNLIKELY(!size))
127
+ return DebugUtils::errored(kErrorInvalidTypeId);
128
+
129
+ if (ASMJIT_UNLIKELY(typeId == TypeId::kFloat80))
130
+ return DebugUtils::errored(kErrorInvalidUseOfF80);
131
+
132
+ RegType regType = RegType::kNone;
133
+ if (TypeUtils::isBetween(typeId, TypeId::_kBaseStart, TypeId::_kVec32Start)) {
134
+ regType = archTraits._typeIdToRegType[uint32_t(typeId) - uint32_t(TypeId::_kBaseStart)];
135
+ if (regType == RegType::kNone) {
136
+ if (typeId == TypeId::kInt64 || typeId == TypeId::kUInt64)
137
+ return DebugUtils::errored(kErrorInvalidUseOfGpq);
138
+ else
139
+ return DebugUtils::errored(kErrorInvalidTypeId);
140
+ }
141
+ }
142
+ else {
143
+ if (size <= 8 && archTraits._regSignature[RegType::kVec64].isValid())
144
+ regType = RegType::kVec64;
145
+ else if (size <= 16 && archTraits._regSignature[RegType::kVec128].isValid())
146
+ regType = RegType::kVec128;
147
+ else if (size == 32 && archTraits._regSignature[RegType::kVec256].isValid())
148
+ regType = RegType::kVec256;
149
+ else if (archTraits._regSignature[RegType::kVec512].isValid())
150
+ regType = RegType::kVec512;
151
+ else
152
+ return DebugUtils::errored(kErrorInvalidTypeId);
153
+ }
154
+
155
+ *typeIdOut = typeId;
156
+ *regSignatureOut = archTraits.regTypeToSignature(regType);
157
+ return kErrorOk;
158
+ }
159
+
160
+ ASMJIT_END_NAMESPACE
@@ -0,0 +1,290 @@
1
+ // This file is part of AsmJit project <https://asmjit.com>
2
+ //
3
+ // See asmjit.h or LICENSE.md for license and copyright information
4
+ // SPDX-License-Identifier: Zlib
5
+
6
+ #ifndef ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
7
+ #define ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
8
+
9
+ #include "../core/operand.h"
10
+ #include "../core/support.h"
11
+ #include "../core/type.h"
12
+
13
+ ASMJIT_BEGIN_NAMESPACE
14
+
15
+ //! \addtogroup asmjit_core
16
+ //! \{
17
+
18
+ //! Instruction set architecture (ISA).
19
+ enum class Arch : uint8_t {
20
+ //! Unknown or uninitialized ISA.
21
+ kUnknown = 0,
22
+
23
+ //! 32-bit X86 ISA.
24
+ kX86 = 1,
25
+ //! 64-bit X86 ISA also known as X64, X86_64, and AMD64.
26
+ kX64 = 2,
27
+
28
+ //! 32-bit RISC-V ISA.
29
+ kRISCV32 = 3,
30
+ //! 64-bit RISC-V ISA.
31
+ kRISCV64 = 4,
32
+
33
+ //! 32-bit ARM ISA (little endian).
34
+ kARM = 5,
35
+ //! 64-bit ARM ISA in (little endian).
36
+ kAArch64 = 6,
37
+ //! 32-bit ARM ISA in Thumb mode (little endian).
38
+ kThumb = 7,
39
+
40
+ // 8 is not used at the moment, even numbers are 64-bit architectures.
41
+
42
+ //! 32-bit MIPS ISA in (little endian).
43
+ kMIPS32_LE = 9,
44
+ //! 64-bit MIPS ISA in (little endian).
45
+ kMIPS64_LE = 10,
46
+
47
+ //! 32-bit ARM ISA (big endian).
48
+ kARM_BE = 11,
49
+ //! 64-bit ARM ISA in (big endian).
50
+ kAArch64_BE = 12,
51
+ //! 32-bit ARM ISA in Thumb mode (big endian).
52
+ kThumb_BE = 13,
53
+
54
+ // 14 is not used at the moment, even numbers are 64-bit architectures.
55
+
56
+ //! 32-bit MIPS ISA in (big endian).
57
+ kMIPS32_BE = 15,
58
+ //! 64-bit MIPS ISA in (big endian).
59
+ kMIPS64_BE = 16,
60
+
61
+ //! Maximum value of `Arch`.
62
+ kMaxValue = kMIPS64_BE,
63
+
64
+ //! Mask used by 32-bit ISAs (odd are 32-bit, even are 64-bit).
65
+ k32BitMask = 0x01,
66
+ //! First big-endian architecture.
67
+ kBigEndian = kARM_BE,
68
+
69
+ //! ISA detected at compile-time (ISA of the host).
70
+ kHost =
71
+ #if defined(_DOXYGEN)
72
+ DETECTED_AT_COMPILE_TIME
73
+ #else
74
+ ASMJIT_ARCH_X86 == 32 ? kX86 :
75
+ ASMJIT_ARCH_X86 == 64 ? kX64 :
76
+
77
+ ASMJIT_ARCH_ARM == 32 && ASMJIT_ARCH_LE ? kARM :
78
+ ASMJIT_ARCH_ARM == 32 && ASMJIT_ARCH_BE ? kARM_BE :
79
+ ASMJIT_ARCH_ARM == 64 && ASMJIT_ARCH_LE ? kAArch64 :
80
+ ASMJIT_ARCH_ARM == 64 && ASMJIT_ARCH_BE ? kAArch64_BE :
81
+
82
+ ASMJIT_ARCH_MIPS == 32 && ASMJIT_ARCH_LE ? kMIPS32_LE :
83
+ ASMJIT_ARCH_MIPS == 32 && ASMJIT_ARCH_BE ? kMIPS32_BE :
84
+ ASMJIT_ARCH_MIPS == 64 && ASMJIT_ARCH_LE ? kMIPS64_LE :
85
+ ASMJIT_ARCH_MIPS == 64 && ASMJIT_ARCH_BE ? kMIPS64_BE :
86
+
87
+ kUnknown
88
+ #endif
89
+ };
90
+
91
+ //! Sub-architecture.
92
+ enum class SubArch : uint8_t {
93
+ //! Unknown or uninitialized architecture sub-type.
94
+ kUnknown = 0,
95
+
96
+ //! Maximum value of `SubArch`.
97
+ kMaxValue = kUnknown,
98
+
99
+ //! Sub-architecture detected at compile-time (sub-architecture of the host).
100
+ kHost =
101
+ #if defined(_DOXYGEN)
102
+ DETECTED_AT_COMPILE_TIME
103
+ #else
104
+ kUnknown
105
+ #endif
106
+ };
107
+
108
+ //! Identifier used to represent names of different data types across architectures.
109
+ enum class ArchTypeNameId : uint8_t {
110
+ //! Describes 'db' (X86/X86_64 convention, always 8-bit quantity).
111
+ kDB = 0,
112
+ //! Describes 'dw' (X86/X86_64 convention, always 16-bit word).
113
+ kDW,
114
+ //! Describes 'dd' (X86/X86_64 convention, always 32-bit word).
115
+ kDD,
116
+ //! Describes 'dq' (X86/X86_64 convention, always 64-bit word).
117
+ kDQ,
118
+ //! Describes 'byte' (always 8-bit quantity).
119
+ kByte,
120
+ //! Describes 'half' (most likely 16-bit word).
121
+ kHalf,
122
+ //! Describes 'word' (either 16-bit or 32-bit word).
123
+ kWord,
124
+ //! Describes 'hword' (most likely 16-bit word).
125
+ kHWord,
126
+ //! Describes 'dword' (either 32-bit or 64-bit word).
127
+ kDWord,
128
+ //! Describes 'qword' (64-bit word).
129
+ kQWord,
130
+ //! Describes 'xword' (64-bit word).
131
+ kXWord,
132
+ //! Describes 'short' (always 16-bit word).
133
+ kShort,
134
+ //! Describes 'long' (most likely 32-bit word).
135
+ kLong,
136
+ //! Describes 'quad' (64-bit word).
137
+ kQuad,
138
+
139
+ //! Maximum value of `ArchTypeNameId`.
140
+ kMaxValue = kQuad
141
+ };
142
+
143
+ //! Instruction feature hints for each register group provided by \ref ArchTraits.
144
+ //!
145
+ //! Instruction feature hints describe miscellaneous instructions provided by the architecture that can be used by
146
+ //! register allocator to make certain things simpler - like register swaps or emitting register push/pop sequences.
147
+ //!
148
+ //! \remarks Instruction feature hints are only defined for register groups that can be used with \ref
149
+ //! asmjit_compiler infrastructure. Register groups that are not managed by Compiler are not provided by
150
+ //! \ref ArchTraits and cannot be queried.
151
+ enum class InstHints : uint8_t {
152
+ //! No feature hints.
153
+ kNoHints = 0,
154
+
155
+ //! Architecture supports a register swap by using a single instruction.
156
+ kRegSwap = 0x01u,
157
+ //! Architecture provides push/pop instructions.
158
+ kPushPop = 0x02u
159
+ };
160
+ ASMJIT_DEFINE_ENUM_FLAGS(InstHints)
161
+
162
+ //! Architecture traits used by Function API and Compiler's register allocator.
163
+ struct ArchTraits {
164
+ //! \name Members
165
+ //! \{
166
+
167
+ //! Stack pointer register id.
168
+ uint8_t _spRegId;
169
+ //! Frame pointer register id.
170
+ uint8_t _fpRegId;
171
+ //! Link register id.
172
+ uint8_t _linkRegId;
173
+ //! Instruction pointer (or program counter) register id, if accessible.
174
+ uint8_t _ipRegId;
175
+
176
+ // Reserved.
177
+ uint8_t _reserved[3];
178
+ //! Hardware stack alignment requirement.
179
+ uint8_t _hwStackAlignment;
180
+
181
+ //! Minimum addressable offset on stack guaranteed for all instructions.
182
+ uint32_t _minStackOffset;
183
+ //! Maximum addressable offset on stack depending on specific instruction.
184
+ uint32_t _maxStackOffset;
185
+
186
+ //! Flags for each virtual register group.
187
+ Support::Array<InstHints, Globals::kNumVirtGroups> _instHints;
188
+
189
+ //! Maps register type into a signature, that provides group, size and can be used to construct register operands.
190
+ Support::Array<OperandSignature, uint32_t(RegType::kMaxValue) + 1> _regSignature;
191
+ //! Maps a register to type-id, see \ref TypeId.
192
+ Support::Array<TypeId, uint32_t(RegType::kMaxValue) + 1> _regTypeToTypeId;
193
+ //! Maps scalar TypeId values (from TypeId::_kIdBaseStart) to register types, see \ref TypeId.
194
+ Support::Array<RegType, 32> _typeIdToRegType;
195
+
196
+ //! Word name identifiers of 8-bit, 16-bit, 32-biit, and 64-bit quantities that appear in formatted text.
197
+ ArchTypeNameId _typeNameIdTable[4];
198
+
199
+ //! \}
200
+
201
+ //! \name Accessors
202
+ //! \{
203
+
204
+ //! Returns stack pointer register id.
205
+ inline uint32_t spRegId() const noexcept { return _spRegId; }
206
+ //! Returns stack frame register id.
207
+ inline uint32_t fpRegId() const noexcept { return _fpRegId; }
208
+ //! Returns link register id, if the architecture provides it.
209
+ inline uint32_t linkRegId() const noexcept { return _linkRegId; }
210
+ //! Returns instruction pointer register id, if the architecture provides it.
211
+ inline uint32_t ipRegId() const noexcept { return _ipRegId; }
212
+
213
+ //! Returns a hardware stack alignment requirement.
214
+ //!
215
+ //! \note This is a hardware constraint. Architectures that don't constrain it would return the lowest alignment
216
+ //! (1), however, some architectures may constrain the alignment, for example AArch64 requires 16-byte alignment.
217
+ inline uint32_t hwStackAlignment() const noexcept { return _hwStackAlignment; }
218
+
219
+ //! Tests whether the architecture provides link register, which is used across function calls. If the link
220
+ //! register is not provided then a function call pushes the return address on stack (X86/X64).
221
+ inline bool hasLinkReg() const noexcept { return _linkRegId != BaseReg::kIdBad; }
222
+
223
+ //! Returns minimum addressable offset on stack guaranteed for all instructions.
224
+ inline uint32_t minStackOffset() const noexcept { return _minStackOffset; }
225
+ //! Returns maximum addressable offset on stack depending on specific instruction.
226
+ inline uint32_t maxStackOffset() const noexcept { return _maxStackOffset; }
227
+
228
+ //! Returns ISA flags of the given register `group`.
229
+ inline InstHints instFeatureHints(RegGroup group) const noexcept { return _instHints[group]; }
230
+ //! Tests whether the given register `group` has the given `flag` set.
231
+ inline bool hasInstHint(RegGroup group, InstHints feature) const noexcept { return Support::test(_instHints[group], feature); }
232
+ //! Tests whether the ISA provides register swap instruction for the given register `group`.
233
+ inline bool hasInstRegSwap(RegGroup group) const noexcept { return hasInstHint(group, InstHints::kRegSwap); }
234
+ //! Tests whether the ISA provides push/pop instructions for the given register `group`.
235
+ inline bool hasInstPushPop(RegGroup group) const noexcept { return hasInstHint(group, InstHints::kPushPop); }
236
+
237
+ inline bool hasRegType(RegType type) const noexcept {
238
+ return type <= RegType::kMaxValue && _regSignature[type].isValid();
239
+ }
240
+
241
+ //! Returns an operand signature from the given register `type` of this architecture.
242
+ inline OperandSignature regTypeToSignature(RegType type) const noexcept { return _regSignature[type]; }
243
+ //! Returns a register from the given register `type` of this architecture.
244
+ inline RegGroup regTypeToGroup(RegType type) const noexcept { return _regSignature[type].regGroup(); }
245
+ //! Returns a register size the given register `type` of this architecture.
246
+ inline uint32_t regTypeToSize(RegType type) const noexcept { return _regSignature[type].size(); }
247
+ //! Returns a corresponding `TypeId` from the given register `type` of this architecture.
248
+ inline TypeId regTypeToTypeId(RegType type) const noexcept { return _regTypeToTypeId[type]; }
249
+
250
+ //! Returns a table of ISA word names that appear in formatted text. Word names are ISA dependent.
251
+ //!
252
+ //! The index of this table is log2 of the size:
253
+ //! - [0] 8-bits
254
+ //! - [1] 16-bits
255
+ //! - [2] 32-bits
256
+ //! - [3] 64-bits
257
+ inline const ArchTypeNameId* typeNameIdTable() const noexcept { return _typeNameIdTable; }
258
+
259
+ //! Returns an ISA word name identifier of the given `index`, see \ref typeNameIdTable() for more details.
260
+ inline ArchTypeNameId typeNameIdByIndex(uint32_t index) const noexcept { return _typeNameIdTable[index]; }
261
+
262
+ //! \}
263
+
264
+ //! \name Statics
265
+ //! \{
266
+
267
+ //! Returns a const reference to `ArchTraits` for the given architecture `arch`.
268
+ static inline const ArchTraits& byArch(Arch arch) noexcept;
269
+
270
+ //! \}
271
+ };
272
+
273
+ ASMJIT_VARAPI const ArchTraits _archTraits[uint32_t(Arch::kMaxValue) + 1];
274
+
275
+ //! \cond
276
+ inline const ArchTraits& ArchTraits::byArch(Arch arch) noexcept { return _archTraits[uint32_t(arch)]; }
277
+ //! \endcond
278
+
279
+ //! Architecture utilities.
280
+ namespace ArchUtils {
281
+
282
+ ASMJIT_API Error typeIdToRegSignature(Arch arch, TypeId typeId, TypeId* typeIdOut, OperandSignature* regSignatureOut) noexcept;
283
+
284
+ } // {ArchUtils}
285
+
286
+ //! \}
287
+
288
+ ASMJIT_END_NAMESPACE
289
+
290
+ #endif // ASMJIT_CORE_ARCHTRAITS_H_INCLUDED