* [binutils-gdb] RISC-V: Print comma and tabs as the "text" style
@ 2022-10-06 3:35 Tsukasa OI
0 siblings, 0 replies; only message in thread
From: Tsukasa OI @ 2022-10-06 3:35 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f3a8023579897b27442654d7819bcc00726c352f
commit f3a8023579897b27442654d7819bcc00726c352f
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date: Tue Aug 2 17:51:44 2022 +0900
RISC-V: Print comma and tabs as the "text" style
On the RISC-V disassembler, some separators have non-text style when
printed with another word with another style.
This commit splits those, making sure that those comma and tabs are printed
with the "text" style.
opcodes/ChangeLog:
* riscv-dis.c (print_insn_args): Split and print the comma as
text. (riscv_disassemble_insn): Split and print tabs as text.
(riscv_disassemble_data): Likewise.
Diff:
---
opcodes/riscv-dis.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index bbeee3feda1..50e634ebfda 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -382,9 +382,12 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
(int)EXTRACT_RVV_OFFSET (l));
break;
case 'm':
- if (! EXTRACT_OPERAND (VMASK, l))
- print (info->stream, dis_style_register, ",%s",
- riscv_vecm_names_numeric[0]);
+ if (!EXTRACT_OPERAND (VMASK, l))
+ {
+ print (info->stream, dis_style_text, ",");
+ print (info->stream, dis_style_register, "%s",
+ riscv_vecm_names_numeric[0]);
+ }
break;
}
break;
@@ -766,7 +769,8 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info)
case 4:
case 8:
(*info->fprintf_styled_func)
- (info->stream, dis_style_assembler_directive, ".%dbyte\t", insnlen);
+ (info->stream, dis_style_assembler_directive, ".%dbyte", insnlen);
+ (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t");
(*info->fprintf_styled_func) (info->stream, dis_style_immediate,
"0x%llx", (unsigned long long) word);
break;
@@ -774,7 +778,8 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info)
{
int i;
(*info->fprintf_styled_func)
- (info->stream, dis_style_assembler_directive, ".byte\t");
+ (info->stream, dis_style_assembler_directive, ".byte");
+ (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t");
for (i = 0; i < insnlen; ++i)
{
if (i > 0)
@@ -962,21 +967,24 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED,
case 1:
info->bytes_per_line = 6;
(*info->fprintf_styled_func)
- (info->stream, dis_style_assembler_directive, ".byte\t");
- (*info->fprintf_styled_func)
- (info->stream, dis_style_immediate, "0x%02x", (unsigned) data);
+ (info->stream, dis_style_assembler_directive, ".byte");
+ (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t");
+ (*info->fprintf_styled_func) (info->stream, dis_style_immediate,
+ "0x%02x", (unsigned)data);
break;
case 2:
info->bytes_per_line = 8;
(*info->fprintf_styled_func)
- (info->stream, dis_style_assembler_directive, ".short\t");
+ (info->stream, dis_style_assembler_directive, ".short");
+ (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t");
(*info->fprintf_styled_func)
(info->stream, dis_style_immediate, "0x%04x", (unsigned) data);
break;
case 4:
info->bytes_per_line = 8;
(*info->fprintf_styled_func)
- (info->stream, dis_style_assembler_directive, ".word\t");
+ (info->stream, dis_style_assembler_directive, ".word");
+ (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t");
(*info->fprintf_styled_func)
(info->stream, dis_style_immediate, "0x%08lx",
(unsigned long) data);
@@ -984,7 +992,8 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED,
case 8:
info->bytes_per_line = 8;
(*info->fprintf_styled_func)
- (info->stream, dis_style_assembler_directive, ".dword\t");
+ (info->stream, dis_style_assembler_directive, ".dword");
+ (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t");
(*info->fprintf_styled_func)
(info->stream, dis_style_immediate, "0x%016llx",
(unsigned long long) data);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-06 3:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 3:35 [binutils-gdb] RISC-V: Print comma and tabs as the "text" style Tsukasa OI
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).