From patchwork Tue Jan 3 21:57:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 38659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4833738wrt; Tue, 3 Jan 2023 13:58:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXtSh0E8geQHCTPMEdgM4ck/0iX5D8SsFNvz97W1mr1MBBSpYDGw/pITAaKBVKdjxFyzKvWB X-Received: by 2002:a17:906:308b:b0:7ae:cda1:76d0 with SMTP id 11-20020a170906308b00b007aecda176d0mr37518835ejv.15.1672783129002; Tue, 03 Jan 2023 13:58:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672783128; cv=none; d=google.com; s=arc-20160816; b=Ua7WCXNJZPZfEhcFnfgvLjYGx4jwxrUdXC1HWf7nw5ttQ7sgjAYHHxIkAC5wvxoUk6 njtQiDV7sb5AbJGEYFsOBauAK0br/pAN5W15xz9yijqJXKnESlS8sJWQcsmXBEfyezhY Yll32hEvVMvl2x8VdAUctndaTxCC9hBwD5F+daryM65vY9gvC7wkRUY58LS+WvkwK0S1 80iUnXDZ2n74wlJHGQsdrQAOYY3+bUgF6oZZ84paSnsREjF12SL5Xss+fuVAi07DWGQU //JBLDWT+9PWn3+y9rYqDbSOrwHZnlkIEeSQbFRW/W5imFNebKLU2L5iD7gVy7s4AELO Argg== 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=5P441nwVTwNwFK5s8grLT+o2+CihELX0QVxUp5jEU9w=; b=p2wSq2F604Km5rhYAseNGAfKtaX4ctQWt/gqcod/Vj+XRiL2rUb00i3gduH3s6pItU eQz/rBFSofkDlkICSnWn/1/qNuMiTH6ULwk1nuLCJ/OQVHZGDLT3jWQtWj98BQ8ma8ls Ue3Z3pLAk1vmL71Ss3tjUUkIJ+AxMJFnIeJUYn3CD09mwCwMiNl8bhSSspJw0rI0lBy6 L2lSis+Y0ZCvNqmgrgrTLSdHoL7vjfLT9HnU2VVwIo/HBz7zX3jCGJpjA/jOO6fiX0Vb u7mn7UaHoF5EbcnfWlOjuITFyQbrw4FM9amTuZ8Ns0g0sadIvjMQMteV9wLsWADzMJLK mYPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=nutvgUxG; 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 hb39-20020a170907162700b007f38bd15f62si30096444ejc.551.2023.01.03.13.58.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 13:58:48 -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=nutvgUxG; 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 CCF443858C78 for ; Tue, 3 Jan 2023 21:58:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCF443858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672783127; bh=5P441nwVTwNwFK5s8grLT+o2+CihELX0QVxUp5jEU9w=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=nutvgUxG8ir3zaZ0ZYuTQBmZHMZnGyitYZyrgqYgOGHR4bK6TaYs3Rc95lP2J0zkr eJltA1QBuNXbfXgk2TMKWYUP71yxCmHbzXsV0QswJ5xNVmNNuB6RWMOf2LcJvHyeI7 iMUnBb24jAviTRyFbJlNg6ZeQ8THjT1WwuIlqtrw= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id EBE543858C60 for ; Tue, 3 Jan 2023 21:57:58 +0000 (GMT) Received: by mail-pj1-x102d.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso37216691pjt.0 for ; Tue, 03 Jan 2023 13:57:58 -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=5P441nwVTwNwFK5s8grLT+o2+CihELX0QVxUp5jEU9w=; b=3J2Nr87NDLZevxqQ3W6/3L8CyXUxv3jEX4gSAlbsrlh4H8sE8A1Z6zZ3kYFUbj6fEw uJhctPc2oT5ObfKoHTuBOb8XdEdApRCx5dGkUfJB9h/G6ACH5MiTcPQTndwGYbSXihi4 zzsLg3rz+nTzdDM0FIteYuCyX/0sTzBs+YTAExZYyYuxEldRZZFEvTYMnoEnHqATOw2g Wg8RDSl/0ss4yLBYn7lzbefNfa4qQbPt4A27+4HpdvAs/t6/c5IzPyxy2ojaJfaOBC8W kTGEZ7x9Nm1H8iGyWlCR2CYo1iMHmKbiPTD11LwnL67OAawx5ZHIDULBNoB1O5TkrX3Z SGQw== X-Gm-Message-State: AFqh2ko6R0S7Zg8PLMtf45AejffOvkFyrDJwrhXJtzNpuNVWGDN3z5TF hlgqH7cj6a+wU4PZyLUUAhKdq1SOKU0= X-Received: by 2002:a17:902:a607:b0:192:c125:ac2f with SMTP id u7-20020a170902a60700b00192c125ac2fmr11249323plq.8.1672783077798; Tue, 03 Jan 2023 13:57:57 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:7cd7:ac9c:cd02:f32d]) by smtp.gmail.com with ESMTPSA id y5-20020a17090322c500b00192a3e13b39sm11123124plg.264.2023.01.03.13.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 13:57:57 -0800 (PST) To: binutils@sourceware.org Cc: Max Filippov Subject: [COMMITTED] opcodes: xtensa: fix jump visualization for FLIX Date: Tue, 3 Jan 2023 13:57:46 -0800 Message-Id: <20230103215746.616794-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?1754040242002432343?= X-GMAIL-MSGID: =?utf-8?q?1754040242002432343?= 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, " }");