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 <alyssa@rosenzweig.io>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31964>
This commit is contained in:
Alyssa Rosenzweig 2024-11-03 21:57:28 -05:00
parent eaf75169ee
commit 23afe968ad

View file

@ -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;