From e231aec0c9d67e2c4e1018698355f1a7a08abeea Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Fri, 7 Nov 2025 14:30:52 +0100 Subject: [PATCH] nir: Move nir_def directly after nir_instr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way, all instruction types have the nir_def at the same offset. Acked-by: Marek Olšák Part-of: --- src/compiler/nir/nir.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index ed40809928d..fe86078939d 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1540,6 +1540,9 @@ typedef struct nir_alu_instr { /** Base instruction */ nir_instr instr; + /** Destination */ + nir_def def; + /** Opcode */ nir_op op; @@ -1573,9 +1576,6 @@ typedef struct nir_alu_instr { */ uint32_t fp_fast_math : 9; - /** Destination */ - nir_def def; - /** Sources * * The size of the array is given by :c:member:`nir_op_info.num_inputs`. @@ -1656,6 +1656,9 @@ typedef enum { typedef struct nir_deref_instr { nir_instr instr; + /** Destination to store the resulting "pointer" */ + nir_def def; + /** The type of this deref instruction */ nir_deref_type deref_type; @@ -1698,9 +1701,6 @@ typedef struct nir_deref_instr { unsigned align_offset; } cast; }; - - /** Destination to store the resulting "pointer" */ - nir_def def; } nir_deref_instr; /** @@ -1893,10 +1893,10 @@ typedef struct nir_call_instr { typedef struct nir_intrinsic_instr { nir_instr instr; - nir_intrinsic_op intrinsic; - nir_def def; + nir_intrinsic_op intrinsic; + /** number of components if this is a vectorized intrinsic * * Similarly to ALU operations, some intrinsics are vectorized. @@ -2405,6 +2405,9 @@ typedef struct nir_tex_instr { /** Base instruction */ nir_instr instr; + /** Destination */ + nir_def def; + /** Dimensionality of the texture operation * * This will typically match the dimensionality of the texture deref type @@ -2429,9 +2432,6 @@ typedef struct nir_tex_instr { /** Texture opcode */ nir_texop op; - /** Destination */ - nir_def def; - /** Array of sources * * This array has :c:member:`nir_tex_instr.num_srcs` elements @@ -2761,10 +2761,10 @@ typedef struct nir_phi_src { typedef struct nir_phi_instr { nir_instr instr; + nir_def def; + /** list of nir_phi_src */ struct exec_list srcs; - - nir_def def; } nir_phi_instr; static inline nir_phi_src *