Files
sx/examples/1641-platform-asm-missing-volatile.sx
agra 1040b8c776 feat(asm): Phase B.0 — validate asm shape in the compile path
Restructures the .asm_expr lowering arm into lowerAsmExpr, which validates the
asm shape with specific named diagnostics BEFORE the not-yet-implemented codegen
bail, so the user sees the real problem first. Two checklist items enforced:

- template must be a compile-time-known string ("..." or #string), not a
  runtime expression;
- an asm with no value outputs must be `volatile` (else its effects could be
  deleted) — mirrors Zig's rule.

Valid shapes still bail with the "codegen not yet implemented" message. Result-
type derivation + the operand auto-naming rule stay deferred to Phase C, where a
real IR op makes the result type observable/testable.

Locked with 1641-platform-asm-missing-volatile (the volatile error) and
1642-platform-asm-nop-volatile (no-output + volatile accepted → codegen bail).

zig build test green (650 corpus, 445 unit).
2026-06-15 20:35:43 +03:00

7 lines
338 B
Plaintext

// ASM stream Phase B — an asm with no value outputs yields no result, so its
// effects could be deleted unless it is marked `volatile`. This omits
// `volatile` ⇒ a compile error. Pins that diagnostic (mirrors Zig's rule).
// Called from `main` so lowering reaches the asm body.
nope :: () { asm { "nop" }; }
main :: () { nope(); }