hexcore-capstone 1.2.0

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 (332) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +191 -0
  3. package/binding.gyp +168 -0
  4. package/deps/capstone/LEB128.h +38 -0
  5. package/deps/capstone/MCDisassembler.h +14 -0
  6. package/deps/capstone/MCFixedLenDisassembler.h +32 -0
  7. package/deps/capstone/MCInst.c +270 -0
  8. package/deps/capstone/MCInst.h +165 -0
  9. package/deps/capstone/MCInstrDesc.c +41 -0
  10. package/deps/capstone/MCInstrDesc.h +167 -0
  11. package/deps/capstone/MCRegisterInfo.c +151 -0
  12. package/deps/capstone/MCRegisterInfo.h +116 -0
  13. package/deps/capstone/Mapping.c +254 -0
  14. package/deps/capstone/Mapping.h +174 -0
  15. package/deps/capstone/MathExtras.h +442 -0
  16. package/deps/capstone/SStream.c +181 -0
  17. package/deps/capstone/SStream.h +40 -0
  18. package/deps/capstone/arch/AArch64/AArch64AddressingModes.h +945 -0
  19. package/deps/capstone/arch/AArch64/AArch64BaseInfo.c +77 -0
  20. package/deps/capstone/arch/AArch64/AArch64BaseInfo.h +585 -0
  21. package/deps/capstone/arch/AArch64/AArch64Disassembler.c +2280 -0
  22. package/deps/capstone/arch/AArch64/AArch64Disassembler.h +18 -0
  23. package/deps/capstone/arch/AArch64/AArch64GenAsmWriter.inc +26589 -0
  24. package/deps/capstone/arch/AArch64/AArch64GenDisassemblerTables.inc +27322 -0
  25. package/deps/capstone/arch/AArch64/AArch64GenInstrInfo.inc +13194 -0
  26. package/deps/capstone/arch/AArch64/AArch64GenRegisterInfo.inc +3814 -0
  27. package/deps/capstone/arch/AArch64/AArch64GenRegisterName.inc +714 -0
  28. package/deps/capstone/arch/AArch64/AArch64GenRegisterV.inc +673 -0
  29. package/deps/capstone/arch/AArch64/AArch64GenSubtargetInfo.inc +229 -0
  30. package/deps/capstone/arch/AArch64/AArch64GenSystemOperands.inc +2863 -0
  31. package/deps/capstone/arch/AArch64/AArch64GenSystemOperands_enum.inc +21 -0
  32. package/deps/capstone/arch/AArch64/AArch64InstPrinter.c +3029 -0
  33. package/deps/capstone/arch/AArch64/AArch64InstPrinter.h +28 -0
  34. package/deps/capstone/arch/AArch64/AArch64Mapping.c +883 -0
  35. package/deps/capstone/arch/AArch64/AArch64Mapping.h +43 -0
  36. package/deps/capstone/arch/AArch64/AArch64MappingInsn.inc +37790 -0
  37. package/deps/capstone/arch/AArch64/AArch64MappingInsnName.inc +1282 -0
  38. package/deps/capstone/arch/AArch64/AArch64MappingInsnOp.inc +26994 -0
  39. package/deps/capstone/arch/AArch64/AArch64Module.c +44 -0
  40. package/deps/capstone/arch/AArch64/AArch64Module.h +12 -0
  41. package/deps/capstone/arch/ARM/ARMAddressingModes.h +698 -0
  42. package/deps/capstone/arch/ARM/ARMBaseInfo.h +486 -0
  43. package/deps/capstone/arch/ARM/ARMDisassembler.c +5763 -0
  44. package/deps/capstone/arch/ARM/ARMDisassembler.h +18 -0
  45. package/deps/capstone/arch/ARM/ARMGenAsmWriter.inc +9545 -0
  46. package/deps/capstone/arch/ARM/ARMGenDisassemblerTables.inc +15185 -0
  47. package/deps/capstone/arch/ARM/ARMGenInstrInfo.inc +6632 -0
  48. package/deps/capstone/arch/ARM/ARMGenRegisterInfo.inc +2102 -0
  49. package/deps/capstone/arch/ARM/ARMGenRegisterName.inc +231 -0
  50. package/deps/capstone/arch/ARM/ARMGenRegisterName_digit.inc +231 -0
  51. package/deps/capstone/arch/ARM/ARMGenSubtargetInfo.inc +162 -0
  52. package/deps/capstone/arch/ARM/ARMGenSystemRegister.inc +270 -0
  53. package/deps/capstone/arch/ARM/ARMInstPrinter.c +3364 -0
  54. package/deps/capstone/arch/ARM/ARMInstPrinter.h +43 -0
  55. package/deps/capstone/arch/ARM/ARMMapping.c +551 -0
  56. package/deps/capstone/arch/ARM/ARMMapping.h +40 -0
  57. package/deps/capstone/arch/ARM/ARMMappingInsn.inc +18772 -0
  58. package/deps/capstone/arch/ARM/ARMMappingInsnName.inc +475 -0
  59. package/deps/capstone/arch/ARM/ARMMappingInsnOp.inc +10729 -0
  60. package/deps/capstone/arch/ARM/ARMModule.c +63 -0
  61. package/deps/capstone/arch/ARM/ARMModule.h +12 -0
  62. package/deps/capstone/arch/BPF/BPFConstants.h +88 -0
  63. package/deps/capstone/arch/BPF/BPFDisassembler.c +464 -0
  64. package/deps/capstone/arch/BPF/BPFDisassembler.h +27 -0
  65. package/deps/capstone/arch/BPF/BPFInstPrinter.c +285 -0
  66. package/deps/capstone/arch/BPF/BPFInstPrinter.h +16 -0
  67. package/deps/capstone/arch/BPF/BPFMapping.c +513 -0
  68. package/deps/capstone/arch/BPF/BPFMapping.h +21 -0
  69. package/deps/capstone/arch/BPF/BPFModule.c +34 -0
  70. package/deps/capstone/arch/BPF/BPFModule.h +12 -0
  71. package/deps/capstone/arch/EVM/EVMDisassembler.c +379 -0
  72. package/deps/capstone/arch/EVM/EVMDisassembler.h +12 -0
  73. package/deps/capstone/arch/EVM/EVMInstPrinter.c +20 -0
  74. package/deps/capstone/arch/EVM/EVMInstPrinter.h +17 -0
  75. package/deps/capstone/arch/EVM/EVMMapping.c +344 -0
  76. package/deps/capstone/arch/EVM/EVMMapping.h +8 -0
  77. package/deps/capstone/arch/EVM/EVMMappingInsn.inc +259 -0
  78. package/deps/capstone/arch/EVM/EVMModule.c +33 -0
  79. package/deps/capstone/arch/EVM/EVMModule.h +12 -0
  80. package/deps/capstone/arch/M680X/M680XDisassembler.c +2307 -0
  81. package/deps/capstone/arch/M680X/M680XDisassembler.h +17 -0
  82. package/deps/capstone/arch/M680X/M680XDisassemblerInternals.h +57 -0
  83. package/deps/capstone/arch/M680X/M680XInstPrinter.c +360 -0
  84. package/deps/capstone/arch/M680X/M680XInstPrinter.h +25 -0
  85. package/deps/capstone/arch/M680X/M680XModule.c +77 -0
  86. package/deps/capstone/arch/M680X/M680XModule.h +12 -0
  87. package/deps/capstone/arch/M680X/cpu12.inc +335 -0
  88. package/deps/capstone/arch/M680X/hcs08.inc +60 -0
  89. package/deps/capstone/arch/M680X/hd6301.inc +15 -0
  90. package/deps/capstone/arch/M680X/hd6309.inc +259 -0
  91. package/deps/capstone/arch/M680X/insn_props.inc +367 -0
  92. package/deps/capstone/arch/M680X/m6800.inc +277 -0
  93. package/deps/capstone/arch/M680X/m6801.inc +39 -0
  94. package/deps/capstone/arch/M680X/m6805.inc +277 -0
  95. package/deps/capstone/arch/M680X/m6808.inc +91 -0
  96. package/deps/capstone/arch/M680X/m6809.inc +352 -0
  97. package/deps/capstone/arch/M680X/m6811.inc +105 -0
  98. package/deps/capstone/arch/M68K/M68KDisassembler.c +3668 -0
  99. package/deps/capstone/arch/M68K/M68KDisassembler.h +30 -0
  100. package/deps/capstone/arch/M68K/M68KInstPrinter.c +387 -0
  101. package/deps/capstone/arch/M68K/M68KInstPrinter.h +21 -0
  102. package/deps/capstone/arch/M68K/M68KInstructionTable.inc +65540 -0
  103. package/deps/capstone/arch/M68K/M68KModule.c +42 -0
  104. package/deps/capstone/arch/M68K/M68KModule.h +12 -0
  105. package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.c +544 -0
  106. package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.h +22 -0
  107. package/deps/capstone/arch/MOS65XX/MOS65XXDisassemblerInternals.h +23 -0
  108. package/deps/capstone/arch/MOS65XX/MOS65XXModule.c +79 -0
  109. package/deps/capstone/arch/MOS65XX/MOS65XXModule.h +12 -0
  110. package/deps/capstone/arch/MOS65XX/instruction_info.inc +106 -0
  111. package/deps/capstone/arch/MOS65XX/m6502.inc +256 -0
  112. package/deps/capstone/arch/MOS65XX/m65816.inc +256 -0
  113. package/deps/capstone/arch/MOS65XX/m65c02.inc +256 -0
  114. package/deps/capstone/arch/MOS65XX/mw65c02.inc +256 -0
  115. package/deps/capstone/arch/Mips/MipsDisassembler.c +1794 -0
  116. package/deps/capstone/arch/Mips/MipsDisassembler.h +16 -0
  117. package/deps/capstone/arch/Mips/MipsGenAsmWriter.inc +5725 -0
  118. package/deps/capstone/arch/Mips/MipsGenDisassemblerTables.inc +6942 -0
  119. package/deps/capstone/arch/Mips/MipsGenInstrInfo.inc +1805 -0
  120. package/deps/capstone/arch/Mips/MipsGenRegisterInfo.inc +1679 -0
  121. package/deps/capstone/arch/Mips/MipsGenSubtargetInfo.inc +52 -0
  122. package/deps/capstone/arch/Mips/MipsInstPrinter.c +424 -0
  123. package/deps/capstone/arch/Mips/MipsInstPrinter.h +25 -0
  124. package/deps/capstone/arch/Mips/MipsMapping.c +1070 -0
  125. package/deps/capstone/arch/Mips/MipsMapping.h +25 -0
  126. package/deps/capstone/arch/Mips/MipsMappingInsn.inc +9315 -0
  127. package/deps/capstone/arch/Mips/MipsModule.c +52 -0
  128. package/deps/capstone/arch/Mips/MipsModule.h +12 -0
  129. package/deps/capstone/arch/PowerPC/PPCDisassembler.c +627 -0
  130. package/deps/capstone/arch/PowerPC/PPCDisassembler.h +17 -0
  131. package/deps/capstone/arch/PowerPC/PPCGenAsmWriter.inc +11451 -0
  132. package/deps/capstone/arch/PowerPC/PPCGenDisassemblerTables.inc +6886 -0
  133. package/deps/capstone/arch/PowerPC/PPCGenInstrInfo.inc +4772 -0
  134. package/deps/capstone/arch/PowerPC/PPCGenRegisterInfo.inc +1122 -0
  135. package/deps/capstone/arch/PowerPC/PPCGenRegisterName.inc +278 -0
  136. package/deps/capstone/arch/PowerPC/PPCGenSubtargetInfo.inc +90 -0
  137. package/deps/capstone/arch/PowerPC/PPCInstPrinter.c +1238 -0
  138. package/deps/capstone/arch/PowerPC/PPCInstPrinter.h +15 -0
  139. package/deps/capstone/arch/PowerPC/PPCMapping.c +570 -0
  140. package/deps/capstone/arch/PowerPC/PPCMapping.h +40 -0
  141. package/deps/capstone/arch/PowerPC/PPCMappingInsn.inc +13220 -0
  142. package/deps/capstone/arch/PowerPC/PPCMappingInsnName.inc +1731 -0
  143. package/deps/capstone/arch/PowerPC/PPCModule.c +45 -0
  144. package/deps/capstone/arch/PowerPC/PPCModule.h +12 -0
  145. package/deps/capstone/arch/PowerPC/PPCPredicates.h +62 -0
  146. package/deps/capstone/arch/RISCV/RISCVBaseInfo.h +106 -0
  147. package/deps/capstone/arch/RISCV/RISCVDisassembler.c +433 -0
  148. package/deps/capstone/arch/RISCV/RISCVDisassembler.h +18 -0
  149. package/deps/capstone/arch/RISCV/RISCVGenAsmWriter.inc +2651 -0
  150. package/deps/capstone/arch/RISCV/RISCVGenDisassemblerTables.inc +1776 -0
  151. package/deps/capstone/arch/RISCV/RISCVGenInsnNameMaps.inc +275 -0
  152. package/deps/capstone/arch/RISCV/RISCVGenInstrInfo.inc +470 -0
  153. package/deps/capstone/arch/RISCV/RISCVGenRegisterInfo.inc +426 -0
  154. package/deps/capstone/arch/RISCV/RISCVGenSubtargetInfo.inc +33 -0
  155. package/deps/capstone/arch/RISCV/RISCVInstPrinter.c +447 -0
  156. package/deps/capstone/arch/RISCV/RISCVInstPrinter.h +24 -0
  157. package/deps/capstone/arch/RISCV/RISCVMapping.c +366 -0
  158. package/deps/capstone/arch/RISCV/RISCVMapping.h +22 -0
  159. package/deps/capstone/arch/RISCV/RISCVMappingInsn.inc +1635 -0
  160. package/deps/capstone/arch/RISCV/RISCVModule.c +42 -0
  161. package/deps/capstone/arch/RISCV/RISCVModule.h +12 -0
  162. package/deps/capstone/arch/SH/SHDisassembler.c +2221 -0
  163. package/deps/capstone/arch/SH/SHDisassembler.h +19 -0
  164. package/deps/capstone/arch/SH/SHInsnTable.inc +66 -0
  165. package/deps/capstone/arch/SH/SHInstPrinter.c +438 -0
  166. package/deps/capstone/arch/SH/SHInstPrinter.h +23 -0
  167. package/deps/capstone/arch/SH/SHModule.c +39 -0
  168. package/deps/capstone/arch/SH/SHModule.h +12 -0
  169. package/deps/capstone/arch/SH/mktable.rb +390 -0
  170. package/deps/capstone/arch/Sparc/Sparc.h +63 -0
  171. package/deps/capstone/arch/Sparc/SparcDisassembler.c +500 -0
  172. package/deps/capstone/arch/Sparc/SparcDisassembler.h +17 -0
  173. package/deps/capstone/arch/Sparc/SparcGenAsmWriter.inc +5709 -0
  174. package/deps/capstone/arch/Sparc/SparcGenDisassemblerTables.inc +2028 -0
  175. package/deps/capstone/arch/Sparc/SparcGenInstrInfo.inc +514 -0
  176. package/deps/capstone/arch/Sparc/SparcGenRegisterInfo.inc +451 -0
  177. package/deps/capstone/arch/Sparc/SparcGenSubtargetInfo.inc +27 -0
  178. package/deps/capstone/arch/Sparc/SparcInstPrinter.c +446 -0
  179. package/deps/capstone/arch/Sparc/SparcInstPrinter.h +17 -0
  180. package/deps/capstone/arch/Sparc/SparcMapping.c +665 -0
  181. package/deps/capstone/arch/Sparc/SparcMapping.h +34 -0
  182. package/deps/capstone/arch/Sparc/SparcMappingInsn.inc +2643 -0
  183. package/deps/capstone/arch/Sparc/SparcModule.c +45 -0
  184. package/deps/capstone/arch/Sparc/SparcModule.h +12 -0
  185. package/deps/capstone/arch/SystemZ/SystemZDisassembler.c +484 -0
  186. package/deps/capstone/arch/SystemZ/SystemZDisassembler.h +17 -0
  187. package/deps/capstone/arch/SystemZ/SystemZGenAsmWriter.inc +11575 -0
  188. package/deps/capstone/arch/SystemZ/SystemZGenDisassemblerTables.inc +10262 -0
  189. package/deps/capstone/arch/SystemZ/SystemZGenInsnNameMaps.inc +2348 -0
  190. package/deps/capstone/arch/SystemZ/SystemZGenInstrInfo.inc +2820 -0
  191. package/deps/capstone/arch/SystemZ/SystemZGenRegisterInfo.inc +741 -0
  192. package/deps/capstone/arch/SystemZ/SystemZGenSubtargetInfo.inc +49 -0
  193. package/deps/capstone/arch/SystemZ/SystemZInstPrinter.c +433 -0
  194. package/deps/capstone/arch/SystemZ/SystemZInstPrinter.h +15 -0
  195. package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.c +195 -0
  196. package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.h +51 -0
  197. package/deps/capstone/arch/SystemZ/SystemZMapping.c +479 -0
  198. package/deps/capstone/arch/SystemZ/SystemZMapping.h +23 -0
  199. package/deps/capstone/arch/SystemZ/SystemZMappingInsn.inc +14175 -0
  200. package/deps/capstone/arch/SystemZ/SystemZModule.c +44 -0
  201. package/deps/capstone/arch/SystemZ/SystemZModule.h +12 -0
  202. package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.c +628 -0
  203. package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.h +19 -0
  204. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenAsmWriter.inc +684 -0
  205. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc +1352 -0
  206. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenInstrInfo.inc +298 -0
  207. package/deps/capstone/arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc +277 -0
  208. package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.c +572 -0
  209. package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.h +15 -0
  210. package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.c +1926 -0
  211. package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.h +26 -0
  212. package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.c +39 -0
  213. package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.h +12 -0
  214. package/deps/capstone/arch/TriCore/TriCore.td +134 -0
  215. package/deps/capstone/arch/TriCore/TriCoreCallingConv.td +61 -0
  216. package/deps/capstone/arch/TriCore/TriCoreDisassembler.c +1655 -0
  217. package/deps/capstone/arch/TriCore/TriCoreDisassembler.h +18 -0
  218. package/deps/capstone/arch/TriCore/TriCoreGenAsmWriter.inc +3691 -0
  219. package/deps/capstone/arch/TriCore/TriCoreGenCSFeatureName.inc +22 -0
  220. package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsn.inc +8938 -0
  221. package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnName.inc +404 -0
  222. package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnOp.inc +7994 -0
  223. package/deps/capstone/arch/TriCore/TriCoreGenCSOpGroup.inc +32 -0
  224. package/deps/capstone/arch/TriCore/TriCoreGenDisassemblerTables.inc +4044 -0
  225. package/deps/capstone/arch/TriCore/TriCoreGenInstrInfo.inc +2693 -0
  226. package/deps/capstone/arch/TriCore/TriCoreGenRegisterInfo.inc +295 -0
  227. package/deps/capstone/arch/TriCore/TriCoreGenSubtargetInfo.inc +40 -0
  228. package/deps/capstone/arch/TriCore/TriCoreInstPrinter.c +488 -0
  229. package/deps/capstone/arch/TriCore/TriCoreInstrFormats.td +773 -0
  230. package/deps/capstone/arch/TriCore/TriCoreInstrInfo.td +1873 -0
  231. package/deps/capstone/arch/TriCore/TriCoreLinkage.h +21 -0
  232. package/deps/capstone/arch/TriCore/TriCoreMapping.c +241 -0
  233. package/deps/capstone/arch/TriCore/TriCoreMapping.h +32 -0
  234. package/deps/capstone/arch/TriCore/TriCoreModule.c +44 -0
  235. package/deps/capstone/arch/TriCore/TriCoreModule.h +11 -0
  236. package/deps/capstone/arch/TriCore/TriCoreRegisterInfo.td +153 -0
  237. package/deps/capstone/arch/WASM/WASMDisassembler.c +1009 -0
  238. package/deps/capstone/arch/WASM/WASMDisassembler.h +12 -0
  239. package/deps/capstone/arch/WASM/WASMInstPrinter.c +47 -0
  240. package/deps/capstone/arch/WASM/WASMInstPrinter.h +18 -0
  241. package/deps/capstone/arch/WASM/WASMMapping.c +333 -0
  242. package/deps/capstone/arch/WASM/WASMMapping.h +9 -0
  243. package/deps/capstone/arch/WASM/WASMModule.c +33 -0
  244. package/deps/capstone/arch/WASM/WASMModule.h +12 -0
  245. package/deps/capstone/arch/X86/X86ATTInstPrinter.c +997 -0
  246. package/deps/capstone/arch/X86/X86BaseInfo.h +50 -0
  247. package/deps/capstone/arch/X86/X86Disassembler.c +1033 -0
  248. package/deps/capstone/arch/X86/X86Disassembler.h +28 -0
  249. package/deps/capstone/arch/X86/X86DisassemblerDecoder.c +2358 -0
  250. package/deps/capstone/arch/X86/X86DisassemblerDecoder.h +725 -0
  251. package/deps/capstone/arch/X86/X86DisassemblerDecoderCommon.h +483 -0
  252. package/deps/capstone/arch/X86/X86GenAsmWriter.inc +49199 -0
  253. package/deps/capstone/arch/X86/X86GenAsmWriter1.inc +33196 -0
  254. package/deps/capstone/arch/X86/X86GenAsmWriter1_reduce.inc +2531 -0
  255. package/deps/capstone/arch/X86/X86GenAsmWriter_reduce.inc +2855 -0
  256. package/deps/capstone/arch/X86/X86GenDisassemblerTables.inc +112961 -0
  257. package/deps/capstone/arch/X86/X86GenDisassemblerTables2.inc +102151 -0
  258. package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce.inc +28047 -0
  259. package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce2.inc +18827 -0
  260. package/deps/capstone/arch/X86/X86GenInstrInfo.inc +15158 -0
  261. package/deps/capstone/arch/X86/X86GenInstrInfo_reduce.inc +1564 -0
  262. package/deps/capstone/arch/X86/X86GenRegisterInfo.inc +1549 -0
  263. package/deps/capstone/arch/X86/X86GenRegisterName.inc +292 -0
  264. package/deps/capstone/arch/X86/X86GenRegisterName1.inc +291 -0
  265. package/deps/capstone/arch/X86/X86ImmSize.inc +335 -0
  266. package/deps/capstone/arch/X86/X86InstPrinter.h +26 -0
  267. package/deps/capstone/arch/X86/X86InstPrinterCommon.c +116 -0
  268. package/deps/capstone/arch/X86/X86InstPrinterCommon.h +16 -0
  269. package/deps/capstone/arch/X86/X86IntelInstPrinter.c +1061 -0
  270. package/deps/capstone/arch/X86/X86Lookup16.inc +16874 -0
  271. package/deps/capstone/arch/X86/X86Lookup16_reduce.inc +2308 -0
  272. package/deps/capstone/arch/X86/X86Mapping.c +2266 -0
  273. package/deps/capstone/arch/X86/X86Mapping.h +96 -0
  274. package/deps/capstone/arch/X86/X86MappingInsn.inc +105977 -0
  275. package/deps/capstone/arch/X86/X86MappingInsnName.inc +1527 -0
  276. package/deps/capstone/arch/X86/X86MappingInsnName_reduce.inc +348 -0
  277. package/deps/capstone/arch/X86/X86MappingInsnOp.inc +75700 -0
  278. package/deps/capstone/arch/X86/X86MappingInsnOp_reduce.inc +7729 -0
  279. package/deps/capstone/arch/X86/X86MappingInsn_reduce.inc +10819 -0
  280. package/deps/capstone/arch/X86/X86MappingReg.inc +280 -0
  281. package/deps/capstone/arch/X86/X86Module.c +94 -0
  282. package/deps/capstone/arch/X86/X86Module.h +12 -0
  283. package/deps/capstone/arch/XCore/XCoreDisassembler.c +794 -0
  284. package/deps/capstone/arch/XCore/XCoreDisassembler.h +17 -0
  285. package/deps/capstone/arch/XCore/XCoreGenAsmWriter.inc +772 -0
  286. package/deps/capstone/arch/XCore/XCoreGenDisassemblerTables.inc +853 -0
  287. package/deps/capstone/arch/XCore/XCoreGenInstrInfo.inc +267 -0
  288. package/deps/capstone/arch/XCore/XCoreGenRegisterInfo.inc +110 -0
  289. package/deps/capstone/arch/XCore/XCoreInstPrinter.c +250 -0
  290. package/deps/capstone/arch/XCore/XCoreInstPrinter.h +18 -0
  291. package/deps/capstone/arch/XCore/XCoreMapping.c +297 -0
  292. package/deps/capstone/arch/XCore/XCoreMapping.h +26 -0
  293. package/deps/capstone/arch/XCore/XCoreMappingInsn.inc +1287 -0
  294. package/deps/capstone/arch/XCore/XCoreModule.c +41 -0
  295. package/deps/capstone/arch/XCore/XCoreModule.h +12 -0
  296. package/deps/capstone/cs.c +1664 -0
  297. package/deps/capstone/cs_priv.h +101 -0
  298. package/deps/capstone/cs_simple_types.h +886 -0
  299. package/deps/capstone/include/capstone/arm.h +991 -0
  300. package/deps/capstone/include/capstone/arm64.h +3159 -0
  301. package/deps/capstone/include/capstone/bpf.h +209 -0
  302. package/deps/capstone/include/capstone/capstone.h +875 -0
  303. package/deps/capstone/include/capstone/evm.h +188 -0
  304. package/deps/capstone/include/capstone/m680x.h +537 -0
  305. package/deps/capstone/include/capstone/m68k.h +613 -0
  306. package/deps/capstone/include/capstone/mips.h +956 -0
  307. package/deps/capstone/include/capstone/mos65xx.h +204 -0
  308. package/deps/capstone/include/capstone/platform.h +122 -0
  309. package/deps/capstone/include/capstone/ppc.h +2108 -0
  310. package/deps/capstone/include/capstone/riscv.h +531 -0
  311. package/deps/capstone/include/capstone/sh.h +465 -0
  312. package/deps/capstone/include/capstone/sparc.h +520 -0
  313. package/deps/capstone/include/capstone/systemz.h +2601 -0
  314. package/deps/capstone/include/capstone/tms320c64x.h +359 -0
  315. package/deps/capstone/include/capstone/tricore.h +567 -0
  316. package/deps/capstone/include/capstone/wasm.h +250 -0
  317. package/deps/capstone/include/capstone/x86.h +1986 -0
  318. package/deps/capstone/include/capstone/xcore.h +235 -0
  319. package/deps/capstone/include/platform.h +110 -0
  320. package/deps/capstone/include/windowsce/intrin.h +12 -0
  321. package/deps/capstone/include/windowsce/stdint.h +133 -0
  322. package/deps/capstone/utils.c +140 -0
  323. package/deps/capstone/utils.h +54 -0
  324. package/index.d.ts +448 -0
  325. package/index.js +64 -0
  326. package/index.mjs +25 -0
  327. package/package.json +82 -0
  328. package/prebuilds/win32-x64/hexcore-capstone.node +0 -0
  329. package/src/capstone_wrapper.cpp +910 -0
  330. package/src/capstone_wrapper.h +147 -0
  331. package/src/disasm_async_worker.h +215 -0
  332. package/src/main.cpp +145 -0
