summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2017-07-26 17:31:36 -0700
committerMatt Turner <[email protected]>2017-08-21 14:05:23 -0700
commit6a2471b5014f5ecc6b96a1a9c228f9ee3d0fdb98 (patch)
treeee9a14c7f3b5556164863e1c1b70908c0882b62f /src
parent1cb0a7941b27d368bc973d22b3a4db091a1852e4 (diff)
i965: Move brw_reg_type_letters() as well
And add "to_" to the name for consistency with the other functions in this file. Reviewed-by: Scott D Phillips <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/compiler/brw_eu.c28
-rw-r--r--src/intel/compiler/brw_fs.cpp4
-rw-r--r--src/intel/compiler/brw_reg.h1
-rw-r--r--src/intel/compiler/brw_reg_type.c30
-rw-r--r--src/intel/compiler/brw_reg_type.h3
-rw-r--r--src/intel/compiler/brw_vec4.cpp4
6 files changed, 37 insertions, 33 deletions
diff --git a/src/intel/compiler/brw_eu.c b/src/intel/compiler/brw_eu.c
index 700a1badd46..b0bdc38f4b5 100644
--- a/src/intel/compiler/brw_eu.c
+++ b/src/intel/compiler/brw_eu.c
@@ -37,34 +37,6 @@
#include "util/ralloc.h"
-/**
- * Converts a BRW_REGISTER_TYPE_* enum to a short string (F, UD, and so on).
- *
- * This is different than reg_encoding from brw_disasm.c in that it operates
- * on the abstract enum values, rather than the generation-specific encoding.
- */
-const char *
-brw_reg_type_letters(unsigned type)
-{
- const char *names[] = {
- [BRW_REGISTER_TYPE_UD] = "UD",
- [BRW_REGISTER_TYPE_D] = "D",
- [BRW_REGISTER_TYPE_UW] = "UW",
- [BRW_REGISTER_TYPE_W] = "W",
- [BRW_REGISTER_TYPE_F] = "F",
- [BRW_REGISTER_TYPE_UB] = "UB",
- [BRW_REGISTER_TYPE_B] = "B",
- [BRW_REGISTER_TYPE_UV] = "UV",
- [BRW_REGISTER_TYPE_V] = "V",
- [BRW_REGISTER_TYPE_VF] = "VF",
- [BRW_REGISTER_TYPE_DF] = "DF",
- [BRW_REGISTER_TYPE_HF] = "HF",
- [BRW_REGISTER_TYPE_UQ] = "UQ",
- [BRW_REGISTER_TYPE_Q] = "Q",
- };
- return names[type];
-}
-
/* Returns a conditional modifier that negates the condition. */
enum brw_conditional_mod
brw_negate_cmod(uint32_t cmod)
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 0ea4c4f1ccb..b48dc4167e7 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -5346,7 +5346,7 @@ fs_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
if (inst->dst.stride != 1)
fprintf(file, "<%u>", inst->dst.stride);
- fprintf(file, ":%s, ", brw_reg_type_letters(inst->dst.type));
+ fprintf(file, ":%s, ", brw_reg_type_to_letters(inst->dst.type));
for (int i = 0; i < inst->sources; i++) {
if (inst->src[i].negate)
@@ -5443,7 +5443,7 @@ fs_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
if (stride != 1)
fprintf(file, "<%u>", stride);
- fprintf(file, ":%s", brw_reg_type_letters(inst->src[i].type));
+ fprintf(file, ":%s", brw_reg_type_to_letters(inst->src[i].type));
}
if (i < inst->sources - 1 && inst->src[i + 1].file != BAD_FILE)
diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
index 9be2b52831f..441dfb24471 100644
--- a/src/intel/compiler/brw_reg.h
+++ b/src/intel/compiler/brw_reg.h
@@ -203,7 +203,6 @@ brw_mask_for_swizzle(unsigned swz)
return brw_apply_inv_swizzle_to_mask(swz, ~0);
}
-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);
#define REG_SIZE (8*4)
diff --git a/src/intel/compiler/brw_reg_type.c b/src/intel/compiler/brw_reg_type.c
index 1ba8f35e642..86cc1cb1e82 100644
--- a/src/intel/compiler/brw_reg_type.c
+++ b/src/intel/compiler/brw_reg_type.c
@@ -124,3 +124,33 @@ brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
enum brw_reg_type type = brw_hw_type_to_reg_type(devinfo, file, hw_type);
return type_size[type];
}
+
+/**
+ * Converts a BRW_REGISTER_TYPE_* enum to a short string (F, UD, and so on).
+ *
+ * This is different than reg_encoding from brw_disasm.c in that it operates
+ * on the abstract enum values, rather than the generation-specific encoding.
+ */
+const char *
+brw_reg_type_to_letters(enum brw_reg_type type)
+{
+ static const char letters[][3] = {
+ [BRW_REGISTER_TYPE_DF] = "DF",
+ [BRW_REGISTER_TYPE_F] = "F",
+ [BRW_REGISTER_TYPE_HF] = "HF",
+ [BRW_REGISTER_TYPE_VF] = "VF",
+
+ [BRW_REGISTER_TYPE_Q] = "Q",
+ [BRW_REGISTER_TYPE_UQ] = "UQ",
+ [BRW_REGISTER_TYPE_D] = "D",
+ [BRW_REGISTER_TYPE_UD] = "UD",
+ [BRW_REGISTER_TYPE_W] = "W",
+ [BRW_REGISTER_TYPE_UW] = "UW",
+ [BRW_REGISTER_TYPE_B] = "B",
+ [BRW_REGISTER_TYPE_UB] = "UB",
+ [BRW_REGISTER_TYPE_V] = "V",
+ [BRW_REGISTER_TYPE_UV] = "UV",
+ };
+ assert(type < ARRAY_SIZE(letters));
+ return letters[type];
+}
diff --git a/src/intel/compiler/brw_reg_type.h b/src/intel/compiler/brw_reg_type.h
index ab482d231a0..e7e8b1987e7 100644
--- a/src/intel/compiler/brw_reg_type.h
+++ b/src/intel/compiler/brw_reg_type.h
@@ -75,6 +75,9 @@ unsigned
brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
enum brw_reg_file file, unsigned hw_type);
+const char *
+brw_reg_type_to_letters(enum brw_reg_type type);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp
index bf9a2719003..020bb1760fb 100644
--- a/src/intel/compiler/brw_vec4.cpp
+++ b/src/intel/compiler/brw_vec4.cpp
@@ -1619,7 +1619,7 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
if (inst->dst.writemask & 8)
fprintf(file, "w");
}
- fprintf(file, ":%s", brw_reg_type_letters(inst->dst.type));
+ fprintf(file, ":%s", brw_reg_type_to_letters(inst->dst.type));
if (inst->src[0].file != BAD_FILE)
fprintf(file, ", ");
@@ -1714,7 +1714,7 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
fprintf(file, "|");
if (inst->src[i].file != IMM) {
- fprintf(file, ":%s", brw_reg_type_letters(inst->src[i].type));
+ fprintf(file, ":%s", brw_reg_type_to_letters(inst->src[i].type));
}
if (i < 2 && inst->src[i + 1].file != BAD_FILE)