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,613 @@
|
|
|
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_API_CONFIG_H_INCLUDED
|
|
7
|
+
#define ASMJIT_CORE_API_CONFIG_H_INCLUDED
|
|
8
|
+
|
|
9
|
+
// AsmJit Library & ABI Version
|
|
10
|
+
// ============================
|
|
11
|
+
|
|
12
|
+
//! \addtogroup asmjit_core
|
|
13
|
+
//! \{
|
|
14
|
+
|
|
15
|
+
//! AsmJit library version in `(Major << 16) | (Minor << 8) | (Patch)` format.
|
|
16
|
+
#define ASMJIT_LIBRARY_VERSION 0x010900 /* 1.9.0 */
|
|
17
|
+
|
|
18
|
+
//! \def ASMJIT_ABI_NAMESPACE
|
|
19
|
+
//!
|
|
20
|
+
//! AsmJit ABI namespace is an inline namespace within \ref asmjit namespace.
|
|
21
|
+
//!
|
|
22
|
+
//! It's used to make sure that when user links to an incompatible version of AsmJit, it won't link. It has also some
|
|
23
|
+
//! additional properties as well. When `ASMJIT_ABI_NAMESPACE` is defined by the user it would override the AsmJit
|
|
24
|
+
//! default, which makes it possible to use use multiple AsmJit libraries within a single project, totally controlled
|
|
25
|
+
//! by the users. This is useful especially in cases in which some of such library comes from a third party.
|
|
26
|
+
#ifndef ASMJIT_ABI_NAMESPACE
|
|
27
|
+
#define ASMJIT_ABI_NAMESPACE _abi_1_9
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
//! \}
|
|
31
|
+
|
|
32
|
+
// Global Dependencies
|
|
33
|
+
// ===================
|
|
34
|
+
|
|
35
|
+
#include <stdarg.h>
|
|
36
|
+
#include <stddef.h>
|
|
37
|
+
#include <stdint.h> // We really want std types as globals, not under 'std' namespace.
|
|
38
|
+
#include <stdio.h>
|
|
39
|
+
#include <stdlib.h>
|
|
40
|
+
#include <string.h>
|
|
41
|
+
|
|
42
|
+
#include <iterator>
|
|
43
|
+
#include <limits>
|
|
44
|
+
#include <new>
|
|
45
|
+
#include <type_traits>
|
|
46
|
+
#include <utility>
|
|
47
|
+
|
|
48
|
+
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
|
49
|
+
#include <pthread.h>
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
// Build Options
|
|
53
|
+
// =============
|
|
54
|
+
|
|
55
|
+
// NOTE: Doxygen cannot document macros that are not defined, that's why we have to define them and then undefine
|
|
56
|
+
// them immediately, so it won't use the macros with its own preprocessor.
|
|
57
|
+
#ifdef _DOXYGEN
|
|
58
|
+
namespace asmjit {
|
|
59
|
+
|
|
60
|
+
//! \addtogroup asmjit_build
|
|
61
|
+
//! \{
|
|
62
|
+
|
|
63
|
+
//! Asmjit is embedded, implies \ref ASMJIT_STATIC.
|
|
64
|
+
#define ASMJIT_EMBED
|
|
65
|
+
|
|
66
|
+
//! Enables static-library build.
|
|
67
|
+
#define ASMJIT_STATIC
|
|
68
|
+
|
|
69
|
+
//! Defined when AsmJit's build configuration is 'Debug'.
|
|
70
|
+
//!
|
|
71
|
+
//! \note Can be defined explicitly to bypass autodetection.
|
|
72
|
+
#define ASMJIT_BUILD_DEBUG
|
|
73
|
+
|
|
74
|
+
//! Defined when AsmJit's build configuration is 'Release'.
|
|
75
|
+
//!
|
|
76
|
+
//! \note Can be defined explicitly to bypass autodetection.
|
|
77
|
+
#define ASMJIT_BUILD_RELEASE
|
|
78
|
+
|
|
79
|
+
//! Disables X86/X64 backends.
|
|
80
|
+
#define ASMJIT_NO_X86
|
|
81
|
+
|
|
82
|
+
//! Disables AArch32 backends (both ARM and Thumb).
|
|
83
|
+
#define ASMJIT_NO_AARCH32
|
|
84
|
+
|
|
85
|
+
//! Disables AArch64 backend.
|
|
86
|
+
#define ASMJIT_NO_AARCH64
|
|
87
|
+
|
|
88
|
+
//! Disables non-host backends entirely (useful for JIT compilers to minimize the library size).
|
|
89
|
+
#define ASMJIT_NO_FOREIGN
|
|
90
|
+
|
|
91
|
+
//! Disables deprecated API at compile time (deprecated API won't be available).
|
|
92
|
+
#define ASMJIT_NO_DEPRECATED
|
|
93
|
+
|
|
94
|
+
//! Disables \ref asmjit_builder functionality completely.
|
|
95
|
+
#define ASMJIT_NO_BUILDER
|
|
96
|
+
|
|
97
|
+
//! Disables \ref asmjit_compiler functionality completely.
|
|
98
|
+
#define ASMJIT_NO_COMPILER
|
|
99
|
+
|
|
100
|
+
//! Disables JIT memory management and \ref asmjit::JitRuntime.
|
|
101
|
+
#define ASMJIT_NO_JIT
|
|
102
|
+
|
|
103
|
+
//! Disables \ref asmjit::Logger and \ref asmjit::Formatter.
|
|
104
|
+
#define ASMJIT_NO_LOGGING
|
|
105
|
+
|
|
106
|
+
//! Disables everything that contains text.
|
|
107
|
+
#define ASMJIT_NO_TEXT
|
|
108
|
+
|
|
109
|
+
//! Disables instruction validation API.
|
|
110
|
+
#define ASMJIT_NO_VALIDATION
|
|
111
|
+
|
|
112
|
+
//! Disables instruction introspection API.
|
|
113
|
+
#define ASMJIT_NO_INTROSPECTION
|
|
114
|
+
|
|
115
|
+
// Avoid doxygen preprocessor using feature-selection definitions.
|
|
116
|
+
#undef ASMJIT_BUILD_EMBNED
|
|
117
|
+
#undef ASMJIT_BUILD_STATIC
|
|
118
|
+
#undef ASMJIT_BUILD_DEBUG
|
|
119
|
+
#undef ASMJIT_BUILD_RELEASE
|
|
120
|
+
#undef ASMJIT_NO_X86
|
|
121
|
+
#undef ASMJIT_NO_FOREIGN
|
|
122
|
+
// (keep ASMJIT_NO_DEPRECATED defined, we don't document deprecated APIs).
|
|
123
|
+
#undef ASMJIT_NO_BUILDER
|
|
124
|
+
#undef ASMJIT_NO_COMPILER
|
|
125
|
+
#undef ASMJIT_NO_JIT
|
|
126
|
+
#undef ASMJIT_NO_LOGGING
|
|
127
|
+
#undef ASMJIT_NO_TEXT
|
|
128
|
+
#undef ASMJIT_NO_VALIDATION
|
|
129
|
+
#undef ASMJIT_NO_INTROSPECTION
|
|
130
|
+
|
|
131
|
+
//! \}
|
|
132
|
+
|
|
133
|
+
} // {asmjit}
|
|
134
|
+
#endif // _DOXYGEN
|
|
135
|
+
|
|
136
|
+
// ASMJIT_NO_BUILDER implies ASMJIT_NO_COMPILER.
|
|
137
|
+
#if defined(ASMJIT_NO_BUILDER) && !defined(ASMJIT_NO_COMPILER)
|
|
138
|
+
#define ASMJIT_NO_COMPILER
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
// Prevent compile-time errors caused by misconfiguration.
|
|
142
|
+
#if defined(ASMJIT_NO_TEXT) && !defined(ASMJIT_NO_LOGGING)
|
|
143
|
+
#pragma message("'ASMJIT_NO_TEXT' can only be defined when 'ASMJIT_NO_LOGGING' is defined.")
|
|
144
|
+
#undef ASMJIT_NO_TEXT
|
|
145
|
+
#endif
|
|
146
|
+
|
|
147
|
+
#if defined(ASMJIT_NO_INTROSPECTION) && !defined(ASMJIT_NO_COMPILER)
|
|
148
|
+
#pragma message("'ASMJIT_NO_INTROSPECTION' can only be defined when 'ASMJIT_NO_COMPILER' is defined")
|
|
149
|
+
#undef ASMJIT_NO_INTROSPECTION
|
|
150
|
+
#endif
|
|
151
|
+
|
|
152
|
+
// Build Mode
|
|
153
|
+
// ==========
|
|
154
|
+
|
|
155
|
+
// Detect ASMJIT_BUILD_DEBUG and ASMJIT_BUILD_RELEASE if not defined.
|
|
156
|
+
#if !defined(ASMJIT_BUILD_DEBUG) && !defined(ASMJIT_BUILD_RELEASE)
|
|
157
|
+
#if !defined(NDEBUG)
|
|
158
|
+
#define ASMJIT_BUILD_DEBUG
|
|
159
|
+
#else
|
|
160
|
+
#define ASMJIT_BUILD_RELEASE
|
|
161
|
+
#endif
|
|
162
|
+
#endif
|
|
163
|
+
|
|
164
|
+
// Target Architecture Detection
|
|
165
|
+
// =============================
|
|
166
|
+
|
|
167
|
+
#if defined(_M_X64) || defined(__x86_64__)
|
|
168
|
+
#define ASMJIT_ARCH_X86 64
|
|
169
|
+
#elif defined(_M_IX86) || defined(__X86__) || defined(__i386__)
|
|
170
|
+
#define ASMJIT_ARCH_X86 32
|
|
171
|
+
#else
|
|
172
|
+
#define ASMJIT_ARCH_X86 0
|
|
173
|
+
#endif
|
|
174
|
+
|
|
175
|
+
#if defined(__arm64__) || defined(__aarch64__)
|
|
176
|
+
# define ASMJIT_ARCH_ARM 64
|
|
177
|
+
#elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__) || defined(__thumb2__)
|
|
178
|
+
#define ASMJIT_ARCH_ARM 32
|
|
179
|
+
#else
|
|
180
|
+
#define ASMJIT_ARCH_ARM 0
|
|
181
|
+
#endif
|
|
182
|
+
|
|
183
|
+
#if defined(_MIPS_ARCH_MIPS64) || defined(__mips64)
|
|
184
|
+
#define ASMJIT_ARCH_MIPS 64
|
|
185
|
+
#elif defined(_MIPS_ARCH_MIPS32) || defined(_M_MRX000) || defined(__mips__)
|
|
186
|
+
#define ASMJIT_ARCH_MIPS 32
|
|
187
|
+
#else
|
|
188
|
+
#define ASMJIT_ARCH_MIPS 0
|
|
189
|
+
#endif
|
|
190
|
+
|
|
191
|
+
#define ASMJIT_ARCH_BITS (ASMJIT_ARCH_X86 | ASMJIT_ARCH_ARM | ASMJIT_ARCH_MIPS)
|
|
192
|
+
#if ASMJIT_ARCH_BITS == 0
|
|
193
|
+
#undef ASMJIT_ARCH_BITS
|
|
194
|
+
#if defined (__LP64__) || defined(_LP64)
|
|
195
|
+
#define ASMJIT_ARCH_BITS 64
|
|
196
|
+
#else
|
|
197
|
+
#define ASMJIT_ARCH_BITS 32
|
|
198
|
+
#endif
|
|
199
|
+
#endif
|
|
200
|
+
|
|
201
|
+
#if (defined(__ARMEB__)) || \
|
|
202
|
+
(defined(__MIPSEB__)) || \
|
|
203
|
+
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
|
|
204
|
+
#define ASMJIT_ARCH_LE 0
|
|
205
|
+
#define ASMJIT_ARCH_BE 1
|
|
206
|
+
#else
|
|
207
|
+
#define ASMJIT_ARCH_LE 1
|
|
208
|
+
#define ASMJIT_ARCH_BE 0
|
|
209
|
+
#endif
|
|
210
|
+
|
|
211
|
+
#if defined(ASMJIT_NO_FOREIGN)
|
|
212
|
+
#if !ASMJIT_ARCH_X86 && !defined(ASMJIT_NO_X86)
|
|
213
|
+
#define ASMJIT_NO_X86
|
|
214
|
+
#endif
|
|
215
|
+
|
|
216
|
+
#if !ASMJIT_ARCH_ARM && !defined(ASMJIT_NO_AARCH64)
|
|
217
|
+
#define ASMJIT_NO_AARCH64
|
|
218
|
+
#endif
|
|
219
|
+
#endif
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
// C++ Compiler and Features Detection
|
|
223
|
+
// ===================================
|
|
224
|
+
|
|
225
|
+
#define ASMJIT_CXX_GNU 0
|
|
226
|
+
#define ASMJIT_CXX_MAKE_VER(MAJOR, MINOR) ((MAJOR) * 1000 + (MINOR))
|
|
227
|
+
|
|
228
|
+
// Intel Compiler [pretends to be GNU or MSC, so it must be checked first]:
|
|
229
|
+
// - https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
|
|
230
|
+
// - https://software.intel.com/en-us/articles/c14-features-supported-by-intel-c-compiler
|
|
231
|
+
// - https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler
|
|
232
|
+
#if defined(__INTEL_COMPILER)
|
|
233
|
+
|
|
234
|
+
// MSC Compiler:
|
|
235
|
+
// - https://msdn.microsoft.com/en-us/library/hh567368.aspx
|
|
236
|
+
//
|
|
237
|
+
// Version List:
|
|
238
|
+
// - 16.00.0 == VS2010
|
|
239
|
+
// - 17.00.0 == VS2012
|
|
240
|
+
// - 18.00.0 == VS2013
|
|
241
|
+
// - 19.00.0 == VS2015
|
|
242
|
+
// - 19.10.0 == VS2017
|
|
243
|
+
#elif defined(_MSC_VER) && defined(_MSC_FULL_VER)
|
|
244
|
+
|
|
245
|
+
// Clang Compiler [Pretends to be GNU, so it must be checked before]:
|
|
246
|
+
// - https://clang.llvm.org/cxx_status.html
|
|
247
|
+
#elif defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
|
|
248
|
+
|
|
249
|
+
// GNU Compiler:
|
|
250
|
+
// - https://gcc.gnu.org/projects/cxx-status.html
|
|
251
|
+
#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
|
252
|
+
|
|
253
|
+
#undef ASMJIT_CXX_GNU
|
|
254
|
+
#define ASMJIT_CXX_GNU ASMJIT_CXX_MAKE_VER(__GNUC__, __GNUC_MINOR__)
|
|
255
|
+
|
|
256
|
+
#endif
|
|
257
|
+
|
|
258
|
+
// Compiler features detection macros.
|
|
259
|
+
#if defined(__clang__) && defined(__has_attribute)
|
|
260
|
+
#define ASMJIT_CXX_HAS_ATTRIBUTE(NAME, CHECK) (__has_attribute(NAME))
|
|
261
|
+
#else
|
|
262
|
+
#define ASMJIT_CXX_HAS_ATTRIBUTE(NAME, CHECK) (!(!(CHECK)))
|
|
263
|
+
#endif
|
|
264
|
+
|
|
265
|
+
// API Decorators & C++ Extensions
|
|
266
|
+
// ===============================
|
|
267
|
+
|
|
268
|
+
//! \def ASMJIT_API
|
|
269
|
+
//!
|
|
270
|
+
//! A decorator that is used to decorate API that AsmJit exports when built as a shared library.
|
|
271
|
+
|
|
272
|
+
// API (Export / Import).
|
|
273
|
+
#if !defined(ASMJIT_STATIC)
|
|
274
|
+
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
|
|
275
|
+
#ifdef ASMJIT_EXPORTS
|
|
276
|
+
#define ASMJIT_API __declspec(dllexport)
|
|
277
|
+
#else
|
|
278
|
+
#define ASMJIT_API __declspec(dllimport)
|
|
279
|
+
#endif
|
|
280
|
+
#elif defined(_WIN32) && defined(__GNUC__)
|
|
281
|
+
#ifdef ASMJIT_EXPORTS
|
|
282
|
+
#define ASMJIT_API __attribute__((__dllexport__))
|
|
283
|
+
#else
|
|
284
|
+
#define ASMJIT_API __attribute__((__dllimport__))
|
|
285
|
+
#endif
|
|
286
|
+
#elif defined(__GNUC__)
|
|
287
|
+
#define ASMJIT_API __attribute__((__visibility__("default")))
|
|
288
|
+
#endif
|
|
289
|
+
#endif
|
|
290
|
+
|
|
291
|
+
#if !defined(ASMJIT_API)
|
|
292
|
+
#define ASMJIT_API
|
|
293
|
+
#endif
|
|
294
|
+
|
|
295
|
+
#if !defined(ASMJIT_VARAPI)
|
|
296
|
+
#define ASMJIT_VARAPI extern ASMJIT_API
|
|
297
|
+
#endif
|
|
298
|
+
|
|
299
|
+
//! \def ASMJIT_VIRTAPI
|
|
300
|
+
//!
|
|
301
|
+
//! This is basically a workaround. When using MSVC and marking class as DLL export everything gets exported, which
|
|
302
|
+
//! is unwanted in most projects. MSVC automatically exports typeinfo and vtable if at least one symbol of the class
|
|
303
|
+
//! is exported. However, GCC has some strange behavior that even if one or more symbol is exported it doesn't export
|
|
304
|
+
//! typeinfo unless the class itself is decorated with "visibility(default)" (i.e. ASMJIT_API).
|
|
305
|
+
#if !defined(_WIN32) && defined(__GNUC__)
|
|
306
|
+
#define ASMJIT_VIRTAPI ASMJIT_API
|
|
307
|
+
#else
|
|
308
|
+
#define ASMJIT_VIRTAPI
|
|
309
|
+
#endif
|
|
310
|
+
|
|
311
|
+
// Function attributes.
|
|
312
|
+
#if !defined(ASMJIT_BUILD_DEBUG) && defined(__GNUC__)
|
|
313
|
+
#define ASMJIT_FORCE_INLINE inline __attribute__((__always_inline__))
|
|
314
|
+
#elif !defined(ASMJIT_BUILD_DEBUG) && defined(_MSC_VER)
|
|
315
|
+
#define ASMJIT_FORCE_INLINE __forceinline
|
|
316
|
+
#else
|
|
317
|
+
#define ASMJIT_FORCE_INLINE inline
|
|
318
|
+
#endif
|
|
319
|
+
|
|
320
|
+
#if defined(__GNUC__)
|
|
321
|
+
#define ASMJIT_NOINLINE __attribute__((__noinline__))
|
|
322
|
+
#define ASMJIT_NORETURN __attribute__((__noreturn__))
|
|
323
|
+
#elif defined(_MSC_VER)
|
|
324
|
+
#define ASMJIT_NOINLINE __declspec(noinline)
|
|
325
|
+
#define ASMJIT_NORETURN __declspec(noreturn)
|
|
326
|
+
#else
|
|
327
|
+
#define ASMJIT_NOINLINE
|
|
328
|
+
#define ASMJIT_NORETURN
|
|
329
|
+
#endif
|
|
330
|
+
|
|
331
|
+
// Calling conventions.
|
|
332
|
+
#if ASMJIT_ARCH_X86 == 32 && defined(__GNUC__)
|
|
333
|
+
#define ASMJIT_CDECL __attribute__((__cdecl__))
|
|
334
|
+
#define ASMJIT_STDCALL __attribute__((__stdcall__))
|
|
335
|
+
#define ASMJIT_FASTCALL __attribute__((__fastcall__))
|
|
336
|
+
#define ASMJIT_REGPARM(N) __attribute__((__regparm__(N)))
|
|
337
|
+
#elif ASMJIT_ARCH_X86 == 32 && defined(_MSC_VER)
|
|
338
|
+
#define ASMJIT_CDECL __cdecl
|
|
339
|
+
#define ASMJIT_STDCALL __stdcall
|
|
340
|
+
#define ASMJIT_FASTCALL __fastcall
|
|
341
|
+
#define ASMJIT_REGPARM(N)
|
|
342
|
+
#else
|
|
343
|
+
#define ASMJIT_CDECL
|
|
344
|
+
#define ASMJIT_STDCALL
|
|
345
|
+
#define ASMJIT_FASTCALL
|
|
346
|
+
#define ASMJIT_REGPARM(N)
|
|
347
|
+
#endif
|
|
348
|
+
|
|
349
|
+
#if ASMJIT_ARCH_X86 && defined(_WIN32) && defined(_MSC_VER)
|
|
350
|
+
#define ASMJIT_VECTORCALL __vectorcall
|
|
351
|
+
#elif ASMJIT_ARCH_X86 && defined(_WIN32)
|
|
352
|
+
#define ASMJIT_VECTORCALL __attribute__((__vectorcall__))
|
|
353
|
+
#else
|
|
354
|
+
#define ASMJIT_VECTORCALL
|
|
355
|
+
#endif
|
|
356
|
+
|
|
357
|
+
// Type alignment (not allowed by C++11 'alignas' keyword).
|
|
358
|
+
#if defined(__GNUC__)
|
|
359
|
+
#define ASMJIT_ALIGN_TYPE(TYPE, N) __attribute__((__aligned__(N))) TYPE
|
|
360
|
+
#elif defined(_MSC_VER)
|
|
361
|
+
#define ASMJIT_ALIGN_TYPE(TYPE, N) __declspec(align(N)) TYPE
|
|
362
|
+
#else
|
|
363
|
+
#define ASMJIT_ALIGN_TYPE(TYPE, N) TYPE
|
|
364
|
+
#endif
|
|
365
|
+
|
|
366
|
+
//! \def ASMJIT_MAY_ALIAS
|
|
367
|
+
//!
|
|
368
|
+
//! Expands to `__attribute__((__may_alias__))` if supported.
|
|
369
|
+
#if defined(__GNUC__)
|
|
370
|
+
#define ASMJIT_MAY_ALIAS __attribute__((__may_alias__))
|
|
371
|
+
#else
|
|
372
|
+
#define ASMJIT_MAY_ALIAS
|
|
373
|
+
#endif
|
|
374
|
+
|
|
375
|
+
//! \def ASMJIT_MAYBE_UNUSED
|
|
376
|
+
//!
|
|
377
|
+
//! Expands to `[[maybe_unused]]` if supported or a compiler attribute instead.
|
|
378
|
+
#if __cplusplus >= 201703L
|
|
379
|
+
#define ASMJIT_MAYBE_UNUSED [[maybe_unused]]
|
|
380
|
+
#elif defined(__GNUC__)
|
|
381
|
+
#define ASMJIT_MAYBE_UNUSED __attribute__((unused))
|
|
382
|
+
#else
|
|
383
|
+
#define ASMJIT_MAYBE_UNUSED
|
|
384
|
+
#endif
|
|
385
|
+
|
|
386
|
+
#if defined(__clang_major__) && __clang_major__ >= 4 && !defined(_DOXYGEN)
|
|
387
|
+
// NOTE: Clang allows to apply this attribute to function arguments, which is what we want. Once GCC decides to
|
|
388
|
+
// support this use, we will enable it for GCC as well. However, until that, it will be clang only, which is
|
|
389
|
+
// what we need for static analysis.
|
|
390
|
+
#define ASMJIT_NONNULL(FUNCTION_ARGUMENT) FUNCTION_ARGUMENT __attribute__((__nonnull__))
|
|
391
|
+
#else
|
|
392
|
+
#define ASMJIT_NONNULL(FUNCTION_ARGUMENT) FUNCTION_ARGUMENT
|
|
393
|
+
#endif
|
|
394
|
+
|
|
395
|
+
//! \def ASMJIT_NOEXCEPT_TYPE
|
|
396
|
+
//!
|
|
397
|
+
//! Defined to `noexcept` in C++17 mode or nothing otherwise. Used by function typedefs.
|
|
398
|
+
#if __cplusplus >= 201703L
|
|
399
|
+
#define ASMJIT_NOEXCEPT_TYPE noexcept
|
|
400
|
+
#else
|
|
401
|
+
#define ASMJIT_NOEXCEPT_TYPE
|
|
402
|
+
#endif
|
|
403
|
+
|
|
404
|
+
//! \def ASMJIT_ASSUME(...)
|
|
405
|
+
//!
|
|
406
|
+
//! Macro that tells the C/C++ compiler that the expression `...` evaluates to true.
|
|
407
|
+
//!
|
|
408
|
+
//! This macro has two purposes:
|
|
409
|
+
//!
|
|
410
|
+
//! 1. Enable optimizations that would not be possible without the assumption.
|
|
411
|
+
//! 2. Hint static analysis tools that a certain condition is true to prevent false positives.
|
|
412
|
+
#if defined(__clang__)
|
|
413
|
+
#define ASMJIT_ASSUME(...) __builtin_assume(__VA_ARGS__)
|
|
414
|
+
#elif defined(__GNUC__)
|
|
415
|
+
#define ASMJIT_ASSUME(...) do { if (!(__VA_ARGS__)) __builtin_unreachable(); } while (0)
|
|
416
|
+
#elif defined(_MSC_VER)
|
|
417
|
+
#define ASMJIT_ASSUME(...) __assume(__VA_ARGS__)
|
|
418
|
+
#else
|
|
419
|
+
#define ASMJIT_ASSUME(...) (void)0
|
|
420
|
+
#endif
|
|
421
|
+
|
|
422
|
+
//! \def ASMJIT_LIKELY(...)
|
|
423
|
+
//!
|
|
424
|
+
//! Condition is likely to be taken (mostly error handling and edge cases).
|
|
425
|
+
|
|
426
|
+
//! \def ASMJIT_UNLIKELY(...)
|
|
427
|
+
//!
|
|
428
|
+
//! Condition is unlikely to be taken (mostly error handling and edge cases).
|
|
429
|
+
#if defined(__GNUC__)
|
|
430
|
+
#define ASMJIT_LIKELY(...) __builtin_expect(!!(__VA_ARGS__), 1)
|
|
431
|
+
#define ASMJIT_UNLIKELY(...) __builtin_expect(!!(__VA_ARGS__), 0)
|
|
432
|
+
#else
|
|
433
|
+
#define ASMJIT_LIKELY(...) (__VA_ARGS__)
|
|
434
|
+
#define ASMJIT_UNLIKELY(...) (__VA_ARGS__)
|
|
435
|
+
#endif
|
|
436
|
+
|
|
437
|
+
//! \def ASMJIT_FALLTHROUGH
|
|
438
|
+
//!
|
|
439
|
+
//! Portable [[fallthrough]] attribute.
|
|
440
|
+
#if defined(__clang__) && __cplusplus >= 201103L
|
|
441
|
+
#define ASMJIT_FALLTHROUGH [[clang::fallthrough]]
|
|
442
|
+
#elif defined(__GNUC__) && __GNUC__ >= 7
|
|
443
|
+
#define ASMJIT_FALLTHROUGH __attribute__((__fallthrough__))
|
|
444
|
+
#else
|
|
445
|
+
#define ASMJIT_FALLTHROUGH ((void)0) /* fallthrough */
|
|
446
|
+
#endif
|
|
447
|
+
|
|
448
|
+
//! \def ASMJIT_DEPRECATED
|
|
449
|
+
//!
|
|
450
|
+
//! Marks function, class, struct, enum, or anything else as deprecated.
|
|
451
|
+
#if defined(__GNUC__)
|
|
452
|
+
#define ASMJIT_DEPRECATED(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
|
|
453
|
+
#if defined(__clang__)
|
|
454
|
+
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
|
|
455
|
+
#else
|
|
456
|
+
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */
|
|
457
|
+
#endif
|
|
458
|
+
#elif defined(_MSC_VER)
|
|
459
|
+
#define ASMJIT_DEPRECATED(MESSAGE) __declspec(deprecated(MESSAGE))
|
|
460
|
+
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */
|
|
461
|
+
#else
|
|
462
|
+
#define ASMJIT_DEPRECATED(MESSAGE)
|
|
463
|
+
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE)
|
|
464
|
+
#endif
|
|
465
|
+
|
|
466
|
+
// Utilities.
|
|
467
|
+
#define ASMJIT_OFFSET_OF(STRUCT, MEMBER) ((int)(intptr_t)((const char*)&((const STRUCT*)0x100)->MEMBER) - 0x100)
|
|
468
|
+
#define ASMJIT_ARRAY_SIZE(X) uint32_t(sizeof(X) / sizeof(X[0]))
|
|
469
|
+
|
|
470
|
+
#if ASMJIT_CXX_HAS_ATTRIBUTE(no_sanitize, 0)
|
|
471
|
+
#define ASMJIT_ATTRIBUTE_NO_SANITIZE_UNDEF __attribute__((__no_sanitize__("undefined")))
|
|
472
|
+
#elif ASMJIT_CXX_GNU >= ASMJIT_CXX_MAKE_VER(4, 9)
|
|
473
|
+
#define ASMJIT_ATTRIBUTE_NO_SANITIZE_UNDEF __attribute__((__no_sanitize_undefined__))
|
|
474
|
+
#else
|
|
475
|
+
#define ASMJIT_ATTRIBUTE_NO_SANITIZE_UNDEF
|
|
476
|
+
#endif
|
|
477
|
+
|
|
478
|
+
// Begin-Namespace & End-Namespace Macros
|
|
479
|
+
// ======================================
|
|
480
|
+
|
|
481
|
+
#if defined _DOXYGEN
|
|
482
|
+
#define ASMJIT_BEGIN_NAMESPACE namespace asmjit {
|
|
483
|
+
#define ASMJIT_END_NAMESPACE }
|
|
484
|
+
#elif defined(__clang__)
|
|
485
|
+
#define ASMJIT_BEGIN_NAMESPACE \
|
|
486
|
+
namespace asmjit { inline namespace ASMJIT_ABI_NAMESPACE { \
|
|
487
|
+
_Pragma("clang diagnostic push") \
|
|
488
|
+
_Pragma("clang diagnostic ignored \"-Wconstant-logical-operand\"") \
|
|
489
|
+
_Pragma("clang diagnostic ignored \"-Wunnamed-type-template-args\"")
|
|
490
|
+
#define ASMJIT_END_NAMESPACE \
|
|
491
|
+
_Pragma("clang diagnostic pop") \
|
|
492
|
+
}}
|
|
493
|
+
#elif defined(__GNUC__) && __GNUC__ == 4
|
|
494
|
+
#define ASMJIT_BEGIN_NAMESPACE \
|
|
495
|
+
namespace asmjit { inline namespace ASMJIT_ABI_NAMESPACE { \
|
|
496
|
+
_Pragma("GCC diagnostic push") \
|
|
497
|
+
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"")
|
|
498
|
+
#define ASMJIT_END_NAMESPACE \
|
|
499
|
+
_Pragma("GCC diagnostic pop") \
|
|
500
|
+
}}
|
|
501
|
+
#elif defined(__GNUC__) && __GNUC__ >= 8
|
|
502
|
+
#define ASMJIT_BEGIN_NAMESPACE \
|
|
503
|
+
namespace asmjit { inline namespace ASMJIT_ABI_NAMESPACE { \
|
|
504
|
+
_Pragma("GCC diagnostic push") \
|
|
505
|
+
_Pragma("GCC diagnostic ignored \"-Wclass-memaccess\"")
|
|
506
|
+
#define ASMJIT_END_NAMESPACE \
|
|
507
|
+
_Pragma("GCC diagnostic pop") \
|
|
508
|
+
}}
|
|
509
|
+
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
|
510
|
+
#define ASMJIT_BEGIN_NAMESPACE \
|
|
511
|
+
namespace asmjit { inline namespace ASMJIT_ABI_NAMESPACE { \
|
|
512
|
+
__pragma(warning(push)) \
|
|
513
|
+
__pragma(warning(disable: 4127)) /* conditional expression is const */ \
|
|
514
|
+
__pragma(warning(disable: 4201)) /* nameless struct/union */
|
|
515
|
+
#define ASMJIT_END_NAMESPACE \
|
|
516
|
+
__pragma(warning(pop)) \
|
|
517
|
+
}}
|
|
518
|
+
#endif
|
|
519
|
+
|
|
520
|
+
#if !defined(ASMJIT_BEGIN_NAMESPACE) && !defined(ASMJIT_END_NAMESPACE)
|
|
521
|
+
#define ASMJIT_BEGIN_NAMESPACE namespace asmjit { inline namespace ASMJIT_ABI_NAMESPACE {
|
|
522
|
+
#define ASMJIT_END_NAMESPACE }}
|
|
523
|
+
#endif
|
|
524
|
+
|
|
525
|
+
#define ASMJIT_BEGIN_SUB_NAMESPACE(NAMESPACE) \
|
|
526
|
+
ASMJIT_BEGIN_NAMESPACE \
|
|
527
|
+
namespace NAMESPACE {
|
|
528
|
+
|
|
529
|
+
#define ASMJIT_END_SUB_NAMESPACE \
|
|
530
|
+
} \
|
|
531
|
+
ASMJIT_END_NAMESPACE
|
|
532
|
+
|
|
533
|
+
// C++ Utilities
|
|
534
|
+
// =============
|
|
535
|
+
|
|
536
|
+
#define ASMJIT_NONCOPYABLE(Type) \
|
|
537
|
+
Type(const Type& other) = delete; \
|
|
538
|
+
Type& operator=(const Type& other) = delete;
|
|
539
|
+
|
|
540
|
+
#define ASMJIT_NONCONSTRUCTIBLE(Type) \
|
|
541
|
+
Type() = delete; \
|
|
542
|
+
Type(const Type& other) = delete; \
|
|
543
|
+
Type& operator=(const Type& other) = delete;
|
|
544
|
+
|
|
545
|
+
//! \def ASMJIT_DEFINE_ENUM_FLAGS(T)
|
|
546
|
+
//!
|
|
547
|
+
//! Defines bit operations for enumeration flags.
|
|
548
|
+
#ifdef _DOXYGEN
|
|
549
|
+
#define ASMJIT_DEFINE_ENUM_FLAGS(T)
|
|
550
|
+
#else
|
|
551
|
+
#define ASMJIT_DEFINE_ENUM_FLAGS(T) \
|
|
552
|
+
static ASMJIT_FORCE_INLINE constexpr T operator~(T a) noexcept { \
|
|
553
|
+
return T(~(std::underlying_type<T>::type)(a)); \
|
|
554
|
+
} \
|
|
555
|
+
\
|
|
556
|
+
static ASMJIT_FORCE_INLINE constexpr T operator|(T a, T b) noexcept { \
|
|
557
|
+
return T((std::underlying_type<T>::type)(a) | \
|
|
558
|
+
(std::underlying_type<T>::type)(b)); \
|
|
559
|
+
} \
|
|
560
|
+
static ASMJIT_FORCE_INLINE constexpr T operator&(T a, T b) noexcept { \
|
|
561
|
+
return T((std::underlying_type<T>::type)(a) & \
|
|
562
|
+
(std::underlying_type<T>::type)(b)); \
|
|
563
|
+
} \
|
|
564
|
+
static ASMJIT_FORCE_INLINE constexpr T operator^(T a, T b) noexcept { \
|
|
565
|
+
return T((std::underlying_type<T>::type)(a) ^ \
|
|
566
|
+
(std::underlying_type<T>::type)(b)); \
|
|
567
|
+
} \
|
|
568
|
+
\
|
|
569
|
+
static ASMJIT_FORCE_INLINE T& operator|=(T& a, T b) noexcept { \
|
|
570
|
+
a = T((std::underlying_type<T>::type)(a) | \
|
|
571
|
+
(std::underlying_type<T>::type)(b)); \
|
|
572
|
+
return a; \
|
|
573
|
+
} \
|
|
574
|
+
static ASMJIT_FORCE_INLINE T& operator&=(T& a, T b) noexcept { \
|
|
575
|
+
a = T((std::underlying_type<T>::type)(a) & \
|
|
576
|
+
(std::underlying_type<T>::type)(b)); \
|
|
577
|
+
return a; \
|
|
578
|
+
} \
|
|
579
|
+
static ASMJIT_FORCE_INLINE T& operator^=(T& a, T b) noexcept { \
|
|
580
|
+
a = T((std::underlying_type<T>::type)(a) ^ \
|
|
581
|
+
(std::underlying_type<T>::type)(b)); \
|
|
582
|
+
return a; \
|
|
583
|
+
}
|
|
584
|
+
#endif
|
|
585
|
+
|
|
586
|
+
//! \def ASMJIT_DEFINE_ENUM_COMPARE(T)
|
|
587
|
+
//!
|
|
588
|
+
//! Defines comparison operations for enumeration flags.
|
|
589
|
+
#ifdef _DOXYGEN
|
|
590
|
+
#define ASMJIT_DEFINE_ENUM_COMPARE(T)
|
|
591
|
+
#else
|
|
592
|
+
#define ASMJIT_DEFINE_ENUM_COMPARE(T) \
|
|
593
|
+
static ASMJIT_FORCE_INLINE bool operator<(T a, T b) noexcept { \
|
|
594
|
+
return (std::underlying_type<T>::type)(a) < (std::underlying_type<T>::type)(b); \
|
|
595
|
+
} \
|
|
596
|
+
static ASMJIT_FORCE_INLINE bool operator<=(T a, T b) noexcept { \
|
|
597
|
+
return (std::underlying_type<T>::type)(a) <= (std::underlying_type<T>::type)(b); \
|
|
598
|
+
} \
|
|
599
|
+
static ASMJIT_FORCE_INLINE bool operator>(T a, T b) noexcept { \
|
|
600
|
+
return (std::underlying_type<T>::type)(a) > (std::underlying_type<T>::type)(b); \
|
|
601
|
+
} \
|
|
602
|
+
static ASMJIT_FORCE_INLINE bool operator>=(T a, T b) noexcept { \
|
|
603
|
+
return (std::underlying_type<T>::type)(a) >= (std::underlying_type<T>::type)(b); \
|
|
604
|
+
}
|
|
605
|
+
#endif
|
|
606
|
+
|
|
607
|
+
// Cleanup Api-Config Specific Macros
|
|
608
|
+
// ==================================
|
|
609
|
+
|
|
610
|
+
#undef ASMJIT_CXX_GNU
|
|
611
|
+
#undef ASMJIT_CXX_MAKE_VER
|
|
612
|
+
|
|
613
|
+
#endif // ASMJIT_CORE_API_CONFIG_H_INCLUDED
|