Should we ever stabilize inline assembly?

From the post you linked, I'd say register allocation was one of the concerns. There were also:

  • Parsing mnemonics and directives:
    • Avoided by using an external assembler.
  • "elaborate operand description language and constraint system"
    • Not avoided, but unlike Clang, Rust does not need to be compatible with existing C code written for GCC. The full set of constraints supported by GCC is incredibly large, but the vast majority of use cases can be satisfied with literally two constraints:

      1. "put this in any register" (GCC's r)
      2. "put this in a specific register I'm naming" (and we don't need GCC's overcomplicated syntax for that)

      Well, plus a few more for floating point / SIMD registers if you want to support those use cases. But the point is, most of the complexity is completely unneeded in Rust.

  • goto labels
    • We probably won't start with asm goto support anyway, since you can't define goto labels in Rust. It would be nice to have analogous functionality in some form eventually. I don't think it's as complicated to implement as @sunfishcode thinks.
  • Clear rules for what is stable:
    • Most of @sunfishcode's list of rhetorical questions I could literally answer with "yes" or "no". In fact, I'm going to do so in that thread.
5 Likes