From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1490 invoked by alias); 10 Nov 2004 22:21:07 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 1389 invoked from network); 10 Nov 2004 22:20:56 -0000 Received: from unknown (HELO mail-in.hq.tensilica.com) (65.205.227.29) by sourceware.org with SMTP; 10 Nov 2004 22:20:56 -0000 Received: from egret.hq.tensilica.com (IDENT:O/drjG99SaUF3vGfbVPLhtn36UA0IYVL@egret.hq.tensilica.com [192.168.11.80]) by mail-in.hq.tensilica.com (8.11.6/8.9.3) with ESMTP id iAAMKqK15021 for ; Wed, 10 Nov 2004 14:20:52 -0800 Received: from tensilica.com (wintergreen.vpn.tensilica.com [172.16.12.1]) by egret.hq.tensilica.com (8.11.6/8.11.6) with ESMTP id iAAMKpw23518 for ; Wed, 10 Nov 2004 14:20:51 -0800 Message-ID: <4192941A.2040505@tensilica.com> Date: Wed, 10 Nov 2004 22:21:00 -0000 From: Bob Wilson Organization: Tensilica, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 MIME-Version: 1.0 To: binutils@sources.redhat.com Subject: fix Xtensa relaxation at ends of loops Content-Type: multipart/mixed; boundary="------------070202090608040005050208" X-SW-Source: 2004-11/txt/msg00178.txt.bz2 This is a multi-part message in MIME format. --------------070202090608040005050208 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 654 Apparently the Xtensa updates that I merged in recently included some new optimizations that are not always safe. This patch temporarily reverts the behavior of relaxations at the ends of loops to skip those optimizations. I plan to revisit this later. Tested by running the GAS testsuite with an xtensa-elf target. Committed on the mainline. --Bob 2004-11-10 Bob Wilson * config/tc-xtensa.c (update_next_frag_state): Always add a NOP if relaxing at the end of a loop. Don't mark frags as UNREACHABLE or MAYBE_UNREACHABLE. (relax_frag_immed): Update call to update_next_frag_state. --------------070202090608040005050208 Content-Type: text/plain; name="gas-loopend-relax.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gas-loopend-relax.patch" Content-length: 2481 Index: tc-xtensa.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v retrieving revision 1.15 diff -u -p -r1.15 tc-xtensa.c --- tc-xtensa.c 5 Nov 2004 17:25:34 -0000 1.15 +++ tc-xtensa.c 10 Nov 2004 21:04:01 -0000 @@ -4535,7 +4535,7 @@ next_frag_format_size (const fragS *frag switch its state so it will instantiate a NOP. */ static void -update_next_frag_state (fragS *fragP, bfd_boolean unreachable) +update_next_frag_state (fragS *fragP) { fragS *next_fragP = fragP->fr_next; fragS *new_target = NULL; @@ -4563,36 +4563,17 @@ update_next_frag_state (fragS *fragP, bf && (new_target->fr_subtype == RELAX_MAYBE_DESIRE_ALIGN || new_target->fr_subtype == RELAX_DESIRE_ALIGN)); } - if (unreachable) - { - if (align_targets) - { - next_fragP->fr_subtype = RELAX_UNREACHABLE; - next_fragP->tc_frag_data.is_unreachable = TRUE; - new_target->fr_subtype = RELAX_DESIRE_ALIGN; - new_target->tc_frag_data.is_branch_target = TRUE; - } - while (next_fragP && next_fragP->fr_fix == 0) - { - if (next_fragP->fr_type == rs_machine_dependent - && next_fragP->fr_subtype == RELAX_LOOP_END) - { - next_fragP->fr_subtype = RELAX_LOOP_END_ADD_NOP; - return; - } - next_fragP = next_fragP->fr_next; - } - } - else + while (next_fragP && next_fragP->fr_fix == 0) { - if (align_targets) + if (next_fragP->fr_type == rs_machine_dependent + && next_fragP->fr_subtype == RELAX_LOOP_END) { - next_fragP->fr_subtype = RELAX_MAYBE_UNREACHABLE; - next_fragP->tc_frag_data.is_unreachable = FALSE; - new_target->fr_subtype = RELAX_MAYBE_DESIRE_ALIGN; - new_target->tc_frag_data.is_branch_target = FALSE; + next_fragP->fr_subtype = RELAX_LOOP_END_ADD_NOP; + return; } + + next_fragP = next_fragP->fr_next; } } @@ -9115,13 +9096,8 @@ relax_frag_immed (segT segP, } } - /* FIXME: When a negatable branch expands and then contracts in a - subsequent pass, update_next_frag_state correctly updates the - type of the frag to RELAX_MAYBE_UNREACHABLE, but it doesn't undo - any expansion relax_frag_for_align may have expected it to. For - now, change back to only call it when the branch expands. */ if (negatable_branch && istack.ninsn > 1) - update_next_frag_state (fragP, FALSE /* istack.ninsn > 1 */); + update_next_frag_state (fragP); return this_text_diff; } --------------070202090608040005050208--