diff options
author | 2022-02-11 17:16:46 +0700 | |
---|---|---|
committer | 2022-02-13 21:26:55 +0700 | |
commit | 1fba2b4f2c27a2f4162855056f9765ee79db31e9 (patch) | |
tree | f98b63565a8b12895b0bb057c0790b88b11a7b2e /3rdparty/asmjit/test/asmjit_test_unit.cpp | |
parent | 3a7e08d47d4e1b0e075360e19be1763d9b29f557 (diff) |
asmjit: sync with upstream
Diffstat (limited to '3rdparty/asmjit/test/asmjit_test_unit.cpp')
-rw-r--r-- | 3rdparty/asmjit/test/asmjit_test_unit.cpp | 90 |
1 files changed, 23 insertions, 67 deletions
diff --git a/3rdparty/asmjit/test/asmjit_test_unit.cpp b/3rdparty/asmjit/test/asmjit_test_unit.cpp index 3aac7401e17..5658ebc1d60 100644 --- a/3rdparty/asmjit/test/asmjit_test_unit.cpp +++ b/3rdparty/asmjit/test/asmjit_test_unit.cpp @@ -1,61 +1,26 @@ -// 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 <asmjit/asmjit.h> -#include "./broken.h" +#include <asmjit/core.h> -using namespace asmjit; +#if !defined(ASMJIT_NO_X86) +#include <asmjit/x86.h> +#endif -// ============================================================================ -// [DumpCpu] -// ============================================================================ - -struct DumpCpuFeature { - uint32_t feature; - const char* name; -}; - -static const char* archToString(uint32_t arch) noexcept { - switch (arch & ~Environment::kArchBigEndianMask) { - case Environment::kArchX86 : return "X86"; - case Environment::kArchX64 : return "X64"; - case Environment::kArchARM : return "ARM"; - case Environment::kArchThumb : return "Thumb"; - case Environment::kArchAArch64 : return "AArch64"; - case Environment::kArchMIPS_LE : return "MIPS"; - case Environment::kArchMIPS64_LE: return "MIPS64"; - default: return "Unknown"; - } -} +#include "asmjitutils.h" +#include "broken.h" + +using namespace asmjit; static void dumpCpu(void) noexcept { const CpuInfo& cpu = CpuInfo::host(); - // -------------------------------------------------------------------------- - // [CPU Information] - // -------------------------------------------------------------------------- + // CPU Information + // --------------- - INFO("Host CPU:"); + INFO("CPU Info:"); INFO(" Vendor : %s", cpu.vendor()); INFO(" Brand : %s", cpu.brand()); INFO(" Model ID : %u", cpu.modelId()); @@ -68,13 +33,12 @@ static void dumpCpu(void) noexcept { INFO(" HW-Thread Count : %u", cpu.hwThreadCount()); INFO(""); - // -------------------------------------------------------------------------- - // [CPU Features] - // -------------------------------------------------------------------------- + // CPU Features + // ------------ #ifndef ASMJIT_NO_LOGGING INFO("CPU Features:"); - BaseFeatures::Iterator it(cpu.features().iterator()); + CpuFeatures::Iterator it(cpu.features().iterator()); while (it.hasNext()) { uint32_t featureId = uint32_t(it.next()); StringTmp<64> featureString; @@ -85,10 +49,6 @@ static void dumpCpu(void) noexcept { #endif // !ASMJIT_NO_LOGGING } -// ============================================================================ -// [DumpSizeOf] -// ============================================================================ - #define DUMP_TYPE(...) \ INFO(" %-26s: %u", #__VA_ARGS__, uint32_t(sizeof(__VA_ARGS__))) @@ -144,7 +104,7 @@ static void dumpSizeOf(void) noexcept { DUMP_TYPE(FuncArgsAssignment); INFO(""); -#ifndef ASMJIT_NO_BUILDER +#if !defined(ASMJIT_NO_BUILDER) INFO("Size of builder classes:"); DUMP_TYPE(BaseBuilder); DUMP_TYPE(BaseNode); @@ -160,7 +120,7 @@ static void dumpSizeOf(void) noexcept { INFO(""); #endif -#ifndef ASMJIT_NO_COMPILER +#if !defined(ASMJIT_NO_COMPILER) INFO("Size of compiler classes:"); DUMP_TYPE(BaseCompiler); DUMP_TYPE(FuncNode); @@ -169,13 +129,13 @@ static void dumpSizeOf(void) noexcept { INFO(""); #endif -#ifdef ASMJIT_BUILD_X86 +#if !defined(ASMJIT_NO_X86) INFO("Size of x86-specific classes:"); DUMP_TYPE(x86::Assembler); - #ifndef ASMJIT_NO_BUILDER + #if !defined(ASMJIT_NO_BUILDER) DUMP_TYPE(x86::Builder); #endif - #ifndef ASMJIT_NO_COMPILER + #if !defined(ASMJIT_NO_COMPILER) DUMP_TYPE(x86::Compiler); #endif DUMP_TYPE(x86::InstDB::InstInfo); @@ -188,10 +148,6 @@ static void dumpSizeOf(void) noexcept { #undef DUMP_TYPE -// ============================================================================ -// [Main] -// ============================================================================ - static void onBeforeRun(void) noexcept { dumpCpu(); dumpSizeOf(); @@ -208,7 +164,7 @@ int main(int argc, const char* argv[]) { unsigned((ASMJIT_LIBRARY_VERSION >> 16) ), unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF), unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF), - archToString(Environment::kArchHost), + asmjitArchAsString(Arch::kHost), buildType ); |