Matthias Krüger
6c9e922685
Rollup merge of #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 #93335 .
This is heavily inspired by the sibling-PR #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
2024-11-29 16:02:20 +01:00
..
2024-11-28 16:12:04 +01:00
2024-05-31 15:56:43 +10:00
2024-11-28 13:43:05 -05:00
2024-10-06 18:12:25 +02:00
2024-10-31 18:20:11 +08:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-11-27 07:18:25 -08:00
2024-05-31 15:56:43 +10:00
2024-09-18 13:53:31 -07:00
2024-11-14 16:18:41 -06:00
2024-08-07 14:08:34 +02:00
2024-02-22 16:04:04 +00:00
2024-11-17 21:49:10 +01:00
2024-11-28 13:43:05 -05:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-23 11:28:06 +11:00
2024-10-06 18:12:25 +02:00
2024-05-31 15:56:43 +10:00
2024-06-25 19:00:02 +02:00
2024-02-22 16:04:04 +00:00
2024-11-03 07:09:34 -08:00
2024-07-25 15:14:42 -04:00
2024-11-23 20:19:51 +08:00
2024-09-09 19:39:43 -07:00
2024-11-07 20:02:20 +01:00
2024-02-22 16:04:04 +00:00
2024-06-19 13:54:55 +01:00
2024-11-25 15:30:35 +01:00
2024-08-07 14:08:34 +02:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-06-19 13:54:55 +01:00
2024-09-09 19:39:43 -07:00
2024-09-18 12:28:55 -07:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-04-11 21:42:35 -04:00
2024-04-22 18:48:47 +02:00
2024-08-10 10:44:24 +08:00
2024-04-11 21:42:35 -04:00
2024-04-09 08:51:32 -07:00
2024-06-19 17:48:05 +02:00
2024-04-11 17:20:08 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-07-29 08:26:52 +10:00
2024-10-21 15:22:17 +01:00
2024-05-31 15:56:43 +10:00
2024-10-31 17:33:42 +08:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-11-14 17:44:54 +08:00
2024-10-31 11:59:17 +00:00
2024-02-22 16:04:04 +00:00
2024-11-14 17:44:54 +08:00
2024-08-11 19:40:44 +02:00
2024-08-29 18:12:31 +08:00
2024-06-19 13:54:55 +01:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-10-23 04:42:03 +02:00
2024-11-17 21:49:10 +01:00
2024-10-31 13:48:06 +08:00
2024-07-25 15:14:42 -04:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-08-07 14:08:34 +02:00
2024-08-11 19:40:44 +02:00
2024-02-22 16:04:04 +00:00
2024-10-23 04:42:03 +02:00
2024-04-24 13:12:33 +01:00
2024-09-09 19:39:43 -07:00
2024-09-21 01:07:00 -04:00
2024-06-04 01:30:51 -07:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-06 23:15:48 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-06 23:15:48 +00:00
2024-05-31 15:56:43 +10:00
2024-08-12 19:20:00 -07:00
2024-02-22 16:04:04 +00:00
2024-08-07 14:08:34 +02:00
2024-10-11 08:43:27 +11:00
2024-02-22 16:04:04 +00:00
2024-06-05 15:40:11 +00:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-07-25 15:14:42 -04:00
2024-05-31 15:56:43 +10:00
2024-06-16 17:19:25 +08:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-10-23 04:42:03 +02:00
2024-05-03 14:32:08 +02:00
2024-05-31 15:56:43 +10:00
2024-03-11 09:36:35 -07:00
2024-06-23 00:40:43 -07:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-11-08 07:35:29 +01:00
2024-09-25 15:53:53 +02:00
2024-05-28 12:31:33 +02:00
2024-07-14 13:48:29 +03:00
2024-10-10 14:24:43 +00:00
2024-02-23 18:04:01 -05:00
2024-03-22 09:55:50 -04:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-08-12 19:20:00 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-11-14 17:44:54 +08:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-08-17 02:14:23 +01:00
2024-09-18 13:53:31 -07:00
2024-10-16 18:38:26 +00:00
2024-02-23 18:04:01 -05:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-22 18:48:47 +02:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-07-14 13:48:29 +03:00
2024-07-14 13:48:29 +03:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-09-18 13:53:31 -07:00
2024-10-31 17:33:42 +08:00
2024-10-31 17:33:42 +08:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-10-23 04:42:03 +02:00
2024-02-22 16:04:04 +00:00
2024-03-17 10:11:04 -07:00
2024-02-22 16:04:04 +00:00
2024-10-06 19:00:09 +02:00
2024-02-22 16:04:04 +00:00
2024-09-21 01:07:00 -04:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-04 21:59:08 +01:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-07-14 13:48:29 +03:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-10-07 11:12:58 -04:00
2024-09-18 13:53:31 -07:00
2024-04-11 21:42:35 -04:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-06-04 01:30:51 -07:00
2024-05-31 15:56:43 +10:00
2024-06-14 13:31:46 +10:00
2024-06-14 13:31:46 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-10-22 02:25:38 -07:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-23 18:04:01 -05:00
2024-04-29 13:03:45 +00:00
2024-10-23 04:42:03 +02:00
2023-01-11 09:32:08 +00:00
2024-05-31 15:56:43 +10:00
2024-10-18 11:59:20 -07:00
2024-02-22 16:04:04 +00:00
2024-10-17 02:07:02 +01:00
2024-10-23 04:42:21 +02:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-03-12 19:01:04 -04:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-04-06 14:09:03 -04:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-08-31 23:56:45 +02:00
2024-09-18 13:53:31 -07:00
2024-05-31 15:56:43 +10:00
2024-04-22 18:48:47 +02:00
2024-10-31 17:33:42 +08:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-08-07 00:41:48 -04:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-04-06 11:37:57 -07:00
2024-05-31 15:56:43 +10:00
2024-05-31 15:56:43 +10:00
2024-04-11 21:42:35 -04:00
2024-02-22 16:04:04 +00:00
2024-05-01 16:54:20 -07:00
2024-08-07 00:41:48 -04:00
2024-02-22 16:04:04 +00:00
2024-08-27 12:06:30 +00:00
2024-05-31 15:56:43 +10:00
2024-03-17 10:11:04 -07:00
2024-05-31 15:56:43 +10:00
2024-10-23 04:42:03 +02:00
2024-11-13 15:05:31 +02:00
2024-05-31 15:56:43 +10:00
2024-10-19 13:09:21 +00:00
2024-04-06 11:21:47 -04:00
2024-04-11 17:20:08 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-10-23 04:42:03 +02:00
2024-06-19 13:54:55 +01:00
2024-06-19 13:54:55 +01:00
2024-06-19 13:54:55 +01:00
2024-09-18 13:53:31 -07:00
2024-09-18 13:53:31 -07:00
2023-01-11 09:32:08 +00:00
2024-10-23 04:42:03 +02:00
2024-03-29 15:37:43 -07:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-10-31 17:33:42 +08:00
2024-05-31 15:56:43 +10:00
2024-02-23 18:04:01 -05:00
2024-04-20 21:07:00 -04:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-10-31 17:33:42 +08:00
2024-10-31 17:33:42 +08:00
2024-10-31 17:33:42 +08:00
2024-04-08 12:12:13 +02:00
2024-10-31 17:33:42 +08:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-06-04 01:30:51 -07:00
2024-05-27 16:26:56 -04:00
2024-05-31 15:56:43 +10:00
2024-02-22 16:04:04 +00:00
2024-06-19 21:26:48 +01:00
2024-05-31 15:56:43 +10:00
2024-09-09 19:39:43 -07:00