for (i = 0; i < 8; i++)
brw_NOP(p);
- *sz = p->nr_insn * sizeof(struct brw_instruction);
+ *sz = p->next_insn_offset;
return (const GLuint *)p->store;
}
+
+void
+brw_dump_compile(struct brw_compile *p, FILE *out, int start, int end)
+{
+ void *store = p->store;
+
+ for (int offset = start; offset < end; offset += 16) {
+ struct brw_instruction *insn = store + offset;
+
+ printf("0x%08x: ", offset);
+
+ if (0) {
+ printf("0x%08x 0x%08x 0x%08x 0x%08x ",
+ ((uint32_t *)insn)[3],
+ ((uint32_t *)insn)[2],
+ ((uint32_t *)insn)[1],
+ ((uint32_t *)insn)[0]);
+ }
+
+ brw_disasm(stdout, insn, p->brw->intel.gen);
+ }
+}
struct brw_instruction *store;
int store_size;
GLuint nr_insn;
+ unsigned int next_insn_offset;
void *mem_ctx;
void brw_init_compile(struct brw_context *, struct brw_compile *p,
void *mem_ctx);
+void brw_dump_compile(struct brw_compile *p, FILE *out, int start, int end);
const GLuint *brw_get_program( struct brw_compile *p, GLuint *sz );
struct brw_instruction *brw_next_insn(struct brw_compile *p, GLuint opcode);
assert(!"realloc eu store memeory failed");
}
+ p->next_insn_offset += 16;
insn = &p->store[p->nr_insn++];
memcpy(insn, p->current, sizeof(*insn));
void
fs_visitor::generate_code()
{
- int last_native_inst = p->nr_insn;
+ int last_native_insn_offset = p->next_insn_offset;
const char *last_annotation_string = NULL;
ir_instruction *last_annotation_ir = NULL;
}
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
- for (unsigned int i = last_native_inst; i < p->nr_insn; i++) {
- if (0) {
- printf("0x%08x 0x%08x 0x%08x 0x%08x ",
- ((uint32_t *)&p->store[i])[3],
- ((uint32_t *)&p->store[i])[2],
- ((uint32_t *)&p->store[i])[1],
- ((uint32_t *)&p->store[i])[0]);
- }
- brw_disasm(stdout, &p->store[i], intel->gen);
- }
+ brw_dump_compile(p, stdout,
+ last_native_insn_offset, p->next_insn_offset);
foreach_list(node, &cfg->block_list) {
fs_bblock_link *link = (fs_bblock_link *)node;
}
}
- last_native_inst = p->nr_insn;
+ last_native_insn_offset = p->next_insn_offset;
}
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
* case you're doing that.
*/
if (0) {
- if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
- for (unsigned int i = 0; i < p->nr_insn; i++) {
- printf("0x%08x 0x%08x 0x%08x 0x%08x ",
- ((uint32_t *)&p->store[i])[3],
- ((uint32_t *)&p->store[i])[2],
- ((uint32_t *)&p->store[i])[1],
- ((uint32_t *)&p->store[i])[0]);
- brw_disasm(stdout, &p->store[i], intel->gen);
- }
- }
+ brw_dump_compile(p, stdout, 0, p->next_insn_offset);
}
}
void
vec4_visitor::generate_code()
{
- int last_native_inst = 0;
+ int last_native_insn_offset = 0;
const char *last_annotation_string = NULL;
ir_instruction *last_annotation_ir = NULL;
}
if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
- for (unsigned int i = last_native_inst; i < p->nr_insn; i++) {
- if (0) {
- printf("0x%08x 0x%08x 0x%08x 0x%08x ",
- ((uint32_t *)&p->store[i])[3],
- ((uint32_t *)&p->store[i])[2],
- ((uint32_t *)&p->store[i])[1],
- ((uint32_t *)&p->store[i])[0]);
- }
- brw_disasm(stdout, &p->store[i], intel->gen);
- }
+ brw_dump_compile(p, stdout,
+ last_native_insn_offset, p->next_insn_offset);
}
- last_native_inst = p->nr_insn;
+ last_native_insn_offset = p->next_insn_offset;
}
if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
* which is often something we want to debug. So this is here in
* case you're doing that.
*/
- if (0) {
- if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
- for (unsigned int i = 0; i < p->nr_insn; i++) {
- printf("0x%08x 0x%08x 0x%08x 0x%08x ",
- ((uint32_t *)&p->store[i])[3],
- ((uint32_t *)&p->store[i])[2],
- ((uint32_t *)&p->store[i])[1],
- ((uint32_t *)&p->store[i])[0]);
- brw_disasm(stdout, &p->store[i], intel->gen);
- }
- }
+ if (0 && unlikely(INTEL_DEBUG & DEBUG_VS)) {
+ brw_dump_compile(p, stdout, 0, p->next_insn_offset);
}
}
brw_optimize(p);
if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
- int i;
-
printf("vs-native:\n");
- for (i = 0; i < p->nr_insn; i++)
- brw_disasm(stdout, &p->store[i], intel->gen);
+ brw_dump_compile(p, stdout, 0, p->next_insn_offset);
printf("\n");
}
}
}
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
- int i;
-
- printf("wm-native:\n");
- for (i = 0; i < p->nr_insn; i++)
- brw_disasm(stdout, &p->store[i], p->brw->intel.gen);
+ printf("wm-native:\n");
+ brw_dump_compile(p, stdout, 0, p->next_insn_offset);
printf("\n");
}
}