[Mesa-dev] [PATCH 12/25] i965: Reverse file/type arguments to register type functions

Matt Turner mattst88 at gmail.com
Fri Aug 4 17:31:44 UTC 2017


I think of the initial arguments as "state" and the last as the actual
subject.
---
 src/intel/compiler/brw_disasm.c      |  4 ++--
 src/intel/compiler/brw_eu_emit.c     | 14 ++++++++------
 src/intel/compiler/brw_eu_validate.c |  2 +-
 src/intel/compiler/brw_reg.h         |  8 ++++----
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/intel/compiler/brw_disasm.c b/src/intel/compiler/brw_disasm.c
index 6da7060517..aafea693fc 100644
--- a/src/intel/compiler/brw_disasm.c
+++ b/src/intel/compiler/brw_disasm.c
@@ -839,7 +839,7 @@ src_da1(FILE *file,
    if (err == -1)
       return 0;
    if (sub_reg_num) {
-      unsigned elem_size = brw_hw_reg_type_to_size(devinfo, type, _reg_file);
+      unsigned elem_size = brw_hw_reg_type_to_size(devinfo, _reg_file, type);
       format(file, ".%d", sub_reg_num / elem_size);   /* use formal style like spec */
    }
    src_align1_region(file, _vert_stride, _width, _horiz_stride);
@@ -928,7 +928,7 @@ src_da16(FILE *file,
       return 0;
    if (_subreg_nr) {
       unsigned elem_size =
-         brw_hw_reg_type_to_size(devinfo, _reg_type, _reg_file);
+         brw_hw_reg_type_to_size(devinfo, _reg_file, _reg_type);
 
       /* bit4 for subreg number byte addressing. Make this same meaning as
          in da1 case, so output looks consistent. */
diff --git a/src/intel/compiler/brw_eu_emit.c b/src/intel/compiler/brw_eu_emit.c
index 69ebf6345c..12e9d332a1 100644
--- a/src/intel/compiler/brw_eu_emit.c
+++ b/src/intel/compiler/brw_eu_emit.c
@@ -91,7 +91,8 @@ gen7_convert_mrf_to_grf(struct brw_codegen *p, struct brw_reg *reg)
  */
 unsigned
 brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
-                        enum brw_reg_type type, enum brw_reg_file file)
+                        enum brw_reg_file file,
+                        enum brw_reg_type type)
 {
    if (file == BRW_IMMEDIATE_VALUE) {
       static const enum hw_imm_type hw_types[] = {
@@ -141,7 +142,8 @@ brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
  */
 unsigned
 brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
-                        unsigned type, enum brw_reg_file file)
+                        enum brw_reg_file file,
+                        unsigned type)
 {
    if (file == BRW_IMMEDIATE_VALUE) {
       static const int hw_sizes[] = {
@@ -198,8 +200,8 @@ brw_set_dest(struct brw_codegen *p, brw_inst *inst, struct brw_reg dest)
 
    brw_inst_set_dst_reg_file(devinfo, inst, dest.file);
    brw_inst_set_dst_reg_type(devinfo, inst,
-                             brw_reg_type_to_hw_type(devinfo, dest.type,
-                                                     dest.file));
+                             brw_reg_type_to_hw_type(devinfo, dest.file,
+                                                     dest.type));
    brw_inst_set_dst_address_mode(devinfo, inst, dest.address_mode);
 
    if (dest.address_mode == BRW_ADDRESS_DIRECT) {
@@ -365,7 +367,7 @@ brw_set_src0(struct brw_codegen *p, brw_inst *inst, struct brw_reg reg)
 
    brw_inst_set_src0_reg_file(devinfo, inst, reg.file);
    brw_inst_set_src0_reg_type(devinfo, inst,
-                              brw_reg_type_to_hw_type(devinfo, reg.type, reg.file));
+                              brw_reg_type_to_hw_type(devinfo, reg.file, reg.type));
    brw_inst_set_src0_abs(devinfo, inst, reg.abs);
    brw_inst_set_src0_negate(devinfo, inst, reg.negate);
    brw_inst_set_src0_address_mode(devinfo, inst, reg.address_mode);
@@ -472,7 +474,7 @@ brw_set_src1(struct brw_codegen *p, brw_inst *inst, struct brw_reg reg)
 
    brw_inst_set_src1_reg_file(devinfo, inst, reg.file);
    brw_inst_set_src1_reg_type(devinfo, inst,
-                              brw_reg_type_to_hw_type(devinfo, reg.type, reg.file));
+                              brw_reg_type_to_hw_type(devinfo, reg.file, reg.type));
    brw_inst_set_src1_abs(devinfo, inst, reg.abs);
    brw_inst_set_src1_negate(devinfo, inst, reg.negate);
 
diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c
index 54e0a2e62e..cacf962904 100644
--- a/src/intel/compiler/brw_eu_validate.c
+++ b/src/intel/compiler/brw_eu_validate.c
@@ -459,7 +459,7 @@ general_restrictions_based_on_operand_types(const struct gen_device_info *devinf
 
    unsigned exec_type = execution_type(devinfo, inst);
    unsigned exec_type_size =
-      brw_hw_reg_type_to_size(devinfo, exec_type, BRW_GENERAL_REGISTER_FILE);
+      brw_hw_reg_type_to_size(devinfo, BRW_GENERAL_REGISTER_FILE, exec_type);
    unsigned dst_type_size = brw_element_size(devinfo, inst, dst);
 
    /* On IVB/BYT, region parameters and execution size for DF are in terms of
diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
index bd179606b0..db932cfeee 100644
--- a/src/intel/compiler/brw_reg.h
+++ b/src/intel/compiler/brw_reg.h
@@ -227,14 +227,14 @@ enum PACKED brw_reg_type {
 };
 
 unsigned brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
-                                 enum brw_reg_type type, enum brw_reg_file file);
+                                 enum brw_reg_file file, enum brw_reg_type type);
 
 #define brw_element_size(devinfo, inst, operand)                             \
    brw_hw_reg_type_to_size(devinfo,                                          \
-                           brw_inst_ ## operand ## _reg_type(devinfo, inst), \
-                           brw_inst_ ## operand ## _reg_file(devinfo, inst))
+                           brw_inst_ ## operand ## _reg_file(devinfo, inst), \
+                           brw_inst_ ## operand ## _reg_type(devinfo, inst))
 unsigned brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
-                                 unsigned type, enum brw_reg_file file);
+                                 enum brw_reg_file file, unsigned type);
 
 const char *brw_reg_type_letters(unsigned brw_reg_type);
 uint32_t brw_swizzle_immediate(enum brw_reg_type type, uint32_t x, unsigned swz);
-- 
2.13.0



More information about the mesa-dev mailing list