ir3/parser: add helper to generate syntax errors based on gen

The assembly syntax of certain instructions differs significantly
between generations (e.g., ldg.a/stg.a) so it's useful to be able to
generate syntax error based on the generation we are assembling for.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33503>
This commit is contained in:
Job Noorman
2025-02-12 07:29:03 +01:00
committed by Marge Bot
parent 605f94520f
commit 5a8193e657
+9
View File
@@ -320,6 +320,15 @@ static void yyerror(const char *error)
fprintf(stderr, "error at line %d: %s\n%s\n", ir3_yyget_lineno(), error, current_line);
}
/* Needs to be a macro to use YYERROR */
#define illegal_syntax_from(gen_from, error) \
do { \
if (variant->compiler->gen >= gen_from) { \
yyerror(error); \
YYERROR; \
} \
} while (0)
struct ir3 * ir3_parse(struct ir3_shader_variant *v,
struct ir3_kernel_info *k, FILE *f)
{