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,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/target.h"
|
8
|
+
|
9
|
+
ASMJIT_BEGIN_NAMESPACE
|
10
|
+
|
11
|
+
Target::Target() noexcept : _environment() {}
|
12
|
+
Target::~Target() noexcept {}
|
13
|
+
|
14
|
+
ASMJIT_END_NAMESPACE
|
@@ -0,0 +1,53 @@
|
|
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_TARGET_H_INCLUDED
|
7
|
+
#define ASMJIT_CORE_TARGET_H_INCLUDED
|
8
|
+
|
9
|
+
#include "../core/archtraits.h"
|
10
|
+
#include "../core/func.h"
|
11
|
+
|
12
|
+
ASMJIT_BEGIN_NAMESPACE
|
13
|
+
|
14
|
+
//! \addtogroup asmjit_core
|
15
|
+
//! \{
|
16
|
+
|
17
|
+
//! Target is an abstract class that describes a machine code target.
|
18
|
+
class ASMJIT_VIRTAPI Target {
|
19
|
+
public:
|
20
|
+
ASMJIT_BASE_CLASS(Target)
|
21
|
+
ASMJIT_NONCOPYABLE(Target)
|
22
|
+
|
23
|
+
//! Target environment information.
|
24
|
+
Environment _environment;
|
25
|
+
|
26
|
+
//! \name Construction & Destruction
|
27
|
+
//! \{
|
28
|
+
|
29
|
+
//! Creates a `Target` instance.
|
30
|
+
ASMJIT_API Target() noexcept;
|
31
|
+
//! Destroys the `Target` instance.
|
32
|
+
ASMJIT_API virtual ~Target() noexcept;
|
33
|
+
|
34
|
+
//! \}
|
35
|
+
|
36
|
+
//! \name Accessors
|
37
|
+
//! \{
|
38
|
+
|
39
|
+
//! Returns target's environment.
|
40
|
+
inline const Environment& environment() const noexcept { return _environment; }
|
41
|
+
//! Returns the target architecture.
|
42
|
+
inline Arch arch() const noexcept { return _environment.arch(); }
|
43
|
+
//! Returns the target sub-architecture.
|
44
|
+
inline SubArch subArch() const noexcept { return _environment.subArch(); }
|
45
|
+
|
46
|
+
//! \}
|
47
|
+
};
|
48
|
+
|
49
|
+
//! \}
|
50
|
+
|
51
|
+
ASMJIT_END_NAMESPACE
|
52
|
+
|
53
|
+
#endif // ASMJIT_CORE_TARGET_H_INCLUDED
|
@@ -0,0 +1,74 @@
|
|
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/misc_p.h"
|
8
|
+
#include "../core/type.h"
|
9
|
+
|
10
|
+
ASMJIT_BEGIN_NAMESPACE
|
11
|
+
|
12
|
+
namespace TypeUtils {
|
13
|
+
|
14
|
+
template<uint32_t Index>
|
15
|
+
struct ScalarOfTypeId {
|
16
|
+
enum : uint32_t {
|
17
|
+
kTypeId = uint32_t(
|
18
|
+
isScalar(TypeId(Index)) ? TypeId(Index) :
|
19
|
+
isMask8 (TypeId(Index)) ? TypeId::kUInt8 :
|
20
|
+
isMask16(TypeId(Index)) ? TypeId::kUInt16 :
|
21
|
+
isMask32(TypeId(Index)) ? TypeId::kUInt32 :
|
22
|
+
isMask64(TypeId(Index)) ? TypeId::kUInt64 :
|
23
|
+
isMmx32 (TypeId(Index)) ? TypeId::kUInt32 :
|
24
|
+
isMmx64 (TypeId(Index)) ? TypeId::kUInt64 :
|
25
|
+
isVec32 (TypeId(Index)) ? TypeId((Index - uint32_t(TypeId::_kVec32Start ) + uint32_t(TypeId::kInt8)) & 0xFF) :
|
26
|
+
isVec64 (TypeId(Index)) ? TypeId((Index - uint32_t(TypeId::_kVec64Start ) + uint32_t(TypeId::kInt8)) & 0xFF) :
|
27
|
+
isVec128(TypeId(Index)) ? TypeId((Index - uint32_t(TypeId::_kVec128Start) + uint32_t(TypeId::kInt8)) & 0xFF) :
|
28
|
+
isVec256(TypeId(Index)) ? TypeId((Index - uint32_t(TypeId::_kVec256Start) + uint32_t(TypeId::kInt8)) & 0xFF) :
|
29
|
+
isVec512(TypeId(Index)) ? TypeId((Index - uint32_t(TypeId::_kVec512Start) + uint32_t(TypeId::kInt8)) & 0xFF) : TypeId::kVoid)
|
30
|
+
};
|
31
|
+
};
|
32
|
+
|
33
|
+
template<uint32_t Index>
|
34
|
+
struct SizeOfTypeId {
|
35
|
+
enum : uint32_t {
|
36
|
+
kTypeSize =
|
37
|
+
isInt8 (TypeId(Index)) ? 1 :
|
38
|
+
isUInt8 (TypeId(Index)) ? 1 :
|
39
|
+
isInt16 (TypeId(Index)) ? 2 :
|
40
|
+
isUInt16 (TypeId(Index)) ? 2 :
|
41
|
+
isInt32 (TypeId(Index)) ? 4 :
|
42
|
+
isUInt32 (TypeId(Index)) ? 4 :
|
43
|
+
isInt64 (TypeId(Index)) ? 8 :
|
44
|
+
isUInt64 (TypeId(Index)) ? 8 :
|
45
|
+
isFloat32(TypeId(Index)) ? 4 :
|
46
|
+
isFloat64(TypeId(Index)) ? 8 :
|
47
|
+
isFloat80(TypeId(Index)) ? 10 :
|
48
|
+
isMask8 (TypeId(Index)) ? 1 :
|
49
|
+
isMask16 (TypeId(Index)) ? 2 :
|
50
|
+
isMask32 (TypeId(Index)) ? 4 :
|
51
|
+
isMask64 (TypeId(Index)) ? 8 :
|
52
|
+
isMmx32 (TypeId(Index)) ? 4 :
|
53
|
+
isMmx64 (TypeId(Index)) ? 8 :
|
54
|
+
isVec32 (TypeId(Index)) ? 4 :
|
55
|
+
isVec64 (TypeId(Index)) ? 8 :
|
56
|
+
isVec128 (TypeId(Index)) ? 16 :
|
57
|
+
isVec256 (TypeId(Index)) ? 32 :
|
58
|
+
isVec512 (TypeId(Index)) ? 64 : 0
|
59
|
+
};
|
60
|
+
};
|
61
|
+
|
62
|
+
const TypeData _typeData = {
|
63
|
+
#define VALUE(x) TypeId(ScalarOfTypeId<x>::kTypeId)
|
64
|
+
{ ASMJIT_LOOKUP_TABLE_256(VALUE, 0) },
|
65
|
+
#undef VALUE
|
66
|
+
|
67
|
+
#define VALUE(x) SizeOfTypeId<x>::kTypeSize
|
68
|
+
{ ASMJIT_LOOKUP_TABLE_256(VALUE, 0) }
|
69
|
+
#undef VALUE
|
70
|
+
};
|
71
|
+
|
72
|
+
} // {TypeUtils}
|
73
|
+
|
74
|
+
ASMJIT_END_NAMESPACE
|
@@ -0,0 +1,419 @@
|
|
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_TYPE_H_INCLUDED
|
7
|
+
#define ASMJIT_CORE_TYPE_H_INCLUDED
|
8
|
+
|
9
|
+
#include "../core/globals.h"
|
10
|
+
#include "../core/support.h"
|
11
|
+
|
12
|
+
ASMJIT_BEGIN_NAMESPACE
|
13
|
+
|
14
|
+
//! \addtogroup asmjit_core
|
15
|
+
//! \{
|
16
|
+
|
17
|
+
//! Type identifier provides a minimalist type system used across AsmJit library.
|
18
|
+
//!
|
19
|
+
//! This is an additional information that can be used to describe a value-type of physical or virtual register. It's
|
20
|
+
//! used mostly by BaseCompiler to describe register representation (the group of data stored in the register and the
|
21
|
+
//! width used) and it's also used by APIs that allow to describe and work with function signatures.
|
22
|
+
enum class TypeId : uint8_t {
|
23
|
+
//! Void type.
|
24
|
+
kVoid = 0,
|
25
|
+
|
26
|
+
_kBaseStart = 32,
|
27
|
+
_kBaseEnd = 44,
|
28
|
+
|
29
|
+
_kIntStart = 32,
|
30
|
+
_kIntEnd = 41,
|
31
|
+
|
32
|
+
//! Abstract signed integer type that has a native size.
|
33
|
+
kIntPtr = 32,
|
34
|
+
//! Abstract unsigned integer type that has a native size.
|
35
|
+
kUIntPtr = 33,
|
36
|
+
|
37
|
+
//! 8-bit signed integer type.
|
38
|
+
kInt8 = 34,
|
39
|
+
//! 8-bit unsigned integer type.
|
40
|
+
kUInt8 = 35,
|
41
|
+
//! 16-bit signed integer type.
|
42
|
+
kInt16 = 36,
|
43
|
+
//! 16-bit unsigned integer type.
|
44
|
+
kUInt16 = 37,
|
45
|
+
//! 32-bit signed integer type.
|
46
|
+
kInt32 = 38,
|
47
|
+
//! 32-bit unsigned integer type.
|
48
|
+
kUInt32 = 39,
|
49
|
+
//! 64-bit signed integer type.
|
50
|
+
kInt64 = 40,
|
51
|
+
//! 64-bit unsigned integer type.
|
52
|
+
kUInt64 = 41,
|
53
|
+
|
54
|
+
_kFloatStart = 42,
|
55
|
+
_kFloatEnd = 44,
|
56
|
+
|
57
|
+
//! 32-bit floating point type.
|
58
|
+
kFloat32 = 42,
|
59
|
+
//! 64-bit floating point type.
|
60
|
+
kFloat64 = 43,
|
61
|
+
//! 80-bit floating point type.
|
62
|
+
kFloat80 = 44,
|
63
|
+
|
64
|
+
_kMaskStart = 45,
|
65
|
+
_kMaskEnd = 48,
|
66
|
+
|
67
|
+
//! 8-bit opmask register (K).
|
68
|
+
kMask8 = 45,
|
69
|
+
//! 16-bit opmask register (K).
|
70
|
+
kMask16 = 46,
|
71
|
+
//! 32-bit opmask register (K).
|
72
|
+
kMask32 = 47,
|
73
|
+
//! 64-bit opmask register (K).
|
74
|
+
kMask64 = 48,
|
75
|
+
|
76
|
+
_kMmxStart = 49,
|
77
|
+
_kMmxEnd = 50,
|
78
|
+
|
79
|
+
//! 64-bit MMX register only used for 32 bits.
|
80
|
+
kMmx32 = 49,
|
81
|
+
//! 64-bit MMX register.
|
82
|
+
kMmx64 = 50,
|
83
|
+
|
84
|
+
_kVec32Start = 51,
|
85
|
+
_kVec32End = 60,
|
86
|
+
|
87
|
+
kInt8x4 = 51,
|
88
|
+
kUInt8x4 = 52,
|
89
|
+
kInt16x2 = 53,
|
90
|
+
kUInt16x2 = 54,
|
91
|
+
kInt32x1 = 55,
|
92
|
+
kUInt32x1 = 56,
|
93
|
+
kFloat32x1 = 59,
|
94
|
+
|
95
|
+
_kVec64Start = 61,
|
96
|
+
_kVec64End = 70,
|
97
|
+
|
98
|
+
kInt8x8 = 61,
|
99
|
+
kUInt8x8 = 62,
|
100
|
+
kInt16x4 = 63,
|
101
|
+
kUInt16x4 = 64,
|
102
|
+
kInt32x2 = 65,
|
103
|
+
kUInt32x2 = 66,
|
104
|
+
kInt64x1 = 67,
|
105
|
+
kUInt64x1 = 68,
|
106
|
+
kFloat32x2 = 69,
|
107
|
+
kFloat64x1 = 70,
|
108
|
+
|
109
|
+
_kVec128Start = 71,
|
110
|
+
_kVec128End = 80,
|
111
|
+
|
112
|
+
kInt8x16 = 71,
|
113
|
+
kUInt8x16 = 72,
|
114
|
+
kInt16x8 = 73,
|
115
|
+
kUInt16x8 = 74,
|
116
|
+
kInt32x4 = 75,
|
117
|
+
kUInt32x4 = 76,
|
118
|
+
kInt64x2 = 77,
|
119
|
+
kUInt64x2 = 78,
|
120
|
+
kFloat32x4 = 79,
|
121
|
+
kFloat64x2 = 80,
|
122
|
+
|
123
|
+
_kVec256Start = 81,
|
124
|
+
_kVec256End = 90,
|
125
|
+
|
126
|
+
kInt8x32 = 81,
|
127
|
+
kUInt8x32 = 82,
|
128
|
+
kInt16x16 = 83,
|
129
|
+
kUInt16x16 = 84,
|
130
|
+
kInt32x8 = 85,
|
131
|
+
kUInt32x8 = 86,
|
132
|
+
kInt64x4 = 87,
|
133
|
+
kUInt64x4 = 88,
|
134
|
+
kFloat32x8 = 89,
|
135
|
+
kFloat64x4 = 90,
|
136
|
+
|
137
|
+
_kVec512Start = 91,
|
138
|
+
_kVec512End = 100,
|
139
|
+
|
140
|
+
kInt8x64 = 91,
|
141
|
+
kUInt8x64 = 92,
|
142
|
+
kInt16x32 = 93,
|
143
|
+
kUInt16x32 = 94,
|
144
|
+
kInt32x16 = 95,
|
145
|
+
kUInt32x16 = 96,
|
146
|
+
kInt64x8 = 97,
|
147
|
+
kUInt64x8 = 98,
|
148
|
+
kFloat32x16 = 99,
|
149
|
+
kFloat64x8 = 100,
|
150
|
+
|
151
|
+
kLastAssigned = kFloat64x8,
|
152
|
+
|
153
|
+
kMaxValue = 255
|
154
|
+
};
|
155
|
+
ASMJIT_DEFINE_ENUM_COMPARE(TypeId)
|
156
|
+
|
157
|
+
//! Type identifier utilities.
|
158
|
+
namespace TypeUtils {
|
159
|
+
|
160
|
+
struct TypeData {
|
161
|
+
TypeId scalarOf[uint32_t(TypeId::kMaxValue) + 1];
|
162
|
+
uint8_t sizeOf[uint32_t(TypeId::kMaxValue) + 1];
|
163
|
+
};
|
164
|
+
ASMJIT_VARAPI const TypeData _typeData;
|
165
|
+
|
166
|
+
//! Returns the scalar type of `typeId`.
|
167
|
+
static inline TypeId scalarOf(TypeId typeId) noexcept { return _typeData.scalarOf[uint32_t(typeId)]; }
|
168
|
+
|
169
|
+
//! Returns the size [in bytes] of `typeId`.
|
170
|
+
static inline uint32_t sizeOf(TypeId typeId) noexcept { return _typeData.sizeOf[uint32_t(typeId)]; }
|
171
|
+
|
172
|
+
//! Tests whether a given type `typeId` is between `a` and `b`.
|
173
|
+
static inline constexpr bool isBetween(TypeId typeId, TypeId a, TypeId b) noexcept {
|
174
|
+
return Support::isBetween(uint32_t(typeId), uint32_t(a), uint32_t(b));
|
175
|
+
}
|
176
|
+
|
177
|
+
//! Tests whether a given type `typeId` is \ref TypeId::kVoid.
|
178
|
+
static inline constexpr bool isVoid(TypeId typeId) noexcept { return typeId == TypeId::kVoid; }
|
179
|
+
//! Tests whether a given type `typeId` is a valid non-void type.
|
180
|
+
static inline constexpr bool isValid(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kIntStart, TypeId::_kVec512End); }
|
181
|
+
//! Tests whether a given type `typeId` is scalar (has no vector part).
|
182
|
+
static inline constexpr bool isScalar(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kBaseStart, TypeId::_kBaseEnd); }
|
183
|
+
//! Tests whether a given type `typeId` is abstract, which means that its size depends on register size.
|
184
|
+
static inline constexpr bool isAbstract(TypeId typeId) noexcept { return isBetween(typeId, TypeId::kIntPtr, TypeId::kUIntPtr); }
|
185
|
+
|
186
|
+
//! Tests whether a given type is a scalar integer (signed or unsigned) of any size.
|
187
|
+
static inline constexpr bool isInt(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kIntStart, TypeId::_kIntEnd); }
|
188
|
+
//! Tests whether a given type is a scalar 8-bit integer (signed).
|
189
|
+
static inline constexpr bool isInt8(TypeId typeId) noexcept { return typeId == TypeId::kInt8; }
|
190
|
+
//! Tests whether a given type is a scalar 8-bit integer (unsigned).
|
191
|
+
static inline constexpr bool isUInt8(TypeId typeId) noexcept { return typeId == TypeId::kUInt8; }
|
192
|
+
//! Tests whether a given type is a scalar 16-bit integer (signed).
|
193
|
+
static inline constexpr bool isInt16(TypeId typeId) noexcept { return typeId == TypeId::kInt16; }
|
194
|
+
//! Tests whether a given type is a scalar 16-bit integer (unsigned).
|
195
|
+
static inline constexpr bool isUInt16(TypeId typeId) noexcept { return typeId == TypeId::kUInt16; }
|
196
|
+
//! Tests whether a given type is a scalar 32-bit integer (signed).
|
197
|
+
static inline constexpr bool isInt32(TypeId typeId) noexcept { return typeId == TypeId::kInt32; }
|
198
|
+
//! Tests whether a given type is a scalar 32-bit integer (unsigned).
|
199
|
+
static inline constexpr bool isUInt32(TypeId typeId) noexcept { return typeId == TypeId::kUInt32; }
|
200
|
+
//! Tests whether a given type is a scalar 64-bit integer (signed).
|
201
|
+
static inline constexpr bool isInt64(TypeId typeId) noexcept { return typeId == TypeId::kInt64; }
|
202
|
+
//! Tests whether a given type is a scalar 64-bit integer (unsigned).
|
203
|
+
static inline constexpr bool isUInt64(TypeId typeId) noexcept { return typeId == TypeId::kUInt64; }
|
204
|
+
|
205
|
+
static inline constexpr bool isGp8(TypeId typeId) noexcept { return isBetween(typeId, TypeId::kInt8, TypeId::kUInt8); }
|
206
|
+
static inline constexpr bool isGp16(TypeId typeId) noexcept { return isBetween(typeId, TypeId::kInt16, TypeId::kUInt16); }
|
207
|
+
static inline constexpr bool isGp32(TypeId typeId) noexcept { return isBetween(typeId, TypeId::kInt32, TypeId::kUInt32); }
|
208
|
+
static inline constexpr bool isGp64(TypeId typeId) noexcept { return isBetween(typeId, TypeId::kInt64, TypeId::kUInt64); }
|
209
|
+
|
210
|
+
//! Tests whether a given type is a scalar floating point of any size.
|
211
|
+
static inline constexpr bool isFloat(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kFloatStart, TypeId::_kFloatEnd); }
|
212
|
+
//! Tests whether a given type is a scalar 32-bit float.
|
213
|
+
static inline constexpr bool isFloat32(TypeId typeId) noexcept { return typeId == TypeId::kFloat32; }
|
214
|
+
//! Tests whether a given type is a scalar 64-bit float.
|
215
|
+
static inline constexpr bool isFloat64(TypeId typeId) noexcept { return typeId == TypeId::kFloat64; }
|
216
|
+
//! Tests whether a given type is a scalar 80-bit float.
|
217
|
+
static inline constexpr bool isFloat80(TypeId typeId) noexcept { return typeId == TypeId::kFloat80; }
|
218
|
+
|
219
|
+
static inline constexpr bool isMask(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kMaskStart, TypeId::_kMaskEnd); }
|
220
|
+
static inline constexpr bool isMask8(TypeId typeId) noexcept { return typeId == TypeId::kMask8; }
|
221
|
+
static inline constexpr bool isMask16(TypeId typeId) noexcept { return typeId == TypeId::kMask16; }
|
222
|
+
static inline constexpr bool isMask32(TypeId typeId) noexcept { return typeId == TypeId::kMask32; }
|
223
|
+
static inline constexpr bool isMask64(TypeId typeId) noexcept { return typeId == TypeId::kMask64; }
|
224
|
+
|
225
|
+
static inline constexpr bool isMmx(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kMmxStart, TypeId::_kMmxEnd); }
|
226
|
+
static inline constexpr bool isMmx32(TypeId typeId) noexcept { return typeId == TypeId::kMmx32; }
|
227
|
+
static inline constexpr bool isMmx64(TypeId typeId) noexcept { return typeId == TypeId::kMmx64; }
|
228
|
+
|
229
|
+
static inline constexpr bool isVec(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kVec32Start, TypeId::_kVec512End); }
|
230
|
+
static inline constexpr bool isVec32(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kVec32Start, TypeId::_kVec32End); }
|
231
|
+
static inline constexpr bool isVec64(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kVec64Start, TypeId::_kVec64End); }
|
232
|
+
static inline constexpr bool isVec128(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kVec128Start, TypeId::_kVec128End); }
|
233
|
+
static inline constexpr bool isVec256(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kVec256Start, TypeId::_kVec256End); }
|
234
|
+
static inline constexpr bool isVec512(TypeId typeId) noexcept { return isBetween(typeId, TypeId::_kVec512Start, TypeId::_kVec512End); }
|
235
|
+
|
236
|
+
//! \cond
|
237
|
+
enum TypeCategory : uint32_t {
|
238
|
+
kTypeCategoryUnknown = 0,
|
239
|
+
kTypeCategoryEnum = 1,
|
240
|
+
kTypeCategoryIntegral = 2,
|
241
|
+
kTypeCategoryFloatingPoint = 3,
|
242
|
+
kTypeCategoryFunction = 4
|
243
|
+
};
|
244
|
+
|
245
|
+
template<typename T, TypeCategory kCategory>
|
246
|
+
struct TypeIdOfT_ByCategory {}; // Fails if not specialized.
|
247
|
+
|
248
|
+
template<typename T>
|
249
|
+
struct TypeIdOfT_ByCategory<T, kTypeCategoryIntegral> {
|
250
|
+
enum : uint32_t {
|
251
|
+
kTypeId = uint32_t(
|
252
|
+
(sizeof(T) == 1 && std::is_signed<T>::value) ? TypeId::kInt8 :
|
253
|
+
(sizeof(T) == 1 && !std::is_signed<T>::value) ? TypeId::kUInt8 :
|
254
|
+
(sizeof(T) == 2 && std::is_signed<T>::value) ? TypeId::kInt16 :
|
255
|
+
(sizeof(T) == 2 && !std::is_signed<T>::value) ? TypeId::kUInt16 :
|
256
|
+
(sizeof(T) == 4 && std::is_signed<T>::value) ? TypeId::kInt32 :
|
257
|
+
(sizeof(T) == 4 && !std::is_signed<T>::value) ? TypeId::kUInt32 :
|
258
|
+
(sizeof(T) == 8 && std::is_signed<T>::value) ? TypeId::kInt64 :
|
259
|
+
(sizeof(T) == 8 && !std::is_signed<T>::value) ? TypeId::kUInt64 : TypeId::kVoid)
|
260
|
+
};
|
261
|
+
};
|
262
|
+
|
263
|
+
template<typename T>
|
264
|
+
struct TypeIdOfT_ByCategory<T, kTypeCategoryFloatingPoint> {
|
265
|
+
enum : uint32_t {
|
266
|
+
kTypeId = uint32_t(
|
267
|
+
(sizeof(T) == 4 ) ? TypeId::kFloat32 :
|
268
|
+
(sizeof(T) == 8 ) ? TypeId::kFloat64 :
|
269
|
+
(sizeof(T) >= 10) ? TypeId::kFloat80 : TypeId::kVoid)
|
270
|
+
};
|
271
|
+
};
|
272
|
+
|
273
|
+
template<typename T>
|
274
|
+
struct TypeIdOfT_ByCategory<T, kTypeCategoryEnum>
|
275
|
+
: public TypeIdOfT_ByCategory<typename std::underlying_type<T>::type, kTypeCategoryIntegral> {};
|
276
|
+
|
277
|
+
template<typename T>
|
278
|
+
struct TypeIdOfT_ByCategory<T, kTypeCategoryFunction> {
|
279
|
+
enum : uint32_t {
|
280
|
+
kTypeId = uint32_t(TypeId::kUIntPtr)
|
281
|
+
};
|
282
|
+
};
|
283
|
+
//! \endcond
|
284
|
+
|
285
|
+
//! TypeIdOfT<> template allows to get a TypeId from a C++ type `T`.
|
286
|
+
#ifdef _DOXYGEN
|
287
|
+
template<typename T>
|
288
|
+
struct TypeIdOfT {
|
289
|
+
//! TypeId of C++ type `T`.
|
290
|
+
static constexpr TypeId kTypeId = _TypeIdDeducedAtCompileTime_;
|
291
|
+
};
|
292
|
+
#else
|
293
|
+
template<typename T>
|
294
|
+
struct TypeIdOfT
|
295
|
+
: public TypeIdOfT_ByCategory<T,
|
296
|
+
std::is_enum<T>::value ? kTypeCategoryEnum :
|
297
|
+
std::is_integral<T>::value ? kTypeCategoryIntegral :
|
298
|
+
std::is_floating_point<T>::value ? kTypeCategoryFloatingPoint :
|
299
|
+
std::is_function<T>::value ? kTypeCategoryFunction : kTypeCategoryUnknown> {};
|
300
|
+
#endif
|
301
|
+
|
302
|
+
//! \cond
|
303
|
+
template<typename T>
|
304
|
+
struct TypeIdOfT<T*> {
|
305
|
+
enum : uint32_t {
|
306
|
+
kTypeId = uint32_t(TypeId::kUIntPtr)
|
307
|
+
};
|
308
|
+
};
|
309
|
+
|
310
|
+
template<typename T>
|
311
|
+
struct TypeIdOfT<T&> {
|
312
|
+
enum : uint32_t {
|
313
|
+
kTypeId = uint32_t(TypeId::kUIntPtr)
|
314
|
+
};
|
315
|
+
};
|
316
|
+
//! \endcond
|
317
|
+
|
318
|
+
//! Returns a corresponding \ref TypeId of `T` type.
|
319
|
+
template<typename T>
|
320
|
+
static inline constexpr TypeId typeIdOfT() noexcept { return TypeId(TypeIdOfT<T>::kTypeId); }
|
321
|
+
|
322
|
+
//! Returns offset needed to convert a `kIntPtr` and `kUIntPtr` TypeId into a type that matches `registerSize`
|
323
|
+
//! (general-purpose register size). If you find such TypeId it's then only about adding the offset to it.
|
324
|
+
//!
|
325
|
+
//! For example:
|
326
|
+
//!
|
327
|
+
//! ```
|
328
|
+
//! uint32_t registerSize = /* 4 or 8 */;
|
329
|
+
//! uint32_t deabstractDelta = TypeUtils::deabstractDeltaOfSize(registerSize);
|
330
|
+
//!
|
331
|
+
//! TypeId typeId = 'some type-id';
|
332
|
+
//!
|
333
|
+
//! // Normalize some typeId into a non-abstract typeId.
|
334
|
+
//! if (TypeUtils::isAbstract(typeId)) typeId += deabstractDelta;
|
335
|
+
//!
|
336
|
+
//! // The same, but by using TypeUtils::deabstract() function.
|
337
|
+
//! typeId = TypeUtils::deabstract(typeId, deabstractDelta);
|
338
|
+
//! ```
|
339
|
+
static inline constexpr uint32_t deabstractDeltaOfSize(uint32_t registerSize) noexcept {
|
340
|
+
return registerSize >= 8 ? uint32_t(TypeId::kInt64) - uint32_t(TypeId::kIntPtr)
|
341
|
+
: uint32_t(TypeId::kInt32) - uint32_t(TypeId::kIntPtr);
|
342
|
+
}
|
343
|
+
|
344
|
+
//! Deabstracts a given `typeId` into a native type by using `deabstractDelta`, which was previously
|
345
|
+
//! calculated by calling \ref deabstractDeltaOfSize() with a target native register size.
|
346
|
+
static inline constexpr TypeId deabstract(TypeId typeId, uint32_t deabstractDelta) noexcept {
|
347
|
+
return isAbstract(typeId) ? TypeId(uint32_t(typeId) + deabstractDelta) : typeId;
|
348
|
+
}
|
349
|
+
|
350
|
+
static inline constexpr TypeId scalarToVector(TypeId scalarTypeId, TypeId vecStartId) noexcept {
|
351
|
+
return TypeId(uint32_t(vecStartId) + uint32_t(scalarTypeId) - uint32_t(TypeId::kInt8));
|
352
|
+
}
|
353
|
+
|
354
|
+
} // {TypeUtils}
|
355
|
+
|
356
|
+
//! Provides type identifiers that can be used in templates instead of native types.
|
357
|
+
namespace Type {
|
358
|
+
|
359
|
+
//! bool as C++ type-name.
|
360
|
+
struct Bool {};
|
361
|
+
//! int8_t as C++ type-name.
|
362
|
+
struct Int8 {};
|
363
|
+
//! uint8_t as C++ type-name.
|
364
|
+
struct UInt8 {};
|
365
|
+
//! int16_t as C++ type-name.
|
366
|
+
struct Int16 {};
|
367
|
+
//! uint16_t as C++ type-name.
|
368
|
+
struct UInt16 {};
|
369
|
+
//! int32_t as C++ type-name.
|
370
|
+
struct Int32 {};
|
371
|
+
//! uint32_t as C++ type-name.
|
372
|
+
struct UInt32 {};
|
373
|
+
//! int64_t as C++ type-name.
|
374
|
+
struct Int64 {};
|
375
|
+
//! uint64_t as C++ type-name.
|
376
|
+
struct UInt64 {};
|
377
|
+
//! intptr_t as C++ type-name.
|
378
|
+
struct IntPtr {};
|
379
|
+
//! uintptr_t as C++ type-name.
|
380
|
+
struct UIntPtr {};
|
381
|
+
//! float as C++ type-name.
|
382
|
+
struct Float32 {};
|
383
|
+
//! double as C++ type-name.
|
384
|
+
struct Float64 {};
|
385
|
+
|
386
|
+
} // {Type}
|
387
|
+
|
388
|
+
//! \cond
|
389
|
+
#define ASMJIT_DEFINE_TYPE_ID(T, TYPE_ID) \
|
390
|
+
namespace TypeUtils { \
|
391
|
+
template<> \
|
392
|
+
struct TypeIdOfT<T> { \
|
393
|
+
enum : uint32_t { \
|
394
|
+
kTypeId = uint32_t(TYPE_ID) \
|
395
|
+
}; \
|
396
|
+
}; \
|
397
|
+
}
|
398
|
+
|
399
|
+
ASMJIT_DEFINE_TYPE_ID(void , TypeId::kVoid);
|
400
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Bool , TypeId::kUInt8);
|
401
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Int8 , TypeId::kInt8);
|
402
|
+
ASMJIT_DEFINE_TYPE_ID(Type::UInt8 , TypeId::kUInt8);
|
403
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Int16 , TypeId::kInt16);
|
404
|
+
ASMJIT_DEFINE_TYPE_ID(Type::UInt16 , TypeId::kUInt16);
|
405
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Int32 , TypeId::kInt32);
|
406
|
+
ASMJIT_DEFINE_TYPE_ID(Type::UInt32 , TypeId::kUInt32);
|
407
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Int64 , TypeId::kInt64);
|
408
|
+
ASMJIT_DEFINE_TYPE_ID(Type::UInt64 , TypeId::kUInt64);
|
409
|
+
ASMJIT_DEFINE_TYPE_ID(Type::IntPtr , TypeId::kIntPtr);
|
410
|
+
ASMJIT_DEFINE_TYPE_ID(Type::UIntPtr, TypeId::kUIntPtr);
|
411
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Float32, TypeId::kFloat32);
|
412
|
+
ASMJIT_DEFINE_TYPE_ID(Type::Float64, TypeId::kFloat64);
|
413
|
+
//! \endcond
|
414
|
+
|
415
|
+
//! \}
|
416
|
+
|
417
|
+
ASMJIT_END_NAMESPACE
|
418
|
+
|
419
|
+
#endif // ASMJIT_CORE_TYPE_H_INCLUDED
|