asmjit 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
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,94 @@
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_X86_X86RAPASS_P_H_INCLUDED
7
+ #define ASMJIT_X86_X86RAPASS_P_H_INCLUDED
8
+
9
+ #include "../core/api-config.h"
10
+ #ifndef ASMJIT_NO_COMPILER
11
+
12
+ #include "../core/compiler.h"
13
+ #include "../core/rabuilders_p.h"
14
+ #include "../core/rapass_p.h"
15
+ #include "../x86/x86assembler.h"
16
+ #include "../x86/x86compiler.h"
17
+ #include "../x86/x86emithelper_p.h"
18
+
19
+ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
20
+
21
+ //! \cond INTERNAL
22
+ //! \addtogroup asmjit_x86
23
+ //! \{
24
+
25
+ //! X86 register allocation pass.
26
+ //!
27
+ //! Takes care of generating function prologs and epilogs, and also performs register allocation.
28
+ class X86RAPass : public BaseRAPass {
29
+ public:
30
+ ASMJIT_NONCOPYABLE(X86RAPass)
31
+ typedef BaseRAPass Base;
32
+
33
+ EmitHelper _emitHelper;
34
+
35
+ //! \name Construction & Destruction
36
+ //! \{
37
+
38
+ X86RAPass() noexcept;
39
+ virtual ~X86RAPass() noexcept;
40
+
41
+ //! \}
42
+
43
+ //! \name Accessors
44
+ //! \{
45
+
46
+ //! Returns the compiler casted to `x86::Compiler`.
47
+ inline Compiler* cc() const noexcept { return static_cast<Compiler*>(_cb); }
48
+
49
+ //! Returns emit helper.
50
+ inline EmitHelper* emitHelper() noexcept { return &_emitHelper; }
51
+
52
+ inline bool avxEnabled() const noexcept { return _emitHelper._avxEnabled; }
53
+ inline bool avx512Enabled() const noexcept { return _emitHelper._avx512Enabled; }
54
+
55
+ //! \}
56
+
57
+ //! \name Utilities
58
+ //! \{
59
+
60
+ inline uint32_t choose(uint32_t sseInstId, uint32_t avxInstId) noexcept {
61
+ return avxEnabled() ? avxInstId : sseInstId;
62
+ }
63
+
64
+ //! \}
65
+
66
+ //! \name Interface
67
+ //! \{
68
+
69
+ void onInit() noexcept override;
70
+ void onDone() noexcept override;
71
+
72
+ Error buildCFG() noexcept override;
73
+
74
+ Error _rewrite(BaseNode* first, BaseNode* stop) noexcept override;
75
+
76
+ Error emitMove(uint32_t workId, uint32_t dstPhysId, uint32_t srcPhysId) noexcept override;
77
+ Error emitSwap(uint32_t aWorkId, uint32_t aPhysId, uint32_t bWorkId, uint32_t bPhysId) noexcept override;
78
+
79
+ Error emitLoad(uint32_t workId, uint32_t dstPhysId) noexcept override;
80
+ Error emitSave(uint32_t workId, uint32_t srcPhysId) noexcept override;
81
+
82
+ Error emitJump(const Label& label) noexcept override;
83
+ Error emitPreCall(InvokeNode* invokeNode) noexcept override;
84
+
85
+ //! \}
86
+ };
87
+
88
+ //! \}
89
+ //! \endcond
90
+
91
+ ASMJIT_END_SUB_NAMESPACE
92
+
93
+ #endif // !ASMJIT_NO_COMPILER
94
+ #endif // ASMJIT_X86_X86RAPASS_P_H_INCLUDED
@@ -0,0 +1,93 @@
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_X86_H_INCLUDED
7
+ #define ASMJIT_X86_H_INCLUDED
8
+
9
+ //! \addtogroup asmjit_x86
10
+ //!
11
+ //! ### Namespace
12
+ //!
13
+ //! - \ref x86 - x86 namespace provides support for X86/X64 code generation.
14
+ //!
15
+ //! ### Emitters
16
+ //!
17
+ //! - \ref x86::Assembler - X86/X64 assembler (must read, provides examples).
18
+ //! - \ref x86::Builder - X86/X64 builder.
19
+ //! - \ref x86::Compiler - X86/X64 compiler.
20
+ //! - \ref x86::Emitter - X86/X64 emitter (abstract).
21
+ //!
22
+ //! ### Supported Instructions
23
+ //!
24
+ //! - Emitters:
25
+ //! - \ref x86::EmitterExplicitT - Provides all instructions that use explicit operands, provides also utility
26
+ //! functions. The member functions provided are part of all X86 emitters.
27
+ //! - \ref x86::EmitterImplicitT - Provides all instructions that use implicit operands, these cannot be used
28
+ //! with \ref x86::Compiler.
29
+ //!
30
+ //! - Instruction representation:
31
+ //! - \ref x86::Inst::Id - Provides instruction identifiers for both X86/X86_64 architectures.
32
+ //! - \ref InstOptions - Provides generic and X86/X86_64 specific options.
33
+ //!
34
+ //! ### Register Operands
35
+ //!
36
+ //! - \ref x86::Reg - Base class for any X86 register.
37
+ //! - \ref x86::Gp - General purpose register:
38
+ //! - \ref x86::GpbLo - 8-bit low register.
39
+ //! - \ref x86::GpbHi - 8-bit high register.
40
+ //! - \ref x86::Gpw - 16-bit register.
41
+ //! - \ref x86::Gpd - 32-bit register.
42
+ //! - \ref x86::Gpq - 64-bit register (X64 only).
43
+ //! - \ref x86::Vec - Vector (SIMD) register:
44
+ //! - \ref x86::Xmm - 128-bit SIMD register (SSE+).
45
+ //! - \ref x86::Ymm - 256-bit SIMD register (AVX+).
46
+ //! - \ref x86::Zmm - 512-bit SIMD register (AVX512+).
47
+ //! - \ref x86::Mm - 64-bit MMX register.
48
+ //! - \ref x86::St - 80-bit FPU register.
49
+ //! - \ref x86::KReg - opmask registers (AVX512+).
50
+ //! - \ref x86::SReg - segment register.
51
+ //! - \ref x86::CReg - control register.
52
+ //! - \ref x86::DReg - debug register.
53
+ //! - \ref x86::Bnd - bound register (discontinued).
54
+ //! - \ref x86::Rip - relative instruction pointer.
55
+ //!
56
+ //! ### Memory Operands
57
+ //!
58
+ //! - \ref x86::Mem - X86/X64 memory operand that provides support for all X86 and X64 addressing features
59
+ //! including absolute addresses, index scales, and segment override prefixes.
60
+ //!
61
+ //! ### Status and Control Words
62
+ //!
63
+ //! - \ref x86::FpuStatusWord - FPU status word bits / decomposition.
64
+ //! - \ref x86::FpuControlWord - FPU control word bits / decomposition.
65
+ //!
66
+ //! ### Predicates (immediate values)
67
+ //!
68
+ //! - \ref x86::CmpImm - `CMP[PD|PS|SD|SS]` predicate (SSE+).
69
+ //! - \ref x86::PCmpStrImm - `[V]PCMP[I|E]STR[I|M]` predicate (SSE4.1+, AVX+).
70
+ //! - \ref x86::RoundImm - `[V]ROUND[PD|PS|SD|SS]` predicate (SSE+, AVX+).
71
+ //! - \ref x86::VCmpImm - `VCMP[PD|PS|SD|SS]` predicate (AVX+).
72
+ //! - \ref x86::VFixupImm - `VFIXUPIMM[PD|PS|SD|SS]` predicate (AVX512+).
73
+ //! - \ref x86::VFPClassImm - `VFPCLASS[PD|PS|SD|SS]` predicate (AVX512+).
74
+ //! - \ref x86::VGetMantImm - `VGETMANT[PD|PS|SD|SS]` predicate (AVX512+).
75
+ //! - \ref x86::VPCmpImm - `VPCMP[U][B|W|D|Q]` predicate (AVX512+).
76
+ //! - \ref x86::VPComImm - `VPCOM[U][B|W|D|Q]` predicate (XOP).
77
+ //! - \ref x86::VRangeImm - `VRANGE[PD|PS|SD|SS]` predicate (AVX512+).
78
+ //! - \ref x86::VReduceImm - `REDUCE[PD|PS|SD|SS]` predicate (AVX512+).
79
+ //! - \ref x86::TLogImm - `VPTERNLOG[D|Q]` predicate and operations (AVX512+).
80
+
81
+ #include "core.h"
82
+
83
+ #include "asmjit-scope-begin.h"
84
+ #include "x86/x86assembler.h"
85
+ #include "x86/x86builder.h"
86
+ #include "x86/x86compiler.h"
87
+ #include "x86/x86emitter.h"
88
+ #include "x86/x86globals.h"
89
+ #include "x86/x86instdb.h"
90
+ #include "x86/x86operand.h"
91
+ #include "asmjit-scope-end.h"
92
+
93
+ #endif // ASMJIT_X86_H_INCLUDED
@@ -0,0 +1,245 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <!-- asmjit visualizer for Visual Studio (natvis) -->
4
+
5
+ <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
6
+ <Type Name="asmjit::String">
7
+ <Intrinsic Name="isSmall" Expression="(_type &lt; 0x1F)"/>
8
+ <DisplayString Condition="isSmall()">{_small.data, s8}</DisplayString>
9
+ <DisplayString Condition="!isSmall()">{_large.data, s8}</DisplayString>
10
+ <Expand HideRawView="true">
11
+ <Synthetic Name="_type">
12
+ <DisplayString Condition="(_type &lt; 0x1F)">Small</DisplayString>
13
+ <DisplayString Condition="(_type == 0x1F)">Large</DisplayString>
14
+ <DisplayString Condition="(_type &gt; 0x1F)">External</DisplayString>
15
+ </Synthetic>
16
+ <Item Name="_size" Condition="isSmall()" ExcludeView="simple">(int)_small.type, d</Item>
17
+ <Item Name="_size" Condition="!isSmall()" ExcludeView="simple">_large.size, d</Item>
18
+ <Item Name="_capacity" Condition="isSmall()" ExcludeView="simple">asmjit::String::kSSOCapacity, d</Item>
19
+ <Item Name="_capacity" Condition="!isSmall()" ExcludeView="simple">_large.capacity, d</Item>
20
+ <Item Name="_data" Condition="isSmall()" ExcludeView="simple">_small.data, s8</Item>
21
+ <Item Name="_data" Condition="!isSmall()" ExcludeView="simple">_large.data, s8</Item>
22
+ </Expand>
23
+ </Type>
24
+
25
+ <Type Name="asmjit::ZoneVector&lt;*&gt;">
26
+ <DisplayString>{{ [size={_size, d} capacity={_capacity, d}] }}</DisplayString>
27
+ <Expand>
28
+ <Item Name="_size" ExcludeView="simple">_size, d</Item>
29
+ <Item Name="_capacity" ExcludeView="simple">_capacity, d</Item>
30
+ <ArrayItems>
31
+ <Size>_size</Size>
32
+ <ValuePointer>(($T1*)_data)</ValuePointer>
33
+ </ArrayItems>
34
+ </Expand>
35
+ </Type>
36
+
37
+ <Type Name="asmjit::OperandSignature">
38
+ <Intrinsic Name="opType" Expression="(asmjit::OperandType)(_bits &amp; 0x7)" />
39
+ <Intrinsic Name="opSize" Expression="(_bits &gt;&gt; 24) &amp; 0xFF" />
40
+ <Intrinsic Name="regType" Expression="(asmjit::RegType)((_bits &gt;&gt; 3) &amp; 0x1F)" />
41
+ <Intrinsic Name="regGroup" Expression="(asmjit::RegGroup)((_bits &gt;&gt; 8) &amp; 0xF)" />
42
+ <Intrinsic Name="memBaseType" Expression="(asmjit::RegType)((_bits &gt;&gt; 3) &amp; 0x1F)" />
43
+ <Intrinsic Name="memIndexType" Expression="(asmjit::RegType)((_bits &gt;&gt; 8) &amp; 0x1F)" />
44
+ <Intrinsic Name="memRegHome" Expression="(bool)((_bits &gt;&gt; 13) &amp; 0x1)" />
45
+ <Intrinsic Name="memX86Segment" Expression="(asmjit::x86::SReg::Id)((_bits &gt;&gt; 18) &amp; 0x7)" />
46
+ <Intrinsic Name="memX86AddrType" Expression="(asmjit::x86::Mem::AddrType)((_bits &gt;&gt; 14) &amp; 0x3)" />
47
+ <Intrinsic Name="memX86ShiftValue" Expression="((_bits &gt;&gt; 16) &amp; 0x3)" />
48
+ <Intrinsic Name="memX86Broadcast" Expression="(asmjit::x86::Mem::Broadcast)((_bits &gt;&gt; 21) &amp; 0x7)" />
49
+ <Intrinsic Name="immType" Expression="(asmjit::ImmType)((_bits &gt;&gt; 3) &amp; 0x1)" />
50
+
51
+ <DisplayString Condition="opType() == asmjit::OperandType::kNone">[None]</DisplayString>
52
+ <DisplayString Condition="opType() == asmjit::OperandType::kReg">[Reg] {{ type={regType()} group={regGroup()} size={opSize(), d} }}</DisplayString>
53
+ <DisplayString Condition="opType() == asmjit::OperandType::kMem">[Mem] {{ base={memBaseType()} index={memIndexType()} }}</DisplayString>
54
+ <DisplayString Condition="opType() == asmjit::OperandType::kImm">[Imm] {{ type={immType()} }}</DisplayString>
55
+ <DisplayString Condition="opType() == asmjit::OperandType::kLabel">[Label]</DisplayString>
56
+ <DisplayString Condition="opType() &gt; asmjit::OperandType::kMaxValue">[Unknown]</DisplayString>
57
+
58
+ <Expand HideRawView="true">
59
+ <Item Name="bits">_bits, X</Item>
60
+ <Item Name="op.type">opType()</Item>
61
+ <Item Name="reg.type" Condition="opType() == asmjit::OperandType::kReg">regType()</Item>
62
+ <Item Name="reg.group" Condition="opType() == asmjit::OperandType::kReg">regGroup()</Item>
63
+ <Item Name="reg.size" Condition="opType() == asmjit::OperandType::kReg">opSize(), d</Item>
64
+ <Item Name="mem.baseType" Condition="opType() == asmjit::OperandType::kMem">memBaseType()</Item>
65
+ <Item Name="mem.indexType" Condition="opType() == asmjit::OperandType::kMem">memIndexType()</Item>
66
+ <Item Name="mem.regHome" Condition="opType() == asmjit::OperandType::kMem">memRegHome()</Item>
67
+ <Item Name="mem.size" Condition="opType() == asmjit::OperandType::kMem">opSize(), d</Item>
68
+ <Item Name="mem.x86.segment" Condition="opType() == asmjit::OperandType::kMem">memX86Segment()</Item>
69
+ <Item Name="mem.x86.addrType" Condition="opType() == asmjit::OperandType::kMem">memX86AddrType()</Item>
70
+ <Item Name="mem.x86.shift" Condition="opType() == asmjit::OperandType::kMem">memX86ShiftValue()</Item>
71
+ <Item Name="mem.x86.broadcast" Condition="opType() == asmjit::OperandType::kMem">memX86Broadcast()</Item>
72
+ <Item Name="imm.type" Condition="opType() == asmjit::OperandType::kImm">immType()</Item>
73
+ </Expand>
74
+ </Type>
75
+
76
+ <Type Name="asmjit::Operand_">
77
+ <Intrinsic Name="opType" Expression="(asmjit::OperandType)(_signature._bits &amp; 0x7)" />
78
+ <Intrinsic Name="opSize" Expression="(_signature._bits &gt;&gt; 24) &amp; 0xFF" />
79
+ <Intrinsic Name="regType" Expression="(asmjit::RegType)((_signature._bits &gt;&gt; 3) &amp; 0x1F)" />
80
+ <Intrinsic Name="regGroup" Expression="(asmjit::RegGroup)((_signature._bits &gt;&gt; 8) &amp; 0xF)" />
81
+ <Intrinsic Name="memBaseType" Expression="(asmjit::RegType)((_signature._bits &gt;&gt; 3) &amp; 0x1F)" />
82
+ <Intrinsic Name="memIndexType" Expression="(asmjit::RegType)((_signature._bits &gt;&gt; 8) &amp; 0x1F)" />
83
+ <Intrinsic Name="memRegHome" Expression="(bool)((_signature._bits &gt;&gt; 13) &amp; 0x1)" />
84
+ <Intrinsic Name="memX86Segment" Expression="(asmjit::x86::SReg::Id)((_signature._bits &gt;&gt; 18) &amp; 0x7)" />
85
+ <Intrinsic Name="memX86AddrType" Expression="(asmjit::x86::Mem::AddrType)((_signature._bits &gt;&gt; 14) &amp; 0x3)" />
86
+ <Intrinsic Name="memX86ShiftValue" Expression="((_signature._bits &gt;&gt; 16) &amp; 0x3)" />
87
+ <Intrinsic Name="memX86Broadcast" Expression="(asmjit::x86::Mem::Broadcast)((_signature._bits &gt;&gt; 21) &amp; 0x7)" />
88
+ <Intrinsic Name="memBaseId" Expression="_baseId" />
89
+ <Intrinsic Name="memIndexId" Expression="_data[0]" />
90
+ <Intrinsic Name="memOffset32b" Expression="(__int64)int(_data[1])" />
91
+ <Intrinsic Name="memOffset64b" Expression="(__int64) ((unsigned __int64)_baseId &lt;&lt; 32) | ((unsigned __int64)_data[1])" />
92
+ <Intrinsic Name="memOffset" Expression="memBaseType() != asmjit::RegType::kNone ? memOffset32b() : memOffset64b()" />
93
+ <Intrinsic Name="immType" Expression="(asmjit::ImmType)((_signature._bits &gt;&gt; 3) &amp; 0x1)" />
94
+ <Intrinsic Name="immValue" Expression="((__int64)_data[1] &lt;&lt; 32) | (__int64)_data[0]" />
95
+
96
+ <DisplayString Condition="opType() == asmjit::OperandType::kNone">[None]</DisplayString>
97
+ <DisplayString Condition="opType() == asmjit::OperandType::kReg">[Reg] {{ id={_baseId, d} group={regGroup(), d} type={regType(), d} size={opSize(), d} }}</DisplayString>
98
+ <DisplayString Condition="opType() == asmjit::OperandType::kMem">[Mem] {{ baseId={memBaseId(), d} indexId={memIndexId(), d} offset={(__int64)memOffset(), d} }}</DisplayString>
99
+ <DisplayString Condition="opType() == asmjit::OperandType::kImm">[Imm] {{ val={immValue(), d} hex={immValue(), X} }}</DisplayString>
100
+ <DisplayString Condition="opType() == asmjit::OperandType::kLabel">[Label] {{ id={_baseId} }}</DisplayString>
101
+ <DisplayString Condition="opType() &gt; 4">[Unknown]</DisplayString>
102
+ <Expand HideRawView="true">
103
+ <Item Name="_signature">_signature._bits, X</Item>
104
+ <Item Name="op.type">opType()</Item>
105
+ <Item Name="op.size">opSize(), d</Item>
106
+ <Item Name="reg.type" Condition="opType() == asmjit::OperandType::kReg">regType()</Item>
107
+ <Item Name="reg.group" Condition="opType() == asmjit::OperandType::kReg">regGroup()</Item>
108
+ <Item Name="reg.id" Condition="opType() == asmjit::OperandType::kReg">_baseId, d</Item>
109
+ <Item Name="mem.baseType" Condition="opType() == asmjit::OperandType::kMem">memBaseType()</Item>
110
+ <Item Name="mem.baseId" Condition="opType() == asmjit::OperandType::kMem &amp;&amp; memBaseType() != asmjit::RegType::kNone">memBaseId()</Item>
111
+ <Item Name="mem.indexType" Condition="opType() == asmjit::OperandType::kMem">memIndexType()</Item>
112
+ <Item Name="mem.indexId" Condition="opType() == asmjit::OperandType::kMem &amp;&amp; memIndexType() != asmjit::RegType::kNone">memIndexId()</Item>
113
+ <Item Name="mem.regHome" Condition="opType() == asmjit::OperandType::kMem">memRegHome()</Item>
114
+ <Item Name="mem.offset" Condition="opType() == asmjit::OperandType::kMem">memOffset(), d</Item>
115
+ <Item Name="mem.x86.segment" Condition="opType() == asmjit::OperandType::kMem">memX86Segment()</Item>
116
+ <Item Name="mem.x86.addrType" Condition="opType() == asmjit::OperandType::kMem">memX86AddrType()</Item>
117
+ <Item Name="mem.x86.shift" Condition="opType() == asmjit::OperandType::kMem">memX86ShiftValue()</Item>
118
+ <Item Name="mem.x86.broadcast" Condition="opType() == asmjit::OperandType::kMem">memX86Broadcast()</Item>
119
+ <Item Name="imm.type" Condition="opType() == asmjit::OperandType::kImm">immType()</Item>
120
+ <Item Name="imm.value" Condition="opType() == asmjit::OperandType::kImm">immValue(), X</Item>
121
+ <Item Name="label.id" Condition="opType() == asmjit::OperandType::kLabel">_baseId, d</Item>
122
+ <Item Name="raw.baseId">_baseId</Item>
123
+ <Item Name="raw.data[0]">_data[0]</Item>
124
+ <Item Name="raw.data[1]">_data[1]</Item>
125
+ </Expand>
126
+ </Type>
127
+
128
+ <Type Name="asmjit::FuncValue">
129
+ <Intrinsic Name="isReg" Expression="(_data &amp; asmjit::FuncValue::kFlagIsReg) != 0" />
130
+ <Intrinsic Name="isStack" Expression="(_data &amp; asmjit::FuncValue::kFlagIsStack) != 0" />
131
+ <Intrinsic Name="isIndirect" Expression="(_data &amp; asmjit::FuncValue::kFlagIsIndirect) != 0" />
132
+ <Intrinsic Name="isDone" Expression="(_data &amp; asmjit::FuncValue::kFlagIsDone) != 0" />
133
+
134
+ <Intrinsic Name="typeId" Expression="((_data &amp; asmjit::FuncValue::kTypeIdMask) &gt;&gt; asmjit::FuncValue::kTypeIdShift)" />
135
+ <Intrinsic Name="regId" Expression="((_data &amp; asmjit::FuncValue::kRegIdMask) &gt;&gt; asmjit::FuncValue::kRegIdShift)" />
136
+ <Intrinsic Name="regType" Expression="((_data &amp; asmjit::FuncValue::kRegTypeMask) &gt;&gt; asmjit::FuncValue::kRegTypeShift)" />
137
+ <Intrinsic Name="stackOffset" Expression="((_data &amp; asmjit::FuncValue::kStackOffsetMask) &gt;&gt; asmjit::FuncValue::kStackOffsetShift)" />
138
+
139
+ <DisplayString Condition="isReg()">[RegValue {{ regType={regType()} indirect={isIndirect()} done={isDone()} }}]</DisplayString>
140
+ <DisplayString Condition="isStack()">[StackValue {{ indirect={isIndirect()} done={isDone()} }}]</DisplayString>
141
+ <DisplayString Condition="!isReg() &amp;&amp; !isStack()">[Unknown]</DisplayString>
142
+
143
+ <Expand HideRawView="true">
144
+ <Item Name="data">_data</Item>
145
+ <Item Name="typeId">(asmjit::TypeId)(typeId())</Item>
146
+ <Item Name="regType" Condition="isReg()">(asmjit::BaseReg::RegType)regType()</Item>
147
+ <Item Name="regId" Condition="isReg()">regId()</Item>
148
+ <Item Name="stackOffset" Condition="isStack()">stackOffset()</Item>
149
+ </Expand>
150
+ </Type>
151
+
152
+ <Type Name="asmjit::BaseNode">
153
+ <Intrinsic Name="nodeType" Expression="_any._nodeType" />
154
+
155
+ <Intrinsic Name="isInst" Expression="nodeType() == asmjit::NodeType::kInst"></Intrinsic>
156
+ <Intrinsic Name="isSection" Expression="nodeType() == asmjit::NodeType::kSection"></Intrinsic>
157
+ <Intrinsic Name="isLabel" Expression="nodeType() == asmjit::NodeType::kLabel"></Intrinsic>
158
+ <Intrinsic Name="isAlign" Expression="nodeType() == asmjit::NodeType::kAlign"></Intrinsic>
159
+ <Intrinsic Name="isEmbedData" Expression="nodeType() == asmjit::NodeType::kEmbedData"></Intrinsic>
160
+ <Intrinsic Name="isEmbedLabel" Expression="nodeType() == asmjit::NodeType::kEmbedLabel"></Intrinsic>
161
+ <Intrinsic Name="isEmbedLabelDelta" Expression="nodeType() == asmjit::NodeType::kEmbedLabelDelta"></Intrinsic>
162
+ <Intrinsic Name="isConstPool" Expression="nodeType() == asmjit::NodeType::kConstPool"></Intrinsic>
163
+ <Intrinsic Name="isComment" Expression="nodeType() == asmjit::NodeType::kComment"></Intrinsic>
164
+ <Intrinsic Name="isSentinel" Expression="nodeType() == asmjit::NodeType::kSentinel"></Intrinsic>
165
+ <Intrinsic Name="isJump" Expression="nodeType() == asmjit::NodeType::kJump"></Intrinsic>
166
+ <Intrinsic Name="isFunc" Expression="nodeType() == asmjit::NodeType::kFunc"></Intrinsic>
167
+ <Intrinsic Name="isFuncRet" Expression="nodeType() == asmjit::NodeType::kFuncRet"></Intrinsic>
168
+ <Intrinsic Name="isInvoke" Expression="nodeType() == asmjit::NodeType::kInvoke"></Intrinsic>
169
+
170
+ <Intrinsic Name="actsAsInst" Expression="isInst() || isJump() || isFunc() || isFuncRet() || isInvoke()" />
171
+ <Intrinsic Name="actsAsLabel" Expression="isLabel() || isFunc()" />
172
+
173
+ <DisplayString Condition="isInst()">[InstNode]</DisplayString>
174
+ <DisplayString Condition="isSection()">[SectionNode]</DisplayString>
175
+ <DisplayString Condition="isLabel()">[LabelNode]</DisplayString>
176
+ <DisplayString Condition="isAlign()">[AlignNode]</DisplayString>
177
+ <DisplayString Condition="isEmbedData()">[EmbedDataNode]</DisplayString>
178
+ <DisplayString Condition="isEmbedLabel()">[EmbedLabelNode]</DisplayString>
179
+ <DisplayString Condition="isEmbedLabelDelta()">[EmbedLabelDeltaNode]</DisplayString>
180
+ <DisplayString Condition="isConstPool()">[ConstPoolNode]</DisplayString>
181
+ <DisplayString Condition="isComment()">[CommentNode]</DisplayString>
182
+ <DisplayString Condition="isSentinel()">[SentinelNode]</DisplayString>
183
+ <DisplayString Condition="isJump()">[JumpNode]</DisplayString>
184
+ <DisplayString Condition="isFunc()">[FuncNode]</DisplayString>
185
+ <DisplayString Condition="isFuncRet()">[FuncRetNode]</DisplayString>
186
+ <DisplayString Condition="isInvoke()">[InvokeNode]</DisplayString>
187
+ <DisplayString Condition="nodeType() == asmjit::NodeType::kNone || nodeType() &gt; 18">[UnknownNode {nodeType(), d}]</DisplayString>
188
+
189
+ <Expand HideRawView="true">
190
+ <Item Name="prev">_prev</Item>
191
+ <Item Name="next">_next</Item>
192
+
193
+ <Item Name="nodeType">_any._nodeType</Item>
194
+ <Item Name="nodeFlags">_any._nodeFlags</Item>
195
+
196
+ <Item Name="position">_position</Item>
197
+ <Item Name="userData.u64">_userDataU64</Item>
198
+ <Item Name="userData.ptr">_userDataPtr</Item>
199
+ <Item Name="passData">_passData</Item>
200
+ <Item Name="inlineComment">_inlineComment, s8</Item>
201
+
202
+ <Item Name="baseInst" Condition="actsAsInst()">((asmjit::InstNode*)this)-&gt;_baseInst</Item>
203
+ <Item Name="opCount" Condition="actsAsInst()">_inst._opCount</Item>
204
+ <Item Name="opCapacity" Condition="actsAsInst()">_inst._opCapacity</Item>
205
+ <Item Name="opArray" Condition="actsAsInst()">((asmjit::InstNode*)this)-&gt;_opArray, [_inst._opCount]</Item>
206
+
207
+ <Item Name="sectionId" Condition="isSection()">((asmjit::SectionNode*)this)-&gt;_id</Item>
208
+ <Item Name="nextSection" Condition="isSection()">((asmjit::SectionNode*)this)-&gt;_nextSection</Item>
209
+
210
+ <Item Name="labelId" Condition="isLabel()">((asmjit::LabelNode*)this)-&gt;_labelId</Item>
211
+
212
+ <Item Name="alignMode" Condition="isAlign()">((asmjit::AlignNode*)this)-&gt;_alignData._alignMode</Item>
213
+ <Item Name="alignment" Condition="isAlign()">((asmjit::AlignNode*)this)-&gt;_alignment</Item>
214
+
215
+ <Item Name="typeId" Condition="isEmbedData()">_embed._typeId, d</Item>
216
+ <Item Name="typeSize" Condition="isEmbedData()">_embed._typeSize, d</Item>
217
+ <Item Name="itemCount" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_itemCount</Item>
218
+ <Item Name="repeatCount" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_repeatCount</Item>
219
+ <Item Name="inlineData" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_inlineData</Item>
220
+ <Item Name="externalData" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_externalData</Item>
221
+
222
+ <Item Name="labelId" Condition="isEmbedLabel()">((asmjit::EmbedLabelNode*)this)-&gt;_labelId</Item>
223
+
224
+ <Item Name="labelId" Condition="isEmbedLabelDelta()">((asmjit::EmbedLabelDeltaNode*)this)-&gt;_labelId</Item>
225
+ <Item Name="baseLabelId" Condition="isEmbedLabelDelta()">((asmjit::EmbedLabelDeltaNode*)this)-&gt;_baseLabelId</Item>
226
+ <Item Name="dataSize" Condition="isEmbedLabelDelta()">((asmjit::EmbedLabelDeltaNode*)this)-&gt;_dataSize</Item>
227
+
228
+ <Item Name="constPool" Condition="isConstPool()">((asmjit::ConstPoolNode*)this)-&gt;_constPool</Item>
229
+
230
+ <Item Name="sentinel.sentinelType" Condition="isSentinel()">_sentinel._sentinelType</Item>
231
+
232
+ <Item Name="annotation" Condition="isJump()">((asmjit::JumpNode*)this)-&gt;_annotation</Item>
233
+
234
+ <Item Name="funcDetail" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_funcDetail</Item>
235
+ <Item Name="frame" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_frame</Item>
236
+ <Item Name="exitNode" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_exitNode</Item>
237
+ <Item Name="end" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_end</Item>
238
+ <Item Name="args" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_args, [((asmjit::FuncNode*)this)-&gt;_funcDetail._argCount]</Item>
239
+
240
+ <Item Name="funcDetail" Condition="isInvoke()">((asmjit::InvokeNode*)this)-&gt;_funcDetail</Item>
241
+ <Item Name="rets" Condition="isInvoke()">((asmjit::InvokeNode*)this)-&gt;_rets</Item>
242
+ <Item Name="args" Condition="isInvoke()">((asmjit::InvokeNode*)this)-&gt;_args, [((asmjit::InvokeNode*)this)-&gt;_funcDetail._argCount]</Item>
243
+ </Expand>
244
+ </Type>
245
+ </AutoVisualizer>
@@ -0,0 +1,84 @@
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 <asmjit/core.h>
7
+ #include <stdio.h>
8
+ #include <stdlib.h>
9
+ #include <string.h>
10
+
11
+ #include "asmjit_test_assembler.h"
12
+ #include "cmdline.h"
13
+
14
+ using namespace asmjit;
15
+
16
+ #if !defined(ASMJIT_NO_X86)
17
+ bool testX86Assembler(const TestSettings& settings) noexcept;
18
+ bool testX64Assembler(const TestSettings& settings) noexcept;
19
+ #endif
20
+
21
+ #if !defined(ASMJIT_NO_AARCH64)
22
+ bool testA64Assembler(const TestSettings& settings) noexcept;
23
+ #endif
24
+
25
+ int main(int argc, char* argv[]) {
26
+ CmdLine cmdLine(argc, argv);
27
+
28
+ TestSettings settings {};
29
+ settings.quiet = cmdLine.hasArg("--quiet");
30
+ settings.validate = cmdLine.hasArg("--validate");
31
+
32
+ printf("AsmJit Assembler Test-Suite v%u.%u.%u:\n\n",
33
+ unsigned((ASMJIT_LIBRARY_VERSION >> 16) ),
34
+ unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF),
35
+ unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF));
36
+
37
+ printf("Usage:\n");
38
+ printf(" --help Show usage only\n");
39
+ printf(" --arch=<ARCH> Select architecture to run ('all' by default)\n");
40
+ printf(" --quiet Show only assembling errors [%s]\n", settings.quiet ? "x" : " ");
41
+ printf(" --validate Use instruction validation [%s]\n", settings.validate ? "x" : " ");
42
+ printf("\n");
43
+
44
+ if (cmdLine.hasArg("--help"))
45
+ return 0;
46
+
47
+ const char* arch = cmdLine.valueOf("--arch", "all");
48
+ bool x86Failed = false;
49
+ bool x64Failed = false;
50
+ bool aarch64Failed = false;
51
+
52
+ #if !defined(ASMJIT_NO_X86)
53
+ if ((strcmp(arch, "all") == 0 || strcmp(arch, "x86") == 0))
54
+ x86Failed = !testX86Assembler(settings);
55
+
56
+ if ((strcmp(arch, "all") == 0 || strcmp(arch, "x64") == 0))
57
+ x64Failed = !testX64Assembler(settings);
58
+ #endif
59
+
60
+ #if !defined(ASMJIT_NO_AARCH64)
61
+ if ((strcmp(arch, "all") == 0 || strcmp(arch, "aarch64") == 0))
62
+ aarch64Failed = !testA64Assembler(settings);
63
+ #endif
64
+
65
+ bool failed = x86Failed || x64Failed || aarch64Failed;
66
+
67
+ if (failed) {
68
+ if (x86Failed)
69
+ printf("** X86 test suite failed **\n");
70
+
71
+ if (x64Failed)
72
+ printf("** X64 test suite failed **\n");
73
+
74
+ if (aarch64Failed)
75
+ printf("** AArch64 test suite failed **\n");
76
+
77
+ printf("** FAILURE **\n");
78
+ }
79
+ else {
80
+ printf("** SUCCESS **\n");
81
+ }
82
+
83
+ return failed ? 1 : 0;
84
+ }
@@ -0,0 +1,85 @@
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_TEST_ASSEMBLER_H_INCLUDED
7
+ #define ASMJIT_TEST_ASSEMBLER_H_INCLUDED
8
+
9
+ #include <asmjit/core.h>
10
+ #include <stdio.h>
11
+
12
+ struct TestSettings {
13
+ bool quiet;
14
+ bool validate;
15
+ };
16
+
17
+ template<typename AssemblerType>
18
+ class AssemblerTester {
19
+ public:
20
+ asmjit::Environment env {};
21
+ asmjit::CodeHolder code {};
22
+ AssemblerType assembler {};
23
+ asmjit::Label L0 {};
24
+ const TestSettings& settings;
25
+
26
+ size_t passed {};
27
+ size_t count {};
28
+
29
+ AssemblerTester(asmjit::Arch arch, const TestSettings& settings) noexcept
30
+ : env(arch),
31
+ settings(settings) {
32
+ prepare();
33
+ }
34
+
35
+ void printHeader(const char* archName) noexcept {
36
+ printf("%s assembler tests:\n", archName);
37
+ }
38
+
39
+ void printSummary() noexcept {
40
+ printf(" Passed: %zu / %zu tests\n\n", passed, count);
41
+ }
42
+
43
+ bool didPass() const noexcept { return passed == count; }
44
+
45
+ void prepare() noexcept {
46
+ code.reset();
47
+ code.init(env, 0);
48
+ code.attach(&assembler);
49
+ L0 = assembler.newLabel();
50
+
51
+ if (settings.validate)
52
+ assembler.addDiagnosticOptions(asmjit::DiagnosticOptions::kValidateAssembler);
53
+ }
54
+
55
+ ASMJIT_NOINLINE bool testInstruction(const char* expectedOpcode, const char* s, uint32_t err) noexcept {
56
+ count++;
57
+
58
+ if (err) {
59
+ printf(" !! %s\n"
60
+ " <%s>\n", s, asmjit::DebugUtils::errorAsString(err));
61
+ prepare();
62
+ return false;
63
+ }
64
+
65
+ asmjit::String encodedOpcode;
66
+ asmjit::Section* text = code.textSection();
67
+
68
+ encodedOpcode.appendHex(text->data(), text->bufferSize());
69
+ if (encodedOpcode != expectedOpcode) {
70
+ printf(" !! [%s] <- %s\n"
71
+ " [%s] (Expected)\n", encodedOpcode.data(), s, expectedOpcode);
72
+ prepare();
73
+ return false;
74
+ }
75
+
76
+ if (!settings.quiet)
77
+ printf(" OK [%s] <- %s\n", encodedOpcode.data(), s);
78
+
79
+ passed++;
80
+ prepare();
81
+ return true;
82
+ }
83
+ };
84
+
85
+ #endif // ASMJIT_TEST_ASSEMBLER_H_INCLUDED