[Intel-gfx] [PATCH 81/90] assembler: Put struct opcode_desc back in brw_context.h

Damien Lespiau damien.lespiau at intel.com
Mon Feb 4 16:28:16 CET 2013


I originally moved struct opcode_desc from brw_context.h to brw_eu.h on
the mesa side, but that was before the realization we needed struct
brw_context if we wanted to not touch the code too much.

So put it back there now that the mesa patch has been dropped.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 assembler/brw_context.h |   14 ++++++++++++++
 assembler/brw_disasm.c  |   17 +++++++++--------
 assembler/brw_eu.h      |   11 -----------
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/assembler/brw_context.h b/assembler/brw_context.h
index 16a9f70..90e66f7 100644
--- a/assembler/brw_context.h
+++ b/assembler/brw_context.h
@@ -31,6 +31,9 @@
 #define __BRW_CONTEXT_H__
 
 #include <stdbool.h>
+#include <stdio.h>
+
+#include "brw_structs.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,6 +60,17 @@ struct brw_context
 bool
 brw_init_context(struct brw_context *brw, int gen);
 
+/* brw_disasm.c */
+struct opcode_desc {
+    char    *name;
+    int	    nsrc;
+    int	    ndst;
+};
+
+extern const struct opcode_desc opcode_descs[128];
+
+int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);
+
 #ifdef __cplusplus
 } /* end of extern "C" */
 #endif
diff --git a/assembler/brw_disasm.c b/assembler/brw_disasm.c
index 8524d41..9781f6b 100644
--- a/assembler/brw_disasm.c
+++ b/assembler/brw_disasm.c
@@ -27,7 +27,8 @@
 #include <unistd.h>
 #include <stdarg.h>
 
-#include "brw_eu.h"
+#include "brw_context.h"
+#include "brw_defines.h"
 
 const struct opcode_desc opcode_descs[128] = {
     [BRW_OPCODE_MOV] = { .name = "mov", .nsrc = 1, .ndst = 1 },
@@ -99,7 +100,7 @@ static const char * const conditional_modifier[16] = {
     [BRW_CONDITIONAL_U] = ".u",
 };
 
-static const char * const negate_op[2] = {
+static const char * const negate[2] = {
     [0] = "",
     [1] = "-",
 };
@@ -602,7 +603,7 @@ static int src_da1 (FILE *file, GLuint type, GLuint _reg_file,
 		    GLuint reg_num, GLuint sub_reg_num, GLuint __abs, GLuint _negate)
 {
     int err = 0;
-    err |= control (file, "negate", negate_op, _negate, NULL);
+    err |= control (file, "negate", negate, _negate, NULL);
     err |= control (file, "abs", _abs, __abs, NULL);
 
     err |= reg (file, _reg_file, reg_num);
@@ -628,7 +629,7 @@ static int src_ia1 (FILE *file,
 		    GLuint _vert_stride)
 {
     int err = 0;
-    err |= control (file, "negate", negate_op, _negate, NULL);
+    err |= control (file, "negate", negate, _negate, NULL);
     err |= control (file, "abs", _abs, __abs, NULL);
 
     string (file, "g[a0");
@@ -656,7 +657,7 @@ static int src_da16 (FILE *file,
 		     GLuint swz_w)
 {
     int err = 0;
-    err |= control (file, "negate", negate_op, _negate, NULL);
+    err |= control (file, "negate", negate, _negate, NULL);
     err |= control (file, "abs", _abs, __abs, NULL);
 
     err |= reg (file, _reg_file, _reg_nr);
@@ -707,7 +708,7 @@ static int src0_3src (FILE *file, struct brw_instruction *inst)
     GLuint swz_z = (inst->bits2.da3src.src0_swizzle >> 4) & 0x3;
     GLuint swz_w = (inst->bits2.da3src.src0_swizzle >> 6) & 0x3;
 
-    err |= control (file, "negate", negate_op, inst->bits1.da3src.src0_negate, NULL);
+    err |= control (file, "negate", negate, inst->bits1.da3src.src0_negate, NULL);
     err |= control (file, "abs", _abs, inst->bits1.da3src.src0_abs, NULL);
 
     err |= reg (file, BRW_GENERAL_REGISTER_FILE, inst->bits2.da3src.src0_reg_nr);
@@ -757,7 +758,7 @@ static int src1_3src (FILE *file, struct brw_instruction *inst)
     GLuint src1_subreg_nr = (inst->bits2.da3src.src1_subreg_nr_low |
 			     (inst->bits3.da3src.src1_subreg_nr_high << 2));
 
-    err |= control (file, "negate", negate_op, inst->bits1.da3src.src1_negate,
+    err |= control (file, "negate", negate, inst->bits1.da3src.src1_negate,
 		    NULL);
     err |= control (file, "abs", _abs, inst->bits1.da3src.src1_abs, NULL);
 
@@ -808,7 +809,7 @@ static int src2_3src (FILE *file, struct brw_instruction *inst)
     GLuint swz_z = (inst->bits3.da3src.src2_swizzle >> 4) & 0x3;
     GLuint swz_w = (inst->bits3.da3src.src2_swizzle >> 6) & 0x3;
 
-    err |= control (file, "negate", negate_op, inst->bits1.da3src.src2_negate,
+    err |= control (file, "negate", negate, inst->bits1.da3src.src2_negate,
 		    NULL);
     err |= control (file, "abs", _abs, inst->bits1.da3src.src2_abs, NULL);
 
diff --git a/assembler/brw_eu.h b/assembler/brw_eu.h
index 5d623c0..83c82d1 100644
--- a/assembler/brw_eu.h
+++ b/assembler/brw_eu.h
@@ -420,17 +420,6 @@ void brw_optimize(struct brw_compile *p);
 void brw_remove_duplicate_mrf_moves(struct brw_compile *p);
 void brw_remove_grf_to_mrf_moves(struct brw_compile *p);
 
-/* brw_disasm.c */
-struct opcode_desc {
-    char    *name;
-    int	    nsrc;
-    int	    ndst;
-};
-
-extern const struct opcode_desc opcode_descs[128];
-
-int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);
-
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.7.5




More information about the Intel-gfx mailing list