From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5P441nwVTwNwFK5s8grLT+o2+CihELX0QVxUp5jEU9w=; b=Mbj0MiTRcoykwQ7SfToZ0d46MwyV0ipmsB/IJLfdztzeV47WArJzswZAqLFK1MbmKL dCMXeYPod+6NyX2pcYAkhbV6OMaR8p36esMZpQCHKi2of63YVDPxR0DJ7rXht9k4aTnJ UM2DTgtnRdWzXCpPrqZLdTWe2KhfTjHzNt0kJ1+4bat9PrNYGtW7mXYMz/yhE/1Fcgnb DCuwer/bbcF2Wp4HOPmL1gjwAh7NXqec62Ur1Ig/JWyZ9dcK4Rz6WbRmOEnMgCV9NfNZ IcS8PVd/CnWiOQ7/MsKaKguZIpFhdP3V9daxgMEDcEAopDk3w/6ub8HO9m8ZdipJdXT5 oDig== 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-Google-Smtp-Source: AMrXdXv+/v+tHmq14TY1DtNxwaZhpUesgYuBo4MKkHTBW3u1eXu3ffu8gg584wmHxy6vwAT760njPA== 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) From: Max Filippov 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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, " }"); -- 2.30.2