From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 070693858D1E for ; Wed, 10 Aug 2022 11:20:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 070693858D1E Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-648-kx2PsinKPR2kWJgIJq7AeA-1; Wed, 10 Aug 2022 07:20:30 -0400 X-MC-Unique: kx2PsinKPR2kWJgIJq7AeA-1 Received: by mail-wm1-f72.google.com with SMTP id j36-20020a05600c1c2400b003a540d88677so3721452wms.1 for ; Wed, 10 Aug 2022 04:20:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=OnbjDwFtCH6FhEXrB7A5YrJm9S7hh3eV1gtDuoLt6bM=; b=iV8Jc6NT+qO6E1+o0xhAYbHDqe3Usfk+gwuOJSZLerpVJq2u3kVdfQXSKPMJ59dUdS 75XuDNRrm7qaoQLSA034BPKrJRztRQdysntjFufKBo82GqDIaZh/GEXXm3KEJ5SBFzkb tK82AXULwL9WRUaaMIRs9YHUuPC2/hgqXiF4Nng9aC1i5iEn4X9cAcG6FEs04ttH9Foa MUMo9k/9/pNc8USyajD5YYGnEr84kYL4IZ3M/q2nqB9DjVsqinqRGNcM9AYNmKJE32BB 6GKUSpZtrR5sf3p2ZuE8yyutbQUVm1ps2QHwMjE+EfgcofzK+Q5KCceNlzVL7CQfsdtM BJuA== X-Gm-Message-State: ACgBeo3JQttsRZNiHgaIr+vsU/zYTcjhDigtqFAFJtM1VAqL2eBBb/1c AIVwoL4r40WF6lLNQrjSEuXCWDRXXnZMKMkZJIUTdT7Kd/lCqJnAE3be9+Z5MyrYT4Ex76r+IH7 OsY6p2dVAC6EIYMyy5XGcfert/qwu9u92TMySvHimmaY/3A+MWJ4x8dS4JPn9m0wKe3zBoA== X-Received: by 2002:a05:600c:4e01:b0:3a3:342:5f55 with SMTP id b1-20020a05600c4e0100b003a303425f55mr2148555wmq.150.1660130429257; Wed, 10 Aug 2022 04:20:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Aptwy8pmVQb+pepOWAqMWzMP2tPVCxPlJqztKISB2MUPt7n3wb2sksyJsXjZeg4WFlFtnUg== X-Received: by 2002:a05:600c:4e01:b0:3a3:342:5f55 with SMTP id b1-20020a05600c4e0100b003a303425f55mr2148539wmq.150.1660130429011; Wed, 10 Aug 2022 04:20:29 -0700 (PDT) Received: from localhost (15.72.115.87.dyn.plus.net. [87.115.72.15]) by smtp.gmail.com with ESMTPSA id m11-20020a7bcb8b000000b003a550be861bsm1999624wmi.27.2022.08.10.04.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 04:20:28 -0700 (PDT) From: Andrew Burgess To: Tsukasa OI via Binutils , Tsukasa OI , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: Re: [PATCH 4/4] RISC-V: Print comma and tabs as the `text' style In-Reply-To: <13432197297737fb0f449ec6ef123cfdc0bff8a1.1659500861.git.research_trasio@irq.a4lg.com> References: <4919138bb21768d0cdc3a6da81dbbbd62cc96855.1657719581.git.research_trasio@irq.a4lg.com> <13432197297737fb0f449ec6ef123cfdc0bff8a1.1659500861.git.research_trasio@irq.a4lg.com> Date: Wed, 10 Aug 2022 12:20:27 +0100 Message-ID: <87y1vwz6o4.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2022 11:20:33 -0000 Tsukasa OI via Binutils writes: > 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. I'm not a binutils maintainer, so can't approve this patch. However, this looks good to me with one minor nit, see below... > --- > 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 fe18c18642e..460f77676d2 100644 > --- a/opcodes/riscv-dis.c > +++ b/opcodes/riscv-dis.c > @@ -373,9 +373,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; > @@ -709,7 +712,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; > @@ -717,7 +721,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) > @@ -905,21 +910,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); You lost the space in '(unsigned) data'. Thanks, Andrew > 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); > @@ -927,7 +935,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