From patchwork Tue Jan 3 21:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 38658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4833450wrt; Tue, 3 Jan 2023 13:57:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXv0T/svPgF6Vta0DFbXgOI/GIZQdrVcfpJTNlXZohzm6nmRNOTT3uvcNbW8a4R+vFF/N1CL X-Received: by 2002:a17:906:5048:b0:7c0:b770:df94 with SMTP id e8-20020a170906504800b007c0b770df94mr39457854ejk.63.1672783070148; Tue, 03 Jan 2023 13:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672783070; cv=none; d=google.com; s=arc-20160816; b=k/hcsg4fTts4YFP0xQrVTFSX95kjMo5wzZUbeK81A+7CdVPadQ6U3nKWaHKFWDWtKl I8x5mU3NqDM2XKbNM3ufL2Z7tEjWSQ5FxsXk2bg0Bx7usBAMbtEIJm7ZCL7GgYegbkNm pP+j9pnFNMYqgqdZTmHCRowVOn1PXH4+vw6kptR6ZtE62ne+giGhzU8Tp316r00UfQTX qVzQJS5UXvqKOoMqb+AtQbBDx7KPIGfaMX9bPG238B7Sm2idZa5HWLZe3CATsr8DoJbb IfsYK3O59hgSXbxCk3UiC4ZXbRDl4ZEjQBWsa6gpi8py8+fIdSQYdtMGJK9kg1EVK6Fm I1Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:delivered-to:dkim-signature:dkim-filter; bh=xBk0ZJ+WZ/cbjKLGGD+yMtW79Msg7e8riN4klY/iGvA=; b=pVc1l5dZyWbmhdwXGj96qbd8OE8wAT12b/ksmAkP1gmzbg53VY15OUyQ+FOvhkgaeK YwdjkBhYNr+MNbWim4VNJeceYCVuT8Y5K/4jYCUFafRwNmOx2aQizUl10CzRpGz7hVug toSslf0HIMCAA36umMy7u1HZHpD4NDzqLuLPJEeX8E0OIXiaVSG1dIvfSCYXGalsKKdh +swE3EZTMQIw+LyKS9NoCN6pQDv6x81yXcey/+bLCAjyGoGsTqRqbpJGuaSpho4mOYjk RJhqhlVKIKWWKgSt/cN7yAx6huqj00TNIQmeeAAMKtNBhstHLU3/cUNHR9gcdIsVij+k gYMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="EswLwmh/"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id nb41-20020a1709071ca900b007be1d7d1c3csi28508766ejc.386.2023.01.03.13.57.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 13:57:50 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="EswLwmh/"; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25B5E3858C1F for ; Tue, 3 Jan 2023 21:57:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25B5E3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672783069; bh=xBk0ZJ+WZ/cbjKLGGD+yMtW79Msg7e8riN4klY/iGvA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=EswLwmh/fvnJSi9UsKTNYyfI6gOGGm95Xt4PVDy6lKFE+JDKA6Hi6OsuNkGVGwlRI 6YN9d/KyyFq4g4i7uanBcpsbqmARrAZND4Ca69yCFGnlhTg/V2TldpH1uxHpHd6YeY cceO95WNQAPLQ7fHFSe1QZktbU1Zqr7epsC3xhck= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 1370A3858D1E for ; Tue, 3 Jan 2023 21:57:40 +0000 (GMT) Received: by mail-pg1-x52a.google.com with SMTP id v3so21020344pgh.4 for ; Tue, 03 Jan 2023 13:57:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xBk0ZJ+WZ/cbjKLGGD+yMtW79Msg7e8riN4klY/iGvA=; b=qDPttfPm363o0TcW/841c/gt0rJ8Yot8eVkFVOSmLMa74JT8HRbUIoYYoWXjeZ+vOE 933phSqzoBSd12qHPixOHKrxLJW0QdYjQhsEkQ691VfrxyK6CDwbUYce849dq0a1Xpyd /fgFDBc/wforSll+hrWrKqxTnnKU/A9S15lXYw1aklyZIbCSSnkEMhMOfPUHJpjbS5b+ vvIgs6OTk0PxDsthRCHHH8mlzGzexQ60+5BFAa0dAjGa6UPnklmlJ4zEQ7jJTSqMj5ay OYff7vaCFYWBUIxUcqikh5Z0NCfgCpIEX7pSdcY0noB96Z3W3PoWlRhjYmUpzOLCiP16 1Azw== X-Gm-Message-State: AFqh2krY3OYbcWSjy2317c2dIJveKKiN7MXvIUVAerGt/sCtJLh3mJFO 8z0LbU/8E61/A3hwu0HSndTFpf/2kMg= X-Received: by 2002:a62:1dc1:0:b0:582:16a6:82d1 with SMTP id d184-20020a621dc1000000b0058216a682d1mr14664056pfd.30.1672783058939; Tue, 03 Jan 2023 13:57:38 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:7cd7:ac9c:cd02:f32d]) by smtp.gmail.com with ESMTPSA id e62-20020a621e41000000b005810c4286d6sm16427567pfe.0.2023.01.03.13.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 13:57:38 -0800 (PST) To: binutils@sourceware.org Cc: Max Filippov Subject: [COMMITTED] opcodes: xtensa: implement styled disassembly Date: Tue, 3 Jan 2023 13:57:22 -0800 Message-Id: <20230103215722.616744-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, 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 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-Patchwork-Original-From: Max Filippov via Binutils From: Max Filippov Reply-To: Max Filippov Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754040180533893995?= X-GMAIL-MSGID: =?utf-8?q?1754040180533893995?= opcodes/ * xtensa-dis.c (print_xtensa_operand) (print_insn_xtensa): Replace fprintf_func with fprintf_styled_func. --- opcodes/xtensa-dis.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c index 8a26fd7c1239..3631f7fad715 100644 --- a/opcodes/xtensa-dis.c +++ b/opcodes/xtensa-dis.c @@ -238,24 +238,28 @@ print_xtensa_operand (bfd_vma memaddr, else { if ((signed_operand_val > -256) && (signed_operand_val < 256)) - (*info->fprintf_func) (info->stream, "%d", signed_operand_val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "%d", signed_operand_val); else - (*info->fprintf_func) (info->stream, "0x%x", signed_operand_val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "0x%x", signed_operand_val); } } else { int i = 1; xtensa_regfile opnd_rf = xtensa_operand_regfile (isa, opc, opnd); - (*info->fprintf_func) (info->stream, "%s%u", - xtensa_regfile_shortname (isa, opnd_rf), - operand_val); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s%u", + xtensa_regfile_shortname (isa, opnd_rf), + operand_val); while (i < xtensa_operand_num_regs (isa, opc, opnd)) { operand_val++; - (*info->fprintf_func) (info->stream, ":%s%u", - xtensa_regfile_shortname (isa, opnd_rf), - operand_val); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + ":%s%u", + xtensa_regfile_shortname (isa, opnd_rf), + operand_val); i++; } } @@ -404,7 +408,13 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info) } else { - (*info->fprintf_func) (info->stream, ".byte %#02x", priv.byte_buf[0]); + (*info->fprintf_styled_func) (info->stream, + dis_style_assembler_directive, + ".byte"); + (*info->fprintf_func) (info->stream, "\t"); + (*info->fprintf_styled_func) (info->stream, + dis_style_immediate, + "%#02x", priv.byte_buf[0]); return 1; } } @@ -425,8 +435,9 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info) xtensa_format_get_slot (isa, fmt, n, insn_buffer, slot_buffer); opc = xtensa_opcode_decode (isa, fmt, n, slot_buffer); - (*info->fprintf_func) (info->stream, "%s", - xtensa_opcode_name (isa, opc)); + (*info->fprintf_styled_func) (info->stream, + dis_style_mnemonic, "%s", + xtensa_opcode_name (isa, opc)); if (xtensa_opcode_is_branch (isa, opc)) info->insn_type = dis_condbranch;