Closed jopperm closed 1 year ago
Decided to keep the [start:end]
syntax (see #52), but we'll relax the compile-time-constness-constraint. Instead, arbitrary expression are allowed as long as the range size is compile-time constant. A limited set of patterns that an frontend must understand will be specified.
Implemented and successfully used in the MLIR code generator.
The bit range operator must have a fixed size. Do achieve this, it is currently limited to compile-time-constant expressions comprised only of literals and parameters. However, this semantic precludes using it e.g. in a loop:
The proposed solution is to relax the restriction and allow arbitrary expressions, under the condition that the frontend is able to evaluate
(from)-(to)
at compile-time to a constant value. In the example above, this would mean to determine thati+2 - i
evaluates to2
and the variable reference expression cancels out.