From c0fb93506b9d4590196aa1d18f30c21803ba98eb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 26 Feb 2025 10:02:55 -0800 Subject: [PATCH] brw: Add brw_reg::is_grf v2: Add a function comment. Suggested by Caio. Reviewed-by: Caio Oliveira Part-of: --- src/intel/compiler/brw/brw_opt_copy_propagation.cpp | 3 +-- src/intel/compiler/brw/brw_reg.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw/brw_opt_copy_propagation.cpp b/src/intel/compiler/brw/brw_opt_copy_propagation.cpp index 35caaf2d7b2..1ebe3bee143 100644 --- a/src/intel/compiler/brw/brw_opt_copy_propagation.cpp +++ b/src/intel/compiler/brw/brw_opt_copy_propagation.cpp @@ -704,8 +704,7 @@ try_copy_propagate(brw_shader &s, brw_inst *inst, const struct intel_device_info *devinfo = s.devinfo; - assert(entry->src.file == VGRF || entry->src.file == UNIFORM || - entry->src.file == ATTR || entry->src.file == FIXED_GRF); + assert(entry->src.is_grf()); /* Avoid propagating a LOAD_PAYLOAD instruction into another if there is a * good chance that we'll be able to eliminate the latter through register diff --git a/src/intel/compiler/brw/brw_reg.h b/src/intel/compiler/brw/brw_reg.h index 1d71b05c746..acc233ed376 100644 --- a/src/intel/compiler/brw/brw_reg.h +++ b/src/intel/compiler/brw/brw_reg.h @@ -233,6 +233,17 @@ typedef struct brw_reg { bool is_ip() const { return brw_reg_is_arf(*this, BRW_ARF_IP); } bool is_address() const; + /** + * These are all the things that will eventually become FIXED_GRF. The + * things that will live in regular registers can, for the most part, be + * treated the same by optimization passes. + */ + bool is_grf() const + { + return file == FIXED_GRF || file == VGRF || file == ATTR || + file == UNIFORM; + } + unsigned address_slot(unsigned byte_offset) const; /**