You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/doc/unstable-book/src/library-features/asm.md
+13-1
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,15 @@ It can be used to embed handwritten assembly in the assembly output generated by
18
18
Generally this should not be necessary, but might be where the required performance or timing
19
19
cannot be otherwise achieved. Accessing low level hardware primitives, e.g. in kernel code, may also demand this functionality.
20
20
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
22
30
23
31
## Basic usage
24
32
@@ -606,6 +614,10 @@ Some registers cannot be used for input or output operands:
606
614
| RISC-V |`gp`, `tp`| These registers are reserved and cannot be used as inputs or outputs. |
607
615
| Hexagon |`lr`| This is the link register which cannot be used as an input or output. |
608
616
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
+
609
621
## Template modifiers
610
622
611
623
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