From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 5C23E3857355 for ; Mon, 26 Sep 2022 12:27:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C23E3857355 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 8FDDC300089; Mon, 26 Sep 2022 12:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1664195261; bh=ABHg0bE4EmR0PWRSPP1wvwOo6MTPejBaEIrcTdQq4pI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=IeoykPs5tWkQggZ+XVlCDEtvoEgZnv13k4FOeyNwvdyJegkXV/+0K5wfTnQX9xKPD zcFDgt+0ipF1QDpDc04zizJ2yJsDb1TXV/8lqNT6hb3d8CCiFWS87fQCXAH48nSn4+ OgVuwTucu4//dfw8B7CXMgjkNXRJ29/y3qeqio1U= From: Tsukasa OI To: Tsukasa OI , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH v2 4/6] RISC-V: Print comma and tabs as the "text" style Date: Mon, 26 Sep 2022 12:26:53 +0000 Message-Id: In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. --- 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 30cd90548a0..1c75317fad1 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; @@ -765,7 +768,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; @@ -773,7 +777,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) @@ -961,21 +966,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); @@ -983,7 +991,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); -- 2.34.1