summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-05-29 11:45:15 -0700
committerMatt Turner <[email protected]>2014-06-01 13:18:52 -0700
commit56d6dcf4f771d57d2759b2a5c5006f24444c696f (patch)
treef28bb39f2dfc49b9e340e2cdc985388416ecd6c3
parent08c2acd8d97fe19c0620190c0ce47e9128a75842 (diff)
i965: Give dump_instruction() a FILE* argument.
Use function overloading rather than default arguments, since gdb doesn't know about default arguments. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp108
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp104
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h1
5 files changed, 115 insertions, 100 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 5605db359d3..8bd3f612532 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2587,181 +2587,187 @@ fs_visitor::dump_instructions()
void
fs_visitor::dump_instruction(backend_instruction *be_inst)
{
+ dump_instruction(be_inst, stderr);
+}
+
+void
+fs_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
+{
fs_inst *inst = (fs_inst *)be_inst;
if (inst->predicate) {
- fprintf(stderr, "(%cf0.%d) ",
+ fprintf(file, "(%cf0.%d) ",
inst->predicate_inverse ? '-' : '+',
inst->flag_subreg);
}
- fprintf(stderr, "%s", brw_instruction_name(inst->opcode));
+ fprintf(file, "%s", brw_instruction_name(inst->opcode));
if (inst->saturate)
- fprintf(stderr, ".sat");
+ fprintf(file, ".sat");
if (inst->conditional_mod) {
- fprintf(stderr, "%s", conditional_modifier[inst->conditional_mod]);
+ fprintf(file, "%s", conditional_modifier[inst->conditional_mod]);
if (!inst->predicate &&
(brw->gen < 5 || (inst->opcode != BRW_OPCODE_SEL &&
inst->opcode != BRW_OPCODE_IF &&
inst->opcode != BRW_OPCODE_WHILE))) {
- fprintf(stderr, ".f0.%d", inst->flag_subreg);
+ fprintf(file, ".f0.%d", inst->flag_subreg);
}
}
- fprintf(stderr, " ");
+ fprintf(file, " ");
switch (inst->dst.file) {
case GRF:
- fprintf(stderr, "vgrf%d", inst->dst.reg);
+ fprintf(file, "vgrf%d", inst->dst.reg);
if (virtual_grf_sizes[inst->dst.reg] != 1 ||
inst->dst.subreg_offset)
- fprintf(stderr, "+%d.%d",
+ fprintf(file, "+%d.%d",
inst->dst.reg_offset, inst->dst.subreg_offset);
break;
case MRF:
- fprintf(stderr, "m%d", inst->dst.reg);
+ fprintf(file, "m%d", inst->dst.reg);
break;
case BAD_FILE:
- fprintf(stderr, "(null)");
+ fprintf(file, "(null)");
break;
case UNIFORM:
- fprintf(stderr, "***u%d***", inst->dst.reg + inst->dst.reg_offset);
+ fprintf(file, "***u%d***", inst->dst.reg + inst->dst.reg_offset);
break;
case HW_REG:
if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
switch (inst->dst.fixed_hw_reg.nr) {
case BRW_ARF_NULL:
- fprintf(stderr, "null");
+ fprintf(file, "null");
break;
case BRW_ARF_ADDRESS:
- fprintf(stderr, "a0.%d", inst->dst.fixed_hw_reg.subnr);
+ fprintf(file, "a0.%d", inst->dst.fixed_hw_reg.subnr);
break;
case BRW_ARF_ACCUMULATOR:
- fprintf(stderr, "acc%d", inst->dst.fixed_hw_reg.subnr);
+ fprintf(file, "acc%d", inst->dst.fixed_hw_reg.subnr);
break;
case BRW_ARF_FLAG:
- fprintf(stderr, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+ fprintf(file, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
inst->dst.fixed_hw_reg.subnr);
break;
default:
- fprintf(stderr, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+ fprintf(file, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
inst->dst.fixed_hw_reg.subnr);
break;
}
} else {
- fprintf(stderr, "hw_reg%d", inst->dst.fixed_hw_reg.nr);
+ fprintf(file, "hw_reg%d", inst->dst.fixed_hw_reg.nr);
}
if (inst->dst.fixed_hw_reg.subnr)
- fprintf(stderr, "+%d", inst->dst.fixed_hw_reg.subnr);
+ fprintf(file, "+%d", inst->dst.fixed_hw_reg.subnr);
break;
default:
- fprintf(stderr, "???");
+ fprintf(file, "???");
break;
}
- fprintf(stderr, ":%s, ", brw_reg_type_letters(inst->dst.type));
+ fprintf(file, ":%s, ", brw_reg_type_letters(inst->dst.type));
for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) {
if (inst->src[i].negate)
- fprintf(stderr, "-");
+ fprintf(file, "-");
if (inst->src[i].abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
switch (inst->src[i].file) {
case GRF:
- fprintf(stderr, "vgrf%d", inst->src[i].reg);
+ fprintf(file, "vgrf%d", inst->src[i].reg);
if (virtual_grf_sizes[inst->src[i].reg] != 1 ||
inst->src[i].subreg_offset)
- fprintf(stderr, "+%d.%d", inst->src[i].reg_offset,
+ fprintf(file, "+%d.%d", inst->src[i].reg_offset,
inst->src[i].subreg_offset);
break;
case MRF:
- fprintf(stderr, "***m%d***", inst->src[i].reg);
+ fprintf(file, "***m%d***", inst->src[i].reg);
break;
case UNIFORM:
- fprintf(stderr, "u%d", inst->src[i].reg + inst->src[i].reg_offset);
+ fprintf(file, "u%d", inst->src[i].reg + inst->src[i].reg_offset);
if (inst->src[i].reladdr) {
- fprintf(stderr, "+reladdr");
+ fprintf(file, "+reladdr");
} else if (virtual_grf_sizes[inst->src[i].reg] != 1 ||
inst->src[i].subreg_offset) {
- fprintf(stderr, "+%d.%d", inst->src[i].reg_offset,
+ fprintf(file, "+%d.%d", inst->src[i].reg_offset,
inst->src[i].subreg_offset);
}
break;
case BAD_FILE:
- fprintf(stderr, "(null)");
+ fprintf(file, "(null)");
break;
case IMM:
switch (inst->src[i].type) {
case BRW_REGISTER_TYPE_F:
- fprintf(stderr, "%ff", inst->src[i].imm.f);
+ fprintf(file, "%ff", inst->src[i].imm.f);
break;
case BRW_REGISTER_TYPE_D:
- fprintf(stderr, "%dd", inst->src[i].imm.i);
+ fprintf(file, "%dd", inst->src[i].imm.i);
break;
case BRW_REGISTER_TYPE_UD:
- fprintf(stderr, "%uu", inst->src[i].imm.u);
+ fprintf(file, "%uu", inst->src[i].imm.u);
break;
default:
- fprintf(stderr, "???");
+ fprintf(file, "???");
break;
}
break;
case HW_REG:
if (inst->src[i].fixed_hw_reg.negate)
- fprintf(stderr, "-");
+ fprintf(file, "-");
if (inst->src[i].fixed_hw_reg.abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
if (inst->src[i].fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
switch (inst->src[i].fixed_hw_reg.nr) {
case BRW_ARF_NULL:
- fprintf(stderr, "null");
+ fprintf(file, "null");
break;
case BRW_ARF_ADDRESS:
- fprintf(stderr, "a0.%d", inst->src[i].fixed_hw_reg.subnr);
+ fprintf(file, "a0.%d", inst->src[i].fixed_hw_reg.subnr);
break;
case BRW_ARF_ACCUMULATOR:
- fprintf(stderr, "acc%d", inst->src[i].fixed_hw_reg.subnr);
+ fprintf(file, "acc%d", inst->src[i].fixed_hw_reg.subnr);
break;
case BRW_ARF_FLAG:
- fprintf(stderr, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+ fprintf(file, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
inst->src[i].fixed_hw_reg.subnr);
break;
default:
- fprintf(stderr, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+ fprintf(file, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
inst->src[i].fixed_hw_reg.subnr);
break;
}
} else {
- fprintf(stderr, "hw_reg%d", inst->src[i].fixed_hw_reg.nr);
+ fprintf(file, "hw_reg%d", inst->src[i].fixed_hw_reg.nr);
}
if (inst->src[i].fixed_hw_reg.subnr)
- fprintf(stderr, "+%d", inst->src[i].fixed_hw_reg.subnr);
+ fprintf(file, "+%d", inst->src[i].fixed_hw_reg.subnr);
if (inst->src[i].fixed_hw_reg.abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
break;
default:
- fprintf(stderr, "???");
+ fprintf(file, "???");
break;
}
if (inst->src[i].abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
if (inst->src[i].file != IMM) {
- fprintf(stderr, ":%s", brw_reg_type_letters(inst->src[i].type));
+ fprintf(file, ":%s", brw_reg_type_letters(inst->src[i].type));
}
if (i < 2 && inst->src[i + 1].file != BAD_FILE)
- fprintf(stderr, ", ");
+ fprintf(file, ", ");
}
- fprintf(stderr, " ");
+ fprintf(file, " ");
if (inst->force_uncompressed)
- fprintf(stderr, "1sthalf ");
+ fprintf(file, "1sthalf ");
if (inst->force_sechalf)
- fprintf(stderr, "2ndhalf ");
+ fprintf(file, "2ndhalf ");
- fprintf(stderr, "\n");
+ fprintf(file, "\n");
}
/**
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 60a4906cb18..90cf6fb3014 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -485,6 +485,7 @@ public:
virtual void dump_instructions();
void dump_instruction(backend_instruction *inst);
+ void dump_instruction(backend_instruction *inst, FILE *file);
void visit_atomic_counter_intrinsic(ir_call *ir);
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 5af6e082df2..0dc87789b78 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -109,6 +109,7 @@ public:
exec_list instructions;
virtual void dump_instruction(backend_instruction *inst) = 0;
+ virtual void dump_instruction(backend_instruction *inst, FILE *file) = 0;
virtual void dump_instructions();
void assign_common_binding_table_offsets(uint32_t next_binding_table_offset);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index daff3641119..fa186b536bf 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1261,168 +1261,174 @@ vec4_visitor::split_virtual_grfs()
void
vec4_visitor::dump_instruction(backend_instruction *be_inst)
{
+ dump_instruction(be_inst, stderr);
+}
+
+void
+vec4_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
+{
vec4_instruction *inst = (vec4_instruction *)be_inst;
if (inst->predicate) {
- fprintf(stderr, "(%cf0) ",
+ fprintf(file, "(%cf0) ",
inst->predicate_inverse ? '-' : '+');
}
- fprintf(stderr, "%s", brw_instruction_name(inst->opcode));
+ fprintf(file, "%s", brw_instruction_name(inst->opcode));
if (inst->conditional_mod) {
- fprintf(stderr, "%s", conditional_modifier[inst->conditional_mod]);
+ fprintf(file, "%s", conditional_modifier[inst->conditional_mod]);
}
- fprintf(stderr, " ");
+ fprintf(file, " ");
switch (inst->dst.file) {
case GRF:
- fprintf(stderr, "vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset);
+ fprintf(file, "vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset);
break;
case MRF:
- fprintf(stderr, "m%d", inst->dst.reg);
+ fprintf(file, "m%d", inst->dst.reg);
break;
case HW_REG:
if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
switch (inst->dst.fixed_hw_reg.nr) {
case BRW_ARF_NULL:
- fprintf(stderr, "null");
+ fprintf(file, "null");
break;
case BRW_ARF_ADDRESS:
- fprintf(stderr, "a0.%d", inst->dst.fixed_hw_reg.subnr);
+ fprintf(file, "a0.%d", inst->dst.fixed_hw_reg.subnr);
break;
case BRW_ARF_ACCUMULATOR:
- fprintf(stderr, "acc%d", inst->dst.fixed_hw_reg.subnr);
+ fprintf(file, "acc%d", inst->dst.fixed_hw_reg.subnr);
break;
case BRW_ARF_FLAG:
- fprintf(stderr, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+ fprintf(file, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
inst->dst.fixed_hw_reg.subnr);
break;
default:
- fprintf(stderr, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+ fprintf(file, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
inst->dst.fixed_hw_reg.subnr);
break;
}
} else {
- fprintf(stderr, "hw_reg%d", inst->dst.fixed_hw_reg.nr);
+ fprintf(file, "hw_reg%d", inst->dst.fixed_hw_reg.nr);
}
if (inst->dst.fixed_hw_reg.subnr)
- fprintf(stderr, "+%d", inst->dst.fixed_hw_reg.subnr);
+ fprintf(file, "+%d", inst->dst.fixed_hw_reg.subnr);
break;
case BAD_FILE:
- fprintf(stderr, "(null)");
+ fprintf(file, "(null)");
break;
default:
- fprintf(stderr, "???");
+ fprintf(file, "???");
break;
}
if (inst->dst.writemask != WRITEMASK_XYZW) {
- fprintf(stderr, ".");
+ fprintf(file, ".");
if (inst->dst.writemask & 1)
- fprintf(stderr, "x");
+ fprintf(file, "x");
if (inst->dst.writemask & 2)
- fprintf(stderr, "y");
+ fprintf(file, "y");
if (inst->dst.writemask & 4)
- fprintf(stderr, "z");
+ fprintf(file, "z");
if (inst->dst.writemask & 8)
- fprintf(stderr, "w");
+ fprintf(file, "w");
}
- fprintf(stderr, ":%s, ", brw_reg_type_letters(inst->dst.type));
+ fprintf(file, ":%s, ", brw_reg_type_letters(inst->dst.type));
for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) {
if (inst->src[i].negate)
- fprintf(stderr, "-");
+ fprintf(file, "-");
if (inst->src[i].abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
switch (inst->src[i].file) {
case GRF:
- fprintf(stderr, "vgrf%d", inst->src[i].reg);
+ fprintf(file, "vgrf%d", inst->src[i].reg);
break;
case ATTR:
- fprintf(stderr, "attr%d", inst->src[i].reg);
+ fprintf(file, "attr%d", inst->src[i].reg);
break;
case UNIFORM:
- fprintf(stderr, "u%d", inst->src[i].reg);
+ fprintf(file, "u%d", inst->src[i].reg);
break;
case IMM:
switch (inst->src[i].type) {
case BRW_REGISTER_TYPE_F:
- fprintf(stderr, "%fF", inst->src[i].imm.f);
+ fprintf(file, "%fF", inst->src[i].imm.f);
break;
case BRW_REGISTER_TYPE_D:
- fprintf(stderr, "%dD", inst->src[i].imm.i);
+ fprintf(file, "%dD", inst->src[i].imm.i);
break;
case BRW_REGISTER_TYPE_UD:
- fprintf(stderr, "%uU", inst->src[i].imm.u);
+ fprintf(file, "%uU", inst->src[i].imm.u);
break;
default:
- fprintf(stderr, "???");
+ fprintf(file, "???");
break;
}
break;
case HW_REG:
if (inst->src[i].fixed_hw_reg.negate)
- fprintf(stderr, "-");
+ fprintf(file, "-");
if (inst->src[i].fixed_hw_reg.abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
if (inst->src[i].fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
switch (inst->src[i].fixed_hw_reg.nr) {
case BRW_ARF_NULL:
- fprintf(stderr, "null");
+ fprintf(file, "null");
break;
case BRW_ARF_ADDRESS:
- fprintf(stderr, "a0.%d", inst->src[i].fixed_hw_reg.subnr);
+ fprintf(file, "a0.%d", inst->src[i].fixed_hw_reg.subnr);
break;
case BRW_ARF_ACCUMULATOR:
- fprintf(stderr, "acc%d", inst->src[i].fixed_hw_reg.subnr);
+ fprintf(file, "acc%d", inst->src[i].fixed_hw_reg.subnr);
break;
case BRW_ARF_FLAG:
- fprintf(stderr, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+ fprintf(file, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
inst->src[i].fixed_hw_reg.subnr);
break;
default:
- fprintf(stderr, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+ fprintf(file, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
inst->src[i].fixed_hw_reg.subnr);
break;
}
} else {
- fprintf(stderr, "hw_reg%d", inst->src[i].fixed_hw_reg.nr);
+ fprintf(file, "hw_reg%d", inst->src[i].fixed_hw_reg.nr);
}
if (inst->src[i].fixed_hw_reg.subnr)
- fprintf(stderr, "+%d", inst->src[i].fixed_hw_reg.subnr);
+ fprintf(file, "+%d", inst->src[i].fixed_hw_reg.subnr);
if (inst->src[i].fixed_hw_reg.abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
break;
case BAD_FILE:
- fprintf(stderr, "(null)");
+ fprintf(file, "(null)");
break;
default:
- fprintf(stderr, "???");
+ fprintf(file, "???");
break;
}
if (virtual_grf_sizes[inst->src[i].reg] != 1)
- fprintf(stderr, ".%d", inst->src[i].reg_offset);
+ fprintf(file, ".%d", inst->src[i].reg_offset);
if (inst->src[i].file != IMM) {
static const char *chans[4] = {"x", "y", "z", "w"};
- fprintf(stderr, ".");
+ fprintf(file, ".");
for (int c = 0; c < 4; c++) {
- fprintf(stderr, "%s", chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]);
+ fprintf(file, "%s", chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]);
}
}
if (inst->src[i].abs)
- fprintf(stderr, "|");
+ fprintf(file, "|");
if (inst->src[i].file != IMM) {
- fprintf(stderr, ":%s", brw_reg_type_letters(inst->src[i].type));
+ fprintf(file, ":%s", brw_reg_type_letters(inst->src[i].type));
}
if (i < 2 && inst->src[i + 1].file != BAD_FILE)
- fprintf(stderr, ", ");
+ fprintf(file, ", ");
}
- fprintf(stderr, "\n");
+ fprintf(file, "\n");
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 4b2b01942b4..fd58b3c8401 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -594,6 +594,7 @@ public:
bool process_move_condition(ir_rvalue *ir);
void dump_instruction(backend_instruction *inst);
+ void dump_instruction(backend_instruction *inst, FILE *file);
void visit_atomic_counter_intrinsic(ir_call *ir);