-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support clobber_abi in MSP430 inline assembly #131310
Conversation
Hmmm, I is @taiki-e Thanks for providing the relevant section of the manual, so I could refresh. It looks good to me, except for two questions.
|
Thanks for pointing that out, I missed that because it is unstable. However, it appears that
x86/x86_64: rust/compiler/rustc_target/src/asm/mod.rs Lines 909 to 921 in 3743618
riscv: rust/compiler/rustc_target/src/asm/mod.rs Lines 938 to 941 in 3743618
(
This is because it is not a That test is based on the same test for s390x added in #130630, and FYI, for x86_64, it is rust/tests/codegen/asm-clobber_abi.rs Line 9 in 3743618
|
That's fair. AFAIK no one is driving the current RFC for unified interrupt calling conventions forward, so perhaps no impetus to support the interrupt calling conventions elsewhere right now.
Ahhh okay I see, This PR looks fine to me. |
Interrupt calling conventions can't be supported by clobber_abi because they clobber reserved registers, which is not supported by back-ends. |
@bors r+ |
Support clobber_abi in MSP430 inline assembly This supports `clobber_abi` which is one of the requirements of stabilization mentioned in rust-lang#93335. Refs: Section 3.2 "Register Conventions" in [MSP430 Embedded Application Binary Interface](https://www.ti.com/lit/an/slaa534a/slaa534a.pdf) cc `@cr1901` r? `@Amanieu` `@rustbot` label +O-msp430
Rollup of 7 pull requests Successful merges: - rust-lang#124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics) - rust-lang#130962 (Migrate lib's `&Option<T>` into `Option<&T>`) - rust-lang#131289 (stabilize duration_consts_float) - rust-lang#131310 (Support clobber_abi in MSP430 inline assembly) - rust-lang#131546 (Make unused_parens's suggestion considering expr's attributes.) - rust-lang#131565 (Remove deprecation note in the `non_local_definitions` lint) - rust-lang#131576 (Flatten redundant test module `run_make_support::diff::tests::tests`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - rust-lang#124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics) - rust-lang#130962 (Migrate lib's `&Option<T>` into `Option<&T>`) - rust-lang#131289 (stabilize duration_consts_float) - rust-lang#131310 (Support clobber_abi in MSP430 inline assembly) - rust-lang#131546 (Make unused_parens's suggestion considering expr's attributes.) - rust-lang#131565 (Remove deprecation note in the `non_local_definitions` lint) - rust-lang#131576 (Flatten redundant test module `run_make_support::diff::tests::tests`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131310 - taiki-e:msp430-clobber-abi, r=Amanieu Support clobber_abi in MSP430 inline assembly This supports `clobber_abi` which is one of the requirements of stabilization mentioned in rust-lang#93335. Refs: Section 3.2 "Register Conventions" in [MSP430 Embedded Application Binary Interface](https://www.ti.com/lit/an/slaa534a/slaa534a.pdf) cc ``@cr1901`` r? ``@Amanieu`` ``@rustbot`` label +O-msp430
…i, r=Amanieu Support `clobber_abi` in AVR inline assembly This PR implements the `clobber_abi` part necessary to eventually stabilize the inline assembly for AVR. This is tracked in rust-lang#93335. This is heavily inspired by the sibling-PR rust-lang#131310 for the MSP430. I've explained my reasoning in the first commit message in detail, which is reproduced below for easier reviewing: This follows the [ABI documentation] of AVR-GCC: > The [...] call-clobbered general purpose registers (GPRs) are registers that might be destroyed (clobbered) by a function call. > > - **R18–R27, R30, R31** > > These GPRs are call clobbered. An ordinary function may use them without restoring the contents. [...] > > - **R0, T-Flag** > > The temporary register and the T-flag in SREG are also call-clobbered, but this knowledge is not exposed explicitly to the compiler (R0 is a fixed register). Therefore this commit lists the aforementioned registers `r18–r27`, `r30` and `r31` as clobbered registers. Since the `r0` register (listed above as well) is not available in inline assembly at all (potentially because the AVR-GCC considers it a fixed register causing the register to never be used in register allocation and LLVM adopting this), there is no need to list it in the clobber list (the `r0`-variant is not even available). A comment was added to ensure, that the `r0` gets added to the clobber-list once the register gets usable in inline ASM. Since the SREG is normally considered clobbered anyways (unless the user supplies the `preserve_flags`-option), there is no need to explicitly list a bit in this register (which is not possible to list anyways). Note, that this commit completely ignores the case of interrupts (that are described in the ABI-specification), since every register touched in an ISR need to be saved anyways. [ABI documentation]: https://gcc.gnu.org/wiki/avr-gcc#Call-Used_Registers r? `@Amanieu` `@rustbot` label +O-AVR
…i, r=Amanieu Support `clobber_abi` in AVR inline assembly This PR implements the `clobber_abi` part necessary to eventually stabilize the inline assembly for AVR. This is tracked in rust-lang#93335. This is heavily inspired by the sibling-PR rust-lang#131310 for the MSP430. I've explained my reasoning in the first commit message in detail, which is reproduced below for easier reviewing: This follows the [ABI documentation] of AVR-GCC: > The [...] call-clobbered general purpose registers (GPRs) are registers that might be destroyed (clobbered) by a function call. > > - **R18–R27, R30, R31** > > These GPRs are call clobbered. An ordinary function may use them without restoring the contents. [...] > > - **R0, T-Flag** > > The temporary register and the T-flag in SREG are also call-clobbered, but this knowledge is not exposed explicitly to the compiler (R0 is a fixed register). Therefore this commit lists the aforementioned registers `r18–r27`, `r30` and `r31` as clobbered registers. Since the `r0` register (listed above as well) is not available in inline assembly at all (potentially because the AVR-GCC considers it a fixed register causing the register to never be used in register allocation and LLVM adopting this), there is no need to list it in the clobber list (the `r0`-variant is not even available). A comment was added to ensure, that the `r0` gets added to the clobber-list once the register gets usable in inline ASM. Since the SREG is normally considered clobbered anyways (unless the user supplies the `preserve_flags`-option), there is no need to explicitly list a bit in this register (which is not possible to list anyways). Note, that this commit completely ignores the case of interrupts (that are described in the ABI-specification), since every register touched in an ISR need to be saved anyways. [ABI documentation]: https://gcc.gnu.org/wiki/avr-gcc#Call-Used_Registers r? ``@Amanieu`` ``@rustbot`` label +O-AVR
Rollup merge of rust-lang#131323 - jfrimmel:avr-inline-asm-clobber-abi, r=Amanieu Support `clobber_abi` in AVR inline assembly This PR implements the `clobber_abi` part necessary to eventually stabilize the inline assembly for AVR. This is tracked in rust-lang#93335. This is heavily inspired by the sibling-PR rust-lang#131310 for the MSP430. I've explained my reasoning in the first commit message in detail, which is reproduced below for easier reviewing: This follows the [ABI documentation] of AVR-GCC: > The [...] call-clobbered general purpose registers (GPRs) are registers that might be destroyed (clobbered) by a function call. > > - **R18–R27, R30, R31** > > These GPRs are call clobbered. An ordinary function may use them without restoring the contents. [...] > > - **R0, T-Flag** > > The temporary register and the T-flag in SREG are also call-clobbered, but this knowledge is not exposed explicitly to the compiler (R0 is a fixed register). Therefore this commit lists the aforementioned registers `r18–r27`, `r30` and `r31` as clobbered registers. Since the `r0` register (listed above as well) is not available in inline assembly at all (potentially because the AVR-GCC considers it a fixed register causing the register to never be used in register allocation and LLVM adopting this), there is no need to list it in the clobber list (the `r0`-variant is not even available). A comment was added to ensure, that the `r0` gets added to the clobber-list once the register gets usable in inline ASM. Since the SREG is normally considered clobbered anyways (unless the user supplies the `preserve_flags`-option), there is no need to explicitly list a bit in this register (which is not possible to list anyways). Note, that this commit completely ignores the case of interrupts (that are described in the ABI-specification), since every register touched in an ISR need to be saved anyways. [ABI documentation]: https://gcc.gnu.org/wiki/avr-gcc#Call-Used_Registers r? ``@Amanieu`` ``@rustbot`` label +O-AVR
This supports
clobber_abi
which is one of the requirements of stabilization mentioned in #93335.Refs: Section 3.2 "Register Conventions" in MSP430 Embedded Application Binary Interface
cc @cr1901
r? @Amanieu
@rustbot label +O-msp430 +A-inline-assembly