| 1 | //===- ArmSMEStub.cpp - ArmSME ABI routine stubs --------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/Support/Compiler.h" |
| 10 | #include <cstdint> |
| 11 | #include <iostream> |
| 12 | |
| 13 | // The actual implementation of these routines is in: |
| 14 | // compiler-rt/lib/builtins/aarch64/sme-abi.S. These stubs allow the current |
| 15 | // ArmSME tests to run without depending on compiler-rt. This works as we don't |
| 16 | // rely on nested ZA-enabled calls at the moment. The use of these stubs can be |
| 17 | // overridden by setting the ARM_SME_ABI_ROUTINES_SHLIB CMake cache variable to |
| 18 | // a path to an alternate implementation. |
| 19 | |
| 20 | extern "C" { |
| 21 | |
| 22 | struct sme_state { |
| 23 | int64_t x0; |
| 24 | int64_t x1; |
| 25 | }; |
| 26 | |
| 27 | LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK sme_state __arm_sme_state() { |
| 28 | std::cerr << "[warning] __arm_sme_state() stubbed!\n" ; |
| 29 | return sme_state{}; |
| 30 | } |
| 31 | |
| 32 | LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK void __arm_tpidr2_restore() { |
| 33 | std::cerr << "[warning] __arm_tpidr2_restore() stubbed!\n" ; |
| 34 | } |
| 35 | |
| 36 | LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK void __arm_tpidr2_save() { |
| 37 | std::cerr << "[warning] __arm_tpidr2_save() stubbed!\n" ; |
| 38 | } |
| 39 | |
| 40 | LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK void __arm_za_disable() { |
| 41 | std::cerr << "[warning] __arm_za_disable() stubbed!\n" ; |
| 42 | } |
| 43 | } |
| 44 | |