Skip to content

Commit 75696a7

Browse files
committed
feat(hexagon): add Hexagon ISA target support
Add interpreter and AOT execution support for Qualcomm Hexagon DSP: invokeNative trampoline, ELF relocation handler with PLT stubs, wamrc --target=hexagon with auto -small-data, SIMD enablement, and cross-compilation platform cmake.
1 parent 60a48b7 commit 75696a7

21 files changed

Lines changed: 1166 additions & 29 deletions

File tree

build-scripts/build_llvm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
108108
LLVM_TARGETS_TO_BUILD = [
109109
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
110110
if normal_backends
111-
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
111+
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Hexagon;Mips;RISCV;X86"'
112112
]
113113

114114
# if not on ARC platform, but want to add expeirmental backend ARC as target
@@ -243,6 +243,7 @@ def main():
243243
"AArch64",
244244
"ARC",
245245
"ARM",
246+
"Hexagon",
246247
"Mips",
247248
"RISCV",
248249
"WebAssembly",

build-scripts/config_common.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32")
4545
add_definitions(-DBUILD_TARGET_RISCV32_ILP32)
4646
elseif (WAMR_BUILD_TARGET STREQUAL "ARC")
4747
add_definitions(-DBUILD_TARGET_ARC)
48+
elseif (WAMR_BUILD_TARGET STREQUAL "HEXAGON")
49+
add_definitions(-DBUILD_TARGET_HEXAGON)
4850
else ()
4951
message (FATAL_ERROR "-- WAMR build target isn't set")
5052
endif ()

core/config.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
&& !defined(BUILD_TARGET_RISCV32_ILP32D) \
2323
&& !defined(BUILD_TARGET_RISCV32_ILP32F) \
2424
&& !defined(BUILD_TARGET_RISCV32_ILP32) \
25-
&& !defined(BUILD_TARGET_ARC)
25+
&& !defined(BUILD_TARGET_ARC) \
26+
&& !defined(BUILD_TARGET_HEXAGON)
2627
/* clang-format on */
2728
#if defined(__x86_64__) || defined(__x86_64)
2829
#define BUILD_TARGET_X86_64
@@ -52,6 +53,8 @@
5253
#define BUILD_TARGET_RISCV32_ILP32D
5354
#elif defined(__arc__)
5455
#define BUILD_TARGET_ARC
56+
#elif defined(__hexagon__)
57+
#define BUILD_TARGET_HEXAGON
5558
#else
5659
#error "Build target isn't set"
5760
#endif
@@ -282,7 +285,7 @@
282285
* natural alignment. */
283286
#ifndef WASM_CPU_SUPPORTS_UNALIGNED_SIMD_ACCESS
284287
#if defined(BUILD_TARGET_X86_32) || defined(BUILD_TARGET_X86_64) \
285-
|| defined(BUILD_TARGET_AARCH64)
288+
|| defined(BUILD_TARGET_AARCH64) || defined(BUILD_TARGET_HEXAGON)
286289
#define WASM_CPU_SUPPORTS_UNALIGNED_SIMD_ACCESS 1
287290
#else
288291
#define WASM_CPU_SUPPORTS_UNALIGNED_SIMD_ACCESS 0

core/iwasm/aot/aot_loader.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ GET_U16_FROM_ADDR(const uint8 *p)
275275
#define E_MACHINE_ARC_COMPACT 93 /* ARC International ARCompact */
276276
#define E_MACHINE_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */
277277
#define E_MACHINE_XTENSA 94 /* Tensilica Xtensa Architecture */
278+
#define E_MACHINE_HEXAGON 164 /* Qualcomm Hexagon */
278279
#define E_MACHINE_RISCV 243 /* RISC-V 32/64 */
279280
#define E_MACHINE_WIN_I386 0x14c /* Windows i386 architecture */
280281
#define E_MACHINE_WIN_X86_64 0x8664 /* Windows x86-64 architecture */
@@ -419,6 +420,9 @@ get_aot_file_target(AOTTargetInfo *target_info, char *target_buf,
419420
* Use const strings here */
420421
machine_type = target_info->arch;
421422
break;
423+
case E_MACHINE_HEXAGON:
424+
machine_type = "hexagon";
425+
break;
422426
case E_MACHINE_MIPS:
423427
machine_type = "mips";
424428
break;

0 commit comments

Comments
 (0)