powdr-labs/powdr

Rich assembly instruction syntax

Opened this issue · 0 comments

With registers-in-memory, the generated assembly instruction list is not too readable any more:

shl 12, 13, 20, 4

While it used to be

a4 = shl(a12 + 13, a20)

People have to know which arguments in the instruction do what, also which instructions are used as constants and which instructions are used as register indices.

This proposal allows the instructions to use a richer syntax in the sense that instructions do not always have to use , as the separator between arguments. It could look like the following:

/// declaration:
instr shl "a" X + Y, "a" Z -> "a" W { ... }

/// use:
shl a12 + 13, a20 -> a4

The compiler would check the correct use of separators for each instruction but not assign any meaning to the separators.

The downside is that this conflicts a little with the use of arbitrary expressions for instruction arguments, but I have the feeling we don't use that for instructions that use registers-in-memory.