summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler/brw_eu_compact.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/compiler/brw_eu_compact.c')
-rw-r--r--src/intel/compiler/brw_eu_compact.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/intel/compiler/brw_eu_compact.c b/src/intel/compiler/brw_eu_compact.c
index a9da46957a5..d2edb5586c2 100644
--- a/src/intel/compiler/brw_eu_compact.c
+++ b/src/intel/compiler/brw_eu_compact.c
@@ -1486,7 +1486,7 @@ brw_init_compaction_tables(const struct gen_device_info *devinfo)
void
brw_compact_instructions(struct brw_codegen *p, int start_offset,
- int num_annotations, struct annotation *annotation)
+ struct disasm_info *disasm)
{
if (unlikely(INTEL_DEBUG & DEBUG_NO_COMPACTION))
return;
@@ -1501,7 +1501,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset,
/* For an instruction at byte offset 8*i after compaction, this was its IP
* (in 16-byte units) before compaction.
*/
- int old_ip[(p->next_insn_offset - start_offset) / sizeof(brw_compact_inst)];
+ int old_ip[(p->next_insn_offset - start_offset) / sizeof(brw_compact_inst) + 1];
if (devinfo->gen == 4 && !devinfo->is_g4x)
return;
@@ -1556,6 +1556,12 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset,
}
}
+ /* Add an entry for the ending offset of the program. This greatly
+ * simplifies the linked list walk at the end of the function.
+ */
+ old_ip[offset / sizeof(brw_compact_inst)] =
+ (p->next_insn_offset - start_offset) / sizeof(brw_inst);
+
/* Fix up control flow offsets. */
p->next_insn_offset = start_offset + offset;
for (offset = 0; offset < p->next_insn_offset - start_offset;
@@ -1651,21 +1657,21 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset,
}
p->nr_insn = p->next_insn_offset / sizeof(brw_inst);
- /* Update the instruction offsets for each annotation. */
- if (annotation) {
- for (int offset = 0, i = 0; i < num_annotations; i++) {
+ /* Update the instruction offsets for each group. */
+ if (disasm) {
+ int offset = 0;
+
+ foreach_list_typed(struct inst_group, group, link, &disasm->group_list) {
while (start_offset + old_ip[offset / sizeof(brw_compact_inst)] *
- sizeof(brw_inst) != annotation[i].offset) {
+ sizeof(brw_inst) != group->offset) {
assert(start_offset + old_ip[offset / sizeof(brw_compact_inst)] *
- sizeof(brw_inst) < annotation[i].offset);
+ sizeof(brw_inst) < group->offset);
offset = next_offset(devinfo, store, offset);
}
- annotation[i].offset = start_offset + offset;
+ group->offset = start_offset + offset;
offset = next_offset(devinfo, store, offset);
}
-
- annotation[num_annotations].offset = p->next_insn_offset;
}
}