You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #93219 - cr1901:msp430-asm-squashed, r=Amanieu
Add preliminary support for inline assembly for msp430.
The `llvm_asm` macro was removed recently, and the MSP430 backend relies on inline assembly to build useful embedded apps. I conveniently "found" time to implement basic support for the new inline `asm` macro syntax with the help of `@Amanieu` :D.
In addition to tests in the compiler, I have tested this locally against deployed MSP430 code and have not found any noticeable differences in firmware operation or `objdump` disassemblies between the old `llvm_asm` and the new `asm` syntax.
| All |`sp`| The stack pointer must be restored to its original value at the end of an asm code block. |
89
-
| All |`fr` (Hexagon), `$fp` (MIPS), `Y` (AVR) | The frame pointer cannot be used as an input or output. |
101
+
| All |`fr` (Hexagon), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430)| The frame pointer cannot be used as an input or output. |
90
102
| All |`r19` (Hexagon) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
91
103
| MIPS |`$0` or `$zero`| This is a constant zero register which can't be modified. |
92
104
| MIPS |`$1` or `$at`| Reserved for assembler. |
@@ -95,6 +107,7 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
95
107
| MIPS |`$ra`| Return address cannot be used as inputs or outputs. |
96
108
| Hexagon |`lr`| This is the link register which cannot be used as an input or output. |
97
109
| AVR |`r0`, `r1`, `r1r0`| Due to an issue in LLVM, the `r0` and `r1` registers cannot be used as inputs or outputs. If modified, they must be restored to their original values before the end of the block. |
110
+
|MSP430 |`r0`, `r2`, `r3`| These are the program counter, status register, and constant generator respectively. Neither the status register nor constant generator can be written to. |
98
111
99
112
## Template modifiers
100
113
@@ -115,3 +128,5 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
115
128
These flags registers must be restored upon exiting the asm block if the `preserves_flags` option is set:
0 commit comments