Skip to content

Commit 6cd6679

Browse files
committed
Sync with latest changes to the unstable book
1 parent cb05739 commit 6cd6679

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/inline-assembly.md

+8-11
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ Here is the list of currently supported register classes:
161161
| AArch64 | `vreg` | `v[0-31]` | `w` |
162162
| AArch64 | `vreg_low16` | `v[0-15]` | `x` |
163163
| AArch64 | `preg` | `p[0-15]`, `ffr` | Only clobbers |
164-
| ARM | `reg` | `r[0-12]`, `r14` | `r` |
165-
| ARM (Thumb) | `reg_thumb` | `r[0-r7]` | `l` |
166-
| ARM (ARM) | `reg_thumb` | `r[0-r12]`, `r14` | `l` |
164+
| ARM (ARM/Thumb2) | `reg` | `r[0-12]`, `r14` | `r` |
165+
| ARM (Thumb1) | `reg` | `r[0-7]` | `r` |
167166
| ARM | `sreg` | `s[0-31]` | `t` |
168167
| ARM | `sreg_low16` | `s[0-15]` | `x` |
169168
| ARM | `dreg` | `d[0-31]` | `w` |
@@ -284,21 +283,16 @@ Some registers cannot be used for input or output operands:
284283
| All | `si` (x86-32), `bx` (x86-64), `r6` (ARM), `x19` (AArch64), `x9` (RISC-V) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
285284
| x86 | `k0` | This is a constant zero register which can't be modified. |
286285
| x86 | `ip` | This is the program counter, not a real register. |
287-
| x86 | `mm[0-7]` | MMX registers are not currently supported (but may be in the future). |
288-
| x86 | `st([0-7])` | x87 registers are not currently supported (but may be in the future). |
289286
| AArch64 | `xzr` | This is a constant zero register which can't be modified. |
287+
| AArch64 | `x18` | This is a reserved register on some AArch64 targets. |
290288
| ARM | `pc` | This is the program counter, not a real register. |
291289
| ARM | `r9` | This is a reserved register on some ARM targets. |
292290
| RISC-V | `x0` | This is a constant zero register which can't be modified. |
293291
| RISC-V | `gp`, `tp` | These registers are reserved and cannot be used as inputs or outputs. |
294292

295293
In some cases LLVM will allocate a "reserved register" for `reg` operands even though this register cannot be explicitly specified.
296294
Assembly code making use of reserved registers should be careful since `reg` operands may alias with those registers.
297-
298-
These reserved registers are:
299-
- The frame pointer and LLVM base pointer on all architectures.
300-
- `r9` on ARM.
301-
- `x18` on AArch64.
295+
Reserved registers that can sometimes be allocated are the frame pointer and base pointer in the list above.
302296

303297
## Template modifiers
304298

@@ -371,10 +365,13 @@ The following ABIs can be used with `clobber_abi`:
371365
| x86-32 | `"C"`, `"system"`, `"efiapi"`, `"cdecl"`, `"stdcall"`, `"fastcall"` | `ax`, `cx`, `dx`, `xmm[0-7]`, `mm[0-7]`, `k[1-7]`, `st([0-7])` |
372366
| x86-64 | `"C"`, `"system"` (on Windows), `"efiapi"`, `"win64"` | `ax`, `cx`, `dx`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `k[1-7]`, `st([0-7])` |
373367
| x86-64 | `"C"`, `"system"` (on non-Windows), `"sysv64"` | `ax`, `cx`, `dx`, `si`, `di`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `k[1-7]`, `st([0-7])` |
374-
| AArch64 | `"C"`, `"system"`, `"efiapi"` | `x[0-17]`, `x30`, `v[0-31]`, `p[0-15]`, `ffr` |
368+
| AArch64 | `"C"`, `"system"`, `"efiapi"` | `x[0-17]`, `x18`\*, `x30`, `v[0-31]`, `p[0-15]`, `ffr` |
375369
| ARM | `"C"`, `"system"`, `"efiapi"`, `"aapcs"` | `r[0-3]`, `r12`, `r14`, `s[0-15]`, `d[0-7]`, `d[16-31]` |
376370
| RISC-V | `"C"`, `"system"`, `"efiapi"` | `x1`, `x[5-7]`, `x[10-17]`, `x[28-31]`, `f[0-7]`, `f[10-17]`, `f[28-31]`, `v[0-31]` |
377371

372+
> Notes:
373+
> - On AArch64 `x18` only included in the clobber list if it is not considered as a reserved register on the target.
374+
378375
The list of clobbered registers for each ABI is updated in rustc as architectures gain new registers: this ensures that `asm!` clobbers will continue to be correct when LLVM starts using these new registers in its generated code.
379376

380377
## Options

0 commit comments

Comments
 (0)