summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asmjit/src/asmjit/core/inst.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asmjit/src/asmjit/core/inst.cpp')
-rw-r--r--3rdparty/asmjit/src/asmjit/core/inst.cpp118
1 files changed, 48 insertions, 70 deletions
diff --git a/3rdparty/asmjit/src/asmjit/core/inst.cpp b/3rdparty/asmjit/src/asmjit/core/inst.cpp
index a233b9383bf..ade4ae001f2 100644
--- a/3rdparty/asmjit/src/asmjit/core/inst.cpp
+++ b/3rdparty/asmjit/src/asmjit/core/inst.cpp
@@ -1,133 +1,113 @@
-// AsmJit - Machine code generation for C++
+// This file is part of AsmJit project <https://asmjit.com>
//
-// * Official AsmJit Home Page: https://asmjit.com
-// * Official Github Repository: https://github.com/asmjit/asmjit
-//
-// Copyright (c) 2008-2020 The AsmJit Authors
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-// claim that you wrote the original software. If you use this software
-// in a product, an acknowledgment in the product documentation would be
-// appreciated but is not required.
-// 2. Altered source versions must be plainly marked as such, and must not be
-// misrepresented as being the original software.
-// 3. This notice may not be removed or altered from any source distribution.
+// See asmjit.h or LICENSE.md for license and copyright information
+// SPDX-License-Identifier: Zlib
#include "../core/api-build_p.h"
-#ifdef ASMJIT_BUILD_X86
-
-#include "../core/arch.h"
+#include "../core/archtraits.h"
#include "../core/inst.h"
-#ifdef ASMJIT_BUILD_X86
+#if !defined(ASMJIT_NO_X86)
#include "../x86/x86instapi_p.h"
#endif
-#ifdef ASMJIT_BUILD_ARM
- #include "../arm/arminstapi_p.h"
+#if !defined(ASMJIT_NO_AARCH64)
+ #include "../arm/a64instapi_p.h"
#endif
ASMJIT_BEGIN_NAMESPACE
-// ============================================================================
-// [asmjit::InstAPI - Text]
-// ============================================================================
+// InstAPI - InstId <-> String
+// ===========================
#ifndef ASMJIT_NO_TEXT
-Error InstAPI::instIdToString(uint32_t arch, uint32_t instId, String& output) noexcept {
-#ifdef ASMJIT_BUILD_X86
+Error InstAPI::instIdToString(Arch arch, InstId instId, String& output) noexcept {
+#if !defined(ASMJIT_NO_X86)
if (Environment::isFamilyX86(arch))
- return x86::InstInternal::instIdToString(arch, instId, output);
+ return x86::InstInternal::instIdToString(instId, output);
#endif
-#ifdef ASMJIT_BUILD_ARM
- if (Environment::isFamilyARM(arch))
- return arm::InstInternal::instIdToString(arch, instId, output);
+#if !defined(ASMJIT_NO_AARCH64)
+ if (Environment::isFamilyAArch64(arch))
+ return a64::InstInternal::instIdToString(instId, output);
#endif
return DebugUtils::errored(kErrorInvalidArch);
}
-uint32_t InstAPI::stringToInstId(uint32_t arch, const char* s, size_t len) noexcept {
-#ifdef ASMJIT_BUILD_X86
+InstId InstAPI::stringToInstId(Arch arch, const char* s, size_t len) noexcept {
+#if !defined(ASMJIT_NO_X86)
if (Environment::isFamilyX86(arch))
- return x86::InstInternal::stringToInstId(arch, s, len);
+ return x86::InstInternal::stringToInstId(s, len);
#endif
-#ifdef ASMJIT_BUILD_ARM
- if (Environment::isFamilyARM(arch))
- return arm::InstInternal::stringToInstId(arch, s, len);
+#if !defined(ASMJIT_NO_AARCH64)
+ if (Environment::isFamilyAArch64(arch))
+ return a64::InstInternal::stringToInstId(s, len);
#endif
return 0;
}
#endif // !ASMJIT_NO_TEXT
-// ============================================================================
-// [asmjit::InstAPI - Validate]
-// ============================================================================
+// InstAPI - Validate
+// ==================
#ifndef ASMJIT_NO_VALIDATION
-Error InstAPI::validate(uint32_t arch, const BaseInst& inst, const Operand_* operands, size_t opCount, uint32_t validationFlags) noexcept {
-#ifdef ASMJIT_BUILD_X86
- if (Environment::isFamilyX86(arch))
- return x86::InstInternal::validate(arch, inst, operands, opCount, validationFlags);
+Error InstAPI::validate(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, ValidationFlags validationFlags) noexcept {
+#if !defined(ASMJIT_NO_X86)
+ if (Environment::isFamilyX86(arch)) {
+ if (arch == Arch::kX86)
+ return x86::InstInternal::validateX86(inst, operands, opCount, validationFlags);
+ else
+ return x86::InstInternal::validateX64(inst, operands, opCount, validationFlags);
+ }
#endif
-#ifdef ASMJIT_BUILD_ARM
- if (Environment::isFamilyARM(arch))
- return arm::InstInternal::validate(arch, inst, operands, opCount, validationFlags);
+#if !defined(ASMJIT_NO_AARCH64)
+ if (Environment::isFamilyAArch64(arch))
+ return a64::InstInternal::validate(inst, operands, opCount, validationFlags);
#endif
return DebugUtils::errored(kErrorInvalidArch);
}
#endif // !ASMJIT_NO_VALIDATION
-// ============================================================================
-// [asmjit::InstAPI - QueryRWInfo]
-// ============================================================================
+// InstAPI - QueryRWInfo
+// =====================
#ifndef ASMJIT_NO_INTROSPECTION
-Error InstAPI::queryRWInfo(uint32_t arch, const BaseInst& inst, const Operand_* operands, size_t opCount, InstRWInfo* out) noexcept {
+Error InstAPI::queryRWInfo(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, InstRWInfo* out) noexcept {
if (ASMJIT_UNLIKELY(opCount > Globals::kMaxOpCount))
return DebugUtils::errored(kErrorInvalidArgument);
-#ifdef ASMJIT_BUILD_X86
+#if !defined(ASMJIT_NO_X86)
if (Environment::isFamilyX86(arch))
return x86::InstInternal::queryRWInfo(arch, inst, operands, opCount, out);
#endif
-#ifdef ASMJIT_BUILD_ARM
- if (Environment::isFamilyARM(arch))
- return arm::InstInternal::queryRWInfo(arch, inst, operands, opCount, out);
+#if !defined(ASMJIT_NO_AARCH64)
+ if (Environment::isFamilyAArch64(arch))
+ return a64::InstInternal::queryRWInfo(inst, operands, opCount, out);
#endif
return DebugUtils::errored(kErrorInvalidArch);
}
#endif // !ASMJIT_NO_INTROSPECTION
-// ============================================================================
-// [asmjit::InstAPI - QueryFeatures]
-// ============================================================================
+// InstAPI - QueryFeatures
+// =======================
#ifndef ASMJIT_NO_INTROSPECTION
-Error InstAPI::queryFeatures(uint32_t arch, const BaseInst& inst, const Operand_* operands, size_t opCount, BaseFeatures* out) noexcept {
-#ifdef ASMJIT_BUILD_X86
+Error InstAPI::queryFeatures(Arch arch, const BaseInst& inst, const Operand_* operands, size_t opCount, CpuFeatures* out) noexcept {
+#if !defined(ASMJIT_NO_X86)
if (Environment::isFamilyX86(arch))
return x86::InstInternal::queryFeatures(arch, inst, operands, opCount, out);
#endif
-#ifdef ASMJIT_BUILD_ARM
- if (Environment::isFamilyARM(arch))
- return arm::InstInternal::queryFeatures(arch, inst, operands, opCount, out);
+#if !defined(ASMJIT_NO_AARCH64)
+ if (Environment::isFamilyAArch64(arch))
+ return a64::InstInternal::queryFeatures(inst, operands, opCount, out);
#endif
return DebugUtils::errored(kErrorInvalidArch);
@@ -135,5 +115,3 @@ Error InstAPI::queryFeatures(uint32_t arch, const BaseInst& inst, const Operand_
#endif // !ASMJIT_NO_INTROSPECTION
ASMJIT_END_NAMESPACE
-
-#endif // ASMJIT_BUILD_X86