Skip to content

Commit b5cef24

Browse files
committed
Update asm! documentation in unstable book
- Update the list of supported architectures. - Clarify issues with LLVM's use of reserved registers.
1 parent c15bae5 commit b5cef24

File tree

1 file changed

+13
-1
lines changed
  • src/doc/unstable-book/src/library-features

1 file changed

+13
-1
lines changed

src/doc/unstable-book/src/library-features/asm.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ It can be used to embed handwritten assembly in the assembly output generated by
1818
Generally this should not be necessary, but might be where the required performance or timing
1919
cannot be otherwise achieved. Accessing low level hardware primitives, e.g. in kernel code, may also demand this functionality.
2020

21-
> **Note**: the examples here are given in x86/x86-64 assembly, but ARM, AArch64 and RISC-V are also supported.
21+
> **Note**: the examples here are given in x86/x86-64 assembly, but other architectures are also supported.
22+
23+
Inline assembly is currently supported on the following architectures:
24+
- x86 and x86-64
25+
- ARM
26+
- AArch64
27+
- RISC-V
28+
- NVPTX
29+
- Hexagon
2230

2331
## Basic usage
2432

@@ -606,6 +614,10 @@ Some registers cannot be used for input or output operands:
606614
| RISC-V | `gp`, `tp` | These registers are reserved and cannot be used as inputs or outputs. |
607615
| Hexagon | `lr` | This is the link register which cannot be used as an input or output. |
608616

617+
In some cases LLVM will allocate a "reserved register" for `reg` operands even though this register cannot be explicitly specified. Assembly code making use of reserved registers should be careful since `reg` operands may alias with those registers. Reserved registers are:
618+
- The frame pointer on all architectures.
619+
- `r6` on ARM.
620+
609621
## Template modifiers
610622

611623
The placeholders can be augmented by modifiers which are specified after the `:` in the curly braces. These modifiers do not affect register allocation, but change the way operands are formatted when inserted into the template string. Only one modifier is allowed per template placeholder.

0 commit comments

Comments
 (0)