mirror of
https://github.com/libretro/mame.git
synced 2026-11-07 12:28:03 -10:00
Merge branch '0288-bonus'
This commit is contained in:
commit
afc5e47a90
2559 files changed
+125177
-81804
No files matched your search
Vendored
-2
@@ -58,8 +58,6 @@ pugixml - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
|
||||
|
||||
rapidjson - [The MIT License (MIT)](http://opensource.org/licenses/MIT), [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause) (msinttypes), JSON license (JSON_checker)
|
||||
|
||||
softfloat - ["Softfloat 2b" U.C. Berkeley modified license](https://github.com/mamedev/mame/blob/master/3rdparty/softfloat/README.txt) MIT compatible
|
||||
|
||||
softfloat3 - [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
|
||||
|
||||
sol2 - [The MIT License (MIT)](http://opensource.org/licenses/MIT)
|
||||
|
||||
Vendored
+424
-471
File diff suppressed because it is too large.
Load diff
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"version": 10,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "conf-base",
|
||||
"hidden": true,
|
||||
"description": "${presetName}",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" }
|
||||
},
|
||||
|
||||
{
|
||||
"name": "conf-debug",
|
||||
"hidden": true,
|
||||
"inherits": "conf-base",
|
||||
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
|
||||
},
|
||||
|
||||
{
|
||||
"name": "conf-release",
|
||||
"hidden": true,
|
||||
"inherits": "conf-base",
|
||||
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON" }
|
||||
},
|
||||
|
||||
{ "name": "conf-test" , "hidden": true, "cacheVariables": { "ASMJIT_TEST": "ON" } },
|
||||
{ "name": "conf-static" , "hidden": true, "cacheVariables": { "ASMJIT_STATIC": "ON" } },
|
||||
{ "name": "conf-shared" , "hidden": true, "cacheVariables": { "ASMJIT_STATIC": "OFF" } },
|
||||
{ "name": "conf-asan" , "hidden": true, "cacheVariables": { "ASMJIT_SANITIZE": "address" } },
|
||||
{ "name": "conf-msan" , "hidden": true, "cacheVariables": { "ASMJIT_SANITIZE": "memory" } },
|
||||
{ "name": "conf-tsan" , "hidden": true, "cacheVariables": { "ASMJIT_SANITIZE": "thread" } },
|
||||
{ "name": "conf-ubsan" , "hidden": true, "cacheVariables": { "ASMJIT_SANITIZE": "undefined" } },
|
||||
{ "name": "conf-32" , "hidden": true, "environment": { "CFLAGS": "-m32", "CXXFLAGS": "-m32" } },
|
||||
{ "name": "conf-avx2" , "hidden": true, "environment": { "CXXFLAGS": "-mavx2 -mbmi -mbmi2" } },
|
||||
|
||||
{ "name": "debug" , "inherits": ["conf-debug", "conf-test", "conf-static"] },
|
||||
{ "name": "debug-asan" , "inherits": ["conf-debug", "conf-test", "conf-static", "conf-asan"] },
|
||||
{ "name": "debug-msan" , "inherits": ["conf-debug", "conf-test", "conf-static", "conf-msan"] },
|
||||
{ "name": "debug-ubsan" , "inherits": ["conf-debug", "conf-test", "conf-static", "conf-ubsan"] },
|
||||
{ "name": "debug-32" , "inherits": ["conf-debug", "conf-test", "conf-static", "conf-32"] },
|
||||
{ "name": "debug-shared" , "inherits": ["conf-debug", "conf-test", "conf-shared"] },
|
||||
{ "name": "debug-shared-32" , "inherits": ["conf-debug", "conf-test", "conf-shared", "conf-32"] },
|
||||
|
||||
{ "name": "release" , "inherits": ["conf-release", "conf-test", "conf-static"] },
|
||||
{ "name": "release-avx2" , "inherits": ["conf-release", "conf-test", "conf-static", "conf-avx2"] },
|
||||
{ "name": "release-asan" , "inherits": ["conf-release", "conf-test", "conf-static", "conf-asan"] },
|
||||
{ "name": "release-msan" , "inherits": ["conf-release", "conf-test", "conf-static", "conf-msan"] },
|
||||
{ "name": "release-ubsan" , "inherits": ["conf-release", "conf-test", "conf-static", "conf-ubsan"] },
|
||||
{ "name": "release-32" , "inherits": ["conf-release", "conf-test", "conf-static", "conf-32"] },
|
||||
{ "name": "release-shared" , "inherits": ["conf-release", "conf-test", "conf-shared"] },
|
||||
{ "name": "release-shared-32", "inherits": ["conf-release", "conf-test", "conf-shared", "conf-32"] }
|
||||
]
|
||||
}
|
||||
Vendored
+12
-10
@@ -10,7 +10,7 @@
|
||||
|
||||
### Asking questions
|
||||
|
||||
* We prefer GitHub issues to be used for reporting bugs or feature requests, but it's still okay to ask questions there as well. However, please consider joining our [Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im) to ask questions; it has an active community that can quickly respond.
|
||||
* We prefer GitHub issues to be used for reporting bugs or feature requests, but it's still okay to ask questions there as well. However, please consider joining our [Public Chat](https://app.element.io/#/room/#asmjit:matrix.org) to ask questions; it has an active community that can quickly respond.
|
||||
|
||||
### Suggesting feature requests
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
### Suggesting a website content enhancement
|
||||
|
||||
* [AsmJit's website](https://asmjit.com) is also generated, but not from public sources at the moment. If you did find an issue on the website you can either use contact information on the [support page](https://asmjit.com/support.html) or to discuss the change on our [Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im). Alternatively, opening a regular issue is also okay.
|
||||
* [AsmJit's website](https://asmjit.com) is also generated, but not from public sources at the moment. If you did find an issue on the website you can either use contact information on the [support page](https://asmjit.com/support.html) or to discuss the change on our [Public Chat](https://app.element.io/#/room/#asmjit:matrix.org). Alternatively, opening a regular issue is also okay.
|
||||
|
||||
|
||||
## Coding Style & Consistency
|
||||
@@ -37,42 +37,44 @@
|
||||
|
||||
* Initially, AsmJit coding style was based on Google C++ Style Guide, but it has diverged from it.
|
||||
|
||||
* Include guards use `<PATH_TO_SRC>_H_INCLUDED` format.
|
||||
* Include guards use `ASMJIT_<...PATH...>_H_INCLUDED` format.
|
||||
|
||||
* `asmjit` namespace must be open by `ASMJIT_BEGIN_NAMESPACE` and closed by `ASMJIT_END_NAMESPACE`
|
||||
|
||||
* `asmjit::xxx` (backend specific) nested namespace must be open by `ASMJIT_BEGIN_SUB_NAMESPACE(xxx)` and closed by `ASMJIT_END_SUB_NAMESPACE`.
|
||||
|
||||
* Opening bracket is on the same line, like `struct Something {`, `if (condition) {`, etc...
|
||||
* Opening brackets are on the same line, like `struct Something {`, `if (condition) {`, etc...
|
||||
|
||||
* The code uses a soft limit of 120 characters per line (including documentation), but it's not enforced and it's okay to use more when it makes sense (for example defining tables, etc...).
|
||||
|
||||
* Since AsmJit doesn't use Exceptions nor RTTI the code cannot use containers provided by the C++ standard library. In general, we try to only use a bare minimum from the C++ standard library to make it viable to use AsmJit even in C code bases where JIT complier is implemented in C++ ([Erlang](https://www.erlang.org/) can be seen as a great example).
|
||||
* Since AsmJit doesn't use Exceptions nor RTTI the code cannot use containers provided by the C++ standard library. In general, we try to only use a bare minimum from the C++ standard library to make it viable to use AsmJit even in C code bases where JIT compiler is implemented in C++ ([Erlang](https://www.erlang.org/) can be seen as a great example).
|
||||
|
||||
* Please don't bring your own coding style preferences into the code base.
|
||||
|
||||
## Testing
|
||||
|
||||
* AsmJit uses a minimalist unit testing framework to write unit tests to avoid third-party dependencies.
|
||||
|
||||
* At the moment tests are in the same file as the implementation and are only compiled when `ASMJIT_TEST` macro is defined.
|
||||
* At the moment tests are in the same file as the implementation and are only compiled when `ASMJIT_TEST` macro is defined (will change in the future).
|
||||
|
||||
* Use `-DASMJIT_TEST=1` when invoking [CMake](https://cmake.org/) to compile AsmJit tests.
|
||||
|
||||
* Unit tests are compiled to a single `asmjit_test_unit[.exe]` executable.
|
||||
* Unit tests are compiled to a single `asmjit_test_runner[.exe]` executable.
|
||||
|
||||
* Other tests have their own executables based on what is tested.
|
||||
|
||||
* Always add assembler tests when adding new instructions, see [asmjit_test_assembler_x64.cpp](./test/asmjit_test_assembler_x64.cpp) and [asmjit_test_assembler_a64.cpp](./test/asmjit_test_assembler_a64.cpp) for more details.
|
||||
* Always add assembler tests when adding new instructions, see [asmjit_test_assembler_x64.cpp](./asmjit-testing/tests/asmjit_test_assembler_x64.cpp) and [asmjit_test_assembler_a64.cpp](./asmjit-testing/tests/asmjit_test_assembler_a64.cpp) for more details.
|
||||
|
||||
## Pull Request Messages
|
||||
|
||||
* If a change breaks ABI it must start with `[abi]` - this prefix has a precedence over anything else.
|
||||
|
||||
* If a change fixes a bug the message should should start with `[bug]`.
|
||||
|
||||
* If a change fixes or enhances documentation it should start with `[doc]`.
|
||||
|
||||
* If a change fixes or enhances our CI it should start with `[ci]`.
|
||||
|
||||
* If a change breaks ABI it must start with `[abi]`.
|
||||
|
||||
* Otherwise there is no suggested prefix.
|
||||
|
||||
## ABI Changes
|
||||
|
||||
Vendored
+29
-28
@@ -5,7 +5,7 @@ AsmJit is a library for low-latency machine code generation written in C++.
|
||||
|
||||
* [Official Home Page (asmjit.com)](https://asmjit.com)
|
||||
* [Official Repository (asmjit/asmjit)](https://github.com/asmjit/asmjit)
|
||||
* [Public Chat Channel](https://app.gitter.im/#/room/#asmjit:gitter.im)
|
||||
* [Public Chat Channel](https://app.element.io/#/room/#asmjit:matrix.org)
|
||||
* [Zlib License](./LICENSE.md)
|
||||
|
||||
See [asmjit.com](https://asmjit.com) page for more details, examples, and documentation.
|
||||
@@ -13,36 +13,37 @@ See [asmjit.com](https://asmjit.com) page for more details, examples, and docume
|
||||
Project Organization
|
||||
--------------------
|
||||
|
||||
* **`/`** - Project root
|
||||
* **src** - Source code
|
||||
* **asmjit** - Source code and headers (always point include path in here)
|
||||
* **core** - Core API, backend independent except relocations
|
||||
* **arm** - ARM specific API, designed to be common for both AArch32 and AArch64
|
||||
* **a64** - AArch64 specific API, used only by AArch64 backends
|
||||
* **x86** - X86 specific API, used only by X86 and X64 backends
|
||||
* **ujit** - Universal JIT API
|
||||
* **testing** - Unit tests, integration tests, and benchmarks (don't embed in your project)
|
||||
* **commons** - Common utilities shared between tests and benchmarks
|
||||
* **bench** - Benchmarks
|
||||
* **tests** - Unit tests and integration tests
|
||||
* **tools** - Tools used to re-regenerate generated files (instruction DB, enum strings)
|
||||
* **`/`** - Project root - project files and scripts, `include` path points here
|
||||
* **asmjit** - AsmJit source code and headers
|
||||
* **core** - Core API, backend independent except relocations
|
||||
* **support** - Support classes and functions
|
||||
* **arm** - ARM specific API, designed to be common for both AArch32 and AArch64
|
||||
* **a64** - AArch64 specific API, used only by AArch64 backends
|
||||
* **x86** - X86 specific API, used only by X86 and X64 backends
|
||||
* **ujit** - Universal JIT API
|
||||
* **asmjit-testing** - Unit tests, integration tests, and benchmarks (don't embed in your project)
|
||||
* **commons** - Common utilities shared between tests and benchmarks
|
||||
* **bench** - Benchmarks
|
||||
* **tests** - Unit tests and integration tests
|
||||
* **db** - Instruction database
|
||||
* **tools** - Tools used to re-regenerate generated files (instruction DB, enum strings)
|
||||
|
||||
Roadmap
|
||||
-------
|
||||
|
||||
* See [Roadmap](https://asmjit.com/roadmap.html) page for more details
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
* See [CONTRIBUTING](./CONTRIBUTING.md) page for more details
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
* [Documentation Index](https://asmjit.com/doc/index.html)
|
||||
* [Build Instructions](https://asmjit.com/doc/group__asmjit__build.html) (includes [CMake Integration](https://asmjit.com/doc/group__asmjit__build.html#cmake_integration))
|
||||
|
||||
Contributing Guidelines
|
||||
-----------------------
|
||||
|
||||
* See [CONTRIBUTING](./CONTRIBUTING.md) page for more details
|
||||
|
||||
Development & Testing
|
||||
---------------------
|
||||
|
||||
@@ -55,18 +56,18 @@ Breaking the API is sometimes inevitable, what to do?
|
||||
|
||||
* See [Breaking Changes Guide](https://asmjit.com/doc/group__asmjit__breaking__changes.html), which is now part of AsmJit documentation
|
||||
* See asmjit tests, they always compile and provide implementation of many use-cases:
|
||||
* [asmjit_test_emitters.cpp](./testing/tests/asmjit_test_emitters.cpp) - Tests that demonstrate the purpose of emitters
|
||||
* [asmjit_test_assembler_x86.cpp](./testing/tests/asmjit_test_assembler_x86.cpp) - Tests targeting AsmJit's Assembler (x86/x64)
|
||||
* [asmjit_test_compiler_x86.cpp](./testing/tests/asmjit_test_compiler_x86.cpp) - Tests targeting AsmJit's Compiler (x86/x64)
|
||||
* [asmjit_test_instinfo.cpp](./testing/tests/asmjit_test_instinfo.cpp) - Tests that query instruction information
|
||||
* [asmjit_test_x86_sections.cpp](./testing/tests/asmjit_test_x86_sections.cpp) - Multiple sections test
|
||||
* Visit our [Gitter Chat](https://app.gitter.im/#/room/#asmjit:gitter.im) if you need a quick help
|
||||
* [asmjit_test_emitters.cpp](./asmjit-testing/tests/asmjit_test_emitters.cpp) - Tests that demonstrate the purpose of emitters
|
||||
* [asmjit_test_assembler_x86.cpp](./asmjit-testing/tests/asmjit_test_assembler_x86.cpp) - Tests targeting AsmJit's Assembler (x86/x64)
|
||||
* [asmjit_test_compiler_x86.cpp](./asmjit-testing/tests/asmjit_test_compiler_x86.cpp) - Tests targeting AsmJit's Compiler (x86/x64)
|
||||
* [asmjit_test_instinfo.cpp](./asmjit-testing/tests/asmjit_test_instinfo.cpp) - Tests that query instruction information
|
||||
* [asmjit_test_x86_sections.cpp](./asmjit-testing/tests/asmjit_test_x86_sections.cpp) - Multiple sections test
|
||||
* Visit our [Public Chat](https://app.element.io/#/room/#asmjit:matrix.org) if you need a quick help
|
||||
|
||||
Support
|
||||
-------
|
||||
Support & Funding
|
||||
-----------------
|
||||
|
||||
* AsmJit project has both community and commercial support, see [AsmJit's Support Page](https://asmjit.com/support.html)
|
||||
* Organizations that rely on AsmJit should support the development!
|
||||
* If you use this software commercially, please see the [Funding Page](https://kobalicek.com/funding.html) and support the development
|
||||
|
||||
Notable Donors List:
|
||||
|
||||
|
||||
+4
-3
@@ -4,13 +4,14 @@
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include <asmjit/core.h>
|
||||
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/commons/cmdline.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include "../commons/cmdline.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
static void print_app_info() noexcept {
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
|
||||
#include <asmjit/core.h>
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include "../commons/performancetimer.h"
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/commons/performancetimer.h>
|
||||
|
||||
namespace asmjit_perf_utils {
|
||||
|
||||
+2
-2
@@ -8,12 +8,12 @@
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
#include <asmjit/a64.h>
|
||||
|
||||
#include <asmjit-testing/bench/asmjit_bench_codegen.h>
|
||||
|
||||
#include <limits>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_bench_codegen.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
// Generates a long sequence of GP instructions.
|
||||
+3
-3
@@ -8,13 +8,13 @@
|
||||
#if !defined(ASMJIT_NO_X86)
|
||||
#include <asmjit/x86.h>
|
||||
|
||||
#include <asmjit-testing/bench/asmjit_bench_codegen.h>
|
||||
#include <asmjit-testing/tests/asmjit_test_misc.h>
|
||||
|
||||
#include <limits>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_bench_codegen.h"
|
||||
#include "../tests/asmjit_test_misc.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
enum class InstForm {
|
||||
+107
-157
@@ -1,9 +1,10 @@
|
||||
#include <stdint.h>
|
||||
#include <asmjit/host.h>
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include "../commons/cmdline.h"
|
||||
#include "../commons/performancetimer.h"
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/commons/cmdline.h>
|
||||
#include <asmjit-testing/commons/performancetimer.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
@@ -19,12 +20,15 @@ static void print_app_info(size_t n) noexcept {
|
||||
printf("This benchmark was designed to benchmark the cost of initialization and\n"
|
||||
"reset (or reinitialization) of CodeHolder and Emitters; and the cost of\n"
|
||||
"moving a minimal assembled function to executable memory. Each output line\n"
|
||||
"uses \"<Test> [Func] [Finalize] [RT]\" format, with the following meaning:\n"
|
||||
"provides the following columns:\n"
|
||||
"\n"
|
||||
" - <Test> - test case name - either 'CodeHolder' only or an emitter\n"
|
||||
" - [Func] - function was assembled\n"
|
||||
" - [Finalize] - function was finalized (Builder/Compiler)\n"
|
||||
" - [RT] - function was added to JitRuntime and then removed from it\n"
|
||||
" - Strategy - reusability strategy - whether init/reset or reinit is used\n"
|
||||
" - Reuse Only - no code generation, no use of emitter except for init/reuse\n"
|
||||
" - Func - function was assembled\n"
|
||||
" - RA - function was compiled (registers allocated) (Compiler)\n"
|
||||
" - Asm - function was finalized & serialized (Builder/Compiler)\n"
|
||||
" - RT - function was added to JitRuntime and then removed from it\n"
|
||||
"\n"
|
||||
"Essentially the output provides an insight into the cost of reusing\n"
|
||||
"CodeHolder and other emitters, and the cost of assembling, finalizing,\n"
|
||||
@@ -36,6 +40,24 @@ static void print_app_info(size_t n) noexcept {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
enum class AssemblerOp {
|
||||
kNone,
|
||||
kRT
|
||||
};
|
||||
|
||||
enum class BuilderOp {
|
||||
kNone,
|
||||
kFinalize,
|
||||
kFinalize_RT
|
||||
};
|
||||
|
||||
enum class CompilerOp {
|
||||
kNone,
|
||||
kCompile,
|
||||
kFinalize,
|
||||
kFinalize_RT
|
||||
};
|
||||
|
||||
#if !defined(ASMJIT_NO_JIT)
|
||||
|
||||
class MyErrorHandler : public ErrorHandler {
|
||||
@@ -126,7 +148,7 @@ static inline void bench_assembler(InitStrategy strategy, size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename AssemblerT>
|
||||
template<typename AssemblerT, AssemblerOp op>
|
||||
static inline void bench_assembler_func(InitStrategy strategy, size_t count) {
|
||||
JitRuntime rt;
|
||||
CodeHolder code;
|
||||
@@ -139,40 +161,13 @@ static inline void bench_assembler_func(InitStrategy strategy, size_t count) {
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&a);
|
||||
emit_raw_func(a);
|
||||
code.reset();
|
||||
}
|
||||
}
|
||||
else {
|
||||
code.init(rt.environment());
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&a);
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
code.reinit();
|
||||
emit_raw_func(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename AssemblerT>
|
||||
static inline void bench_assembler_func_rt(InitStrategy strategy, size_t count) {
|
||||
JitRuntime rt;
|
||||
CodeHolder code;
|
||||
AssemblerT a;
|
||||
MyErrorHandler eh;
|
||||
|
||||
using Func = uint32_t(*)(void);
|
||||
|
||||
if (strategy == InitStrategy::kInitReset) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
code.init(rt.environment());
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&a);
|
||||
emit_raw_func(a);
|
||||
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
if constexpr (op == AssemblerOp::kRT) {
|
||||
using Func = uint32_t(*)(void);
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
|
||||
code.reset();
|
||||
}
|
||||
@@ -186,9 +181,12 @@ static inline void bench_assembler_func_rt(InitStrategy strategy, size_t count)
|
||||
code.reinit();
|
||||
emit_raw_func(a);
|
||||
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
if constexpr (op == AssemblerOp::kRT) {
|
||||
using Func = uint32_t(*)(void);
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,8 +219,8 @@ static inline void bench_builder(InitStrategy strategy, size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename BuilderT>
|
||||
static inline void bench_builder_func(InitStrategy strategy, size_t count, bool finalize) {
|
||||
template<typename BuilderT, BuilderOp op>
|
||||
static inline void bench_builder_func(InitStrategy strategy, size_t count) {
|
||||
JitRuntime rt;
|
||||
CodeHolder code;
|
||||
BuilderT b;
|
||||
@@ -235,9 +233,16 @@ static inline void bench_builder_func(InitStrategy strategy, size_t count, bool
|
||||
code.attach(&b);
|
||||
emit_raw_func(b);
|
||||
|
||||
if (finalize) {
|
||||
if constexpr (op >= BuilderOp::kFinalize) {
|
||||
b.finalize();
|
||||
if constexpr (op == BuilderOp::kFinalize_RT) {
|
||||
using Func = uint32_t(*)(void);
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
|
||||
code.reset();
|
||||
}
|
||||
}
|
||||
@@ -250,53 +255,18 @@ static inline void bench_builder_func(InitStrategy strategy, size_t count, bool
|
||||
code.reinit();
|
||||
emit_raw_func(b);
|
||||
|
||||
if (finalize) {
|
||||
if constexpr (op >= BuilderOp::kFinalize) {
|
||||
b.finalize();
|
||||
if constexpr (op == BuilderOp::kFinalize_RT) {
|
||||
using Func = uint32_t(*)(void);
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename BuilderT>
|
||||
static inline void bench_builder_func_finalize_rt(InitStrategy strategy, size_t count) {
|
||||
JitRuntime rt;
|
||||
CodeHolder code;
|
||||
BuilderT b;
|
||||
MyErrorHandler eh;
|
||||
|
||||
using Func = uint32_t(*)(void);
|
||||
|
||||
if (strategy == InitStrategy::kInitReset) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
code.init(rt.environment());
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&b);
|
||||
emit_raw_func(b);
|
||||
b.finalize();
|
||||
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
|
||||
code.reset();
|
||||
}
|
||||
}
|
||||
else {
|
||||
code.init(rt.environment());
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&b);
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
code.reinit();
|
||||
emit_raw_func(b);
|
||||
b.finalize();
|
||||
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ASMJIT_HAS_HOST_BACKEND && !ASMJIT_NO_BUILDER
|
||||
|
||||
#if defined(ASMJIT_HAS_HOST_BACKEND) && !defined(ASMJIT_NO_COMPILER)
|
||||
@@ -326,8 +296,8 @@ static inline void bench_compiler(InitStrategy strategy, size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename CompilerT>
|
||||
static inline void bench_compiler_func(InitStrategy strategy, size_t count, bool finalize) {
|
||||
template<typename CompilerT, CompilerOp op>
|
||||
static inline void bench_compiler_func(InitStrategy strategy, size_t count) {
|
||||
JitRuntime rt;
|
||||
CodeHolder code;
|
||||
CompilerT cc;
|
||||
@@ -343,8 +313,17 @@ static inline void bench_compiler_func(InitStrategy strategy, size_t count, bool
|
||||
compile_raw_func(cc);
|
||||
cc.end_func();
|
||||
|
||||
if (finalize) {
|
||||
if constexpr (op == CompilerOp::kCompile) {
|
||||
cc.run_passes();
|
||||
}
|
||||
else if constexpr (op >= CompilerOp::kFinalize) {
|
||||
cc.finalize();
|
||||
if constexpr (op == CompilerOp::kFinalize_RT) {
|
||||
using Func = uint32_t(*)(void);
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
|
||||
code.reset();
|
||||
@@ -362,99 +341,70 @@ static inline void bench_compiler_func(InitStrategy strategy, size_t count, bool
|
||||
compile_raw_func(cc);
|
||||
cc.end_func();
|
||||
|
||||
if (finalize) {
|
||||
if constexpr (op == CompilerOp::kCompile) {
|
||||
cc.run_passes();
|
||||
}
|
||||
else if constexpr (op >= CompilerOp::kFinalize) {
|
||||
cc.finalize();
|
||||
if constexpr (op == CompilerOp::kFinalize_RT) {
|
||||
using Func = uint32_t(*)(void);
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename CompilerT>
|
||||
static inline void bench_compiler_func_rt(InitStrategy strategy, size_t count) {
|
||||
JitRuntime rt;
|
||||
CodeHolder code;
|
||||
CompilerT cc;
|
||||
MyErrorHandler eh;
|
||||
|
||||
using Func = uint32_t(*)(void);
|
||||
|
||||
if (strategy == InitStrategy::kInitReset) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
code.init(rt.environment());
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&cc);
|
||||
|
||||
(void)cc.add_func(FuncSignature::build<uint32_t>());
|
||||
compile_raw_func(cc);
|
||||
cc.end_func();
|
||||
cc.finalize();
|
||||
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
|
||||
code.reset();
|
||||
}
|
||||
}
|
||||
else {
|
||||
code.init(rt.environment());
|
||||
code.set_error_handler(&eh);
|
||||
code.attach(&cc);
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
code.reinit();
|
||||
|
||||
(void)cc.add_func(FuncSignature::build<uint32_t>());
|
||||
compile_raw_func(cc);
|
||||
cc.end_func();
|
||||
cc.finalize();
|
||||
|
||||
Func fn;
|
||||
rt.add(&fn, &code);
|
||||
rt.release(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ASMJIT_HAS_HOST_BACKEND && !ASMJIT_NO_COMPILER
|
||||
|
||||
template<typename Lambda>
|
||||
static inline void test_perf(const char* bench_name, InitStrategy strategy, size_t n, Lambda&& fn) {
|
||||
static inline void test_perf(const char* group, const char* params, InitStrategy strategy, size_t n, Lambda&& fn) {
|
||||
PerformanceTimer timer;
|
||||
const char* strategy_name = strategy == InitStrategy::kInitReset ? "init/reset" : "reinit ";
|
||||
const char* strategy_name = strategy == InitStrategy::kInitReset ? "init/reset" : "reinit";
|
||||
|
||||
timer.start();
|
||||
fn(strategy, n);
|
||||
timer.stop();
|
||||
|
||||
printf("%-31s [%s]: %8.3f [ms]\n", bench_name, strategy_name, timer.duration());
|
||||
printf("| %-10s | %-10s | %-23s| %8.1f [ms] |\n", group, strategy_name, params, timer.duration());
|
||||
}
|
||||
|
||||
static inline void test_perf_all(InitStrategy strategy, size_t n) {
|
||||
using IS = InitStrategy;
|
||||
|
||||
test_perf("CodeHolder (Only)" , strategy, n, [](IS s, size_t n) { bench_codeholder(s, n); });
|
||||
const char frame[] = "+------------+------------+------------------------+---------------+\n";
|
||||
const char header[] = "| Group | Strategy | Features Used | Time [ms] |\n";
|
||||
|
||||
printf(frame);
|
||||
printf(header);
|
||||
printf(frame);
|
||||
|
||||
test_perf("CodeHolder", "Reuse Only" , strategy, n, [](IS s, size_t n) { bench_codeholder(s, n); });
|
||||
|
||||
#if defined(ASMJIT_HAS_HOST_BACKEND)
|
||||
test_perf("Assembler" , strategy, n, [](IS s, size_t n) { bench_assembler<host::Assembler>(s, n); });
|
||||
test_perf("Assembler + Func" , strategy, n, [](IS s, size_t n) { bench_assembler_func<host::Assembler>(s, n); });
|
||||
test_perf("Assembler + Func + RT" , strategy, n, [](IS s, size_t n) { bench_assembler_func_rt<host::Assembler>(s, n); });
|
||||
test_perf("Assembler ", "Reuse Only" , strategy, n, [](IS s, size_t n) { bench_assembler<host::Assembler>(s, n); });
|
||||
test_perf("Assembler ", "Func" , strategy, n, [](IS s, size_t n) { bench_assembler_func<host::Assembler, AssemblerOp::kNone>(s, n); });
|
||||
test_perf("Assembler ", "Func + RT" , strategy, n, [](IS s, size_t n) { bench_assembler_func<host::Assembler, AssemblerOp::kRT>(s, n); });
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_HAS_HOST_BACKEND) && !defined(ASMJIT_NO_BUILDER)
|
||||
test_perf("Builder" , strategy, n, [](IS s, size_t n) { bench_builder<host::Builder>(s, n); });
|
||||
test_perf("Builder + Func" , strategy, n, [](IS s, size_t n) { bench_builder_func<host::Builder>(s, n, false); });
|
||||
test_perf("Builder + Func + Finalize" , strategy, n, [](IS s, size_t n) { bench_builder_func<host::Builder>(s, n, true); });
|
||||
test_perf("Builder + Func + Finalize + RT" , strategy, n, [](IS s, size_t n) { bench_builder_func_finalize_rt<host::Builder>(s, n); });
|
||||
test_perf("Builder ", "Reuse Only" , strategy, n, [](IS s, size_t n) { bench_builder<host::Builder>(s, n); });
|
||||
test_perf("Builder ", "Func" , strategy, n, [](IS s, size_t n) { bench_builder_func<host::Builder, BuilderOp::kNone>(s, n); });
|
||||
test_perf("Builder ", "Func + Asm" , strategy, n, [](IS s, size_t n) { bench_builder_func<host::Builder, BuilderOp::kFinalize>(s, n); });
|
||||
test_perf("Builder ", "Func + Asm + RT" , strategy, n, [](IS s, size_t n) { bench_builder_func<host::Builder, BuilderOp::kFinalize_RT>(s, n); });
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_HAS_HOST_BACKEND) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
test_perf("Compiler" , strategy, n, [](IS s, size_t n) { bench_compiler<host::Compiler>(s, n); });
|
||||
test_perf("Compiler + Func" , strategy, n, [](IS s, size_t n) { bench_compiler_func<host::Compiler>(s, n, false); });
|
||||
test_perf("Compiler + Func + Finalize" , strategy, n, [](IS s, size_t n) { bench_compiler_func<host::Compiler>(s, n, true); });
|
||||
|
||||
test_perf("Compiler + Func + Finalize + RT", strategy, n, [](IS s, size_t n) { bench_compiler_func_rt<host::Compiler>(s, n); });
|
||||
test_perf("Compiler ", "Reuse Only" , strategy, n, [](IS s, size_t n) { bench_compiler<host::Compiler>(s, n); });
|
||||
test_perf("Compiler ", "Func" , strategy, n, [](IS s, size_t n) { bench_compiler_func<host::Compiler, CompilerOp::kNone>(s, n); });
|
||||
test_perf("Compiler ", "Func + RA" , strategy, n, [](IS s, size_t n) { bench_compiler_func<host::Compiler, CompilerOp::kCompile>(s, n); });
|
||||
test_perf("Compiler ", "Func + RA + Asm" , strategy, n, [](IS s, size_t n) { bench_compiler_func<host::Compiler, CompilerOp::kFinalize>(s, n); });
|
||||
test_perf("Compiler ", "Func + RA + Asm + RT", strategy, n, [](IS s, size_t n) { bench_compiler_func<host::Compiler, CompilerOp::kFinalize_RT>(s, n); });
|
||||
#endif
|
||||
|
||||
printf(frame);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
+8
-8
@@ -13,6 +13,14 @@
|
||||
#include <asmjit/a64.h>
|
||||
#endif // !ASMJIT_NO_AARCH64
|
||||
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
|
||||
#if !defined(ASMJIT_NO_COMPILER)
|
||||
#include <asmjit-testing/commons/cmdline.h>
|
||||
#include <asmjit-testing/commons/performancetimer.h>
|
||||
#include <asmjit-testing/commons/random.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -20,14 +28,6 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
|
||||
#if !defined(ASMJIT_NO_COMPILER)
|
||||
#include "../commons/cmdline.h"
|
||||
#include "../commons/performancetimer.h"
|
||||
#include "../commons/random.h"
|
||||
#endif
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
static void print_app_info() {
|
||||
3rdparty/asmjit/testing/commons/asmjitutils.h → 3rdparty/asmjit/asmjit-testing/commons/asmjitutils.h
Vendored
+1
-15
@@ -146,12 +146,6 @@ static void print_build_options() {
|
||||
constexpr bool no_foreign = false;
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_NO_DEPRECATED)
|
||||
constexpr bool no_deprecated = true;
|
||||
#else
|
||||
constexpr bool no_deprecated = false;
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_NO_ABI_NAMESPACE)
|
||||
constexpr bool no_abi_namespace = true;
|
||||
#else
|
||||
@@ -182,12 +176,6 @@ static void print_build_options() {
|
||||
constexpr bool no_logging = false;
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_NO_VALIDATION)
|
||||
constexpr bool no_validation = true;
|
||||
#else
|
||||
constexpr bool no_validation = false;
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_NO_INTROSPECTION)
|
||||
constexpr bool no_introspection = true;
|
||||
#else
|
||||
@@ -214,8 +202,8 @@ static void print_build_options() {
|
||||
|
||||
printf("Build Options:\n");
|
||||
printf(" BUILD_TYPE : %s\n", asmjit_build_type());
|
||||
printf(" ASMJIT_NO_DEPRECATED : %s\n", stringify_build_definition(no_deprecated));
|
||||
printf(" ASMJIT_NO_ABI_NAMESPACE: %s\n", stringify_build_definition(no_abi_namespace));
|
||||
printf(" ASMJIT_NO_SHM_OPEN : %s\n", stringify_build_definition(no_shm_open));
|
||||
printf("\n");
|
||||
|
||||
printf("Build Backends:\n");
|
||||
@@ -225,11 +213,9 @@ static void print_build_options() {
|
||||
printf("\n");
|
||||
|
||||
printf("Build Features:\n");
|
||||
printf(" ASMJIT_NO_SHM_OPEN : %s\n", stringify_build_definition(no_shm_open));
|
||||
printf(" ASMJIT_NO_JIT : %s\n", stringify_build_definition(no_jit));
|
||||
printf(" ASMJIT_NO_TEXT : %s\n", stringify_build_definition(no_text));
|
||||
printf(" ASMJIT_NO_LOGGING : %s\n", stringify_build_definition(no_logging));
|
||||
printf(" ASMJIT_NO_VALIDATION : %s\n", stringify_build_definition(no_validation));
|
||||
printf(" ASMJIT_NO_INTROSPECTION: %s\n", stringify_build_definition(no_introspection));
|
||||
printf(" ASMJIT_NO_BUILDER : %s\n", stringify_build_definition(no_builder));
|
||||
printf(" ASMJIT_NO_COMPILER : %s\n", stringify_build_definition(no_compiler));
|
||||
Vendored
File renamed without changes.
-1
@@ -6,7 +6,6 @@
|
||||
#ifndef PERFORMANCETIMER_H_INCLUDED
|
||||
#define PERFORMANCETIMER_H_INCLUDED
|
||||
|
||||
#include <asmjit/core.h>
|
||||
#include <chrono>
|
||||
|
||||
class PerformanceTimer {
|
||||
File renamed without changes.
+5
-5
@@ -4,15 +4,15 @@
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include <asmjit/core.h>
|
||||
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/commons/cmdline.h>
|
||||
#include <asmjit-testing/tests/asmjit_test_assembler.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_test_assembler.h"
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include "../commons/cmdline.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
#if !defined(ASMJIT_NO_X86)
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
#define ASMJIT_TEST_ASSEMBLER_H_INCLUDED
|
||||
|
||||
#include <asmjit/core.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct TestSettings {
|
||||
+7
-2
@@ -7,12 +7,13 @@
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include <asmjit/a64.h>
|
||||
|
||||
#include <asmjit-testing/tests/asmjit_test_assembler.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_test_assembler.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
#define TEST_INSTRUCTION(OPCODE, ...) \
|
||||
@@ -1906,6 +1907,10 @@ static void ASMJIT_NOINLINE test_aarch64_assembler_simd(AssemblerTester<a64::Ass
|
||||
TEST_INSTRUCTION("01F4034F", fmov(v1.s4(), 0.5));
|
||||
TEST_INSTRUCTION("01F4004F", fmov(v1.s4(), 2.0));
|
||||
TEST_INSTRUCTION("01F4036F", fmov(v1.d2(), 0.5));
|
||||
TEST_INSTRUCTION("00F4030F", fmov(v0.s2(), 0.5));
|
||||
TEST_INSTRUCTION("00F4000F", fmov(v0.s2(), 2.0));
|
||||
TEST_INSTRUCTION("00F4034F", fmov(v0.s4(), 0.5));
|
||||
TEST_INSTRUCTION("00F4004F", fmov(v0.s4(), 2.0));
|
||||
TEST_INSTRUCTION("01F4006F", fmov(v1.d2(), 2.0));
|
||||
TEST_INSTRUCTION("4190C31F", fmsub(h1, h2, h3, h4));
|
||||
TEST_INSTRUCTION("4190031F", fmsub(s1, s2, s3, s4));
|
||||
+3
-2
@@ -7,12 +7,13 @@
|
||||
#if !defined(ASMJIT_NO_X86)
|
||||
|
||||
#include <asmjit/x86.h>
|
||||
|
||||
#include <asmjit-testing/tests/asmjit_test_assembler.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_test_assembler.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
#define TEST_INSTRUCTION(OPCODE, ...) \
|
||||
+3
-2
@@ -7,12 +7,13 @@
|
||||
#if !defined(ASMJIT_NO_X86)
|
||||
|
||||
#include <asmjit/x86.h>
|
||||
|
||||
#include <asmjit-testing/tests/asmjit_test_assembler.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_test_assembler.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
#define TEST_INSTRUCTION(OPCODE, ...) \
|
||||
+4
-5
@@ -15,11 +15,10 @@
|
||||
|
||||
#if !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include "../commons/cmdline.h"
|
||||
#include "../commons/performancetimer.h"
|
||||
|
||||
#include "asmjit_test_compiler.h"
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/commons/cmdline.h>
|
||||
#include <asmjit-testing/commons/performancetimer.h>
|
||||
#include <asmjit-testing/tests/asmjit_test_compiler.h>
|
||||
|
||||
#if !defined(ASMJIT_NO_X86)
|
||||
#include <asmjit/x86.h>
|
||||
File renamed without changes.
+3
-2
@@ -7,12 +7,13 @@
|
||||
#if !defined(ASMJIT_NO_COMPILER) && !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include <asmjit/a64.h>
|
||||
|
||||
#include <asmjit-testing/tests/asmjit_test_compiler.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asmjit_test_compiler.h"
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
// a64::Compiler - A64TestCase
|
||||
+4
-3
@@ -7,6 +7,10 @@
|
||||
#if !defined(ASMJIT_NO_X86) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include <asmjit/x86.h>
|
||||
|
||||
#include <asmjit-testing/tests/asmjit_test_misc.h>
|
||||
#include <asmjit-testing/tests/asmjit_test_compiler.h>
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -17,9 +21,6 @@
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
#include "asmjit_test_misc.h"
|
||||
#include "asmjit_test_compiler.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Interaction between '_setjmp' and C++ object destruction is non-portable.
|
||||
#pragma warning(disable: 4611)
|
||||
+2
-1
@@ -8,7 +8,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <asmjit/core.h>
|
||||
#include "../commons/asmjitutils.h"
|
||||
|
||||
#if ASMJIT_ARCH_X86 != 0
|
||||
#include <asmjit/x86.h>
|
||||
@@ -18,6 +17,8 @@
|
||||
#include <asmjit/a64.h>
|
||||
#endif
|
||||
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
static void print_app_info() noexcept {
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
#include <asmjit/a64.h>
|
||||
#endif
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
File renamed without changes.
+2
-2
@@ -13,8 +13,8 @@
|
||||
#include <asmjit/a64.h>
|
||||
#endif
|
||||
|
||||
#include "broken.h"
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/tests/broken.h>
|
||||
|
||||
#if !defined(ASMJIT_NO_COMPILER)
|
||||
#include <asmjit/core/racfgblock_p.h>
|
||||
+4
-4
@@ -5,13 +5,13 @@
|
||||
|
||||
#include <asmjit/ujit.h>
|
||||
|
||||
#include <asmjit-testing/commons/asmjitutils.h>
|
||||
#include <asmjit-testing/commons/random.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
#include "../commons/asmjitutils.h"
|
||||
#include "../commons/random.h"
|
||||
|
||||
static void print_app_info() noexcept {
|
||||
printf("AsmJit UniCompiler Test Suite v%u.%u.%u [Arch=%s] [Mode=%s]\n\n",
|
||||
unsigned((ASMJIT_LIBRARY_VERSION >> 16) ),
|
||||
@@ -24,7 +24,7 @@ static void print_app_info() noexcept {
|
||||
|
||||
#if !defined(ASMJIT_NO_UJIT) && !defined(ASMJIT_NO_JIT)
|
||||
|
||||
#include "broken.h"
|
||||
#include <asmjit-testing/tests/broken.h>
|
||||
|
||||
namespace UniCompilerTests {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+10
-10
@@ -39,17 +39,17 @@
|
||||
//! - \ref arm::Shift - Shift operation and value.
|
||||
//! - \ref arm::Utils - Utilities that can help during code generation for AArch32 and AArch64.
|
||||
|
||||
#include "./arm.h"
|
||||
#include <asmjit/arm.h>
|
||||
|
||||
#include "asmjit-scope-begin.h"
|
||||
#include "arm/a64assembler.h"
|
||||
#include "arm/a64builder.h"
|
||||
#include "arm/a64compiler.h"
|
||||
#include "arm/a64emitter.h"
|
||||
#include "arm/a64globals.h"
|
||||
#include "arm/a64instdb.h"
|
||||
#include "arm/a64operand.h"
|
||||
#include "asmjit-scope-end.h"
|
||||
#include <asmjit/asmjit-scope-begin.h>
|
||||
#include <asmjit/arm/a64assembler.h>
|
||||
#include <asmjit/arm/a64builder.h>
|
||||
#include <asmjit/arm/a64compiler.h>
|
||||
#include <asmjit/arm/a64emitter.h>
|
||||
#include <asmjit/arm/a64globals.h>
|
||||
#include <asmjit/arm/a64instdb.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
#include <asmjit/asmjit-scope-end.h>
|
||||
|
||||
#endif // ASMJIT_A64_H_INCLUDED
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
//! - \ref arm::Shift - Shift operation and value (both AArch32 and AArch64).
|
||||
//! - \ref arm::Utils - Utilities that can help during code generation for AArch32 and AArch64.
|
||||
|
||||
#include "core.h"
|
||||
#include <asmjit/core.h>
|
||||
|
||||
#include "asmjit-scope-begin.h"
|
||||
#include "arm/armglobals.h"
|
||||
#include "arm/armutils.h"
|
||||
#include "asmjit-scope-end.h"
|
||||
#include <asmjit/asmjit-scope-begin.h>
|
||||
#include <asmjit/arm/armglobals.h>
|
||||
#include <asmjit/arm/armutils.h>
|
||||
#include <asmjit/asmjit-scope-end.h>
|
||||
|
||||
#endif // ASMJIT_ARM_H_INCLUDED
|
||||
Vendored
+5
-5
@@ -6,11 +6,11 @@
|
||||
#ifndef ASMJIT_ARM_A64ARCHTRAITS_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64ARCHTRAITS_P_H_INCLUDED
|
||||
|
||||
#include "../core/archtraits.h"
|
||||
#include "../core/misc_p.h"
|
||||
#include "../core/type.h"
|
||||
#include "../arm/a64globals.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/misc_p.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/arm/a64globals.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
Vendored
+20
-20
@@ -3,22 +3,21 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include "../core/codewriter_p.h"
|
||||
#include "../core/cpuinfo.h"
|
||||
#include "../core/emitterutils_p.h"
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/misc_p.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
#include "../arm/armformatter_p.h"
|
||||
#include "../arm/armutils.h"
|
||||
#include "../arm/a64assembler.h"
|
||||
#include "../arm/a64emithelper_p.h"
|
||||
#include "../arm/a64instdb_p.h"
|
||||
#include <asmjit/core/codewriter_p.h>
|
||||
#include <asmjit/core/cpuinfo.h>
|
||||
#include <asmjit/core/emitterutils_p.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/core/misc_p.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/armformatter_p.h>
|
||||
#include <asmjit/arm/armutils.h>
|
||||
#include <asmjit/arm/a64assembler.h>
|
||||
#include <asmjit/arm/a64emithelper_p.h>
|
||||
#include <asmjit/arm/a64instdb_p.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -835,7 +834,7 @@ Error Assembler::_emit(InstId inst_id, const Operand_& o0, const Operand_& o1, c
|
||||
goto Failed;
|
||||
}
|
||||
|
||||
#ifndef ASMJIT_NO_VALIDATION
|
||||
#ifndef ASMJIT_NO_INTROSPECTION
|
||||
// Strict validation.
|
||||
if (has_diagnostic_option(DiagnosticOptions::kValidateAssembler)) {
|
||||
Operand_ op_array[Globals::kMaxOpCount];
|
||||
@@ -3581,7 +3580,7 @@ Case_BaseLdurStur:
|
||||
if (q > 1 || sz > 2)
|
||||
goto InvalidInstruction;
|
||||
|
||||
static const uint32_t sz_bits_table[3] = { B(11), B(0), B(29) };
|
||||
static const uint32_t sz_bits_table[3] = { B(11), 0, B(29) };
|
||||
opcode.reset(0b00001111000000001111010000000000);
|
||||
opcode ^= sz_bits_table[sz];
|
||||
opcode.add_imm(q, 30);
|
||||
@@ -5129,11 +5128,12 @@ EmitOp_Rel:
|
||||
|
||||
if (rm_rel->is_imm()) {
|
||||
uint64_t base_address = _code->base_address();
|
||||
uint64_t target_offset = rm_rel->as<Imm>().value_as<uint64_t>();
|
||||
uint64_t section_offset = _section->offset();
|
||||
|
||||
uint64_t target_offset = rm_rel->as<Imm>().value_as<uint64_t>();
|
||||
size_t code_offset = writer.offset_from(_buffer_data);
|
||||
|
||||
if (base_address == Globals::kNoBaseAddress || _section->section_id() != 0) {
|
||||
if (!EmitterUtils::is_absolute_location(base_address, section_offset)) {
|
||||
// Create a new RelocEntry as we cannot calculate the offset right now.
|
||||
RelocEntry* re;
|
||||
err = _code->new_reloc_entry(Out(re), RelocType::kAbsToRel);
|
||||
@@ -5148,7 +5148,7 @@ EmitOp_Rel:
|
||||
goto EmitOp;
|
||||
}
|
||||
else {
|
||||
uint64_t pc = base_address + code_offset;
|
||||
uint64_t pc = base_address + section_offset + code_offset;
|
||||
|
||||
if (offset_format.type() == OffsetType::kAArch64_ADRP) {
|
||||
pc &= ~uint64_t(4096 - 1);
|
||||
@@ -5168,7 +5168,7 @@ EmitOp_DispImm:
|
||||
}
|
||||
|
||||
int64_t disp_imm64 = int64_t(offset_value) >> offset_format.imm_discard_lsb();
|
||||
if (!Support::is_encodable_offset_64(disp_imm64, offset_format.imm_bit_count())) {
|
||||
if (!EmitterUtils::is_encodable_offset_64(disp_imm64, offset_format.imm_bit_count())) {
|
||||
goto InvalidDisplacement;
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
#ifndef ASMJIT_ARM_A64ASSEMBLER_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64ASSEMBLER_H_INCLUDED
|
||||
|
||||
#include "../core/assembler.h"
|
||||
#include "../arm/a64emitter.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/arm/a64emitter.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+4
-4
@@ -3,12 +3,12 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64) && !defined(ASMJIT_NO_BUILDER)
|
||||
|
||||
#include "../arm/a64assembler.h"
|
||||
#include "../arm/a64builder.h"
|
||||
#include "../arm/a64emithelper_p.h"
|
||||
#include <asmjit/arm/a64assembler.h>
|
||||
#include <asmjit/arm/a64builder.h>
|
||||
#include <asmjit/arm/a64emithelper_p.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+3
-3
@@ -6,11 +6,11 @@
|
||||
#ifndef ASMJIT_ARM_A64BUILDER_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64BUILDER_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/builder.h"
|
||||
#include "../arm/a64emitter.h"
|
||||
#include <asmjit/core/builder.h>
|
||||
#include <asmjit/arm/a64emitter.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
Vendored
+5
-5
@@ -3,13 +3,13 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include "../arm/a64assembler.h"
|
||||
#include "../arm/a64compiler.h"
|
||||
#include "../arm/a64emithelper_p.h"
|
||||
#include "../arm/a64rapass_p.h"
|
||||
#include <asmjit/arm/a64assembler.h>
|
||||
#include <asmjit/arm/a64compiler.h>
|
||||
#include <asmjit/arm/a64emithelper_p.h>
|
||||
#include <asmjit/arm/a64rapass_p.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+5
-5
@@ -6,12 +6,12 @@
|
||||
#ifndef ASMJIT_ARM_A64COMPILER_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64COMPILER_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/compiler.h"
|
||||
#include "../core/type.h"
|
||||
#include "../arm/a64emitter.h"
|
||||
#include <asmjit/core/compiler.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/arm/a64emitter.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
//!
|
||||
//! \note This is a convenience function alias of \ref new_gp32().
|
||||
template<typename... Args>
|
||||
ASMJIT_INLINE_NODEBUG Gp new_gpw(Args&&... args) { return new_reg<Gp>(TypeId::kUIntPtr, std::forward<Args>(args)...); }
|
||||
ASMJIT_INLINE_NODEBUG Gp new_gpw(Args&&... args) { return new_reg<Gp>(TypeId::kUInt32, std::forward<Args>(args)...); }
|
||||
|
||||
//! Creates a new 64-bit general purpose register.
|
||||
//!
|
||||
Vendored
+11
-11
@@ -3,18 +3,18 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/funcargscontext_p.h"
|
||||
#include "../core/string.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
#include "../arm/a64emithelper_p.h"
|
||||
#include "../arm/a64formatter_p.h"
|
||||
#include "../arm/a64instapi_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/funcargscontext_p.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/a64emithelper_p.h>
|
||||
#include <asmjit/arm/a64formatter_p.h>
|
||||
#include <asmjit/arm/a64instapi_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -471,7 +471,7 @@ void init_emitter_funcs(BaseEmitter* emitter) {
|
||||
emitter->_funcs.format_instruction = FormatterInternal::format_instruction;
|
||||
#endif
|
||||
|
||||
#ifndef ASMJIT_NO_VALIDATION
|
||||
#ifndef ASMJIT_NO_INTROSPECTION
|
||||
emitter->_funcs.validate = InstInternal::validate;
|
||||
#endif
|
||||
}
|
||||
Vendored
+5
-5
@@ -6,12 +6,12 @@
|
||||
#ifndef ASMJIT_ARM_A64EMITHELPER_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64EMITHELPER_P_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
|
||||
#include "../core/emithelper_p.h"
|
||||
#include "../core/func.h"
|
||||
#include "../arm/a64emitter.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/emithelper_p.h>
|
||||
#include <asmjit/core/func.h>
|
||||
#include <asmjit/arm/a64emitter.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+4
-4
@@ -6,10 +6,10 @@
|
||||
#ifndef ASMJIT_ARM_A64EMITTER_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64EMITTER_H_INCLUDED
|
||||
|
||||
#include "../core/emitter.h"
|
||||
#include "../core/support.h"
|
||||
#include "../arm/a64instdb.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/emitter.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/a64instdb.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
// MSVC targeting AArch64 defines a lot of macros without underscores clashing
|
||||
// with AArch64 instruction names. We have to workaround until it's fixed in SDK.
|
||||
Vendored
+8
-8
@@ -3,18 +3,18 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64) && !defined(ASMJIT_NO_LOGGING)
|
||||
|
||||
#include "../core/misc_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../arm/a64formatter_p.h"
|
||||
#include "../arm/a64instapi_p.h"
|
||||
#include "../arm/a64instdb_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/misc_p.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/a64formatter_p.h>
|
||||
#include <asmjit/arm/a64instapi_p.h>
|
||||
#include <asmjit/arm/a64instdb_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
#include "../core/compiler.h"
|
||||
#include <asmjit/core/compiler.h>
|
||||
#endif
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
Vendored
+6
-6
@@ -6,14 +6,14 @@
|
||||
#ifndef ASMJIT_ARM_A64FORMATTER_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64FORMATTER_P_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/span.h"
|
||||
#include "../core/string.h"
|
||||
#include "../arm/armformatter_p.h"
|
||||
#include "../arm/a64globals.h"
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/support/span.h>
|
||||
#include <asmjit/arm/armformatter_p.h>
|
||||
#include <asmjit/arm/a64globals.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+3
-3
@@ -3,11 +3,11 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include "../arm/a64func_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/arm/a64func_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
#ifndef ASMJIT_ARM_A64FUNC_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64FUNC_P_H_INCLUDED
|
||||
|
||||
#include "../core/func.h"
|
||||
#include <asmjit/core/func.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
#ifndef ASMJIT_ARM_A64GLOBALS_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64GLOBALS_H_INCLUDED
|
||||
|
||||
#include "../arm/armglobals.h"
|
||||
#include <asmjit/arm/armglobals.h>
|
||||
|
||||
//! \namespace asmjit::a64
|
||||
//! \ingroup asmjit_a64
|
||||
+9
-9
@@ -3,15 +3,15 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
#include "../core/misc_p.h"
|
||||
#include "../core/support_p.h"
|
||||
#include "../arm/a64instapi_p.h"
|
||||
#include "../arm/a64instdb_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/cpuinfo.h>
|
||||
#include <asmjit/core/misc_p.h>
|
||||
#include <asmjit/support/support_p.h>
|
||||
#include <asmjit/arm/a64instapi_p.h>
|
||||
#include <asmjit/arm/a64instdb_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -50,13 +50,13 @@ InstId string_to_inst_id(const char* s, size_t len) noexcept {
|
||||
// a64::InstInternal - Validate
|
||||
// ============================
|
||||
|
||||
#ifndef ASMJIT_NO_VALIDATION
|
||||
#ifndef ASMJIT_NO_INTROSPECTION
|
||||
ASMJIT_FAVOR_SIZE Error validate(const BaseInst& inst, const Operand_* operands, size_t op_count, ValidationFlags validation_flags) noexcept {
|
||||
// TODO:
|
||||
Support::maybe_unused(inst, operands, op_count, validation_flags);
|
||||
return Error::kOk;
|
||||
}
|
||||
#endif // !ASMJIT_NO_VALIDATION
|
||||
#endif // !ASMJIT_NO_INTROSPECTION
|
||||
|
||||
// a64::InstInternal - QueryRWInfo
|
||||
// ===============================
|
||||
+3
-6
@@ -6,8 +6,8 @@
|
||||
#ifndef ASMJIT_ARM_A64INSTAPI_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64INSTAPI_P_H_INCLUDED
|
||||
|
||||
#include "../core/inst.h"
|
||||
#include "../core/operand.h"
|
||||
#include <asmjit/core/inst.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -22,11 +22,8 @@ Error ASMJIT_CDECL inst_id_to_string(InstId inst_id, InstStringifyOptions option
|
||||
InstId ASMJIT_CDECL string_to_inst_id(const char* s, size_t len) noexcept;
|
||||
#endif // !ASMJIT_NO_TEXT
|
||||
|
||||
#ifndef ASMJIT_NO_VALIDATION
|
||||
Error ASMJIT_CDECL validate(const BaseInst& inst, const Operand_* operands, size_t op_count, ValidationFlags validation_flags) noexcept;
|
||||
#endif // !ASMJIT_NO_VALIDATION
|
||||
|
||||
#ifndef ASMJIT_NO_INTROSPECTION
|
||||
Error ASMJIT_CDECL validate(const BaseInst& inst, const Operand_* operands, size_t op_count, ValidationFlags validation_flags) noexcept;
|
||||
Error ASMJIT_CDECL query_rw_info(const BaseInst& inst, const Operand_* operands, size_t op_count, InstRWInfo* out) noexcept;
|
||||
Error ASMJIT_CDECL query_features(const BaseInst& inst, const Operand_* operands, size_t op_count, CpuFeatures* out) noexcept;
|
||||
#endif // !ASMJIT_NO_INTROSPECTION
|
||||
+5
-5
@@ -3,13 +3,13 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include "../core/codeholder.h"
|
||||
#include "../core/support.h"
|
||||
#include "../arm/a64instdb_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/a64instdb_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
#ifndef ASMJIT_ARM_A64INSTDB_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64INSTDB_H_INCLUDED
|
||||
|
||||
#include "../arm/a64globals.h"
|
||||
#include <asmjit/arm/a64globals.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+4
-4
@@ -6,10 +6,10 @@
|
||||
#ifndef ASMJIT_ARM_A64INSTDB_H_P_INCLUDED
|
||||
#define ASMJIT_ARM_A64INSTDB_H_P_INCLUDED
|
||||
|
||||
#include "../core/codeholder.h"
|
||||
#include "../core/instdb_p.h"
|
||||
#include "../arm/a64instdb.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/instdb_p.h>
|
||||
#include <asmjit/arm/a64instdb.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+3
-3
@@ -3,11 +3,11 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
|
||||
#include "../core/misc_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include <asmjit/core/misc_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
+28
-22
@@ -6,8 +6,8 @@
|
||||
#ifndef ASMJIT_ARM_A64OPERAND_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64OPERAND_H_INCLUDED
|
||||
|
||||
#include "../core/operand.h"
|
||||
#include "../arm/armglobals.h"
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/arm/armglobals.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -651,24 +651,6 @@ public:
|
||||
//! \}
|
||||
};
|
||||
|
||||
//! \name Shift Operation Construction
|
||||
//! \{
|
||||
|
||||
//! Constructs a `LSL #value` shift (logical shift left).
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift lsl(uint32_t value) noexcept { return Shift(ShiftOp::kLSL, value); }
|
||||
//! Constructs a `LSR #value` shift (logical shift right).
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift lsr(uint32_t value) noexcept { return Shift(ShiftOp::kLSR, value); }
|
||||
//! Constructs a `ASR #value` shift (arithmetic shift right).
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift asr(uint32_t value) noexcept { return Shift(ShiftOp::kASR, value); }
|
||||
//! Constructs a `ROR #value` shift (rotate right).
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift ror(uint32_t value) noexcept { return Shift(ShiftOp::kROR, value); }
|
||||
//! Constructs a `RRX` shift (rotate with carry by 1).
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift rrx() noexcept { return Shift(ShiftOp::kRRX, 0); }
|
||||
//! Constructs a `MSL #value` shift (logical shift left filling ones).
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift msl(uint32_t value) noexcept { return Shift(ShiftOp::kMSL, value); }
|
||||
|
||||
//! \}
|
||||
|
||||
#ifndef _DOXYGEN
|
||||
namespace regs {
|
||||
#endif
|
||||
@@ -705,11 +687,11 @@ static ASMJIT_INLINE_CONSTEXPR Vec s(uint32_t id) noexcept { return Vec::make_v3
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Vec d(uint32_t id) noexcept { return Vec::make_v64(id); }
|
||||
|
||||
//! Creates a 1282-bit V register operand.
|
||||
//! Creates a 128-bit Q register operand.
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Vec q(uint32_t id) noexcept { return Vec::make_v128(id); }
|
||||
|
||||
//! Creates a 1282-bit V register operand.
|
||||
//! Creates a 128-bit V register operand.
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Vec v(uint32_t id) noexcept { return Vec::make_v128(id); }
|
||||
|
||||
@@ -989,6 +971,30 @@ using namespace regs;
|
||||
//! \name Shift Operation Construction
|
||||
//! \{
|
||||
|
||||
//! Constructs a `LSL #value` shift (logical shift left).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift lsl(uint32_t value) noexcept { return Shift(ShiftOp::kLSL, value); }
|
||||
|
||||
//! Constructs a `LSR #value` shift (logical shift right).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift lsr(uint32_t value) noexcept { return Shift(ShiftOp::kLSR, value); }
|
||||
|
||||
//! Constructs a `ASR #value` shift (arithmetic shift right).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift asr(uint32_t value) noexcept { return Shift(ShiftOp::kASR, value); }
|
||||
|
||||
//! Constructs a `ROR #value` shift (rotate right).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift ror(uint32_t value) noexcept { return Shift(ShiftOp::kROR, value); }
|
||||
|
||||
//! Constructs a `RRX` shift (rotate with carry by 1).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift rrx() noexcept { return Shift(ShiftOp::kRRX, 0); }
|
||||
|
||||
//! Constructs a `MSL #value` shift (logical shift left filling ones).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift msl(uint32_t value) noexcept { return Shift(ShiftOp::kMSL, value); }
|
||||
|
||||
//! Constructs a `UXTB #value` extend and shift (unsigned byte extend) (AArch64).
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_CONSTEXPR Shift uxtb(uint32_t value) noexcept { return Shift(ShiftOp::kUXTB, value); }
|
||||
+15
-15
@@ -3,19 +3,19 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#if !defined(ASMJIT_NO_AARCH64) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
#include "../core/formatter_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
#include "../arm/a64assembler.h"
|
||||
#include "../arm/a64compiler.h"
|
||||
#include "../arm/a64emithelper_p.h"
|
||||
#include "../arm/a64instapi_p.h"
|
||||
#include "../arm/a64instdb_p.h"
|
||||
#include "../arm/a64rapass_p.h"
|
||||
#include <asmjit/core/cpuinfo.h>
|
||||
#include <asmjit/core/formatter_p.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/a64assembler.h>
|
||||
#include <asmjit/arm/a64compiler.h>
|
||||
#include <asmjit/arm/a64emithelper_p.h>
|
||||
#include <asmjit/arm/a64instapi_p.h>
|
||||
#include <asmjit/arm/a64instdb_p.h>
|
||||
#include <asmjit/arm/a64rapass_p.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
@@ -512,10 +512,10 @@ Error RACFGBuilder::on_invoke(InvokeNode* invoke_node, RAInstBuilder& ib) noexce
|
||||
}
|
||||
|
||||
// Setup clobbered registers.
|
||||
ib._clobbered[0] = Support::lsb_mask<RegMask>(_pass._phys_reg_count[RegGroup(0)]) & ~fd.preserved_regs(RegGroup(0));
|
||||
ib._clobbered[1] = Support::lsb_mask<RegMask>(_pass._phys_reg_count[RegGroup(1)]) & ~fd.preserved_regs(RegGroup(1));
|
||||
ib._clobbered[2] = Support::lsb_mask<RegMask>(_pass._phys_reg_count[RegGroup(2)]) & ~fd.preserved_regs(RegGroup(2));
|
||||
ib._clobbered[3] = Support::lsb_mask<RegMask>(_pass._phys_reg_count[RegGroup(3)]) & ~fd.preserved_regs(RegGroup(3));
|
||||
ib._clobbered[0] = Support::lsb_mask<RegMask>(_pass._phys_reg_count.get(RegGroup(0))) & ~fd.preserved_regs(RegGroup(0));
|
||||
ib._clobbered[1] = Support::lsb_mask<RegMask>(_pass._phys_reg_count.get(RegGroup(1))) & ~fd.preserved_regs(RegGroup(1));
|
||||
ib._clobbered[2] = Support::lsb_mask<RegMask>(_pass._phys_reg_count.get(RegGroup(2))) & ~fd.preserved_regs(RegGroup(2));
|
||||
ib._clobbered[3] = Support::lsb_mask<RegMask>(_pass._phys_reg_count.get(RegGroup(3))) & ~fd.preserved_regs(RegGroup(3));
|
||||
|
||||
return Error::kOk;
|
||||
}
|
||||
+8
-8
@@ -6,16 +6,16 @@
|
||||
#ifndef ASMJIT_ARM_A64RAPASS_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_A64RAPASS_P_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/compiler.h"
|
||||
#include "../core/racfgblock_p.h"
|
||||
#include "../core/racfgbuilder_p.h"
|
||||
#include "../core/rapass_p.h"
|
||||
#include "../arm/a64assembler.h"
|
||||
#include "../arm/a64compiler.h"
|
||||
#include "../arm/a64emithelper_p.h"
|
||||
#include <asmjit/core/compiler.h>
|
||||
#include <asmjit/core/racfgblock_p.h>
|
||||
#include <asmjit/core/racfgbuilder_p.h>
|
||||
#include <asmjit/core/rapass_p.h>
|
||||
#include <asmjit/arm/a64assembler.h>
|
||||
#include <asmjit/arm/a64compiler.h>
|
||||
#include <asmjit/arm/a64emithelper_p.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
|
||||
|
||||
Vendored
+9
-9
@@ -3,19 +3,19 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
|
||||
#include "../core/formatter_p.h"
|
||||
#include "../core/misc_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../arm/armformatter_p.h"
|
||||
#include "../arm/a64operand.h"
|
||||
#include "../arm/a64instapi_p.h"
|
||||
#include "../arm/a64instdb_p.h"
|
||||
#include <asmjit/core/formatter_p.h>
|
||||
#include <asmjit/core/misc_p.h>
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/armformatter_p.h>
|
||||
#include <asmjit/arm/a64operand.h>
|
||||
#include <asmjit/arm/a64instapi_p.h>
|
||||
#include <asmjit/arm/a64instdb_p.h>
|
||||
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
#include "../core/compiler.h"
|
||||
#include <asmjit/core/compiler.h>
|
||||
#endif
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(arm)
|
||||
Vendored
+4
-4
@@ -6,12 +6,12 @@
|
||||
#ifndef ASMJIT_ARM_ARMFORMATTER_P_H_INCLUDED
|
||||
#define ASMJIT_ARM_ARMFORMATTER_P_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/string.h"
|
||||
#include "../arm/armglobals.h"
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/arm/armglobals.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(arm)
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@
|
||||
#ifndef ASMJIT_ARM_ARMGLOBALS_H_INCLUDED
|
||||
#define ASMJIT_ARM_ARMGLOBALS_H_INCLUDED
|
||||
|
||||
#include "../core/archcommons.h"
|
||||
#include "../core/inst.h"
|
||||
#include <asmjit/core/archcommons.h>
|
||||
#include <asmjit/core/inst.h>
|
||||
|
||||
//! \namespace asmjit::arm
|
||||
//! \ingroup asmjit_arm
|
||||
+2
-2
@@ -6,8 +6,8 @@
|
||||
#ifndef ASMJIT_ARM_ARMUTILS_H_INCLUDED
|
||||
#define ASMJIT_ARM_ARMUTILS_H_INCLUDED
|
||||
|
||||
#include "../core/support.h"
|
||||
#include "../arm/armglobals.h"
|
||||
#include <asmjit/support/support.h>
|
||||
#include <asmjit/arm/armglobals.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(arm)
|
||||
|
||||
Vendored
File renamed without changes.
File renamed without changes.
@@ -26,10 +26,10 @@
|
||||
|
||||
#pragma message("asmjit/asmjit.h is deprecated! Please use asmjit/[core|x86|a64|host].h instead.")
|
||||
|
||||
#include "./core.h"
|
||||
#include <asmjit/core.h>
|
||||
|
||||
#ifndef ASMJIT_NO_X86
|
||||
#include "./x86.h"
|
||||
#include <asmjit/x86.h>
|
||||
#endif
|
||||
|
||||
#endif // ASMJIT_ASMJIT_H_INCLUDED
|
||||
File renamed without changes.
@@ -225,10 +225,6 @@ namespace asmjit {
|
||||
//!
|
||||
//! \section build_options Build Options
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_DEPRECATED - Disables deprecated API at compile time so it won't be available and the
|
||||
//! compilation will fail if there is attempt to use such API. This includes deprecated classes, namespaces,
|
||||
//! enumerations, and functions.
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_SHM_OPEN - Disables functionality that uses `shm_open()`.
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_ABI_NAMESPACE - Disables inline ABI namespace within `asmjit` namespace. This is only provided
|
||||
@@ -238,8 +234,8 @@ namespace asmjit {
|
||||
//!
|
||||
//! \section build_features Build Features
|
||||
//!
|
||||
//! AsmJit builds by default all supported features, which includes all emitters, logging, instruction validation and
|
||||
//! introspection, and JIT memory allocation. Features can be disabled at compile time by using `ASMJIT_NO_...`
|
||||
//! AsmJit builds by default all supported features, which includes all emitters, logging, instruction validation
|
||||
//! and introspection, and JIT memory allocation. Features can be disabled at compile time by using `ASMJIT_NO_...`
|
||||
//! definitions.
|
||||
//! - \ref ASMJIT_NO_JIT - Disables JIT memory management and \ref JitRuntime.
|
||||
//!
|
||||
@@ -249,11 +245,9 @@ namespace asmjit {
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_LOGGING - Disables \ref Logger and \ref Formatter.
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_VALIDATION - Disables validation API.
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_INTROSPECTION - Disables instruction introspection API, must be used together with \ref
|
||||
//! ASMJIT_NO_COMPILER as \ref asmjit_compiler requires introspection for its liveness analysis and register
|
||||
//! allocation.
|
||||
//! - \ref ASMJIT_NO_INTROSPECTION - Disables instruction introspection and validation API, must be used together
|
||||
//! with \ref ASMJIT_NO_COMPILER as \ref asmjit_compiler requires introspection for its liveness analysis and
|
||||
//! register allocation.
|
||||
//!
|
||||
//! - \ref ASMJIT_NO_BUILDER - Disables \ref asmjit_builder functionality completely. This implies \ref
|
||||
//! ASMJIT_NO_COMPILER as \ref asmjit_compiler cannot be used without \ref asmjit_builder.
|
||||
@@ -1027,7 +1021,7 @@ namespace asmjit {
|
||||
//! \section code_sections Code & Data Sections
|
||||
//!
|
||||
//! AsmJit allows to create multiple sections within the same \ref CodeHolder. A test-case
|
||||
//! [asmjit_test_x86_sections.cpp](https://github.com/asmjit/asmjit/blob/master/test/asmjit_test_x86_sections.cpp)
|
||||
//! [asmjit_test_x86_sections.cpp](https://github.com/asmjit/asmjit/blob/master/asmjit-testing/tests/asmjit_test_x86_sections.cpp)
|
||||
//! can be used as a reference point although the following example should also provide a useful insight:
|
||||
//!
|
||||
//! ```
|
||||
@@ -1866,7 +1860,7 @@ namespace asmjit {
|
||||
//! instruction with operands must be given as some architectures like X86 may require different features for the
|
||||
//! same instruction based on its operands.
|
||||
//!
|
||||
//! - <a href="https://github.com/asmjit/asmjit/blob/master/test/asmjit_test_instinfo.cpp">asmjit_test_instinfo.cpp</a>
|
||||
//! - <a href="https://github.com/asmjit/asmjit/blob/master/asmjit-testing/tests/asmjit_test_instinfo.cpp">asmjit_test_instinfo.cpp</a>
|
||||
//! can be also used as a reference about accessing instruction information.
|
||||
//!
|
||||
//! \section instruction_validation Instruction Validation
|
||||
@@ -2281,43 +2275,46 @@ namespace asmjit {
|
||||
|
||||
} // {asmjit}
|
||||
|
||||
#include "asmjit-scope-begin.h"
|
||||
#include "core/api-config.h"
|
||||
#include "core/archcommons.h"
|
||||
#include "core/archtraits.h"
|
||||
#include "core/arena.h"
|
||||
#include "core/arenahash.h"
|
||||
#include "core/arenalist.h"
|
||||
#include "core/arenapool.h"
|
||||
#include "core/arenastring.h"
|
||||
#include "core/arenatree.h"
|
||||
#include "core/arenavector.h"
|
||||
#include "core/assembler.h"
|
||||
#include "core/builder.h"
|
||||
#include "core/codebuffer.h"
|
||||
#include "core/codeholder.h"
|
||||
#include "core/compiler.h"
|
||||
#include "core/constpool.h"
|
||||
#include "core/cpuinfo.h"
|
||||
#include "core/emitter.h"
|
||||
#include "core/environment.h"
|
||||
#include "core/errorhandler.h"
|
||||
#include "core/fixup.h"
|
||||
#include "core/formatter.h"
|
||||
#include "core/func.h"
|
||||
#include "core/globals.h"
|
||||
#include "core/inst.h"
|
||||
#include "core/jitallocator.h"
|
||||
#include "core/jitruntime.h"
|
||||
#include "core/logger.h"
|
||||
#include "core/operand.h"
|
||||
#include "core/osutils.h"
|
||||
#include "core/span.h"
|
||||
#include "core/string.h"
|
||||
#include "core/support.h"
|
||||
#include "core/target.h"
|
||||
#include "core/type.h"
|
||||
#include "core/virtmem.h"
|
||||
#include "asmjit-scope-end.h"
|
||||
#include <asmjit/asmjit-scope-begin.h>
|
||||
|
||||
#include <asmjit/core/api-config.h>
|
||||
#include <asmjit/core/archcommons.h>
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/builder.h>
|
||||
#include <asmjit/core/codebuffer.h>
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/compiler.h>
|
||||
#include <asmjit/core/constpool.h>
|
||||
#include <asmjit/core/cpuinfo.h>
|
||||
#include <asmjit/core/emitter.h>
|
||||
#include <asmjit/core/environment.h>
|
||||
#include <asmjit/core/errorhandler.h>
|
||||
#include <asmjit/core/fixup.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/func.h>
|
||||
#include <asmjit/core/globals.h>
|
||||
#include <asmjit/core/inst.h>
|
||||
#include <asmjit/core/jitallocator.h>
|
||||
#include <asmjit/core/jitruntime.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/osutils.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/core/target.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/core/virtmem.h>
|
||||
|
||||
#include <asmjit/support/arena.h>
|
||||
#include <asmjit/support/arenahash.h>
|
||||
#include <asmjit/support/arenalist.h>
|
||||
#include <asmjit/support/arenapool.h>
|
||||
#include <asmjit/support/arenastring.h>
|
||||
#include <asmjit/support/arenatree.h>
|
||||
#include <asmjit/support/arenavector.h>
|
||||
#include <asmjit/support/span.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
#include <asmjit/asmjit-scope-end.h>
|
||||
|
||||
#endif // ASMJIT_CORE_H_INCLUDED
|
||||
+2
-2
@@ -48,7 +48,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
|
||||
#if !defined(ASMJIT_BUILD_DEBUG) && defined(__GNUC__) && !defined(__clang__)
|
||||
#define ASMJIT_FAVOR_SIZE __attribute__((__optimize__("Os")))
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
// Include a unit testing package if this is a `asmjit_test_unit` build.
|
||||
#if defined(ASMJIT_TEST)
|
||||
#include "../../../testing/tests/broken.h"
|
||||
#include <asmjit-testing/tests/broken.h>
|
||||
#endif
|
||||
|
||||
#endif // ASMJIT_CORE_API_BUILD_P_H_INCLUDED
|
||||
+2
-14
@@ -16,7 +16,7 @@
|
||||
#define ASMJIT_LIBRARY_MAKE_VERSION(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
|
||||
|
||||
//! AsmJit library version, see \ref ASMJIT_LIBRARY_MAKE_VERSION for a version format reference.
|
||||
#define ASMJIT_LIBRARY_VERSION ASMJIT_LIBRARY_MAKE_VERSION(1, 20, 0)
|
||||
#define ASMJIT_LIBRARY_VERSION ASMJIT_LIBRARY_MAKE_VERSION(1, 21, 0)
|
||||
|
||||
//! \def ASMJIT_ABI_NAMESPACE
|
||||
//!
|
||||
@@ -27,7 +27,7 @@
|
||||
//! AsmJit default, which makes it possible to use multiple AsmJit libraries within a single project, totally
|
||||
//! controlled by users. This is useful especially in cases in which some of such library comes from third party.
|
||||
#if !defined(ASMJIT_ABI_NAMESPACE)
|
||||
#define ASMJIT_ABI_NAMESPACE v1_20
|
||||
#define ASMJIT_ABI_NAMESPACE v1_21
|
||||
#endif // !ASMJIT_ABI_NAMESPACE
|
||||
|
||||
//! \}
|
||||
@@ -90,12 +90,6 @@
|
||||
#define ASMJIT_BUILD_RELEASE
|
||||
#undef ASMJIT_BUILD_RELEASE
|
||||
|
||||
//! \def ASMJIT_NO_DEPRECATED
|
||||
//!
|
||||
//! Disables deprecated API at compile time (deprecated API won't be available).
|
||||
#define ASMJIT_NO_DEPRECATED
|
||||
#undef ASMJIT_NO_DEPRECATED
|
||||
|
||||
//! \def ASMJIT_NO_ABI_NAMESPACE
|
||||
//!
|
||||
//! Disables the use of an inline ABI namespace within asmjit namespace (the inline namespace is used as an ABI tag).
|
||||
@@ -138,12 +132,6 @@
|
||||
#define ASMJIT_NO_TEXT
|
||||
#undef ASMJIT_NO_TEXT
|
||||
|
||||
//! \def ASMJIT_NO_VALIDATION
|
||||
//!
|
||||
//! Disables instruction validation API.
|
||||
#define ASMJIT_NO_VALIDATION
|
||||
#undef ASMJIT_NO_VALIDATION
|
||||
|
||||
//! \def ASMJIT_NO_INTROSPECTION
|
||||
//!
|
||||
//! Disables instruction introspection API.
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
// allows to be created from arm::Shift in a const-expr way, so the arm::Shift must be provided. So this header file
|
||||
// provides everything architecture-specific that is used by the Core API.
|
||||
|
||||
#include "../core/globals.h"
|
||||
#include <asmjit/core/globals.h>
|
||||
|
||||
ASMJIT_BEGIN_SUB_NAMESPACE(arm)
|
||||
|
||||
Vendored
+6
-6
@@ -3,17 +3,17 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/archtraits.h"
|
||||
#include "../core/environment.h"
|
||||
#include "../core/misc_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/environment.h>
|
||||
#include <asmjit/core/misc_p.h>
|
||||
|
||||
#if !defined(ASMJIT_NO_X86)
|
||||
#include "../x86/x86archtraits_p.h"
|
||||
#include <asmjit/x86/x86archtraits_p.h>
|
||||
#endif
|
||||
|
||||
#if !defined(ASMJIT_NO_AARCH64)
|
||||
#include "../arm/a64archtraits_p.h"
|
||||
#include <asmjit/arm/a64archtraits_p.h>
|
||||
#endif
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
#ifndef ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
|
||||
#define ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
|
||||
|
||||
#include "../core/operand.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+9
-9
@@ -3,14 +3,14 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/codewriter_p.h"
|
||||
#include "../core/constpool.h"
|
||||
#include "../core/emitterutils_p.h"
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/codewriter_p.h>
|
||||
#include <asmjit/core/constpool.h>
|
||||
#include <asmjit/core/emitterutils_p.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -259,7 +259,7 @@ Error BaseAssembler::embed_label(const Label& label, size_t data_size) {
|
||||
return report_error(make_error(Error::kNotInitialized));
|
||||
}
|
||||
|
||||
if (ASMJIT_UNLIKELY(is_label_valid(label))) {
|
||||
if (ASMJIT_UNLIKELY(!is_label_valid(label))) {
|
||||
return report_error(make_error(Error::kInvalidLabel));
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
#ifndef ASMJIT_CORE_ASSEMBLER_H_INCLUDED
|
||||
#define ASMJIT_CORE_ASSEMBLER_H_INCLUDED
|
||||
|
||||
#include "../core/codeholder.h"
|
||||
#include "../core/emitter.h"
|
||||
#include "../core/operand.h"
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/emitter.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+18
-18
@@ -3,15 +3,15 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/builder.h"
|
||||
#include "../core/emitterutils_p.h"
|
||||
#include "../core/errorhandler.h"
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/builder.h>
|
||||
#include <asmjit/core/emitterutils_p.h>
|
||||
#include <asmjit/core/errorhandler.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
// BaseBuilder - Utilities
|
||||
// =======================
|
||||
|
||||
static void BaseBuilder_deletePasses(BaseBuilder* self) noexcept {
|
||||
static void BaseBuilder_delete_passes(BaseBuilder* self) noexcept {
|
||||
for (Pass* pass : self->_passes) {
|
||||
pass->~Pass();
|
||||
}
|
||||
@@ -50,7 +50,7 @@ BaseBuilder::BaseBuilder() noexcept
|
||||
_pass_arena(64u * 1024u) {}
|
||||
|
||||
BaseBuilder::~BaseBuilder() noexcept {
|
||||
BaseBuilder_deletePasses(this);
|
||||
BaseBuilder_delete_passes(this);
|
||||
}
|
||||
|
||||
// BaseBuilder - Node Management
|
||||
@@ -612,7 +612,7 @@ Error BaseBuilder::_emit(InstId inst_id, const Operand_& o0, const Operand_& o1,
|
||||
return make_error(Error::kNotInitialized);
|
||||
}
|
||||
|
||||
#ifndef ASMJIT_NO_VALIDATION
|
||||
#ifndef ASMJIT_NO_INTROSPECTION
|
||||
// Strict validation.
|
||||
if (has_diagnostic_option(DiagnosticOptions::kValidateIntermediate)) {
|
||||
Operand_ op_array[Globals::kMaxOpCount];
|
||||
@@ -865,7 +865,7 @@ Error BaseBuilder::serialize_to(BaseEmitter* dst) {
|
||||
// BaseBuilder - Events
|
||||
// ====================
|
||||
|
||||
static ASMJIT_INLINE void BaseBuilder_clearAll(BaseBuilder* self) noexcept {
|
||||
static ASMJIT_INLINE void BaseBuilder_clear_all(BaseBuilder* self) noexcept {
|
||||
self->_section_nodes.reset();
|
||||
self->_label_nodes.reset();
|
||||
|
||||
@@ -876,7 +876,7 @@ static ASMJIT_INLINE void BaseBuilder_clearAll(BaseBuilder* self) noexcept {
|
||||
self->_node_list.reset();
|
||||
}
|
||||
|
||||
static ASMJIT_INLINE Error BaseBuilder_initSection(BaseBuilder* self) noexcept {
|
||||
static ASMJIT_INLINE Error BaseBuilder_init_section(BaseBuilder* self) noexcept {
|
||||
SectionNode* initial_section;
|
||||
|
||||
ASMJIT_PROPAGATE(self->section_node_of(Out(initial_section), 0));
|
||||
@@ -893,7 +893,7 @@ static ASMJIT_INLINE Error BaseBuilder_initSection(BaseBuilder* self) noexcept {
|
||||
Error BaseBuilder::on_attach(CodeHolder& code) noexcept {
|
||||
ASMJIT_PROPAGATE(Base::on_attach(code));
|
||||
|
||||
Error err = BaseBuilder_initSection(this);
|
||||
Error err = BaseBuilder_init_section(this);
|
||||
if (ASMJIT_UNLIKELY(err != Error::kOk)) {
|
||||
on_detach(code);
|
||||
}
|
||||
@@ -901,8 +901,8 @@ Error BaseBuilder::on_attach(CodeHolder& code) noexcept {
|
||||
}
|
||||
|
||||
Error BaseBuilder::on_detach(CodeHolder& code) noexcept {
|
||||
BaseBuilder_deletePasses(this);
|
||||
BaseBuilder_clearAll(this);
|
||||
BaseBuilder_delete_passes(this);
|
||||
BaseBuilder_clear_all(this);
|
||||
|
||||
return Base::on_detach(code);
|
||||
}
|
||||
@@ -911,9 +911,9 @@ Error BaseBuilder::on_reinit(CodeHolder& code) noexcept {
|
||||
// BaseEmitter::on_reinit() never fails.
|
||||
(void)Base::on_reinit(code);
|
||||
|
||||
BaseBuilder_deletePasses(this);
|
||||
BaseBuilder_clearAll(this);
|
||||
return BaseBuilder_initSection(this);
|
||||
BaseBuilder_delete_passes(this);
|
||||
BaseBuilder_clear_all(this);
|
||||
return BaseBuilder_init_section(this);
|
||||
}
|
||||
|
||||
// Pass - Construction & Destruction
|
||||
+14
-14
@@ -6,20 +6,20 @@
|
||||
#ifndef ASMJIT_CORE_BUILDER_H_INCLUDED
|
||||
#define ASMJIT_CORE_BUILDER_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/arena.h"
|
||||
#include "../core/arenavector.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/codeholder.h"
|
||||
#include "../core/constpool.h"
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/inst.h"
|
||||
#include "../core/operand.h"
|
||||
#include "../core/string.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/constpool.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/inst.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/support/arena.h>
|
||||
#include <asmjit/support/arenavector.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -1088,7 +1088,7 @@ public:
|
||||
//! Returns the index of the given operand type `op_type`.
|
||||
//!
|
||||
//! \note If the operand type wa found, the value returned represents its index in \ref operands()
|
||||
//! array, otherwise \ref Globals::kNPos is returned to signalize that the operand was not found.
|
||||
//! array, otherwise `SIZE_MAX` is returned to signalize that the operand was not found.
|
||||
[[nodiscard]]
|
||||
inline size_t index_of_op_type(OperandType op_type) const noexcept {
|
||||
Span<const Operand> ops = operands();
|
||||
@@ -1097,7 +1097,7 @@ public:
|
||||
return i;
|
||||
}
|
||||
|
||||
return Globals::kNPos;
|
||||
return SIZE_MAX;
|
||||
}
|
||||
|
||||
//! A shortcut that calls `index_of_op_type(OperandType::kMem)`.
|
||||
+2
-2
@@ -6,10 +6,10 @@
|
||||
#ifndef ASMJIT_CORE_BUILDER_P_H_INCLUDED
|
||||
#define ASMJIT_CORE_BUILDER_P_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/builder.h"
|
||||
#include <asmjit/core/builder.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@
|
||||
#ifndef ASMJIT_CORE_CODEBUFFER_H_INCLUDED
|
||||
#define ASMJIT_CORE_CODEBUFFER_H_INCLUDED
|
||||
|
||||
#include "../core/globals.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/globals.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
Vendored
+45
-27
@@ -3,11 +3,11 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/codewriter_p.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/codewriter_p.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
@@ -32,7 +32,7 @@ static constexpr LabelEntry::ExtraData CodeHolder_make_shared_label_extra_data()
|
||||
return extra_data;
|
||||
}
|
||||
|
||||
static constexpr LabelEntry::ExtraData CodeHolder_sharedLabelExtraData = CodeHolder_make_shared_label_extra_data();
|
||||
static constexpr LabelEntry::ExtraData CodeHolder_shared_label_extra_data = CodeHolder_make_shared_label_extra_data();
|
||||
|
||||
class ResolveFixupIterator {
|
||||
public:
|
||||
@@ -86,7 +86,7 @@ static ASMJIT_INLINE void Section_init_name(
|
||||
section->_name.u32[3] = 0u;
|
||||
}
|
||||
|
||||
static ASMJIT_INLINE void Section_init_data(Section* section, uint32_t section_id, SectionFlags flags, uint32_t alignment, int order) noexcept {
|
||||
static ASMJIT_INLINE void Section_init_data(Section* section, uint32_t section_id, SectionFlags flags, uint32_t alignment, int order, uint64_t offset) noexcept {
|
||||
section->_section_id = section_id;
|
||||
|
||||
// These two fields are not used by sections (see \ref LabelEntry for more details about why).
|
||||
@@ -96,7 +96,7 @@ static ASMJIT_INLINE void Section_init_data(Section* section, uint32_t section_i
|
||||
section->assign_flags(flags);
|
||||
section->_alignment = alignment;
|
||||
section->_order = order;
|
||||
section->_offset = 0;
|
||||
section->_offset = offset;
|
||||
section->_virtual_size = 0;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ static ASMJIT_INLINE Error CodeHolder_init_section_storage(CodeHolder* self) noe
|
||||
static ASMJIT_INLINE void CodeHolder_add_text_section(CodeHolder* self) noexcept {
|
||||
Section* text_section = &self->_text_section;
|
||||
|
||||
Section_init_data(text_section, 0u, SectionFlags::kExecutable | SectionFlags::kReadOnly | SectionFlags::kBuiltIn, 0u, 0);
|
||||
Section_init_data(text_section, 0u, SectionFlags::kExecutable | SectionFlags::kReadOnly | SectionFlags::kBuiltIn, 0u, std::numeric_limits<int>::lowest(), 0);
|
||||
Section_init_name(text_section, '.', 't', 'e', 'x', 't');
|
||||
|
||||
self->_sections.append_unchecked(text_section);
|
||||
@@ -535,7 +535,7 @@ Error CodeHolder::new_section(Out<Section*> section_out, const char* name, size_
|
||||
alignment = 1u;
|
||||
}
|
||||
|
||||
Section_init_data(section, section_id, flags, alignment, order);
|
||||
Section_init_data(section, section_id, flags, alignment, order, Globals::kNoSectionOffset);
|
||||
Section_init_buffer(section);
|
||||
memcpy(section->_name.str, name, name_size);
|
||||
|
||||
@@ -692,7 +692,7 @@ Error CodeHolder::new_label_id(Out<uint32_t> label_id_out) noexcept {
|
||||
}
|
||||
else {
|
||||
label_id_out = label_id;
|
||||
_label_entries.append_unchecked(LabelEntry{const_cast<LabelEntry::ExtraData*>(&CodeHolder_sharedLabelExtraData), uint64_t(0)});
|
||||
_label_entries.append_unchecked(LabelEntry{const_cast<LabelEntry::ExtraData*>(&CodeHolder_shared_label_extra_data), uint64_t(0)});
|
||||
return Error::kOk;
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ Error CodeHolder::new_named_label_id(Out<uint32_t> label_id_out, const char* nam
|
||||
}
|
||||
|
||||
label_id_out = label_id;
|
||||
_label_entries.append_unchecked(LabelEntry{const_cast<LabelEntry::ExtraData*>(&CodeHolder_sharedLabelExtraData), uint64_t(0)});
|
||||
_label_entries.append_unchecked(LabelEntry{const_cast<LabelEntry::ExtraData*>(&CodeHolder_shared_label_extra_data), uint64_t(0)});
|
||||
return Error::kOk;
|
||||
}
|
||||
|
||||
@@ -1099,14 +1099,14 @@ Error CodeHolder::flatten() noexcept {
|
||||
}
|
||||
|
||||
// Now we know that we can assign offsets of all sections properly.
|
||||
Section* prev = nullptr;
|
||||
offset = 0;
|
||||
Section* prev = nullptr;
|
||||
for (Section* section : _sections_by_order) {
|
||||
uint64_t real_size = section->real_size();
|
||||
if (real_size) {
|
||||
offset = Support::align_up(offset, section->alignment());
|
||||
}
|
||||
section->_offset = offset;
|
||||
section->set_offset(offset);
|
||||
|
||||
// Make sure the previous section extends a bit to cover the alignment.
|
||||
if (prev) {
|
||||
@@ -1411,22 +1411,40 @@ UNIT(code_holder) {
|
||||
EXPECT_EQ(strcmp(code.label_entry_of(label_id2).name(), "NamedLabel2"), 0);
|
||||
EXPECT_EQ(code.label_id_by_name("NamedLabel2"), label_id2);
|
||||
|
||||
INFO("Verifying .text properties");
|
||||
Section* section_text = code.text_section();
|
||||
EXPECT_TRUE(section_text->has_offset());
|
||||
|
||||
INFO("Verifying section ordering");
|
||||
Section* section1;
|
||||
EXPECT_EQ(code.new_section(Out(section1), "high-priority", SIZE_MAX, SectionFlags::kNone, 1, -1), Error::kOk);
|
||||
EXPECT_EQ(code.sections()[1], section1);
|
||||
EXPECT_EQ(code.sections_by_order()[0], section1);
|
||||
Section* section_a;
|
||||
EXPECT_EQ(code.new_section(Out(section_a), "high-priority", SIZE_MAX, SectionFlags::kNone, 1, -1), Error::kOk);
|
||||
EXPECT_EQ(code.sections()[0], section_text);
|
||||
EXPECT_EQ(code.sections()[1], section_a);
|
||||
EXPECT_EQ(code.sections_by_order()[0], section_text);
|
||||
EXPECT_EQ(code.sections_by_order()[1], section_a);
|
||||
EXPECT_FALSE(section_a->has_offset());
|
||||
|
||||
Section* section0;
|
||||
EXPECT_EQ(code.new_section(Out(section0), "higher-priority", SIZE_MAX, SectionFlags::kNone, 1, -2), Error::kOk);
|
||||
EXPECT_EQ(code.sections()[2], section0);
|
||||
EXPECT_EQ(code.sections_by_order()[0], section0);
|
||||
EXPECT_EQ(code.sections_by_order()[1], section1);
|
||||
Section* section_b;
|
||||
EXPECT_EQ(code.new_section(Out(section_b), "higher-priority", SIZE_MAX, SectionFlags::kNone, 1, -2), Error::kOk);
|
||||
EXPECT_EQ(code.sections()[0], section_text);
|
||||
EXPECT_EQ(code.sections()[1], section_a);
|
||||
EXPECT_EQ(code.sections()[2], section_b);
|
||||
EXPECT_EQ(code.sections_by_order()[0], section_text);
|
||||
EXPECT_EQ(code.sections_by_order()[1], section_b);
|
||||
EXPECT_EQ(code.sections_by_order()[2], section_a);
|
||||
EXPECT_FALSE(section_b->has_offset());
|
||||
|
||||
Section* section3;
|
||||
EXPECT_EQ(code.new_section(Out(section3), "low-priority", SIZE_MAX, SectionFlags::kNone, 1, 2), Error::kOk);
|
||||
EXPECT_EQ(code.sections()[3], section3);
|
||||
EXPECT_EQ(code.sections_by_order()[3], section3);
|
||||
Section* section_c;
|
||||
EXPECT_EQ(code.new_section(Out(section_c), "low-priority", SIZE_MAX, SectionFlags::kNone, 1, 2), Error::kOk);
|
||||
EXPECT_EQ(code.sections()[0], section_text);
|
||||
EXPECT_EQ(code.sections()[1], section_a);
|
||||
EXPECT_EQ(code.sections()[2], section_b);
|
||||
EXPECT_EQ(code.sections()[3], section_c);
|
||||
EXPECT_EQ(code.sections_by_order()[0], section_text);
|
||||
EXPECT_EQ(code.sections_by_order()[1], section_b);
|
||||
EXPECT_EQ(code.sections_by_order()[2], section_a);
|
||||
EXPECT_EQ(code.sections_by_order()[3], section_c);
|
||||
EXPECT_FALSE(section_c->has_offset());
|
||||
}
|
||||
#endif
|
||||
|
||||
+22
-15
@@ -6,21 +6,21 @@
|
||||
#ifndef ASMJIT_CORE_CODEHOLDER_H_INCLUDED
|
||||
#define ASMJIT_CORE_CODEHOLDER_H_INCLUDED
|
||||
|
||||
#include "../core/archtraits.h"
|
||||
#include "../core/arena.h"
|
||||
#include "../core/arenahash.h"
|
||||
#include "../core/arenapool.h"
|
||||
#include "../core/arenastring.h"
|
||||
#include "../core/arenatree.h"
|
||||
#include "../core/arenavector.h"
|
||||
#include "../core/codebuffer.h"
|
||||
#include "../core/errorhandler.h"
|
||||
#include "../core/fixup.h"
|
||||
#include "../core/operand.h"
|
||||
#include "../core/span.h"
|
||||
#include "../core/string.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/target.h"
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/codebuffer.h>
|
||||
#include <asmjit/core/errorhandler.h>
|
||||
#include <asmjit/core/fixup.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/core/target.h>
|
||||
#include <asmjit/support/arena.h>
|
||||
#include <asmjit/support/arenahash.h>
|
||||
#include <asmjit/support/arenapool.h>
|
||||
#include <asmjit/support/arenastring.h>
|
||||
#include <asmjit/support/arenatree.h>
|
||||
#include <asmjit/support/arenavector.h>
|
||||
#include <asmjit/support/span.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -294,8 +294,15 @@ public:
|
||||
ASMJIT_INLINE_NODEBUG uint64_t offset() const noexcept { return _offset; }
|
||||
|
||||
//! Set the section offset.
|
||||
//!
|
||||
//! \note If the section's offset hasn't been assigned, the returned value would be \ref Globals::kNoSectionOffset.
|
||||
ASMJIT_INLINE_NODEBUG void set_offset(uint64_t offset) noexcept { _offset = offset; }
|
||||
|
||||
//! Returns whether the section's offset has been already assigned.
|
||||
//!
|
||||
//! This is true for the first built-in .text section and for all sections that have been flattened.
|
||||
ASMJIT_INLINE_NODEBUG bool has_offset() const noexcept { return _offset != Globals::kNoSectionOffset; }
|
||||
|
||||
//! Returns the virtual size of the section.
|
||||
//!
|
||||
//! Virtual size is initially zero and is never changed by AsmJit. It's normal if virtual size is smaller than
|
||||
Vendored
+7
-6
@@ -3,11 +3,12 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/codeholder.h"
|
||||
#include "../core/codewriter_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/codewriter_p.h>
|
||||
#include <asmjit/core/emitterutils_p.h>
|
||||
|
||||
#include "../arm/armutils.h"
|
||||
#include <asmjit/arm/armutils.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -65,7 +66,7 @@ bool CodeWriterUtils::encode_offset32(uint32_t* dst, int64_t offset64, const Off
|
||||
}
|
||||
|
||||
value = uint32_t(int32_t(offset64));
|
||||
if (!Support::is_encodable_offset_32(int32_t(value), bit_count)) {
|
||||
if (!EmitterUtils::is_encodable_offset_32(int32_t(value), bit_count)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -228,7 +229,7 @@ bool CodeWriterUtils::encode_offset64(uint64_t* dst, int64_t offset64, const Off
|
||||
offset64 >>= discard_lsb;
|
||||
}
|
||||
|
||||
if (!Support::is_encodable_offset_64(offset64, bit_count)) {
|
||||
if (!EmitterUtils::is_encodable_offset_64(offset64, bit_count)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -6,9 +6,9 @@
|
||||
#ifndef ASMJIT_CORE_CODEBUFFERWRITER_P_H_INCLUDED
|
||||
#define ASMJIT_CORE_CODEBUFFERWRITER_P_H_INCLUDED
|
||||
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/codebuffer.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/codebuffer.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+10
-10
@@ -3,18 +3,18 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/builder_p.h"
|
||||
#include "../core/compiler.h"
|
||||
#include "../core/cpuinfo.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/rapass_p.h"
|
||||
#include "../core/rastack_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/builder_p.h>
|
||||
#include <asmjit/core/compiler.h>
|
||||
#include <asmjit/core/cpuinfo.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/core/rapass_p.h>
|
||||
#include <asmjit/core/rastack_p.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+11
-11
@@ -6,19 +6,19 @@
|
||||
#ifndef ASMJIT_CORE_COMPILER_H_INCLUDED
|
||||
#define ASMJIT_CORE_COMPILER_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/arena.h"
|
||||
#include "../core/arenavector.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/builder.h"
|
||||
#include "../core/constpool.h"
|
||||
#include "../core/compilerdefs.h"
|
||||
#include "../core/func.h"
|
||||
#include "../core/inst.h"
|
||||
#include "../core/operand.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/builder.h>
|
||||
#include <asmjit/core/constpool.h>
|
||||
#include <asmjit/core/compilerdefs.h>
|
||||
#include <asmjit/core/func.h>
|
||||
#include <asmjit/core/inst.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/support/arena.h>
|
||||
#include <asmjit/support/arenavector.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
Vendored
+5
-5
@@ -6,11 +6,11 @@
|
||||
#ifndef ASMJIT_CORE_COMPILERDEFS_H_INCLUDED
|
||||
#define ASMJIT_CORE_COMPILERDEFS_H_INCLUDED
|
||||
|
||||
#include "../core/api-config.h"
|
||||
#include "../core/arenastring.h"
|
||||
#include "../core/operand.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
#include <asmjit/core/api-config.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/type.h>
|
||||
#include <asmjit/support/arenastring.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/constpool.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/constpool.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
#ifndef ASMJIT_CORE_CONSTPOOL_H_INCLUDED
|
||||
#define ASMJIT_CORE_CONSTPOOL_H_INCLUDED
|
||||
|
||||
#include "../core/arena.h"
|
||||
#include "../core/arenatree.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/support/arena.h>
|
||||
#include <asmjit/support/arenatree.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/cpuinfo.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/cpuinfo.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
+5
-5
@@ -6,11 +6,11 @@
|
||||
#ifndef ASMJIT_CORE_CPUINFO_H_INCLUDED
|
||||
#define ASMJIT_CORE_CPUINFO_H_INCLUDED
|
||||
|
||||
#include "../core/archtraits.h"
|
||||
#include "../core/environment.h"
|
||||
#include "../core/globals.h"
|
||||
#include "../core/string.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/environment.h>
|
||||
#include <asmjit/core/globals.h>
|
||||
#include <asmjit/core/string.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
Vendored
+6
-6
@@ -3,12 +3,12 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/archtraits.h"
|
||||
#include "../core/emithelper_p.h"
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/funcargscontext_p.h"
|
||||
#include "../core/radefs_p.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/emithelper_p.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/funcargscontext_p.h>
|
||||
#include <asmjit/core/radefs_p.h>
|
||||
|
||||
// Can be used for debugging...
|
||||
// #define ASMJIT_DUMP_ARGS_ASSIGNMENT
|
||||
Vendored
+3
-3
@@ -6,9 +6,9 @@
|
||||
#ifndef ASMJIT_CORE_EMITHELPER_P_H_INCLUDED
|
||||
#define ASMJIT_CORE_EMITHELPER_P_H_INCLUDED
|
||||
|
||||
#include "../core/emitter.h"
|
||||
#include "../core/operand.h"
|
||||
#include "../core/type.h"
|
||||
#include <asmjit/core/emitter.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/type.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+5
-5
@@ -3,11 +3,11 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/emitterutils_p.h"
|
||||
#include "../core/errorhandler.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/emitterutils_p.h>
|
||||
#include <asmjit/core/errorhandler.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+6
-6
@@ -6,12 +6,12 @@
|
||||
#ifndef ASMJIT_CORE_EMITTER_H_INCLUDED
|
||||
#define ASMJIT_CORE_EMITTER_H_INCLUDED
|
||||
|
||||
#include "../core/archtraits.h"
|
||||
#include "../core/codeholder.h"
|
||||
#include "../core/formatter.h"
|
||||
#include "../core/inst.h"
|
||||
#include "../core/operand.h"
|
||||
#include "../core/type.h"
|
||||
#include <asmjit/core/archtraits.h>
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/formatter.h>
|
||||
#include <asmjit/core/inst.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/core/type.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
Vendored
+6
-6
@@ -3,12 +3,12 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/emitterutils_p.h"
|
||||
#include "../core/formatter_p.h"
|
||||
#include "../core/logger.h"
|
||||
#include "../core/support.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/assembler.h>
|
||||
#include <asmjit/core/emitterutils_p.h>
|
||||
#include <asmjit/core/formatter_p.h>
|
||||
#include <asmjit/core/logger.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
Vendored
+21
-4
@@ -6,8 +6,10 @@
|
||||
#ifndef ASMJIT_CORE_EMITTERUTILS_P_H_INCLUDED
|
||||
#define ASMJIT_CORE_EMITTERUTILS_P_H_INCLUDED
|
||||
|
||||
#include "../core/emitter.h"
|
||||
#include "../core/operand.h"
|
||||
#include <asmjit/core/codeholder.h>
|
||||
#include <asmjit/core/emitter.h>
|
||||
#include <asmjit/core/operand.h>
|
||||
#include <asmjit/support/support.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -21,8 +23,6 @@ class FormatOptions;
|
||||
//! Utilities used by various emitters, mostly Assembler implementations.
|
||||
namespace EmitterUtils {
|
||||
|
||||
//! Default paddings used by Emitter utils and Formatter.
|
||||
|
||||
static constexpr Operand no_ext[3] = { {}, {}, {} };
|
||||
|
||||
enum kOpIndex : uint32_t {
|
||||
@@ -59,6 +59,23 @@ static ASMJIT_INLINE void op_array_from_emit_args(Operand_ dst[Globals::kMaxOpCo
|
||||
dst[5].copy_from(op_ext[kOp5]);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_NODEBUG bool is_encodable_offset_32(int32_t offset, uint32_t num_bits) noexcept {
|
||||
uint32_t n_rev = 32 - num_bits;
|
||||
return Support::sar(Support::shl(offset, n_rev), n_rev) == offset;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_NODEBUG bool is_encodable_offset_64(int64_t offset, uint32_t num_bits) noexcept {
|
||||
uint32_t n_rev = 64 - num_bits;
|
||||
return Support::sar(Support::shl(offset, n_rev), n_rev) == offset;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
static ASMJIT_INLINE_NODEBUG bool is_absolute_location(uint64_t base_address, uint64_t section_offset) noexcept {
|
||||
return base_address != Globals::kNoBaseAddress && section_offset != Globals::kNoSectionOffset;
|
||||
}
|
||||
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
Error finish_formatted_line(String& sb, const FormatOptions& format_options, const uint8_t* bin_data, size_t bin_size, size_t offset_size, size_t imm_size, const char* comment) noexcept;
|
||||
|
||||
Vendored
+2
-2
@@ -3,8 +3,8 @@
|
||||
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
||||
// SPDX-License-Identifier: Zlib
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/environment.h"
|
||||
#include <asmjit/core/api-build_p.h>
|
||||
#include <asmjit/core/environment.h>
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
#ifndef ASMJIT_CORE_ENVIRONMENT_H_INCLUDED
|
||||
#define ASMJIT_CORE_ENVIRONMENT_H_INCLUDED
|
||||
|
||||
#include "../core/archtraits.h"
|
||||
#include <asmjit/core/archtraits.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
Loaded 100 of 2559 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user