Closed glx22 closed 2 months ago
Found a perfect use case in 030_house.
Have I understand this correctly? When not marked as const, the named parameter may be allocated a GRF parameter which is then dereferenced when used instead of simply storing the value where used.
Exactly, named parameters are just GRF parameters, with all the implied limitations in usage.
It's possible to use named parameters as constants, but it doesn't always work and it's not very efficient in the resulting GRF when it does work.
Introduce the
const
keyword andconst <name> = <value>;
syntax, which will define the constant<name>
to the value<value>
.Constants should be usable like any of the predefined constants so I delayed some validations for
item
anddisable_item
as they were happening too early.