From: Max Filippov <jcmvbkbc@gmail.com>
To: binutils@sourceware.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Subject: [COMMITTED] opcodes: xtensa: fix jump visualization for FLIX
Date: Tue, 3 Jan 2023 13:57:46 -0800 [thread overview]
Message-ID: <20230103215746.616794-1-jcmvbkbc@gmail.com> (raw)
opcodes/
* xtensa-dis.c (print_insn_xtensa): Add local variables
insn_type, target and imm_pcrel to track control flow across
multiple slots.
---
opcodes/xtensa-dis.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c
index 3631f7fad715..8017ec2ea8bc 100644
--- a/opcodes/xtensa-dis.c
+++ b/opcodes/xtensa-dis.c
@@ -283,6 +283,8 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
static xtensa_insnbuf slot_buffer = NULL;
int first, first_slot, valid_insn;
property_table_entry *insn_block;
+ enum dis_insn_type insn_type;
+ bfd_vma target;
if (!xtensa_default_isa)
xtensa_default_isa = xtensa_isa_init (0, 0);
@@ -422,12 +424,13 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
if (nslots > 1)
(*info->fprintf_func) (info->stream, "{ ");
- info->insn_type = dis_nonbranch;
- info->insn_info_valid = 1;
-
+ insn_type = dis_nonbranch;
+ target = 0;
first_slot = 1;
for (n = 0; n < nslots; n++)
{
+ int imm_pcrel = 0;
+
if (first_slot)
first_slot = 0;
else
@@ -445,6 +448,8 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
info->insn_type = dis_branch;
else if (xtensa_opcode_is_call (isa, opc))
info->insn_type = dis_jsr;
+ else
+ info->insn_type = dis_nonbranch;
/* Print the operands (if any). */
noperands = xtensa_opcode_num_operands (isa, opc);
@@ -464,8 +469,20 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
slot_buffer, &operand_val);
print_xtensa_operand (memaddr, info, opc, i, operand_val);
+ if (xtensa_operand_is_PCrelative (isa, opc, i))
+ ++imm_pcrel;
+ }
+ if (!imm_pcrel)
+ info->insn_type = dis_nonbranch;
+ if (info->insn_type != dis_nonbranch)
+ {
+ insn_type = info->insn_type;
+ target = info->target;
}
}
+ info->insn_type = insn_type;
+ info->target = target;
+ info->insn_info_valid = 1;
if (nslots > 1)
(*info->fprintf_func) (info->stream, " }");
--
2.30.2
reply other threads:[~2023-01-03 21:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230103215746.616794-1-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).