radv: Handle repeated instructions when splitting disassembly
cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30734>
This commit is contained in:
@@ -241,11 +241,30 @@ radv_add_split_disasm(const char *disasm, uint64_t start_addr, unsigned *num, st
|
||||
{
|
||||
struct radv_shader_inst *last_inst = *num ? &instructions[*num - 1] : NULL;
|
||||
char *next;
|
||||
char *repeat = strstr(disasm, "then repeated");
|
||||
|
||||
while ((next = strchr(disasm, '\n'))) {
|
||||
struct radv_shader_inst *inst = &instructions[*num];
|
||||
unsigned len = next - disasm;
|
||||
|
||||
if (repeat >= disasm && repeat < next) {
|
||||
uint32_t repeat_count;
|
||||
sscanf(repeat, "then repeated %u times", &repeat_count);
|
||||
|
||||
for (uint32_t i = 0; i < repeat_count; i++) {
|
||||
inst = &instructions[*num];
|
||||
memcpy(inst, last_inst, sizeof(struct radv_shader_inst));
|
||||
inst->offset = last_inst->offset + last_inst->size * (i + 1);
|
||||
(*num)++;
|
||||
}
|
||||
|
||||
last_inst = inst;
|
||||
|
||||
disasm = next + 1;
|
||||
repeat = strstr(disasm, "then repeated");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!memchr(disasm, ';', len)) {
|
||||
/* Ignore everything that is not an instruction. */
|
||||
disasm = next + 1;
|
||||
|
||||
Reference in New Issue
Block a user