diff options
author | Matt Turner <[email protected]> | 2014-05-19 10:20:37 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-05-24 23:03:23 -0700 |
commit | f0f7fb181fc267934a44904da4530f50a698b18d (patch) | |
tree | ccdbbb9994000e1a6e02720d5de17c9ab89ebd03 /src/mesa/drivers/dri/i965/brw_fs_generator.cpp | |
parent | b5fd762474fb7252e7e1158e6398c10f1a035b1a (diff) |
i965: Print disassembly after compaction.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_generator.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 119 |
1 files changed, 33 insertions, 86 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 132d5cd6501..6cff9b34ef9 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -1322,12 +1322,9 @@ fs_generator::generate_untyped_surface_read(fs_inst *inst, struct brw_reg dst, } void -fs_generator::generate_code(exec_list *instructions) +fs_generator::generate_code(exec_list *instructions, + struct annotation_info *annotation) { - int last_native_insn_offset = p->next_insn_offset; - const char *last_annotation_string = NULL; - const void *last_annotation_ir = NULL; - if (unlikely(debug_flag)) { if (prog) { fprintf(stderr, @@ -1352,47 +1349,8 @@ fs_generator::generate_code(exec_list *instructions) fs_inst *inst = (fs_inst *)node; struct brw_reg src[3], dst; - if (unlikely(debug_flag)) { - foreach_list(node, &cfg->block_list) { - bblock_link *link = (bblock_link *)node; - bblock_t *block = link->block; - - if (block->start == inst) { - fprintf(stderr, " START B%d", block->block_num); - foreach_list(predecessor_node, &block->parents) { - bblock_link *predecessor_link = - (bblock_link *)predecessor_node; - bblock_t *predecessor_block = predecessor_link->block; - fprintf(stderr, " <-B%d", predecessor_block->block_num); - } - fprintf(stderr, "\n"); - } - } - - if (last_annotation_ir != inst->ir) { - last_annotation_ir = inst->ir; - if (last_annotation_ir) { - fprintf(stderr, " "); - if (prog) - ((ir_instruction *)inst->ir)->fprint(stderr); - else { - const prog_instruction *fpi; - fpi = (const prog_instruction *)inst->ir; - fprintf(stderr, "%d: ", - (int)(fpi - (fp ? fp->Base.Instructions : 0))); - _mesa_fprint_instruction_opt(stderr, - fpi, - 0, PROG_PRINT_DEBUG, NULL); - } - fprintf(stderr, "\n"); - } - } - if (last_annotation_string != inst->annotation) { - last_annotation_string = inst->annotation; - if (last_annotation_string) - fprintf(stderr, " %s\n", last_annotation_string); - } - } + if (unlikely(debug_flag)) + annotate(brw, annotation, cfg, inst, p->next_insn_offset); for (unsigned int i = 0; i < 3; i++) { src[i] = brw_reg_from_fs_reg(&inst->src[i]); @@ -1792,7 +1750,9 @@ fs_generator::generate_code(exec_list *instructions) /* This is the place where the final HALT needs to be inserted if * we've emitted any discards. If not, this will emit no code. */ - patch_discard_jumps_to_fb_writes(); + if (!patch_discard_jumps_to_fb_writes()) { + annotation->ann_count--; + } break; default: @@ -1804,44 +1764,10 @@ fs_generator::generate_code(exec_list *instructions) } abort(); } - - if (unlikely(debug_flag)) { - brw_disassemble(brw, p->store, last_native_insn_offset, p->next_insn_offset, stderr); - - foreach_list(node, &cfg->block_list) { - bblock_link *link = (bblock_link *)node; - bblock_t *block = link->block; - - if (block->end == inst) { - fprintf(stderr, " END B%d", block->block_num); - foreach_list(successor_node, &block->children) { - bblock_link *successor_link = - (bblock_link *)successor_node; - bblock_t *successor_block = successor_link->block; - fprintf(stderr, " ->B%d", successor_block->block_num); - } - fprintf(stderr, "\n"); - } - } - } - - last_native_insn_offset = p->next_insn_offset; - } - - if (unlikely(debug_flag)) { - fprintf(stderr, "\n"); } brw_set_uip_jip(p); - - /* OK, while the INTEL_DEBUG=wm above is very nice for debugging FS - * emit issues, it doesn't get the jump distances into the output, - * which is often something we want to debug. So this is here in - * case you're doing that. - */ - if (0) { - brw_disassemble(brw, p->store, 0, p->next_insn_offset, stderr); - } + annotation_finalize(annotation, p->next_insn_offset); } const unsigned * @@ -1851,10 +1777,21 @@ fs_generator::generate_assembly(exec_list *simd8_instructions, { assert(simd8_instructions || simd16_instructions); + const struct gl_program *prog = fp ? &fp->Base : NULL; + if (simd8_instructions) { + struct annotation_info annotation; + memset(&annotation, 0, sizeof(annotation)); + dispatch_width = 8; - generate_code(simd8_instructions); - brw_compact_instructions(p, 0, 0, NULL); + generate_code(simd8_instructions, &annotation); + brw_compact_instructions(p, 0, annotation.ann_count, annotation.ann); + + if (unlikely(debug_flag)) { + dump_assembly(p->store, annotation.ann_count, annotation.ann, + brw, prog, brw_disassemble); + ralloc_free(annotation.ann); + } } if (simd16_instructions) { @@ -1868,9 +1805,19 @@ fs_generator::generate_assembly(exec_list *simd8_instructions, brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED); + struct annotation_info annotation; + memset(&annotation, 0, sizeof(annotation)); + dispatch_width = 16; - generate_code(simd16_instructions); - brw_compact_instructions(p, prog_data->prog_offset_16, 0, NULL); + generate_code(simd16_instructions, &annotation); + brw_compact_instructions(p, prog_data->prog_offset_16, + annotation.ann_count, annotation.ann); + + if (unlikely(debug_flag)) { + dump_assembly(p->store, annotation.ann_count, annotation.ann, + brw, prog, brw_disassemble); + ralloc_free(annotation.ann); + } } return brw_get_program(p, assembly_size); |