Skip to content

Commit cc7018e

Browse files
authored
JIT compilation on ARM processors (openmm#3517)
* Upgraded to new version of asmjit * JIT compilation for ARM * Updated CMake script
1 parent 0644f05 commit cc7018e

File tree

222 files changed

+81478
-49117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+81478
-49117
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ IF(X86)
247247
ELSE()
248248
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/libraries/sfmt/src/SFMT.cpp PROPERTIES COMPILE_FLAGS "-UHAVE_SSE2")
249249
ENDIF()
250-
IF(X86 AND NOT (WIN32 AND OPENMM_BUILD_STATIC_LIB))
251-
FILE(GLOB src_files ${CMAKE_CURRENT_SOURCE_DIR}/libraries/asmjit/*/*.cpp)
250+
IF((X86 OR ARM) AND NOT (WIN32 AND OPENMM_BUILD_STATIC_LIB))
251+
FILE(GLOB src_files ${CMAKE_CURRENT_SOURCE_DIR}/libraries/asmjit/asmjit/*/*.cpp)
252252
FILE(GLOB incl_files ${CMAKE_CURRENT_SOURCE_DIR}/libraries/asmjit/*.h)
253253
SET(SOURCE_FILES ${SOURCE_FILES} ${src_files})
254254
SET(SOURCE_INCLUDE_FILES ${SOURCE_INCLUDE_FILES} ${incl_files})

libraries/asmjit/arm.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

libraries/asmjit/asmjit.h

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2008-2017, Petr Kobalicek
1+
Copyright (c) 2008-2020 The AsmJit Authors
22

33
This software is provided 'as-is', without any express or implied
44
warranty. In no event will the authors be held liable for any damages

libraries/asmjit/asmjit/a64.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// This file is part of AsmJit project <https://asmjit.com>
2+
//
3+
// See asmjit.h or LICENSE.md for license and copyright information
4+
// SPDX-License-Identifier: Zlib
5+
6+
#ifndef ASMJIT_A64_H_INCLUDED
7+
#define ASMJIT_A64_H_INCLUDED
8+
9+
//! \addtogroup asmjit_a64
10+
//!
11+
//! ### Emitters
12+
//!
13+
//! - \ref a64::Assembler - AArch64 assembler (must read, provides examples).
14+
//! - \ref a64::Builder - AArch64 builder.
15+
//! - \ref a64::Compiler - AArch64 compiler.
16+
//! - \ref a64::Emitter - AArch64 emitter (abstract).
17+
//!
18+
//! ### Supported Instructions
19+
//!
20+
//! - Emitters:
21+
//! - \ref a64::EmitterExplicitT - Provides all instructions that use explicit
22+
//! operands, provides also utility functions. The member functions provided
23+
//! are part of all ARM/AArch64 emitters.
24+
//!
25+
//! - Instruction representation:
26+
//! - \ref a64::Inst::Id - instruction identifiers.
27+
//!
28+
//! ### Register Operands
29+
//!
30+
//! - \ref arm::Reg - Base class for any AArch32/AArch64 register.
31+
//! - \ref arm::Gp - General purpose register:
32+
//! - \ref arm::GpW - 32-bit register.
33+
//! - \ref arm::GpX - 64-bit register.
34+
//! - \ref arm::Vec - Vector (SIMD) register:
35+
//! - \ref arm::VecB - 8-bit SIMD register (AArch64 only).
36+
//! - \ref arm::VecH - 16-bit SIMD register (AArch64 only).
37+
//! - \ref arm::VecS - 32-bit SIMD register.
38+
//! - \ref arm::VecD - 64-bit SIMD register.
39+
//! - \ref arm::VecV - 128-bit SIMD register.
40+
//!
41+
//! ### Memory Operands
42+
//!
43+
//! - \ref arm::Mem - AArch32/AArch64 memory operand that provides support for all ARM addressing features
44+
//! including base, index, pre/post increment, and ARM-specific shift addressing and index extending.
45+
//!
46+
//! ### Other
47+
//!
48+
//! - \ref arm::Shift - Shift operation and value.
49+
//! - \ref a64::Utils - Utilities that can help during code generation for AArch64.
50+
51+
#include "./arm.h"
52+
#include "./arm/a64assembler.h"
53+
#include "./arm/a64builder.h"
54+
#include "./arm/a64compiler.h"
55+
#include "./arm/a64emitter.h"
56+
#include "./arm/a64globals.h"
57+
#include "./arm/a64instdb.h"
58+
#include "./arm/a64operand.h"
59+
#include "./arm/a64utils.h"
60+
61+
#endif // ASMJIT_A64_H_INCLUDED
62+

libraries/asmjit/asmjit/arm.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// This file is part of AsmJit project <https://asmjit.com>
2+
//
3+
// See asmjit.h or LICENSE.md for license and copyright information
4+
// SPDX-License-Identifier: Zlib
5+
6+
#ifndef ASMJIT_ARM_H_INCLUDED
7+
#define ASMJIT_ARM_H_INCLUDED
8+
9+
//! \addtogroup asmjit_arm
10+
//!
11+
//! ### Namespaces
12+
//!
13+
//! - \ref arm - arm namespace provides common functionality for both AArch32 and AArch64 backends.
14+
//! - \ref a64 - a64 namespace provides support for AArch64 architecture. In addition it includes
15+
//! \ref arm namespace, so you can only use a single namespace when targeting AArch64 architecture.
16+
//!
17+
//! ### Emitters
18+
//!
19+
//! - AArch64
20+
//! - \ref a64::Assembler - AArch64 assembler (must read, provides examples).
21+
//! - \ref a64::Builder - AArch64 builder.
22+
//! - \ref a64::Compiler - AArch64 compiler.
23+
//! - \ref a64::Emitter - AArch64 emitter (abstract).
24+
//!
25+
//! ### Supported Instructions
26+
//!
27+
//! - AArch64:
28+
//! - Emitters:
29+
//! - \ref a64::EmitterExplicitT - Provides all instructions that use explicit operands, provides also
30+
//! utility functions. The member functions provided are part of all AArch64 emitters.
31+
//! - Instruction representation:
32+
//! - \ref a64::Inst::Id - instruction identifiers.
33+
//!
34+
//! ### Register Operands
35+
//!
36+
//! - \ref arm::Reg - Base class for any AArch32/AArch64 register.
37+
//! - \ref arm::Gp - General purpose register:
38+
//! - \ref arm::GpW - 32-bit register.
39+
//! - \ref arm::GpX - 64-bit register.
40+
//! - \ref arm::Vec - Vector (SIMD) register:
41+
//! - \ref arm::VecB - 8-bit SIMD register (AArch64 only).
42+
//! - \ref arm::VecH - 16-bit SIMD register (AArch64 only).
43+
//! - \ref arm::VecS - 32-bit SIMD register.
44+
//! - \ref arm::VecD - 64-bit SIMD register.
45+
//! - \ref arm::VecV - 128-bit SIMD register.
46+
//!
47+
//! ### Memory Operands
48+
//!
49+
//! - \ref arm::Mem - AArch32/AArch64 memory operand that provides support for all ARM addressing features
50+
//! including base, index, pre/post increment, and ARM-specific shift addressing and index extending.
51+
//!
52+
//! ### Other
53+
//!
54+
//! - \ref arm::Shift - Shift operation and value (both AArch32 and AArch64).
55+
//! - \ref arm::DataType - Data type that is part of an instruction in AArch32 mode.
56+
//! - \ref a64::Utils - Utilities that can help during code generation for AArch64.
57+
58+
#include "./core.h"
59+
#include "./arm/armglobals.h"
60+
#include "./arm/armoperand.h"
61+
62+
#endif // ASMJIT_ARM_H_INCLUDED
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// This file is part of AsmJit project <https://asmjit.com>
2+
//
3+
// See asmjit.h or LICENSE.md for license and copyright information
4+
// SPDX-License-Identifier: Zlib
5+
6+
#ifndef ASMJIT_ARM_A64ARCHTRAITS_P_H_INCLUDED
7+
#define ASMJIT_ARM_A64ARCHTRAITS_P_H_INCLUDED
8+
9+
#include "../core/archtraits.h"
10+
#include "../core/misc_p.h"
11+
#include "../core/type.h"
12+
#include "../arm/a64operand.h"
13+
14+
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
15+
16+
//! \cond INTERNAL
17+
//! \addtogroup asmjit_a64
18+
//! \{
19+
20+
static const constexpr ArchTraits a64ArchTraits = {
21+
// SP/FP/LR/PC.
22+
Gp::kIdSp, Gp::kIdFp, Gp::kIdLr, 0xFF,
23+
24+
// Reserved.
25+
{ 0, 0, 0 },
26+
27+
// HW stack alignment (AArch64 requires stack aligned to 64 bytes).
28+
16,
29+
30+
// Min/max stack offset - byte addressing is the worst, VecQ addressing the best.
31+
4095, 65520,
32+
33+
// Instruction hints [Gp, Vec, ExtraVirt2, ExtraVirt3].
34+
{{
35+
InstHints::kPushPop,
36+
InstHints::kPushPop,
37+
InstHints::kNoHints,
38+
InstHints::kNoHints
39+
}},
40+
41+
// RegInfo.
42+
#define V(index) OperandSignature{arm::RegTraits<RegType(index)>::kSignature}
43+
{{ ASMJIT_LOOKUP_TABLE_32(V, 0) }},
44+
#undef V
45+
46+
// RegTypeToTypeId.
47+
#define V(index) TypeId(arm::RegTraits<RegType(index)>::kTypeId)
48+
{{ ASMJIT_LOOKUP_TABLE_32(V, 0) }},
49+
#undef V
50+
51+
// TypeIdToRegType.
52+
#define V(index) (index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kInt8) ? RegType::kARM_GpW : \
53+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kUInt8) ? RegType::kARM_GpW : \
54+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kInt16) ? RegType::kARM_GpW : \
55+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kUInt16) ? RegType::kARM_GpW : \
56+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kInt32) ? RegType::kARM_GpW : \
57+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kUInt32) ? RegType::kARM_GpW : \
58+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kInt64) ? RegType::kARM_GpX : \
59+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kUInt64) ? RegType::kARM_GpX : \
60+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kIntPtr) ? RegType::kARM_GpX : \
61+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kUIntPtr) ? RegType::kARM_GpX : \
62+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kFloat32) ? RegType::kARM_VecS : \
63+
index + uint32_t(TypeId::_kBaseStart) == uint32_t(TypeId::kFloat64) ? RegType::kARM_VecD : RegType::kNone)
64+
{{ ASMJIT_LOOKUP_TABLE_32(V, 0) }},
65+
#undef V
66+
67+
// Word names of 8-bit, 16-bit, 32-bit, and 64-bit quantities.
68+
{
69+
ArchTypeNameId::kByte,
70+
ArchTypeNameId::kHWord,
71+
ArchTypeNameId::kWord,
72+
ArchTypeNameId::kXWord
73+
}
74+
};
75+
76+
//! \}
77+
//! \endcond
78+
79+
ASMJIT_END_SUB_NAMESPACE
80+
81+
#endif // ASMJIT_ARM_A64ARCHTRAITS_P_H_INCLUDED

0 commit comments

Comments
 (0)