[Pre-RFC #2]: Inline assembly

This is actually fairly straightforward: the rules on what memory an asm block can access are exactly the same as what a C FFI call is allowed to access. This basically means any globals (subject to visibility?) and locals whose address is leaked out to external code (I realize this is a bit vague, but this thread isn't the place to discuss the FFI memory model). readonly and nomem simply restrict that subset even further.

I only proposed interpolating sym operands directly for global_asm! as a future extension. For normal asm! this would be done through a LLVM operand.

Given that we want to keep the option of mem operands open for the future, the only evaluation order that makes sense is to evaluate (left-to-right) all operand expressions into a value (for inputs) or a place before the asm runs. After the asm runs, outputs are copied from registers to the resolved places (again, left-to-right).

I don't understand the concern here? I imagine rounding modes would be written directly in the asm string, rather than passed as an argument.

I don't really see what we can do about that? For example, the Linux kernel is known to fail to compile with -O0 because it runs out of registers. My question was about whether we should always ban potentially reserved registers (e.g. the frame pointer, even in functions that don't use it) or if we should leave it to LLVM to decide whether to error or not.

1 Like