Re:New inline assembly syntax available in Rust nightly
by jfkebwjsbx on Tuesday June 09, 2020 @12:31PM
(#23468069)
What you describe is how it works in GCC/LLVM and is required in any inline asm system. Otherwise it is not really inline.
Saying that fits with the type system is a stretch... it is like any other FFI.
The asm macro does know about what group of registers (or what specific register) a input/output is stored/loaded from and compilation will fail if the input isn't compatible with the register.
Then it's delegating to a assembler for the rest.
Sure it could also have a list of all asm commands the given target does support and parameters/registers it can be used with but this means keeping track of all supported targets and all commands for all potential featuresets of all targets and all way they can be called. This is a lot of work. Even more such support can be added later one, too. For now it's more important to support asm on stable.
Also with proc-macros you can implement this as a library on top of `asm`!
Also with a more "knowledgeable" asm any support for a new platform would need to manually add support for all asm of that language so having a standard stringly interface is a good think anyway.