about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-10-21 20:32:00 -0700
committerGitHub <noreply@github.com>2024-10-21 20:32:00 -0700
commitfe2cbbd2d571965d30c6f25c6d865babf4529e85 (patch)
tree926b21e859f7da2cb1236dabe70dea166c8f481c /src/doc
parent814df6e50eaf89b90793e7d9618bb60f1f18377a (diff)
parent37dc4ec8d6519d7ba1ed8a11fb57ff4d1eb995dd (diff)
Rollup merge of #130432 - azhogin:azhogin/regparm, r=workingjubilee,pnkfelix
rust_for_linux: -Zregparm=<N> commandline flag for X86 (#116972)

Command line flag `-Zregparm=<N>` for X86 (32-bit) for rust-for-linux: https://github.com/rust-lang/rust/issues/116972
Implemented in the similar way as fastcall/vectorcall support (args are marked InReg if fit).
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/compiler-flags/regparm.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/regparm.md b/src/doc/unstable-book/src/compiler-flags/regparm.md
new file mode 100644
index 00000000000..8f311f091c0
--- /dev/null
+++ b/src/doc/unstable-book/src/compiler-flags/regparm.md
@@ -0,0 +1,20 @@
+# `regparm`
+
+The tracking issue for this feature is: https://github.com/rust-lang/rust/issues/131749.
+
+------------------------
+
+Option -Zregparm=N causes the compiler to pass N arguments
+in registers EAX, EDX, and ECX instead of on the stack for "C", "cdecl", and "stdcall" fn.
+It is UNSOUND to link together crates that use different values for this flag.
+It is only supported on `x86`.
+
+It is equivalent to [Clang]'s and [GCC]'s `-mregparm`.
+
+Supported values for this option are 0-3.
+
+[Clang]: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mregparm
+[GCC]: https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#index-regparm-function-attribute_002c-x86
+
+Implementation details:
+For eligible arguments, llvm `inreg` attribute is set.