diff options
author | Eric Anholt <[email protected]> | 2012-10-03 16:11:26 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-10-17 12:23:59 -0700 |
commit | 914d8f9f84a3539758716d676d59a1fee4cc559f (patch) | |
tree | e086bb9ed59d1a54d84045511e9c45ebdbb01c65 /src/mesa/drivers/dri/i965/brw_vec4.cpp | |
parent | a30d14635d5d55ce0e022b0b66770da32155a3d7 (diff) |
i965/vs: Add a little bit of IR-level debug ability.
This is super basic, but it let me visualize a problem I had with
opt_compute_to_mrf().
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index e0b643242a3..727d980c314 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -925,4 +925,87 @@ vec4_visitor::split_virtual_grfs() this->live_intervals_valid = false; } +void +vec4_visitor::dump_instruction(vec4_instruction *inst) +{ + if (inst->opcode < ARRAY_SIZE(opcode_descs) && + opcode_descs[inst->opcode].name) { + printf("%s ", opcode_descs[inst->opcode].name); + } else { + printf("op%d ", inst->opcode); + } + + switch (inst->dst.file) { + case GRF: + printf("vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset); + break; + case MRF: + printf("m%d", inst->dst.reg); + break; + case BAD_FILE: + printf("(null)"); + break; + default: + printf("???"); + break; + } + if (inst->dst.writemask != WRITEMASK_XYZW) { + printf("."); + if (inst->dst.writemask & 1) + printf("x"); + if (inst->dst.writemask & 2) + printf("y"); + if (inst->dst.writemask & 4) + printf("z"); + if (inst->dst.writemask & 8) + printf("w"); + } + printf(", "); + + for (int i = 0; i < 3; i++) { + switch (inst->src[i].file) { + case GRF: + printf("vgrf%d", inst->src[i].reg); + break; + case ATTR: + printf("attr%d", inst->src[i].reg); + break; + case UNIFORM: + printf("u%d", inst->src[i].reg); + break; + case BAD_FILE: + printf("(null)"); + break; + default: + printf("???"); + break; + } + + if (inst->src[i].reg_offset) + printf(".%d", inst->src[i].reg_offset); + + static const char *chans[4] = {"x", "y", "z", "w"}; + printf("."); + for (int c = 0; c < 4; c++) { + printf(chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]); + } + + if (i < 3) + printf(", "); + } + + printf("\n"); +} + +void +vec4_visitor::dump_instructions() +{ + int ip = 0; + foreach_list_safe(node, &this->instructions) { + vec4_instruction *inst = (vec4_instruction *)node; + printf("%d: ", ip++); + dump_instruction(inst); + } +} + } /* namespace brw */ |