asmjit 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/asmjit.gemspec +1 -1
- 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 +18 -0
- data/lib/asmjit/version.rb +1 -1
- metadata +197 -2
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
// This file is part of AsmJit project <https://asmjit.com>
|
|
2
|
+
//
|
|
3
|
+
// See asmjit.h or LICENSE.md for license and copyright information
|
|
4
|
+
// SPDX-License-Identifier: Zlib
|
|
5
|
+
|
|
6
|
+
#ifndef ASMJIT_CORE_ENVIRONMENT_H_INCLUDED
|
|
7
|
+
#define ASMJIT_CORE_ENVIRONMENT_H_INCLUDED
|
|
8
|
+
|
|
9
|
+
#include "../core/archtraits.h"
|
|
10
|
+
|
|
11
|
+
#if defined(__APPLE__)
|
|
12
|
+
#include <TargetConditionals.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
ASMJIT_BEGIN_NAMESPACE
|
|
16
|
+
|
|
17
|
+
//! \addtogroup asmjit_core
|
|
18
|
+
//! \{
|
|
19
|
+
|
|
20
|
+
//! Vendor.
|
|
21
|
+
//!
|
|
22
|
+
//! \note AsmJit doesn't use vendor information at the moment. It's provided for future use, if required.
|
|
23
|
+
enum class Vendor : uint8_t {
|
|
24
|
+
//! Unknown or uninitialized platform vendor.
|
|
25
|
+
kUnknown = 0,
|
|
26
|
+
|
|
27
|
+
//! Maximum value of `PlatformVendor`.
|
|
28
|
+
kMaxValue = kUnknown,
|
|
29
|
+
|
|
30
|
+
//! Platform vendor detected at compile-time.
|
|
31
|
+
kHost =
|
|
32
|
+
#if defined(_DOXYGEN)
|
|
33
|
+
DETECTED_AT_COMPILE_TIME
|
|
34
|
+
#else
|
|
35
|
+
kUnknown
|
|
36
|
+
#endif
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//! Platform - runtime environment or operating system.
|
|
40
|
+
enum class Platform : uint8_t {
|
|
41
|
+
//! Unknown or uninitialized platform.
|
|
42
|
+
kUnknown = 0,
|
|
43
|
+
|
|
44
|
+
//! Windows OS.
|
|
45
|
+
kWindows,
|
|
46
|
+
|
|
47
|
+
//! Other platform that is not Windows, most likely POSIX based.
|
|
48
|
+
kOther,
|
|
49
|
+
|
|
50
|
+
//! Linux OS.
|
|
51
|
+
kLinux,
|
|
52
|
+
//! GNU/Hurd OS.
|
|
53
|
+
kHurd,
|
|
54
|
+
|
|
55
|
+
//! FreeBSD OS.
|
|
56
|
+
kFreeBSD,
|
|
57
|
+
//! OpenBSD OS.
|
|
58
|
+
kOpenBSD,
|
|
59
|
+
//! NetBSD OS.
|
|
60
|
+
kNetBSD,
|
|
61
|
+
//! DragonFly BSD OS.
|
|
62
|
+
kDragonFlyBSD,
|
|
63
|
+
|
|
64
|
+
//! Haiku OS.
|
|
65
|
+
kHaiku,
|
|
66
|
+
|
|
67
|
+
//! Apple OSX.
|
|
68
|
+
kOSX,
|
|
69
|
+
//! Apple iOS.
|
|
70
|
+
kIOS,
|
|
71
|
+
//! Apple TVOS.
|
|
72
|
+
kTVOS,
|
|
73
|
+
//! Apple WatchOS.
|
|
74
|
+
kWatchOS,
|
|
75
|
+
|
|
76
|
+
//! Emscripten platform.
|
|
77
|
+
kEmscripten,
|
|
78
|
+
|
|
79
|
+
//! Maximum value of `Platform`.
|
|
80
|
+
kMaxValue = kEmscripten,
|
|
81
|
+
|
|
82
|
+
//! Platform detected at compile-time (platform of the host).
|
|
83
|
+
kHost =
|
|
84
|
+
#if defined(_DOXYGEN)
|
|
85
|
+
DETECTED_AT_COMPILE_TIME
|
|
86
|
+
#elif defined(__EMSCRIPTEN__)
|
|
87
|
+
kEmscripten
|
|
88
|
+
#elif defined(_WIN32)
|
|
89
|
+
kWindows
|
|
90
|
+
#elif defined(__linux__)
|
|
91
|
+
kLinux
|
|
92
|
+
#elif defined(__gnu_hurd__)
|
|
93
|
+
kHurd
|
|
94
|
+
#elif defined(__FreeBSD__)
|
|
95
|
+
kFreeBSD
|
|
96
|
+
#elif defined(__OpenBSD__)
|
|
97
|
+
kOpenBSD
|
|
98
|
+
#elif defined(__NetBSD__)
|
|
99
|
+
kNetBSD
|
|
100
|
+
#elif defined(__DragonFly__)
|
|
101
|
+
kDragonFlyBSD
|
|
102
|
+
#elif defined(__HAIKU__)
|
|
103
|
+
kHaiku
|
|
104
|
+
#elif defined(__APPLE__) && TARGET_OS_OSX
|
|
105
|
+
kOSX
|
|
106
|
+
#elif defined(__APPLE__) && TARGET_OS_TV
|
|
107
|
+
kTVOS
|
|
108
|
+
#elif defined(__APPLE__) && TARGET_OS_WATCH
|
|
109
|
+
kWatchOS
|
|
110
|
+
#elif defined(__APPLE__) && TARGET_OS_IPHONE
|
|
111
|
+
kIOS
|
|
112
|
+
#else
|
|
113
|
+
kOther
|
|
114
|
+
#endif
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
//! Platform ABI (application binary interface).
|
|
118
|
+
enum class PlatformABI : uint8_t {
|
|
119
|
+
//! Unknown or uninitialied environment.
|
|
120
|
+
kUnknown = 0,
|
|
121
|
+
//! Microsoft ABI.
|
|
122
|
+
kMSVC,
|
|
123
|
+
//! GNU ABI.
|
|
124
|
+
kGNU,
|
|
125
|
+
//! Android Environment / ABI.
|
|
126
|
+
kAndroid,
|
|
127
|
+
//! Cygwin ABI.
|
|
128
|
+
kCygwin,
|
|
129
|
+
|
|
130
|
+
//! Maximum value of `PlatformABI`.
|
|
131
|
+
kMaxValue,
|
|
132
|
+
|
|
133
|
+
//! Host ABI detected at compile-time.
|
|
134
|
+
kHost =
|
|
135
|
+
#if defined(_DOXYGEN)
|
|
136
|
+
DETECTED_AT_COMPILE_TIME
|
|
137
|
+
#elif defined(_MSC_VER)
|
|
138
|
+
kMSVC
|
|
139
|
+
#elif defined(__CYGWIN__)
|
|
140
|
+
kCygwin
|
|
141
|
+
#elif defined(__MINGW32__) || defined(__GLIBC__)
|
|
142
|
+
kGNU
|
|
143
|
+
#elif defined(__ANDROID__)
|
|
144
|
+
kAndroid
|
|
145
|
+
#else
|
|
146
|
+
kUnknown
|
|
147
|
+
#endif
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
//! Object format.
|
|
151
|
+
//!
|
|
152
|
+
//! \note AsmJit doesn't really use anything except \ref ObjectFormat::kUnknown and \ref ObjectFormat::kJIT at
|
|
153
|
+
//! the moment. Object file formats are provided for future extensibility and a possibility to generate object
|
|
154
|
+
//! files at some point.
|
|
155
|
+
enum class ObjectFormat : uint8_t {
|
|
156
|
+
//! Unknown or uninitialized object format.
|
|
157
|
+
kUnknown = 0,
|
|
158
|
+
|
|
159
|
+
//! JIT code generation object, most likely \ref JitRuntime or a custom
|
|
160
|
+
//! \ref Target implementation.
|
|
161
|
+
kJIT,
|
|
162
|
+
|
|
163
|
+
//! Executable and linkable format (ELF).
|
|
164
|
+
kELF,
|
|
165
|
+
//! Common object file format.
|
|
166
|
+
kCOFF,
|
|
167
|
+
//! Extended COFF object format.
|
|
168
|
+
kXCOFF,
|
|
169
|
+
//! Mach object file format.
|
|
170
|
+
kMachO,
|
|
171
|
+
|
|
172
|
+
//! Maximum value of `ObjectFormat`.
|
|
173
|
+
kMaxValue
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
//! Represents an environment, which is usually related to a \ref Target.
|
|
177
|
+
//!
|
|
178
|
+
//! Environment has usually an 'arch-subarch-vendor-os-abi' format, which is sometimes called "Triple" (historically
|
|
179
|
+
//! it used to be 3 only parts) or "Tuple", which is a convention used by Debian Linux.
|
|
180
|
+
//!
|
|
181
|
+
//! AsmJit doesn't support all possible combinations or architectures and ABIs, however, it models the environment
|
|
182
|
+
//! similarly to other compilers for future extensibility.
|
|
183
|
+
class Environment {
|
|
184
|
+
public:
|
|
185
|
+
//! \name Members
|
|
186
|
+
//! \{
|
|
187
|
+
|
|
188
|
+
//! Architecture.
|
|
189
|
+
Arch _arch;
|
|
190
|
+
//! Sub-architecture type.
|
|
191
|
+
SubArch _subArch;
|
|
192
|
+
//! Vendor type.
|
|
193
|
+
Vendor _vendor;
|
|
194
|
+
//! Platform.
|
|
195
|
+
Platform _platform;
|
|
196
|
+
//! Platform ABI.
|
|
197
|
+
PlatformABI _platformABI;
|
|
198
|
+
//! Object format.
|
|
199
|
+
ObjectFormat _objectFormat;
|
|
200
|
+
//! Reserved for future use, must be zero.
|
|
201
|
+
uint8_t _reserved[2];
|
|
202
|
+
|
|
203
|
+
//! \}
|
|
204
|
+
|
|
205
|
+
//! \name Construction & Destruction
|
|
206
|
+
//! \{
|
|
207
|
+
|
|
208
|
+
inline Environment() noexcept :
|
|
209
|
+
_arch(Arch::kUnknown),
|
|
210
|
+
_subArch(SubArch::kUnknown),
|
|
211
|
+
_vendor(Vendor::kUnknown),
|
|
212
|
+
_platform(Platform::kUnknown),
|
|
213
|
+
_platformABI(PlatformABI::kUnknown),
|
|
214
|
+
_objectFormat(ObjectFormat::kUnknown),
|
|
215
|
+
_reserved { 0, 0 } {}
|
|
216
|
+
|
|
217
|
+
inline explicit Environment(
|
|
218
|
+
Arch arch,
|
|
219
|
+
SubArch subArch = SubArch::kUnknown,
|
|
220
|
+
Vendor vendor = Vendor::kUnknown,
|
|
221
|
+
Platform platform = Platform::kUnknown,
|
|
222
|
+
PlatformABI abi = PlatformABI::kUnknown,
|
|
223
|
+
ObjectFormat objectFormat = ObjectFormat::kUnknown) noexcept {
|
|
224
|
+
|
|
225
|
+
init(arch, subArch, vendor, platform, abi, objectFormat);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
inline Environment(const Environment& other) noexcept = default;
|
|
229
|
+
|
|
230
|
+
//! Returns the host environment constructed from preprocessor macros defined by the compiler.
|
|
231
|
+
//!
|
|
232
|
+
//! The returned environment should precisely match the target host architecture, sub-architecture, platform,
|
|
233
|
+
//! and ABI.
|
|
234
|
+
static inline Environment host() noexcept {
|
|
235
|
+
return Environment(Arch::kHost, SubArch::kHost, Vendor::kHost, Platform::kHost, PlatformABI::kHost, ObjectFormat::kUnknown);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//! \}
|
|
239
|
+
|
|
240
|
+
//! \name Overloaded Operators
|
|
241
|
+
//! \{
|
|
242
|
+
|
|
243
|
+
inline Environment& operator=(const Environment& other) noexcept = default;
|
|
244
|
+
|
|
245
|
+
inline bool operator==(const Environment& other) const noexcept { return equals(other); }
|
|
246
|
+
inline bool operator!=(const Environment& other) const noexcept { return !equals(other); }
|
|
247
|
+
|
|
248
|
+
//! \}
|
|
249
|
+
|
|
250
|
+
//! \name Accessors
|
|
251
|
+
//! \{
|
|
252
|
+
|
|
253
|
+
//! Tests whether the environment is not set up.
|
|
254
|
+
//!
|
|
255
|
+
//! Returns true if all members are zero, and thus unknown.
|
|
256
|
+
inline bool empty() const noexcept {
|
|
257
|
+
// Unfortunately compilers won't optimize fields are checked one by one...
|
|
258
|
+
return _packed() == 0;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
//! Tests whether the environment is initialized, which means it must have
|
|
262
|
+
//! a valid architecture.
|
|
263
|
+
inline bool isInitialized() const noexcept {
|
|
264
|
+
return _arch != Arch::kUnknown;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
inline uint64_t _packed() const noexcept {
|
|
268
|
+
uint64_t x;
|
|
269
|
+
memcpy(&x, this, 8);
|
|
270
|
+
return x;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
//! Resets all members of the environment to zero / unknown.
|
|
274
|
+
inline void reset() noexcept {
|
|
275
|
+
_arch = Arch::kUnknown;
|
|
276
|
+
_subArch = SubArch::kUnknown;
|
|
277
|
+
_vendor = Vendor::kUnknown;
|
|
278
|
+
_platform = Platform::kUnknown;
|
|
279
|
+
_platformABI = PlatformABI::kUnknown;
|
|
280
|
+
_objectFormat = ObjectFormat::kUnknown;
|
|
281
|
+
_reserved[0] = 0;
|
|
282
|
+
_reserved[1] = 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
inline bool equals(const Environment& other) const noexcept {
|
|
286
|
+
return _packed() == other._packed();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
//! Returns the architecture.
|
|
290
|
+
inline Arch arch() const noexcept { return _arch; }
|
|
291
|
+
//! Returns the sub-architecture.
|
|
292
|
+
inline SubArch subArch() const noexcept { return _subArch; }
|
|
293
|
+
//! Returns vendor.
|
|
294
|
+
inline Vendor vendor() const noexcept { return _vendor; }
|
|
295
|
+
//! Returns target's platform or operating system.
|
|
296
|
+
inline Platform platform() const noexcept { return _platform; }
|
|
297
|
+
//! Returns target's ABI.
|
|
298
|
+
inline PlatformABI platformABI() const noexcept { return _platformABI; }
|
|
299
|
+
//! Returns target's object format.
|
|
300
|
+
inline ObjectFormat objectFormat() const noexcept { return _objectFormat; }
|
|
301
|
+
|
|
302
|
+
inline void init(
|
|
303
|
+
Arch arch,
|
|
304
|
+
SubArch subArch = SubArch::kUnknown,
|
|
305
|
+
Vendor vendor = Vendor::kUnknown,
|
|
306
|
+
Platform platform = Platform::kUnknown,
|
|
307
|
+
PlatformABI platformABI = PlatformABI::kUnknown,
|
|
308
|
+
ObjectFormat objectFormat = ObjectFormat::kUnknown) noexcept {
|
|
309
|
+
|
|
310
|
+
_arch = arch;
|
|
311
|
+
_subArch = subArch;
|
|
312
|
+
_vendor = vendor;
|
|
313
|
+
_platform = platform;
|
|
314
|
+
_platformABI = platformABI;
|
|
315
|
+
_objectFormat = objectFormat;
|
|
316
|
+
_reserved[0] = 0;
|
|
317
|
+
_reserved[1] = 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
inline bool isArchX86() const noexcept { return _arch == Arch::kX86; }
|
|
321
|
+
inline bool isArchX64() const noexcept { return _arch == Arch::kX64; }
|
|
322
|
+
inline bool isArchARM() const noexcept { return isArchARM(_arch); }
|
|
323
|
+
inline bool isArchThumb() const noexcept { return isArchThumb(_arch); }
|
|
324
|
+
inline bool isArchAArch64() const noexcept { return isArchAArch64(_arch); }
|
|
325
|
+
inline bool isArchMIPS32() const noexcept { return isArchMIPS32(_arch); }
|
|
326
|
+
inline bool isArchMIPS64() const noexcept { return isArchMIPS64(_arch); }
|
|
327
|
+
inline bool isArchRISCV32() const noexcept { return _arch == Arch::kRISCV32; }
|
|
328
|
+
inline bool isArchRISCV64() const noexcept { return _arch == Arch::kRISCV64; }
|
|
329
|
+
|
|
330
|
+
//! Tests whether the architecture is 32-bit.
|
|
331
|
+
inline bool is32Bit() const noexcept { return is32Bit(_arch); }
|
|
332
|
+
//! Tests whether the architecture is 64-bit.
|
|
333
|
+
inline bool is64Bit() const noexcept { return is64Bit(_arch); }
|
|
334
|
+
|
|
335
|
+
//! Tests whether the architecture is little endian.
|
|
336
|
+
inline bool isLittleEndian() const noexcept { return isLittleEndian(_arch); }
|
|
337
|
+
//! Tests whether the architecture is big endian.
|
|
338
|
+
inline bool isBigEndian() const noexcept { return isBigEndian(_arch); }
|
|
339
|
+
|
|
340
|
+
//! Tests whether this architecture is of X86 family.
|
|
341
|
+
inline bool isFamilyX86() const noexcept { return isFamilyX86(_arch); }
|
|
342
|
+
//! Tests whether this architecture family is ARM, THUMB, or AArch64.
|
|
343
|
+
inline bool isFamilyARM() const noexcept { return isFamilyARM(_arch); }
|
|
344
|
+
//! Tests whether this architecture family is AArch32 (ARM or THUMB).
|
|
345
|
+
inline bool isFamilyAArch32() const noexcept { return isFamilyAArch32(_arch); }
|
|
346
|
+
//! Tests whether this architecture family is AArch64.
|
|
347
|
+
inline bool isFamilyAArch64() const noexcept { return isFamilyAArch64(_arch); }
|
|
348
|
+
//! Tests whether this architecture family is MISP or MIPS64.
|
|
349
|
+
inline bool isFamilyMIPS() const noexcept { return isFamilyMIPS(_arch); }
|
|
350
|
+
//! Tests whether this architecture family is RISC-V (both 32-bit and 64-bit).
|
|
351
|
+
inline bool isFamilyRISCV() const noexcept { return isFamilyRISCV(_arch); }
|
|
352
|
+
|
|
353
|
+
//! Tests whether the environment platform is Windows.
|
|
354
|
+
inline bool isPlatformWindows() const noexcept { return _platform == Platform::kWindows; }
|
|
355
|
+
|
|
356
|
+
//! Tests whether the environment platform is Linux.
|
|
357
|
+
inline bool isPlatformLinux() const noexcept { return _platform == Platform::kLinux; }
|
|
358
|
+
|
|
359
|
+
//! Tests whether the environment platform is Hurd.
|
|
360
|
+
inline bool isPlatformHurd() const noexcept { return _platform == Platform::kHurd; }
|
|
361
|
+
|
|
362
|
+
//! Tests whether the environment platform is Haiku.
|
|
363
|
+
inline bool isPlatformHaiku() const noexcept { return _platform == Platform::kHaiku; }
|
|
364
|
+
|
|
365
|
+
//! Tests whether the environment platform is any BSD.
|
|
366
|
+
inline bool isPlatformBSD() const noexcept {
|
|
367
|
+
return _platform == Platform::kFreeBSD ||
|
|
368
|
+
_platform == Platform::kOpenBSD ||
|
|
369
|
+
_platform == Platform::kNetBSD ||
|
|
370
|
+
_platform == Platform::kDragonFlyBSD;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
//! Tests whether the environment platform is any Apple platform (OSX, iOS, TVOS, WatchOS).
|
|
374
|
+
inline bool isPlatformApple() const noexcept {
|
|
375
|
+
return _platform == Platform::kOSX ||
|
|
376
|
+
_platform == Platform::kIOS ||
|
|
377
|
+
_platform == Platform::kTVOS ||
|
|
378
|
+
_platform == Platform::kWatchOS;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
//! Tests whether the ABI is MSVC.
|
|
382
|
+
inline bool isMSVC() const noexcept { return _platformABI == PlatformABI::kMSVC; }
|
|
383
|
+
//! Tests whether the ABI is GNU.
|
|
384
|
+
inline bool isGNU() const noexcept { return _platformABI == PlatformABI::kGNU; }
|
|
385
|
+
|
|
386
|
+
//! Returns a calculated stack alignment for this environment.
|
|
387
|
+
ASMJIT_API uint32_t stackAlignment() const noexcept;
|
|
388
|
+
|
|
389
|
+
//! Returns a native register size of this architecture.
|
|
390
|
+
uint32_t registerSize() const noexcept { return registerSizeFromArch(_arch); }
|
|
391
|
+
|
|
392
|
+
//! Sets the architecture to `arch`.
|
|
393
|
+
inline void setArch(Arch arch) noexcept { _arch = arch; }
|
|
394
|
+
//! Sets the sub-architecture to `subArch`.
|
|
395
|
+
inline void setSubArch(SubArch subArch) noexcept { _subArch = subArch; }
|
|
396
|
+
//! Sets the vendor to `vendor`.
|
|
397
|
+
inline void setVendor(Vendor vendor) noexcept { _vendor = vendor; }
|
|
398
|
+
//! Sets the platform to `platform`.
|
|
399
|
+
inline void setPlatform(Platform platform) noexcept { _platform = platform; }
|
|
400
|
+
//! Sets the ABI to `platformABI`.
|
|
401
|
+
inline void setPlatformABI(PlatformABI platformABI) noexcept { _platformABI = platformABI; }
|
|
402
|
+
//! Sets the object format to `objectFormat`.
|
|
403
|
+
inline void setObjectFormat(ObjectFormat objectFormat) noexcept { _objectFormat = objectFormat; }
|
|
404
|
+
|
|
405
|
+
//! \}
|
|
406
|
+
|
|
407
|
+
//! \name Static Utilities
|
|
408
|
+
//! \{
|
|
409
|
+
|
|
410
|
+
static inline bool isDefinedArch(Arch arch) noexcept {
|
|
411
|
+
return uint32_t(arch) <= uint32_t(Arch::kMaxValue);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
static inline bool isValidArch(Arch arch) noexcept {
|
|
415
|
+
return arch != Arch::kUnknown && uint32_t(arch) <= uint32_t(Arch::kMaxValue);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
//! Tests whether the given architecture `arch` is 32-bit.
|
|
419
|
+
static inline bool is32Bit(Arch arch) noexcept {
|
|
420
|
+
return (uint32_t(arch) & uint32_t(Arch::k32BitMask)) == uint32_t(Arch::k32BitMask);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
//! Tests whether the given architecture `arch` is 64-bit.
|
|
424
|
+
static inline bool is64Bit(Arch arch) noexcept {
|
|
425
|
+
return (uint32_t(arch) & uint32_t(Arch::k32BitMask)) == 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
//! Tests whether the given architecture `arch` is little endian.
|
|
429
|
+
static inline bool isLittleEndian(Arch arch) noexcept {
|
|
430
|
+
return uint32_t(arch) < uint32_t(Arch::kBigEndian);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
//! Tests whether the given architecture `arch` is big endian.
|
|
434
|
+
static inline bool isBigEndian(Arch arch) noexcept {
|
|
435
|
+
return uint32_t(arch) >= uint32_t(Arch::kBigEndian);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
//! Tests whether the given architecture is Thumb or Thumb_BE.
|
|
439
|
+
static inline bool isArchThumb(Arch arch) noexcept {
|
|
440
|
+
return arch == Arch::kThumb || arch == Arch::kThumb_BE;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
//! Tests whether the given architecture is ARM or ARM_BE.
|
|
444
|
+
static inline bool isArchARM(Arch arch) noexcept {
|
|
445
|
+
return arch == Arch::kARM || arch == Arch::kARM_BE;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
//! Tests whether the given architecture is AArch64 or AArch64_BE.
|
|
449
|
+
static inline bool isArchAArch64(Arch arch) noexcept {
|
|
450
|
+
return arch == Arch::kAArch64 || arch == Arch::kAArch64_BE;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
//! Tests whether the given architecture is MIPS32_LE or MIPS32_BE.
|
|
454
|
+
static inline bool isArchMIPS32(Arch arch) noexcept {
|
|
455
|
+
return arch == Arch::kMIPS32_LE || arch == Arch::kMIPS32_BE;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
//! Tests whether the given architecture is MIPS64_LE or MIPS64_BE.
|
|
459
|
+
static inline bool isArchMIPS64(Arch arch) noexcept {
|
|
460
|
+
return arch == Arch::kMIPS64_LE || arch == Arch::kMIPS64_BE;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
//! Tests whether the given architecture family is X86 or X64.
|
|
464
|
+
static inline bool isFamilyX86(Arch arch) noexcept {
|
|
465
|
+
return arch == Arch::kX86 || arch == Arch::kX64;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
//! Tests whether the given architecture family is ARM, THUMB, or AArch64.
|
|
469
|
+
static inline bool isFamilyARM(Arch arch) noexcept {
|
|
470
|
+
return isArchARM(arch) || isArchAArch64(arch) || isArchThumb(arch);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
//! Tests whether the given architecture family is AArch32 (ARM or THUMB).
|
|
474
|
+
static inline bool isFamilyAArch32(Arch arch) noexcept {
|
|
475
|
+
return isArchARM(arch) || isArchThumb(arch);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
//! Tests whether the given architecture family is AArch64.
|
|
479
|
+
static inline bool isFamilyAArch64(Arch arch) noexcept {
|
|
480
|
+
return isArchAArch64(arch);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
//! Tests whether the given architecture family is MISP or MIPS64.
|
|
484
|
+
static inline bool isFamilyMIPS(Arch arch) noexcept {
|
|
485
|
+
return isArchMIPS32(arch) || isArchMIPS64(arch);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
//! Tests whether the given architecture family is RISC-V (both 32-bit and 64-bit).
|
|
489
|
+
static inline bool isFamilyRISCV(Arch arch) noexcept {
|
|
490
|
+
return arch == Arch::kRISCV32 || arch == Arch::kRISCV64;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
//! Returns a native general purpose register size from the given architecture.
|
|
494
|
+
static inline uint32_t registerSizeFromArch(Arch arch) noexcept {
|
|
495
|
+
return is32Bit(arch) ? 4u : 8u;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
//! \}
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
static_assert(sizeof(Environment) == 8,
|
|
502
|
+
"Environment must occupy exactly 8 bytes.");
|
|
503
|
+
|
|
504
|
+
//! \}
|
|
505
|
+
|
|
506
|
+
ASMJIT_END_NAMESPACE
|
|
507
|
+
|
|
508
|
+
#endif // ASMJIT_CORE_ENVIRONMENT_H_INCLUDED
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// This file is part of AsmJit project <https://asmjit.com>
|
|
2
|
+
//
|
|
3
|
+
// See asmjit.h or LICENSE.md for license and copyright information
|
|
4
|
+
// SPDX-License-Identifier: Zlib
|
|
5
|
+
|
|
6
|
+
#include "../core/api-build_p.h"
|
|
7
|
+
#include "../core/errorhandler.h"
|
|
8
|
+
|
|
9
|
+
ASMJIT_BEGIN_NAMESPACE
|
|
10
|
+
|
|
11
|
+
ErrorHandler::ErrorHandler() noexcept {}
|
|
12
|
+
ErrorHandler::~ErrorHandler() noexcept {}
|
|
13
|
+
|
|
14
|
+
ASMJIT_END_NAMESPACE
|