diff options
author | Tim Northover <tnorthover@apple.com> | 2024-03-08 12:15:53 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2024-03-14 11:32:44 +0000 |
commit | 4299c727e4806aa55398ad23da48a401554cd432 (patch) | |
tree | db50f5ef5df2f7bc8c47dcb1d8112778a85af89d /clang/docs | |
parent | 763be018c57171730f80367e75d994a80f34d2ea (diff) | |
download | llvm-4299c727e4806aa55398ad23da48a401554cd432.zip llvm-4299c727e4806aa55398ad23da48a401554cd432.tar.gz llvm-4299c727e4806aa55398ad23da48a401554cd432.tar.bz2 |
AArch64: add __builtin_arm_trap
It's useful to provide an indicator code with the trap, which the generic
__builtin_trap can't do. asm("brk #N") is an option, but following that with a
__builtin_unreachable() leads to two traps when the compiler doesn't know the
block can't return. So compiler support like this is useful.
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/LanguageExtensions.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 06af93f..9347703 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -3443,6 +3443,21 @@ Query for this feature with ``__has_builtin(__builtin_debugtrap)``. Query for this feature with ``__has_builtin(__builtin_trap)``. +``__builtin_arm_trap`` +------------------ + +``__builtin_arm_trap`` is an AArch64 extension to ``__builtin_trap`` which also accepts a compile-time constant value, encoded directly into the trap instruction for later inspection. + +**Syntax**: + +.. code-block:: c++ + + __builtin_arm_trap(const unsigned short payload) + +**Description** + +``__builtin_arm_trap`` is lowered to the ``llvm.aarch64.break`` builtin, and then to ``brk #payload``. + ``__builtin_nondeterministic_value`` ------------------------------------ |