asmjit 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +5 -3
- data/asmjit.gemspec +1 -3
- data/ext/asmjit/asmjit/.editorconfig +10 -0
- data/ext/asmjit/asmjit/.github/FUNDING.yml +1 -0
- data/ext/asmjit/asmjit/.github/workflows/build-config.json +47 -0
- data/ext/asmjit/asmjit/.github/workflows/build.yml +156 -0
- data/ext/asmjit/asmjit/.gitignore +6 -0
- data/ext/asmjit/asmjit/CMakeLists.txt +611 -0
- data/ext/asmjit/asmjit/LICENSE.md +17 -0
- data/ext/asmjit/asmjit/README.md +69 -0
- data/ext/asmjit/asmjit/src/asmjit/a64.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64archtraits_p.h +81 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.cpp +5115 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.h +72 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.cpp +51 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.h +57 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.cpp +60 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper.cpp +464 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper_p.h +50 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emitter.h +1228 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter.cpp +298 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter_p.h +59 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func.cpp +189 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64globals.h +1894 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi.cpp +278 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.cpp +1957 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.h +74 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb_p.h +876 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.cpp +85 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.h +312 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass.cpp +852 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass_p.h +105 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64utils.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter.cpp +143 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter_p.h +44 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armglobals.h +21 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armoperand.h +621 -0
- data/ext/asmjit/asmjit/src/asmjit/arm.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-begin.h +17 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-end.h +9 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-build_p.h +55 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-config.h +613 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archcommons.h +229 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.cpp +160 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.h +290 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.cpp +406 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.h +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.cpp +889 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.h +1391 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codebuffer.h +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.cpp +1149 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.h +1035 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter.cpp +175 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter_p.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.cpp +582 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.h +737 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compilerdefs.h +173 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.cpp +363 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.h +250 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.cpp +1162 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.h +813 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper.cpp +323 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.cpp +333 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.h +741 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils.cpp +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils_p.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.cpp +46 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.h +508 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.h +228 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.cpp +584 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter_p.h +34 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.cpp +286 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.h +1445 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext.cpp +293 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext_p.h +199 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.cpp +133 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.h +393 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.cpp +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.h +772 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.cpp +1242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.h +261 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.cpp +80 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.cpp +69 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.h +198 -0
- data/ext/asmjit/asmjit/src/asmjit/core/misc_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.cpp +132 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.h +1611 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.cpp +84 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.h +61 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils_p.h +68 -0
- data/ext/asmjit/asmjit/src/asmjit/core/raassignment_p.h +418 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rabuilders_p.h +612 -0
- data/ext/asmjit/asmjit/src/asmjit/core/radefs_p.h +1204 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal.cpp +1166 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal_p.h +254 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass.cpp +1969 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass_p.h +1183 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack.cpp +184 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack_p.h +171 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.cpp +559 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.h +372 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.cpp +494 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.h +1773 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.h +53 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.cpp +74 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.h +419 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.cpp +722 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.h +242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.cpp +353 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.h +615 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.cpp +309 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.h +186 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.cpp +163 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.h +209 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.cpp +176 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.h +239 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestring.h +120 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.cpp +99 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.h +380 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.cpp +356 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.h +690 -0
- data/ext/asmjit/asmjit/src/asmjit/core.h +1861 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86archtraits_p.h +148 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.cpp +5110 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.h +685 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.cpp +52 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.h +351 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.cpp +61 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.h +721 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper.cpp +619 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper_p.h +60 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emitter.h +4315 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter.cpp +944 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func.cpp +503 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86globals.h +2169 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi.cpp +1732 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.cpp +4427 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.h +563 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb_p.h +311 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86opcode_p.h +436 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.cpp +231 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.h +1085 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass.cpp +1509 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass_p.h +94 -0
- data/ext/asmjit/asmjit/src/asmjit/x86.h +93 -0
- data/ext/asmjit/asmjit/src/asmjit.natvis +245 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.cpp +84 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.h +85 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_a64.cpp +4006 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x64.cpp +17833 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x86.cpp +8300 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.cpp +253 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.h +73 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_a64.cpp +690 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_x86.cpp +4317 -0
- data/ext/asmjit/asmjit/test/asmjit_test_emitters.cpp +197 -0
- data/ext/asmjit/asmjit/test/asmjit_test_instinfo.cpp +181 -0
- data/ext/asmjit/asmjit/test/asmjit_test_misc.h +257 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.cpp +62 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.h +61 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_a64.cpp +699 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_x86.cpp +5032 -0
- data/ext/asmjit/asmjit/test/asmjit_test_unit.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjit_test_x86_sections.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjitutils.h +38 -0
- data/ext/asmjit/asmjit/test/broken.cpp +312 -0
- data/ext/asmjit/asmjit/test/broken.h +148 -0
- data/ext/asmjit/asmjit/test/cmdline.h +61 -0
- data/ext/asmjit/asmjit/test/performancetimer.h +41 -0
- data/ext/asmjit/asmjit/tools/configure-makefiles.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-ninja.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-sanitizers.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-xcode.sh +8 -0
- data/ext/asmjit/asmjit/tools/enumgen.js +417 -0
- data/ext/asmjit/asmjit/tools/enumgen.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.js +365 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.js +2638 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen.js +947 -0
- data/ext/asmjit/asmjit/tools/tablegen.sh +4 -0
- data/ext/asmjit/asmjit.cc +167 -30
- data/ext/asmjit/extconf.rb +9 -9
- data/lib/asmjit/version.rb +1 -1
- data/lib/asmjit.rb +14 -4
- metadata +198 -17
@@ -0,0 +1,278 @@
|
|
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
|
+
#if !defined(ASMJIT_NO_AARCH64)
|
8
|
+
|
9
|
+
#include "../core/cpuinfo.h"
|
10
|
+
#include "../core/misc_p.h"
|
11
|
+
#include "../core/support.h"
|
12
|
+
#include "../arm/a64instapi_p.h"
|
13
|
+
#include "../arm/a64instdb_p.h"
|
14
|
+
#include "../arm/a64operand.h"
|
15
|
+
|
16
|
+
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
17
|
+
|
18
|
+
// a64::InstInternal - Text
|
19
|
+
// ========================
|
20
|
+
|
21
|
+
#ifndef ASMJIT_NO_TEXT
|
22
|
+
Error InstInternal::instIdToString(Arch arch, InstId instId, String& output) noexcept {
|
23
|
+
uint32_t realId = instId & uint32_t(InstIdParts::kRealId);
|
24
|
+
DebugUtils::unused(arch);
|
25
|
+
|
26
|
+
if (ASMJIT_UNLIKELY(!Inst::isDefinedId(realId)))
|
27
|
+
return DebugUtils::errored(kErrorInvalidInstruction);
|
28
|
+
|
29
|
+
const InstDB::InstInfo& info = InstDB::infoById(realId);
|
30
|
+
return output.append(InstDB::_nameData + info._nameDataIndex);
|
31
|
+
}
|
32
|
+
|
33
|
+
InstId InstInternal::stringToInstId(Arch arch, const char* s, size_t len) noexcept {
|
34
|
+
DebugUtils::unused(arch);
|
35
|
+
|
36
|
+
if (ASMJIT_UNLIKELY(!s))
|
37
|
+
return Inst::kIdNone;
|
38
|
+
|
39
|
+
if (len == SIZE_MAX)
|
40
|
+
len = strlen(s);
|
41
|
+
|
42
|
+
if (ASMJIT_UNLIKELY(len == 0 || len > InstDB::kMaxNameSize))
|
43
|
+
return Inst::kIdNone;
|
44
|
+
|
45
|
+
uint32_t prefix = uint32_t(s[0]) - 'a';
|
46
|
+
if (ASMJIT_UNLIKELY(prefix > 'z' - 'a'))
|
47
|
+
return Inst::kIdNone;
|
48
|
+
|
49
|
+
uint32_t index = InstDB::instNameIndex[prefix].start;
|
50
|
+
if (ASMJIT_UNLIKELY(!index))
|
51
|
+
return Inst::kIdNone;
|
52
|
+
|
53
|
+
const char* nameData = InstDB::_nameData;
|
54
|
+
const InstDB::InstInfo* table = InstDB::_instInfoTable;
|
55
|
+
|
56
|
+
const InstDB::InstInfo* base = table + index;
|
57
|
+
const InstDB::InstInfo* end = table + InstDB::instNameIndex[prefix].end;
|
58
|
+
|
59
|
+
for (size_t lim = (size_t)(end - base); lim != 0; lim >>= 1) {
|
60
|
+
const InstDB::InstInfo* cur = base + (lim >> 1);
|
61
|
+
int result = Support::cmpInstName(nameData + cur[0]._nameDataIndex, s, len);
|
62
|
+
|
63
|
+
if (result < 0) {
|
64
|
+
base = cur + 1;
|
65
|
+
lim--;
|
66
|
+
continue;
|
67
|
+
}
|
68
|
+
|
69
|
+
if (result > 0)
|
70
|
+
continue;
|
71
|
+
|
72
|
+
return uint32_t((size_t)(cur - table));
|
73
|
+
}
|
74
|
+
|
75
|
+
return Inst::kIdNone;
|
76
|
+
}
|
77
|
+
#endif // !ASMJIT_NO_TEXT
|
78
|
+
|
79
|
+
// a64::InstInternal - Validate
|
80
|
+
// ============================
|
81
|
+
|
82
|
+
#ifndef ASMJIT_NO_VALIDATION
|
83
|
+
ASMJIT_FAVOR_SIZE Error InstInternal::validate(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, ValidationFlags validationFlags) noexcept {
|
84
|
+
// TODO:
|
85
|
+
DebugUtils::unused(arch, inst, operands, opCount, validationFlags);
|
86
|
+
return kErrorOk;
|
87
|
+
}
|
88
|
+
#endif // !ASMJIT_NO_VALIDATION
|
89
|
+
|
90
|
+
// a64::InstInternal - QueryRWInfo
|
91
|
+
// ===============================
|
92
|
+
|
93
|
+
#ifndef ASMJIT_NO_INTROSPECTION
|
94
|
+
struct InstRWInfoData {
|
95
|
+
uint8_t rwx[Globals::kMaxOpCount];
|
96
|
+
};
|
97
|
+
|
98
|
+
static const InstRWInfoData instRWInfoData[] = {
|
99
|
+
#define R uint8_t(OpRWFlags::kRead)
|
100
|
+
#define W uint8_t(OpRWFlags::kWrite)
|
101
|
+
#define X uint8_t(OpRWFlags::kRW)
|
102
|
+
|
103
|
+
{{ R, R, R, R, R, R }}, // kRWI_R
|
104
|
+
{{ R, W, R, R, R, R }}, // kRWI_RW
|
105
|
+
{{ R, X, R, R, R, R }}, // kRWI_RX
|
106
|
+
{{ R, R, W, R, R, R }}, // kRWI_RRW
|
107
|
+
{{ R, W, X, R, R, R }}, // kRWI_RWX
|
108
|
+
{{ W, R, R, R, R, R }}, // kRWI_W
|
109
|
+
{{ W, R, W, R, R, R }}, // kRWI_WRW
|
110
|
+
{{ W, R, X, R, R, R }}, // kRWI_WRX
|
111
|
+
{{ W, R, R, W, R, R }}, // kRWI_WRRW
|
112
|
+
{{ W, R, R, X, R, R }}, // kRWI_WRRX
|
113
|
+
{{ W, W, R, R, R, R }}, // kRWI_WW
|
114
|
+
{{ X, R, R, R, R, R }}, // kRWI_X
|
115
|
+
{{ X, R, X, R, R, R }}, // kRWI_XRX
|
116
|
+
{{ X, X, R, R, X, R }}, // kRWI_XXRRX
|
117
|
+
|
118
|
+
{{ W, R, R, R, R, R }}, // kRWI_LDn
|
119
|
+
{{ R, W, R, R, R, R }}, // kRWI_STn
|
120
|
+
{{ R, R, R, R, R, R }} // kRWI_TODO
|
121
|
+
|
122
|
+
#undef R
|
123
|
+
#undef W
|
124
|
+
#undef X
|
125
|
+
};
|
126
|
+
|
127
|
+
static const uint8_t elementTypeSize[8] = { 0, 1, 2, 4, 8, 4, 4, 0 };
|
128
|
+
|
129
|
+
Error InstInternal::queryRWInfo(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, InstRWInfo* out) noexcept {
|
130
|
+
// Unused in Release configuration as the assert is not compiled in.
|
131
|
+
DebugUtils::unused(arch);
|
132
|
+
|
133
|
+
// Only called when `arch` matches X86 family.
|
134
|
+
ASMJIT_ASSERT(Environment::isFamilyARM(arch));
|
135
|
+
|
136
|
+
// Get the instruction data.
|
137
|
+
uint32_t realId = inst.id() & uint32_t(InstIdParts::kRealId);
|
138
|
+
|
139
|
+
if (ASMJIT_UNLIKELY(!Inst::isDefinedId(realId)))
|
140
|
+
return DebugUtils::errored(kErrorInvalidInstruction);
|
141
|
+
|
142
|
+
out->_instFlags = InstRWFlags::kNone;
|
143
|
+
out->_opCount = uint8_t(opCount);
|
144
|
+
out->_rmFeature = 0;
|
145
|
+
out->_extraReg.reset();
|
146
|
+
out->_readFlags = CpuRWFlags::kNone; // TODO: [ARM] Read PSTATUS.
|
147
|
+
out->_writeFlags = CpuRWFlags::kNone; // TODO: [ARM] Write PSTATUS
|
148
|
+
|
149
|
+
const InstDB::InstInfo& instInfo = InstDB::_instInfoTable[realId];
|
150
|
+
const InstRWInfoData& rwInfo = instRWInfoData[instInfo.rwInfoIndex()];
|
151
|
+
|
152
|
+
if (instInfo.hasFlag(InstDB::kInstFlagConsecutive) && opCount > 2) {
|
153
|
+
for (uint32_t i = 0; i < opCount; i++) {
|
154
|
+
OpRWInfo& op = out->_operands[i];
|
155
|
+
const Operand_& srcOp = operands[i];
|
156
|
+
|
157
|
+
if (!srcOp.isRegOrMem()) {
|
158
|
+
op.reset();
|
159
|
+
continue;
|
160
|
+
}
|
161
|
+
|
162
|
+
OpRWFlags rwFlags = i < opCount - 1 ? (OpRWFlags)rwInfo.rwx[0] : (OpRWFlags)rwInfo.rwx[1];
|
163
|
+
|
164
|
+
op._opFlags = rwFlags & ~(OpRWFlags::kZExt);
|
165
|
+
op._physId = BaseReg::kIdBad;
|
166
|
+
op._rmSize = 0;
|
167
|
+
op._resetReserved();
|
168
|
+
|
169
|
+
uint64_t rByteMask = op.isRead() ? 0xFFFFFFFFFFFFFFFFu : 0x0000000000000000u;
|
170
|
+
uint64_t wByteMask = op.isWrite() ? 0xFFFFFFFFFFFFFFFFu : 0x0000000000000000u;
|
171
|
+
|
172
|
+
op._readByteMask = rByteMask;
|
173
|
+
op._writeByteMask = wByteMask;
|
174
|
+
op._extendByteMask = 0;
|
175
|
+
op._consecutiveLeadCount = 0;
|
176
|
+
|
177
|
+
if (srcOp.isReg()) {
|
178
|
+
if (i == 0)
|
179
|
+
op._consecutiveLeadCount = uint8_t(opCount - 1);
|
180
|
+
else
|
181
|
+
op.addOpFlags(OpRWFlags::kConsecutive);
|
182
|
+
}
|
183
|
+
else {
|
184
|
+
const Mem& memOp = srcOp.as<Mem>();
|
185
|
+
|
186
|
+
if (memOp.hasBase()) {
|
187
|
+
op.addOpFlags(OpRWFlags::kMemBaseRead);
|
188
|
+
}
|
189
|
+
|
190
|
+
if (memOp.hasIndex()) {
|
191
|
+
op.addOpFlags(OpRWFlags::kMemIndexRead);
|
192
|
+
op.addOpFlags(memOp.isPreOrPost() ? OpRWFlags::kMemIndexWrite : OpRWFlags::kNone);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
for (uint32_t i = 0; i < opCount; i++) {
|
199
|
+
OpRWInfo& op = out->_operands[i];
|
200
|
+
const Operand_& srcOp = operands[i];
|
201
|
+
|
202
|
+
if (!srcOp.isRegOrMem()) {
|
203
|
+
op.reset();
|
204
|
+
continue;
|
205
|
+
}
|
206
|
+
|
207
|
+
OpRWFlags rwFlags = (OpRWFlags)rwInfo.rwx[i];
|
208
|
+
|
209
|
+
op._opFlags = rwFlags & ~(OpRWFlags::kZExt);
|
210
|
+
op._physId = BaseReg::kIdBad;
|
211
|
+
op._rmSize = 0;
|
212
|
+
op._resetReserved();
|
213
|
+
|
214
|
+
uint64_t rByteMask = op.isRead() ? 0xFFFFFFFFFFFFFFFFu : 0x0000000000000000u;
|
215
|
+
uint64_t wByteMask = op.isWrite() ? 0xFFFFFFFFFFFFFFFFu : 0x0000000000000000u;
|
216
|
+
|
217
|
+
op._readByteMask = rByteMask;
|
218
|
+
op._writeByteMask = wByteMask;
|
219
|
+
op._extendByteMask = 0;
|
220
|
+
op._consecutiveLeadCount = 0;
|
221
|
+
|
222
|
+
if (srcOp.isReg()) {
|
223
|
+
if (srcOp.as<Vec>().hasElementIndex()) {
|
224
|
+
// Only part of the vector is accessed if element index [] is used.
|
225
|
+
uint32_t elementType = srcOp.as<Vec>().elementType();
|
226
|
+
uint32_t elementIndex = srcOp.as<Vec>().elementIndex();
|
227
|
+
|
228
|
+
uint32_t elementSize = elementTypeSize[elementType];
|
229
|
+
uint64_t accessMask = uint64_t(Support::lsbMask<uint32_t>(elementSize)) << (elementIndex * elementSize);
|
230
|
+
|
231
|
+
op._readByteMask &= accessMask;
|
232
|
+
op._writeByteMask &= accessMask;
|
233
|
+
}
|
234
|
+
|
235
|
+
// TODO: [ARM] RW info is not finished.
|
236
|
+
}
|
237
|
+
else {
|
238
|
+
const Mem& memOp = srcOp.as<Mem>();
|
239
|
+
|
240
|
+
if (memOp.hasBase()) {
|
241
|
+
op.addOpFlags(OpRWFlags::kMemBaseRead);
|
242
|
+
}
|
243
|
+
|
244
|
+
if (memOp.hasIndex()) {
|
245
|
+
op.addOpFlags(OpRWFlags::kMemIndexRead);
|
246
|
+
op.addOpFlags(memOp.isPreOrPost() ? OpRWFlags::kMemIndexWrite : OpRWFlags::kNone);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
return kErrorOk;
|
253
|
+
}
|
254
|
+
#endif // !ASMJIT_NO_INTROSPECTION
|
255
|
+
|
256
|
+
// a64::InstInternal - QueryFeatures
|
257
|
+
// =================================
|
258
|
+
|
259
|
+
#ifndef ASMJIT_NO_INTROSPECTION
|
260
|
+
Error InstInternal::queryFeatures(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, CpuFeatures* out) noexcept {
|
261
|
+
// TODO: [ARM] QueryFeatures not implemented yet.
|
262
|
+
DebugUtils::unused(arch, inst, operands, opCount, out);
|
263
|
+
return kErrorOk;
|
264
|
+
}
|
265
|
+
#endif // !ASMJIT_NO_INTROSPECTION
|
266
|
+
|
267
|
+
// a64::InstInternal - Unit
|
268
|
+
// ========================
|
269
|
+
|
270
|
+
#if defined(ASMJIT_TEST)
|
271
|
+
UNIT(arm_inst_api_text) {
|
272
|
+
// TODO:
|
273
|
+
}
|
274
|
+
#endif
|
275
|
+
|
276
|
+
ASMJIT_END_SUB_NAMESPACE
|
277
|
+
|
278
|
+
#endif // !ASMJIT_NO_AARCH64
|
@@ -0,0 +1,41 @@
|
|
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_ARM_A64INSTAPI_P_H_INCLUDED
|
7
|
+
#define ASMJIT_ARM_A64INSTAPI_P_H_INCLUDED
|
8
|
+
|
9
|
+
#include "../core/inst.h"
|
10
|
+
#include "../core/operand.h"
|
11
|
+
|
12
|
+
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
13
|
+
|
14
|
+
//! \cond INTERNAL
|
15
|
+
//! \addtogroup asmjit_a64
|
16
|
+
//! \{
|
17
|
+
|
18
|
+
namespace InstInternal {
|
19
|
+
|
20
|
+
#ifndef ASMJIT_NO_TEXT
|
21
|
+
Error ASMJIT_CDECL instIdToString(Arch arch, InstId instId, String& output) noexcept;
|
22
|
+
InstId ASMJIT_CDECL stringToInstId(Arch arch, const char* s, size_t len) noexcept;
|
23
|
+
#endif // !ASMJIT_NO_TEXT
|
24
|
+
|
25
|
+
#ifndef ASMJIT_NO_VALIDATION
|
26
|
+
Error ASMJIT_CDECL validate(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, ValidationFlags validationFlags) noexcept;
|
27
|
+
#endif // !ASMJIT_NO_VALIDATION
|
28
|
+
|
29
|
+
#ifndef ASMJIT_NO_INTROSPECTION
|
30
|
+
Error ASMJIT_CDECL queryRWInfo(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, InstRWInfo* out) noexcept;
|
31
|
+
Error ASMJIT_CDECL queryFeatures(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, CpuFeatures* out) noexcept;
|
32
|
+
#endif // !ASMJIT_NO_INTROSPECTION
|
33
|
+
|
34
|
+
} // {InstInternal}
|
35
|
+
|
36
|
+
//! \}
|
37
|
+
//! \endcond
|
38
|
+
|
39
|
+
ASMJIT_END_SUB_NAMESPACE
|
40
|
+
|
41
|
+
#endif // ASMJIT_ARM_A64INSTAPI_P_H_INCLUDED
|