[ABI] Refactored AsmJit to use strong-typed enums, this breaks both API and ABI

[ABI] Added ABI version as an inline namespace, which forms asmjit::_abi_MAJOR_MINOR
[ABI] Added support for AVX512_FP16, 16-bit broadcast, and AVX512_FP16 tests
[ABI] Added initial support for consecutive registers into instruction database and register allocator
[ABI] Added a possibility to use temporary memory in CodeHolder's zone
[ABI] Compiler::setArg() is now deprecated, use FuncNode::setArg()
[Bug] Fixed correct RW information of instructions that only support implicit zeroing with {k}
[Bug] Fixed broadcast to be able to broadcast bcst16 operands
This commit is contained in:
kobalicek
2021-12-13 09:11:58 +01:00
parent 4ec760a3d1
commit 996deae327
154 changed files with 29537 additions and 21190 deletions

View File

@@ -1,25 +1,7 @@
// 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
// ----------------------------------------------------------------------------
// This is a working example that demonstrates how multiple sections can be
@@ -58,12 +40,12 @@ static void fail(const char* message, Error err) {
int main() {
printf("AsmJit X86 Sections Test\n\n");
Environment env = hostEnvironment();
Environment env = Environment::host();
JitAllocator allocator;
#ifndef ASMJIT_NO_LOGGING
FileLogger logger(stdout);
logger.setIndentation(FormatOptions::kIndentationCode, 2);
logger.setIndentation(FormatIndentationGroup::kCode, 2);
#endif
CodeHolder code;
@@ -74,7 +56,7 @@ int main() {
#endif
Section* dataSection;
Error err = code.newSection(&dataSection, ".data", SIZE_MAX, 0, 8);
Error err = code.newSection(&dataSection, ".data", SIZE_MAX, SectionFlags::kNone, 8);
if (err) {
fail("Failed to create a .data section", err);
@@ -88,7 +70,7 @@ int main() {
Label data = a.newLabel();
FuncDetail func;
func.init(FuncSignatureT<size_t, size_t>(CallConv::kIdHost), code.environment());
func.init(FuncSignatureT<size_t, size_t>(CallConvId::kHost), code.environment());
FuncFrame frame;
frame.init(func);
@@ -145,14 +127,14 @@ int main() {
}
// Allocate memory for the function and relocate it there.
void* roPtr;
void* rxPtr;
void* rwPtr;
err = allocator.alloc(&roPtr, &rwPtr, codeSize);
err = allocator.alloc(&rxPtr, &rwPtr, codeSize);
if (err)
fail("Failed to allocate executable memory", err);
// Relocate to the base-address of the allocated memory.
code.relocateToBase(uint64_t(uintptr_t(roPtr)));
code.relocateToBase(uint64_t(uintptr_t(rxPtr)));
// Copy the flattened code into `mem.rw`. There are two ways. You can either copy
// everything manually by iterating over all sections or use `copyFlattenedData`.
@@ -162,7 +144,7 @@ int main() {
// Execute the function and test whether it works.
typedef size_t (*Func)(size_t idx);
Func fn = (Func)roPtr;
Func fn = (Func)rxPtr;
printf("\n");
if (fn(0) != dataArray[0] ||