Skip to content

Commit b159d95

Browse files
committed
Update docs
1 parent 4425fe4 commit b159d95

File tree

1 file changed

+4
-2
lines changed
  • src/doc/unstable-book/src/library-features

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ fn call_foo(arg: i32) -> i32 {
319319

320320
Note that the `fn` or `static` item does not need to be public or `#[no_mangle]`: the compiler will automatically insert the appropriate mangled symbol name into the assembly code.
321321

322-
By default, `asm!` assumes that any register not specified as an output will have its contents preserved by the assembly code. The [`clobber_abi`](#abi-clobbers) argument to `asm!` tells the compiler to automatically insert the necessary clobber operands according to the given calling convention ABI: any register which is not fully preserved in that ABI will be treated as clobbered.
322+
By default, `asm!` assumes that any register not specified as an output will have its contents preserved by the assembly code. The [`clobber_abi`](#abi-clobbers) argument to `asm!` tells the compiler to automatically insert the necessary clobber operands according to the given calling convention ABI: any register which is not fully preserved in that ABI will be treated as clobbered. Multiple `clobber_abi` arguments may be provided and all clobbers from all specified ABIs will be inserted.
323323

324324
## Register template modifiers
325325

@@ -456,7 +456,7 @@ operand := reg_operand / "const" const_expr / "sym" path
456456
clobber_abi := "clobber_abi(" <abi> ")"
457457
option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax" / "raw"
458458
options := "options(" option *["," option] [","] ")"
459-
asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) ["," clobber_abi] ["," options] [","] ")"
459+
asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) *("," clobber_abi) ["," options] [","] ")"
460460
```
461461

462462
Inline assembly is currently supported on the following architectures:
@@ -799,6 +799,8 @@ As stated in the previous section, passing an input value smaller than the regis
799799

800800
The `clobber_abi` keyword can be used to apply a default set of clobbers to an `asm` block. This will automatically insert the necessary clobber constraints as needed for calling a function with a particular calling convention: if the calling convention does not fully preserve the value of a register across a call then a `lateout("reg") _` is implicitly added to the operands list.
801801

802+
`clobber_abi` may be specified any number of times. It will insert a clobber for all unique registers in the union of all specified calling conventions.
803+
802804
Generic register class outputs are disallowed by the compiler when `clobber_abi` is used: all outputs must specify an explicit register. Explicit register outputs have precedence over the implicit clobbers inserted by `clobber_abi`: a clobber will only be inserted for a register if that register is not used as an output.
803805
The following ABIs can be used with `clobber_abi`:
804806

0 commit comments

Comments
 (0)