i965: Rewrite disassembly annotation code

The old code used an array to store each "instruction group" (the new,
better name than the old overloaded "annotation"), and required a
memmove() to shift elements over in the array when we needed to split a
group so that we could add an error message. This was confusing and
difficult to get right, not the least of which was  because the array
has a tail sentinel not included in .ann_count.

Instead use a linked list, a data structure made for efficient
insertion.

Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Matt Turner
2017-11-15 17:08:42 -08:00
parent f80e97346b
commit 4f82b17287
11 changed files with 174 additions and 171 deletions

View File

@@ -1258,7 +1258,7 @@ special_requirements_for_handling_double_precision_data_types(
bool
brw_validate_instructions(const struct gen_device_info *devinfo,
const void *assembly, int start_offset, int end_offset,
struct annotation_info *annotation)
struct disasm_info *disasm)
{
bool valid = true;
@@ -1286,8 +1286,8 @@ brw_validate_instructions(const struct gen_device_info *devinfo,
CHECK(special_requirements_for_handling_double_precision_data_types);
}
if (error_msg.str && annotation) {
annotation_insert_error(annotation, src_offset, error_msg.str);
if (error_msg.str && disasm) {
disasm_insert_error(disasm, src_offset, error_msg.str);
}
valid = valid && error_msg.len == 0;
free(error_msg.str);