Skip to content

Commit e80512c

Browse files
committed
opcodes: xtensa: fix jump visualization for FLIX
opcodes/ * xtensa-dis.c (print_insn_xtensa): Add local variables insn_type, target and imm_pcrel to track control flow across multiple slots.
1 parent 3908658 commit e80512c

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

opcodes/xtensa-dis.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
283283
static xtensa_insnbuf slot_buffer = NULL;
284284
int first, first_slot, valid_insn;
285285
property_table_entry *insn_block;
286+
enum dis_insn_type insn_type;
287+
bfd_vma target;
286288

287289
if (!xtensa_default_isa)
288290
xtensa_default_isa = xtensa_isa_init (0, 0);
@@ -422,12 +424,13 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
422424
if (nslots > 1)
423425
(*info->fprintf_func) (info->stream, "{ ");
424426

425-
info->insn_type = dis_nonbranch;
426-
info->insn_info_valid = 1;
427-
427+
insn_type = dis_nonbranch;
428+
target = 0;
428429
first_slot = 1;
429430
for (n = 0; n < nslots; n++)
430431
{
432+
int imm_pcrel = 0;
433+
431434
if (first_slot)
432435
first_slot = 0;
433436
else
@@ -445,6 +448,8 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
445448
info->insn_type = dis_branch;
446449
else if (xtensa_opcode_is_call (isa, opc))
447450
info->insn_type = dis_jsr;
451+
else
452+
info->insn_type = dis_nonbranch;
448453

449454
/* Print the operands (if any). */
450455
noperands = xtensa_opcode_num_operands (isa, opc);
@@ -464,8 +469,20 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
464469
slot_buffer, &operand_val);
465470

466471
print_xtensa_operand (memaddr, info, opc, i, operand_val);
472+
if (xtensa_operand_is_PCrelative (isa, opc, i))
473+
++imm_pcrel;
474+
}
475+
if (!imm_pcrel)
476+
info->insn_type = dis_nonbranch;
477+
if (info->insn_type != dis_nonbranch)
478+
{
479+
insn_type = info->insn_type;
480+
target = info->target;
467481
}
468482
}
483+
info->insn_type = insn_type;
484+
info->target = target;
485+
info->insn_info_valid = 1;
469486

470487
if (nslots > 1)
471488
(*info->fprintf_func) (info->stream, " }");

0 commit comments

Comments
 (0)