From 23afe968adcc8e27926e7ce2d6989e6f601f367d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 3 Nov 2024 21:57:28 -0500 Subject: [PATCH] nir: add late_lower_int64 option Some drivers generally need int64 lowered, but prefer to do this lowering themselves late, to have a chance to optimize targeted int64 patterns before lowering the rest. This isn't currently possible since nir_lower_int64 takes no options except what's const* in the shader, and frontends call nir_lower_int64 before passing the shader off to the driver. Add an option to defer int64 lowering. This is a bit ugly but the alternative is replumbing nir_lower_int64's option handling cross-tree and no-thank-you-not-right-now. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Karol Herbst Part-of: --- src/compiler/nir/nir.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5a8923cf8f2..ca26c9114d1 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4327,6 +4327,12 @@ typedef struct nir_shader_compiler_options { bool driver_functions; + /** + * If true, the driver will call nir_lower_int64 itself and the frontend + * should not do so. This may enable better optimization around address + * modes. + */ + bool late_lower_int64; nir_lower_int64_options lower_int64_options; nir_lower_doubles_options lower_doubles_options; nir_divergence_options divergence_analysis_options;