Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Standalone View
clang/include/clang/Basic/AttrDocs.td
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 2,311 Lines • ▼ Show 20 Lines | ||||||||||||
Refer to: | Refer to: | |||||||||||
https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html | https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html | |||||||||||
https://riscv.org/specifications/privileged-isa/ | https://riscv.org/specifications/privileged-isa/ | |||||||||||
The RISC-V Instruction Set Manual Volume II: Privileged Architecture | The RISC-V Instruction Set Manual Volume II: Privileged Architecture | |||||||||||
Version 1.10. | Version 1.10. | |||||||||||
}]; | }]; | |||||||||||
} | } | |||||||||||
def RISCVRVVVectorBitsDocs : Documentation { | ||||||||||||
let Category = DocCatType; | ||||||||||||
let Content = [{ | ||||||||||||
On RISC-V targets, the ``riscv_rvv_vector_bits(N)`` attribute is used to define | ||||||||||||
rjmccall: Maybe this is obvious from the attribute name, but it's better to be clear. | ||||||||||||
fixed-length variants of sizeless types. | ||||||||||||
For example: | ||||||||||||
.. code-block:: c | ||||||||||||
#include <riscv_vector.h> | ||||||||||||
#if defined(__riscv_v_fixed_vlen) | ||||||||||||
Not Done ReplyInline ActionsThis probably needs a defined(__RISCV_RVV_VLEN_BITS) clause, right? Because the compiler doesn't actually define this macro unless -mrvv-vector-bits is given. rjmccall: This probably needs a `defined(__RISCV_RVV_VLEN_BITS)` clause, right? Because the compiler… | ||||||||||||
I guess so. I copied the documentation from the SVE attribute and modified it to RISC-V. craig.topper: I guess so. I copied the documentation from the SVE attribute and modified it to RISC-V. | ||||||||||||
Not Done ReplyInline ActionsAh, I see. Yeah, it's probably wrong there, too. rjmccall: Ah, I see. Yeah, it's probably wrong there, too. | ||||||||||||
As written the #if would evaluate to false if __RISCV_RVV_VLEN_BITS isn't defined or it's not defined to be 512. The code line it was guarding is using a hardcoded 512. This isn't how I'd encourage this to be used so I'm changing to #if defined() and will use the preprocessor define in the next line. craig.topper: As written the #if would evaluate to false if __RISCV_RVV_VLEN_BITS isn't defined or it's not… | ||||||||||||
Not Done ReplyInline Actions
rjmccall: | ||||||||||||
typedef vint8m1_t fixed_vint8m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); | ||||||||||||
#endif | ||||||||||||
Creates a type ``fixed_vint8m1_t_t`` that is a fixed-length variant of | ||||||||||||
``vint8m1_t`` that contains exactly 512 bits. Unlike ``vint8m1_t``, this type | ||||||||||||
Not Done ReplyInline Actions
rjmccall: | ||||||||||||
can be used in globals, structs, unions, and arrays, all of which are | ||||||||||||
unsupported for sizeless types. | ||||||||||||
The attribute can be attached to a single RVV vector (such as ``vint8m1_t``). | ||||||||||||
The attribute will be rejected unless | ||||||||||||
``N==__riscv_v_fixed_vlen``, the implementation defined feature macro that | ||||||||||||
is enabled under the ``-mrvv-vector-bits`` flag. ``__riscv_v_fixed_vlen`` can | ||||||||||||
Not Done ReplyInline ActionsYou should add some details about requirements on the argument to the attribute (like the range of valid values, that it needs to be a power-of-two value, etc) and what happens when you write the attribute on a non-sizeless type. aaron.ballman: You should add some details about requirements on the argument to the attribute (like the range… | ||||||||||||
only be a power of 2 between 64 and 65536. | ||||||||||||
Not Done ReplyInline ActionsThis doesn't describe the actual behavior of the compiler, which is that it's *ill-formed* to use this attribute except when providing the same value to -mrvv-vector-bits. Also, this feels like an awkward attempt to also document the __RISCV_RVV_VLEN_BITS macro, which probably ought to be primarily documented in the command line argument reference for -mrvv-vector-bits. rjmccall: This doesn't describe the actual behavior of the compiler, which is that it's *ill-formed* to… | ||||||||||||
I think that means the SVE doc is also incorrect?
Ok I'll move it there. craig.topper: > This doesn't describe the actual behavior of the compiler, which is that it's *ill-formed* to… | ||||||||||||
Not Done ReplyInline Actions
Yeah. rjmccall: > I think that means the SVE doc is also incorrect?
Yeah. | ||||||||||||
Only `*m1_t`(LMUL=1) types are supported at this time. | ||||||||||||
Not Done ReplyInline Actions
rjmccall: | ||||||||||||
}]; | ||||||||||||
} | ||||||||||||
def AVRInterruptDocs : Documentation { | def AVRInterruptDocs : Documentation { | |||||||||||
let Category = DocCatFunction; | let Category = DocCatFunction; | |||||||||||
let Heading = "interrupt (AVR)"; | let Heading = "interrupt (AVR)"; | |||||||||||
let Content = [{ | let Content = [{ | |||||||||||
Clang supports the GNU style ``__attribute__((interrupt))`` attribute on | Clang supports the GNU style ``__attribute__((interrupt))`` attribute on | |||||||||||
AVR targets. This attribute may be attached to a function definition and instructs | AVR targets. This attribute may be attached to a function definition and instructs | |||||||||||
the backend to generate appropriate function entry/exit code so that it can be used | the backend to generate appropriate function entry/exit code so that it can be used | |||||||||||
directly as an interrupt service routine. | directly as an interrupt service routine. | |||||||||||
▲ Show 20 Lines • Show All 4,632 Lines • Show Last 20 Lines |
Maybe this is obvious from the attribute name, but it's better to be clear.