@@ -0,0 +1,77 @@
1
+ //===-- AArch64BaseInfo.cpp - AArch64 Base encoding information------------===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // This file provides basic encoding and assembly information for AArch64.
11
+ //
12
+ //===----------------------------------------------------------------------===//
13
+
14
+ /* Capstone Disassembly Engine */
15
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
16
+
17
+ #ifdef CAPSTONE_HAS_ARM64
18
+
19
+ #if defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)
20
+ #pragma warning(disable:4996) // disable MSVC's warning on strcpy()
21
+ #pragma warning(disable:28719) // disable MSVC's warning on strcpy()
22
+ #endif
23
+
24
+ #include "../../utils.h"
25
+
26
+ #include <stdio.h>
27
+ #include <stdlib.h>
28
+
29
+ #include "AArch64BaseInfo.h"
30
+
31
+ #include "AArch64GenSystemOperands.inc"
32
+
33
+ // return a string representing the number X
34
+ // NOTE: result must be big enough to contain the data
35
+ static void utostr(uint64_t X, bool isNeg, char *result)
36
+ {
37
+ char Buffer[22];
38
+ char *BufPtr = Buffer + 21;
39
+
40
+ Buffer[21] = '\0';
41
+ if (X == 0) *--BufPtr = '0'; // Handle special case...
42
+
43
+ while (X) {
44
+ *--BufPtr = X % 10 + '0';
45
+ X /= 10;
46
+ }
47
+
48
+ if (isNeg) *--BufPtr = '-'; // Add negative sign...
49
+
50
+ // suppose that result is big enough
51
+ strncpy(result, BufPtr, sizeof(Buffer));
52
+ }
53
+
54
+ // NOTE: result must be big enough to contain the result
55
+ void AArch64SysReg_genericRegisterString(uint32_t Bits, char *result)
56
+ {
57
+ // assert(Bits < 0x10000);
58
+ char Op0Str[32], Op1Str[32], CRnStr[32], CRmStr[32], Op2Str[32];
59
+ int dummy;
60
+ uint32_t Op0 = (Bits >> 14) & 0x3;
61
+ uint32_t Op1 = (Bits >> 11) & 0x7;
62
+ uint32_t CRn = (Bits >> 7) & 0xf;
63
+ uint32_t CRm = (Bits >> 3) & 0xf;
64
+ uint32_t Op2 = Bits & 0x7;
65
+
66
+ utostr(Op0, false, Op0Str);
67
+ utostr(Op1, false, Op1Str);
68
+ utostr(Op2, false, Op2Str);
69
+ utostr(CRn, false, CRnStr);
70
+ utostr(CRm, false, CRmStr);
71
+
72
+ dummy = cs_snprintf(result, 128, "s%s_%s_c%s_c%s_%s",
73
+ Op0Str, Op1Str, CRnStr, CRmStr, Op2Str);
74
+ (void)dummy;
75
+ }
76
+
77
+ #endif
@@ -0,0 +1,585 @@
1
+ //===-- AArch64BaseInfo.h - Top level definitions for AArch64- --*- C++ -*-===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // This file contains small standalone helper functions and enum definitions for
11
+ // the AArch64 target useful for the compiler back-end and the MC libraries.
12
+ // As such, it deliberately does not include references to LLVM core
13
+ // code gen types, passes, etc..
14
+ //
15
+ //===----------------------------------------------------------------------===//
16
+
17
+ /* Capstone Disassembly Engine */
18
+ /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
19
+
20
+ #ifndef CS_LLVM_AARCH64_BASEINFO_H
21
+ #define CS_LLVM_AARCH64_BASEINFO_H
22
+
23
+ #include <ctype.h>
24
+ #include <string.h>
25
+ #include "AArch64Mapping.h"
26
+
27
+ #ifndef __cplusplus
28
+ #if defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)
29
+ #define inline /* inline */
30
+ #endif
31
+ #endif
32
+
33
+ inline static unsigned getWRegFromXReg(unsigned Reg)
34
+ {
35
+ switch (Reg) {
36
+ default: break;
37
+ case ARM64_REG_X0: return ARM64_REG_W0;
38
+ case ARM64_REG_X1: return ARM64_REG_W1;
39
+ case ARM64_REG_X2: return ARM64_REG_W2;
40
+ case ARM64_REG_X3: return ARM64_REG_W3;
41
+ case ARM64_REG_X4: return ARM64_REG_W4;
42
+ case ARM64_REG_X5: return ARM64_REG_W5;
43
+ case ARM64_REG_X6: return ARM64_REG_W6;
44
+ case ARM64_REG_X7: return ARM64_REG_W7;
45
+ case ARM64_REG_X8: return ARM64_REG_W8;
46
+ case ARM64_REG_X9: return ARM64_REG_W9;
47
+ case ARM64_REG_X10: return ARM64_REG_W10;
48
+ case ARM64_REG_X11: return ARM64_REG_W11;
49
+ case ARM64_REG_X12: return ARM64_REG_W12;
50
+ case ARM64_REG_X13: return ARM64_REG_W13;
51
+ case ARM64_REG_X14: return ARM64_REG_W14;
52
+ case ARM64_REG_X15: return ARM64_REG_W15;
53
+ case ARM64_REG_X16: return ARM64_REG_W16;
54
+ case ARM64_REG_X17: return ARM64_REG_W17;
55
+ case ARM64_REG_X18: return ARM64_REG_W18;
56
+ case ARM64_REG_X19: return ARM64_REG_W19;
57
+ case ARM64_REG_X20: return ARM64_REG_W20;
58
+ case ARM64_REG_X21: return ARM64_REG_W21;
59
+ case ARM64_REG_X22: return ARM64_REG_W22;
60
+ case ARM64_REG_X23: return ARM64_REG_W23;
61
+ case ARM64_REG_X24: return ARM64_REG_W24;
62
+ case ARM64_REG_X25: return ARM64_REG_W25;
63
+ case ARM64_REG_X26: return ARM64_REG_W26;
64
+ case ARM64_REG_X27: return ARM64_REG_W27;
65
+ case ARM64_REG_X28: return ARM64_REG_W28;
66
+ case ARM64_REG_FP: return ARM64_REG_W29;
67
+ case ARM64_REG_LR: return ARM64_REG_W30;
68
+ case ARM64_REG_SP: return ARM64_REG_WSP;
69
+ case ARM64_REG_XZR: return ARM64_REG_WZR;
70
+ }
71
+
72
+ // For anything else, return it unchanged.
73
+ return Reg;
74
+ }
75
+
76
+ inline static unsigned getXRegFromWReg(unsigned Reg)
77
+ {
78
+ switch (Reg) {
79
+ case ARM64_REG_W0: return ARM64_REG_X0;
80
+ case ARM64_REG_W1: return ARM64_REG_X1;
81
+ case ARM64_REG_W2: return ARM64_REG_X2;
82
+ case ARM64_REG_W3: return ARM64_REG_X3;
83
+ case ARM64_REG_W4: return ARM64_REG_X4;
84
+ case ARM64_REG_W5: return ARM64_REG_X5;
85
+ case ARM64_REG_W6: return ARM64_REG_X6;
86
+ case ARM64_REG_W7: return ARM64_REG_X7;
87
+ case ARM64_REG_W8: return ARM64_REG_X8;
88
+ case ARM64_REG_W9: return ARM64_REG_X9;
89
+ case ARM64_REG_W10: return ARM64_REG_X10;
90
+ case ARM64_REG_W11: return ARM64_REG_X11;
91
+ case ARM64_REG_W12: return ARM64_REG_X12;
92
+ case ARM64_REG_W13: return ARM64_REG_X13;
93
+ case ARM64_REG_W14: return ARM64_REG_X14;
94
+ case ARM64_REG_W15: return ARM64_REG_X15;
95
+ case ARM64_REG_W16: return ARM64_REG_X16;
96
+ case ARM64_REG_W17: return ARM64_REG_X17;
97
+ case ARM64_REG_W18: return ARM64_REG_X18;
98
+ case ARM64_REG_W19: return ARM64_REG_X19;
99
+ case ARM64_REG_W20: return ARM64_REG_X20;
100
+ case ARM64_REG_W21: return ARM64_REG_X21;
101
+ case ARM64_REG_W22: return ARM64_REG_X22;
102
+ case ARM64_REG_W23: return ARM64_REG_X23;
103
+ case ARM64_REG_W24: return ARM64_REG_X24;
104
+ case ARM64_REG_W25: return ARM64_REG_X25;
105
+ case ARM64_REG_W26: return ARM64_REG_X26;
106
+ case ARM64_REG_W27: return ARM64_REG_X27;
107
+ case ARM64_REG_W28: return ARM64_REG_X28;
108
+ case ARM64_REG_W29: return ARM64_REG_FP;
109
+ case ARM64_REG_W30: return ARM64_REG_LR;
110
+ case ARM64_REG_WSP: return ARM64_REG_SP;
111
+ case ARM64_REG_WZR: return ARM64_REG_XZR;
112
+ }
113
+
114
+ // For anything else, return it unchanged.
115
+ return Reg;
116
+ }
117
+
118
+ inline static unsigned getBRegFromDReg(unsigned Reg)
119
+ {
120
+ switch (Reg) {
121
+ case ARM64_REG_D0: return ARM64_REG_B0;
122
+ case ARM64_REG_D1: return ARM64_REG_B1;
123
+ case ARM64_REG_D2: return ARM64_REG_B2;
124
+ case ARM64_REG_D3: return ARM64_REG_B3;
125
+ case ARM64_REG_D4: return ARM64_REG_B4;
126
+ case ARM64_REG_D5: return ARM64_REG_B5;
127
+ case ARM64_REG_D6: return ARM64_REG_B6;
128
+ case ARM64_REG_D7: return ARM64_REG_B7;
129
+ case ARM64_REG_D8: return ARM64_REG_B8;
130
+ case ARM64_REG_D9: return ARM64_REG_B9;
131
+ case ARM64_REG_D10: return ARM64_REG_B10;
132
+ case ARM64_REG_D11: return ARM64_REG_B11;
133
+ case ARM64_REG_D12: return ARM64_REG_B12;
134
+ case ARM64_REG_D13: return ARM64_REG_B13;
135
+ case ARM64_REG_D14: return ARM64_REG_B14;
136
+ case ARM64_REG_D15: return ARM64_REG_B15;
137
+ case ARM64_REG_D16: return ARM64_REG_B16;
138
+ case ARM64_REG_D17: return ARM64_REG_B17;
139
+ case ARM64_REG_D18: return ARM64_REG_B18;
140
+ case ARM64_REG_D19: return ARM64_REG_B19;
141
+ case ARM64_REG_D20: return ARM64_REG_B20;
142
+ case ARM64_REG_D21: return ARM64_REG_B21;
143
+ case ARM64_REG_D22: return ARM64_REG_B22;
144
+ case ARM64_REG_D23: return ARM64_REG_B23;
145
+ case ARM64_REG_D24: return ARM64_REG_B24;
146
+ case ARM64_REG_D25: return ARM64_REG_B25;
147
+ case ARM64_REG_D26: return ARM64_REG_B26;
148
+ case ARM64_REG_D27: return ARM64_REG_B27;
149
+ case ARM64_REG_D28: return ARM64_REG_B28;
150
+ case ARM64_REG_D29: return ARM64_REG_B29;
151
+ case ARM64_REG_D30: return ARM64_REG_B30;
152
+ case ARM64_REG_D31: return ARM64_REG_B31;
153
+ }
154
+
155
+ // For anything else, return it unchanged.
156
+ return Reg;
157
+ }
158
+
159
+ inline static unsigned getDRegFromBReg(unsigned Reg)
160
+ {
161
+ switch (Reg) {
162
+ case ARM64_REG_B0: return ARM64_REG_D0;
163
+ case ARM64_REG_B1: return ARM64_REG_D1;
164
+ case ARM64_REG_B2: return ARM64_REG_D2;
165
+ case ARM64_REG_B3: return ARM64_REG_D3;
166
+ case ARM64_REG_B4: return ARM64_REG_D4;
167
+ case ARM64_REG_B5: return ARM64_REG_D5;
168
+ case ARM64_REG_B6: return ARM64_REG_D6;
169
+ case ARM64_REG_B7: return ARM64_REG_D7;
170
+ case ARM64_REG_B8: return ARM64_REG_D8;
171
+ case ARM64_REG_B9: return ARM64_REG_D9;
172
+ case ARM64_REG_B10: return ARM64_REG_D10;
173
+ case ARM64_REG_B11: return ARM64_REG_D11;
174
+ case ARM64_REG_B12: return ARM64_REG_D12;
175
+ case ARM64_REG_B13: return ARM64_REG_D13;
176
+ case ARM64_REG_B14: return ARM64_REG_D14;
177
+ case ARM64_REG_B15: return ARM64_REG_D15;
178
+ case ARM64_REG_B16: return ARM64_REG_D16;
179
+ case ARM64_REG_B17: return ARM64_REG_D17;
180
+ case ARM64_REG_B18: return ARM64_REG_D18;
181
+ case ARM64_REG_B19: return ARM64_REG_D19;
182
+ case ARM64_REG_B20: return ARM64_REG_D20;
183
+ case ARM64_REG_B21: return ARM64_REG_D21;
184
+ case ARM64_REG_B22: return ARM64_REG_D22;
185
+ case ARM64_REG_B23: return ARM64_REG_D23;
186
+ case ARM64_REG_B24: return ARM64_REG_D24;
187
+ case ARM64_REG_B25: return ARM64_REG_D25;
188
+ case ARM64_REG_B26: return ARM64_REG_D26;
189
+ case ARM64_REG_B27: return ARM64_REG_D27;
190
+ case ARM64_REG_B28: return ARM64_REG_D28;
191
+ case ARM64_REG_B29: return ARM64_REG_D29;
192
+ case ARM64_REG_B30: return ARM64_REG_D30;
193
+ case ARM64_REG_B31: return ARM64_REG_D31;
194
+ }
195
+
196
+ // For anything else, return it unchanged.
197
+ return Reg;
198
+ }
199
+
200
+ // // Enums corresponding to AArch64 condition codes
201
+ // The CondCodes constants map directly to the 4-bit encoding of the
202
+ // condition field for predicated instructions.
203
+ typedef enum AArch64CC_CondCode { // Meaning (integer) Meaning (floating-point)
204
+ AArch64CC_EQ = 0x0, // Equal Equal
205
+ AArch64CC_NE = 0x1, // Not equal Not equal, or unordered
206
+ AArch64CC_HS = 0x2, // Unsigned higher or same >, ==, or unordered
207
+ AArch64CC_LO = 0x3, // Unsigned lower Less than
208
+ AArch64CC_MI = 0x4, // Minus, negative Less than
209
+ AArch64CC_PL = 0x5, // Plus, positive or zero >, ==, or unordered
210
+ AArch64CC_VS = 0x6, // Overflow Unordered
211
+ AArch64CC_VC = 0x7, // No overflow Not unordered
212
+ AArch64CC_HI = 0x8, // Unsigned higher Greater than, or unordered
213
+ AArch64CC_LS = 0x9, // Unsigned lower or same Less than or equal
214
+ AArch64CC_GE = 0xa, // Greater than or equal Greater than or equal
215
+ AArch64CC_LT = 0xb, // Less than Less than, or unordered
216
+ AArch64CC_GT = 0xc, // Greater than Greater than
217
+ AArch64CC_LE = 0xd, // Less than or equal <, ==, or unordered
218
+ AArch64CC_AL = 0xe, // Always (unconditional) Always (unconditional)
219
+ AArch64CC_NV = 0xf, // Always (unconditional) Always (unconditional)
220
+ // Note the NV exists purely to disassemble 0b1111. Execution is "always".
221
+ AArch64CC_Invalid
222
+ } AArch64CC_CondCode;
223
+
224
+ inline static AArch64CC_CondCode getInvertedCondCode(AArch64CC_CondCode Code)
225
+ {
226
+ // To reverse a condition it's necessary to only invert the low bit:
227
+ return (AArch64CC_CondCode)((unsigned)Code ^ 0x1);
228
+ }
229
+
230
+ inline static const char *getCondCodeName(AArch64CC_CondCode CC)
231
+ {
232
+ switch (CC) {
233
+ default: return NULL; // never reach
234
+ case AArch64CC_EQ: return "eq";
235
+ case AArch64CC_NE: return "ne";
236
+ case AArch64CC_HS: return "hs";
237
+ case AArch64CC_LO: return "lo";
238
+ case AArch64CC_MI: return "mi";
239
+ case AArch64CC_PL: return "pl";
240
+ case AArch64CC_VS: return "vs";
241
+ case AArch64CC_VC: return "vc";
242
+ case AArch64CC_HI: return "hi";
243
+ case AArch64CC_LS: return "ls";
244
+ case AArch64CC_GE: return "ge";
245
+ case AArch64CC_LT: return "lt";
246
+ case AArch64CC_GT: return "gt";
247
+ case AArch64CC_LE: return "le";
248
+ case AArch64CC_AL: return "al";
249
+ case AArch64CC_NV: return "nv";
250
+ }
251
+ }
252
+
253
+ /// Given a condition code, return NZCV flags that would satisfy that condition.
254
+ /// The flag bits are in the format expected by the ccmp instructions.
255
+ /// Note that many different flag settings can satisfy a given condition code,
256
+ /// this function just returns one of them.
257
+ inline static unsigned getNZCVToSatisfyCondCode(AArch64CC_CondCode Code)
258
+ {
259
+ // NZCV flags encoded as expected by ccmp instructions, ARMv8 ISA 5.5.7.
260
+ enum { N = 8, Z = 4, C = 2, V = 1 };
261
+ switch (Code) {
262
+ default: // llvm_unreachable("Unknown condition code");
263
+ case AArch64CC_EQ: return Z; // Z == 1
264
+ case AArch64CC_NE: return 0; // Z == 0
265
+ case AArch64CC_HS: return C; // C == 1
266
+ case AArch64CC_LO: return 0; // C == 0
267
+ case AArch64CC_MI: return N; // N == 1
268
+ case AArch64CC_PL: return 0; // N == 0
269
+ case AArch64CC_VS: return V; // V == 1
270
+ case AArch64CC_VC: return 0; // V == 0
271
+ case AArch64CC_HI: return C; // C == 1 && Z == 0
272
+ case AArch64CC_LS: return 0; // C == 0 || Z == 1
273
+ case AArch64CC_GE: return 0; // N == V
274
+ case AArch64CC_LT: return N; // N != V
275
+ case AArch64CC_GT: return 0; // Z == 0 && N == V
276
+ case AArch64CC_LE: return Z; // Z == 1 || N != V
277
+ }
278
+ }
279
+
280
+ /// Instances of this class can perform bidirectional mapping from random
281
+ /// identifier strings to operand encodings. For example "MSR" takes a named
282
+ /// system-register which must be encoded somehow and decoded for printing. This
283
+ /// central location means that the information for those transformations is not
284
+ /// duplicated and remains in sync.
285
+ ///
286
+ /// FIXME: currently the algorithm is a completely unoptimised linear
287
+ /// search. Obviously this could be improved, but we would probably want to work
288
+ /// out just how often these instructions are emitted before working on it. It
289
+ /// might even be optimal to just reorder the tables for the common instructions
290
+ /// rather than changing the algorithm.
291
+ typedef struct A64NamedImmMapper_Mapping {
292
+ const char *Name;
293
+ uint32_t Value;
294
+ } A64NamedImmMapper_Mapping;
295
+
296
+ typedef struct A64NamedImmMapper {
297
+ const A64NamedImmMapper_Mapping *Pairs;
298
+ size_t NumPairs;
299
+ uint32_t TooBigImm;
300
+ } A64NamedImmMapper;
301
+
302
+ typedef struct A64SysRegMapper {
303
+ const A64NamedImmMapper_Mapping *SysRegPairs;
304
+ const A64NamedImmMapper_Mapping *InstPairs;
305
+ size_t NumInstPairs;
306
+ } A64SysRegMapper;
307
+
308
+ typedef enum A64SE_ShiftExtSpecifiers {
309
+ A64SE_Invalid = -1,
310
+ A64SE_LSL,
311
+ A64SE_MSL,
312
+ A64SE_LSR,
313
+ A64SE_ASR,
314
+ A64SE_ROR,
315
+
316
+ A64SE_UXTB,
317
+ A64SE_UXTH,
318
+ A64SE_UXTW,
319
+ A64SE_UXTX,
320
+
321
+ A64SE_SXTB,
322
+ A64SE_SXTH,
323
+ A64SE_SXTW,
324
+ A64SE_SXTX
325
+ } A64SE_ShiftExtSpecifiers;
326
+
327
+ typedef enum A64Layout_VectorLayout {
328
+ A64Layout_Invalid = -1,
329
+ A64Layout_VL_8B,
330
+ A64Layout_VL_4H,
331
+ A64Layout_VL_2S,
332
+ A64Layout_VL_1D,
333
+
334
+ A64Layout_VL_16B,
335
+ A64Layout_VL_8H,
336
+ A64Layout_VL_4S,
337
+ A64Layout_VL_2D,
338
+
339
+ // Bare layout for the 128-bit vector
340
+ // (only show ".b", ".h", ".s", ".d" without vector number)
341
+ A64Layout_VL_B,
342
+ A64Layout_VL_H,
343
+ A64Layout_VL_S,
344
+ A64Layout_VL_D
345
+ } A64Layout_VectorLayout;
346
+
347
+ inline static const char *
348
+ AArch64VectorLayoutToString(A64Layout_VectorLayout Layout)
349
+ {
350
+ switch (Layout) {
351
+ default: return NULL; // never reach
352
+ case A64Layout_VL_8B: return ".8b";
353
+ case A64Layout_VL_4H: return ".4h";
354
+ case A64Layout_VL_2S: return ".2s";
355
+ case A64Layout_VL_1D: return ".1d";
356
+ case A64Layout_VL_16B: return ".16b";
357
+ case A64Layout_VL_8H: return ".8h";
358
+ case A64Layout_VL_4S: return ".4s";
359
+ case A64Layout_VL_2D: return ".2d";
360
+ case A64Layout_VL_B: return ".b";
361
+ case A64Layout_VL_H: return ".h";
362
+ case A64Layout_VL_S: return ".s";
363
+ case A64Layout_VL_D: return ".d";
364
+ }
365
+ }
366
+
367
+ inline static A64Layout_VectorLayout
368
+ AArch64StringToVectorLayout(char *LayoutStr)
369
+ {
370
+ if (!strcmp(LayoutStr, ".8b"))
371
+ return A64Layout_VL_8B;
372
+
373
+ if (!strcmp(LayoutStr, ".4h"))
374
+ return A64Layout_VL_4H;
375
+
376
+ if (!strcmp(LayoutStr, ".2s"))
377
+ return A64Layout_VL_2S;
378
+
379
+ if (!strcmp(LayoutStr, ".1d"))
380
+ return A64Layout_VL_1D;
381
+
382
+ if (!strcmp(LayoutStr, ".16b"))
383
+ return A64Layout_VL_16B;
384
+
385
+ if (!strcmp(LayoutStr, ".8h"))
386
+ return A64Layout_VL_8H;
387
+
388
+ if (!strcmp(LayoutStr, ".4s"))
389
+ return A64Layout_VL_4S;
390
+
391
+ if (!strcmp(LayoutStr, ".2d"))
392
+ return A64Layout_VL_2D;
393
+
394
+ if (!strcmp(LayoutStr, ".b"))
395
+ return A64Layout_VL_B;
396
+
397
+ if (!strcmp(LayoutStr, ".s"))
398
+ return A64Layout_VL_S;
399
+
400
+ if (!strcmp(LayoutStr, ".d"))
401
+ return A64Layout_VL_D;
402
+
403
+ return A64Layout_Invalid;
404
+ }
405
+
406
+ /// Target Operand Flag enum.
407
+ enum TOF {
408
+ //===------------------------------------------------------------------===//
409
+ // AArch64 Specific MachineOperand flags.
410
+
411
+ MO_NO_FLAG,
412
+
413
+ MO_FRAGMENT = 0xf,
414
+
415
+ /// MO_PAGE - A symbol operand with this flag represents the pc-relative
416
+ /// offset of the 4K page containing the symbol. This is used with the
417
+ /// ADRP instruction.
418
+ MO_PAGE = 1,
419
+
420
+ /// MO_PAGEOFF - A symbol operand with this flag represents the offset of
421
+ /// that symbol within a 4K page. This offset is added to the page address
422
+ /// to produce the complete address.
423
+ MO_PAGEOFF = 2,
424
+
425
+ /// MO_G3 - A symbol operand with this flag (granule 3) represents the high
426
+ /// 16-bits of a 64-bit address, used in a MOVZ or MOVK instruction
427
+ MO_G3 = 3,
428
+
429
+ /// MO_G2 - A symbol operand with this flag (granule 2) represents the bits
430
+ /// 32-47 of a 64-bit address, used in a MOVZ or MOVK instruction
431
+ MO_G2 = 4,
432
+
433
+ /// MO_G1 - A symbol operand with this flag (granule 1) represents the bits
434
+ /// 16-31 of a 64-bit address, used in a MOVZ or MOVK instruction
435
+ MO_G1 = 5,
436
+
437
+ /// MO_G0 - A symbol operand with this flag (granule 0) represents the bits
438
+ /// 0-15 of a 64-bit address, used in a MOVZ or MOVK instruction
439
+ MO_G0 = 6,
440
+
441
+ /// MO_HI12 - This flag indicates that a symbol operand represents the bits
442
+ /// 13-24 of a 64-bit address, used in a arithmetic immediate-shifted-left-
443
+ /// by-12-bits instruction.
444
+ MO_HI12 = 7,
445
+
446
+ /// MO_GOT - This flag indicates that a symbol operand represents the
447
+ /// address of the GOT entry for the symbol, rather than the address of
448
+ /// the symbol itself.
449
+ MO_GOT = 0x10,
450
+
451
+ /// MO_NC - Indicates whether the linker is expected to check the symbol
452
+ /// reference for overflow. For example in an ADRP/ADD pair of relocations
453
+ /// the ADRP usually does check, but not the ADD.
454
+ MO_NC = 0x20,
455
+
456
+ /// MO_TLS - Indicates that the operand being accessed is some kind of
457
+ /// thread-local symbol. On Darwin, only one type of thread-local access
458
+ /// exists (pre linker-relaxation), but on ELF the TLSModel used for the
459
+ /// referee will affect interpretation.
460
+ MO_TLS = 0x40,
461
+
462
+ /// MO_DLLIMPORT - On a symbol operand, this represents that the reference
463
+ /// to the symbol is for an import stub. This is used for DLL import
464
+ /// storage class indication on Windows.
465
+ MO_DLLIMPORT = 0x80,
466
+ };
467
+
468
+ typedef struct SysAlias {
469
+ const char *Name;
470
+ uint16_t Encoding;
471
+ } SysAlias;
472
+
473
+ #define AT SysAlias
474
+ #define DB SysAlias
475
+ #define DC SysAlias
476
+ #define SVEPRFM SysAlias
477
+ #define PRFM SysAlias
478
+ #define PSB SysAlias
479
+ #define ISB SysAlias
480
+ #define TSB SysAlias
481
+ #define PState SysAlias
482
+ #define SVEPREDPAT SysAlias
483
+ #define SVCR SysAlias
484
+ #define BTI SysAlias
485
+
486
+ typedef struct SysAliasReg {
487
+ const char *Name;
488
+ uint16_t Encoding;
489
+ bool NeedsReg;
490
+ } SysAliasReg;
491
+
492
+ #define IC SysAliasReg
493
+ #define TLBI SysAliasReg
494
+
495
+ typedef struct SysAliasSysReg {
496
+ const char *Name;
497
+ uint16_t Encoding;
498
+ bool Readable;
499
+ bool Writeable;
500
+ } SysAliasSysReg;
501
+
502
+ #define SysReg SysAliasSysReg
503
+
504
+ typedef struct SysAliasImm {
505
+ const char *Name;
506
+ uint16_t Encoding;
507
+ uint16_t ImmValue;
508
+ } SysAliasImm;
509
+
510
+ #define DBnXS SysAliasImm
511
+
512
+ typedef struct ExactFPImm {
513
+ const char *Name;
514
+ int Enum;
515
+ const char *Repr;
516
+ } ExactFPImm;
517
+
518
+ const AT *lookupATByEncoding(uint16_t Encoding);
519
+ const DB *lookupDBByEncoding(uint16_t Encoding);
520
+ const DC *lookupDCByEncoding(uint16_t Encoding);
521
+ const IC *lookupICByEncoding(uint16_t Encoding);
522
+ const TLBI *lookupTLBIByEncoding(uint16_t Encoding);
523
+ const SVEPRFM *lookupSVEPRFMByEncoding(uint16_t Encoding);
524
+ const PRFM *lookupPRFMByEncoding(uint16_t Encoding);
525
+ const PSB *lookupPSBByEncoding(uint16_t Encoding);
526
+ const ISB *lookupISBByEncoding(uint16_t Encoding);
527
+ const TSB *lookupTSBByEncoding(uint16_t Encoding);
528
+ const SysReg *lookupSysRegByEncoding(uint16_t Encoding);
529
+ const PState *lookupPStateByEncoding(uint16_t Encoding);
530
+ const SVEPREDPAT *lookupSVEPREDPATByEncoding(uint16_t Encoding);
531
+ const ExactFPImm *lookupExactFPImmByEnum(uint16_t Encoding);
532
+ const SVCR *lookupSVCRByEncoding(uint8_t Encoding);
533
+ const BTI *lookupBTIByEncoding(uint8_t Encoding);
534
+ const DBnXS *lookupDBnXSByEncoding(uint8_t Encoding);
535
+
536
+ // NOTE: result must be 128 bytes to contain the result
537
+ void AArch64SysReg_genericRegisterString(uint32_t Bits, char *result);
538
+
539
+ // ---------------------------------------------------------------------------
540
+ // The following Structs and Enum are taken from MCInstPrinter.h in llvm.
541
+ // These are required for the updated printAliasInstr() function in
542
+ // $ARCHGenAsmWriter.inc
543
+
544
+ /// Map from opcode to pattern list by binary search.
545
+ typedef struct PatternsForOpcode {
546
+ uint32_t Opcode;
547
+ uint16_t PatternStart;
548
+ uint16_t NumPatterns;
549
+ } PatternsForOpcode;
550
+
551
+ /// Data for each alias pattern. Includes feature bits, string, number of
552
+ /// operands, and a variadic list of conditions to check.
553
+ typedef struct AliasPattern {
554
+ uint32_t AsmStrOffset;
555
+ uint32_t AliasCondStart;
556
+ uint8_t NumOperands;
557
+ uint8_t NumConds;
558
+ } AliasPattern;
559
+
560
+ enum CondKind {
561
+ AliasPatternCond_K_Feature, // Match only if a feature is enabled.
562
+ AliasPatternCond_K_NegFeature, // Match only if a feature is disabled.
563
+ AliasPatternCond_K_OrFeature, // Match only if one of a set of features is
564
+ // enabled.
565
+ AliasPatternCond_K_OrNegFeature, // Match only if one of a set of features is
566
+ // disabled.
567
+ AliasPatternCond_K_EndOrFeatures, // Note end of list of K_Or(Neg)?Features.
568
+ AliasPatternCond_K_Ignore, // Match any operand.
569
+ AliasPatternCond_K_Reg, // Match a specific register.
570
+ AliasPatternCond_K_TiedReg, // Match another already matched register.
571
+ AliasPatternCond_K_Imm, // Match a specific immediate.
572
+ AliasPatternCond_K_RegClass, // Match registers in a class.
573
+ AliasPatternCond_K_Custom, // Call custom matcher by index.
574
+ };
575
+
576
+ typedef struct AliasPatternCond {
577
+ int Kind;
578
+ uint32_t Value;
579
+ } AliasPatternCond;
580
+
581
+ // ---------------------------------------------------------------------------
582
+
583
+ #include "AArch64GenSystemOperands_enum.inc"
584
+
585
+ #endif