macro_rules! llvm_asm {
("MRS $0, ipsr" : "=r" ($result:ident) : : : "volatile") => { ... };
("MRS $0, primask" : "=r" ($result:ident) : : "memory" : "volatile") => { ... };
("MSR primask, $0" : : "r" ($primask_in:ident) : "memory" : "volatile") => { ... };
("cpsid i" : : : "memory" : "volatile") => { ... };
("cpsie i" : : : "memory" : "volatile") => { ... };
("csrrc $0, mstatus, $1" : "=r" ($state:ident) : "i" ($constant:ident) : "memory" : "volatile") => { ... };
("csrw mstatus, $0" : : "r" ($state:ident) : "memory" : "volatile") => { ... };
("csrr $0, mstatus" : "=r" ($state:ident) : : "memory" : "volatile") => { ... };
($($x:tt)*) => { ... };
}
Expand description
Compatibility macro that looks up assembly in the deprecated llvm_asm!
style in a manually
manged list of known short snippets mapped to asm!
equivalents.
As this is tailored for RIOT’s C2Rust output, code not found in the list is not rejected at compile time, but mapped to the external (and nonexistent) symbol llvm_asm_is_not_supported_any_more. This allows otherwise unused code (which is there either because the bulk-used CMSIS just defines it and it is unused by RIOT, or just because it doesn’t happen to be used by any actually used function) to just slip through without causing much fuss.
This is defined right in the inline module, because using it from another module would make the
imports ambiguous versus the builtin llvm_asm!
macro.