From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29075 invoked by alias); 29 May 2008 18:37:39 -0000 Received: (qmail 29064 invoked by uid 22791); 29 May 2008 18:37:38 -0000 X-Spam-Check-By: sourceware.org Received: from rv-out-0708.google.com (HELO rv-out-0708.google.com) (209.85.198.240) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 29 May 2008 18:37:21 +0000 Received: by rv-out-0708.google.com with SMTP id c5so3762307rvf.56 for ; Thu, 29 May 2008 11:37:19 -0700 (PDT) Received: by 10.140.136.5 with SMTP id j5mr2396716rvd.27.1212086239467; Thu, 29 May 2008 11:37:19 -0700 (PDT) Received: by 10.140.173.7 with HTTP; Thu, 29 May 2008 11:37:19 -0700 (PDT) Message-ID: <84ccfe8c0805291137t4578b525xa4680f21ffeb064b@mail.gmail.com> Date: Thu, 29 May 2008 18:37:00 -0000 From: "Denis Chertykov" To: hutchinsonandy@aim.com Subject: Re: Help with reload and naked constant sum causing ICE Cc: law@redhat.com, gcc@gcc.gnu.org, rdsandiford@googlemail.com In-Reply-To: <8CA8FA40260210A-1024-2C04@WEBMAIL-MA19.sysops.aol.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <483AD976.8020108@aim.com> <87wslf2x24.fsf@firetop.home> <483CA17D.5040908@aim.com> <87bq2q1cg2.fsf@firetop.home> <483DC5D3.4060409@redhat.com> <84ccfe8c0805290023j7a96d829yf59778ecf7d7011b@mail.gmail.com> <8CA8FA40260210A-1024-2C04@WEBMAIL-MA19.sysops.aol.com> X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg00437.txt.bz2 2008/5/29 : > Again thank you and Denis for your comment. > > Here is what I deduce from code and Denis comments - I am sure he (and > others) will correct me if wrong :-) > > > The main issue is that we have one pointer register that cannot take offset > and two base pointers with limited offset (0-63). Yes. Oops I'm sorry. I wrote -63 to +63 in my last mail it's wrong. The right offset 0 to 63. > > Reload provides no means to pick the right pointer register. To do so would > require a "preffered base pointer" mechanism. Yes. > > AVR L_R_A sole purpose is substituting POINTER class where there are > oppertunities to do so. > > BUT as L_R_A is in middle of find_reloads_address, we have a problem in > that some normal reload solutions have already been applied and some have > not. Yes. > This may mean that 1) We never get here - so miss POINTER oppertunity or 2) > Miss even better solutions that are applied latter. > 3)Have code vulnerable to reload changes. Yes. > I have added comment below to explain the parts. > I'll probably need to add some debug hooks to check what parts still > contribute. > > best regards > > Andy > > > > #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) > \ > do { \ > if (1&&(GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC)) \ > { \ > push_reload (XEXP (X,0), XEXP (X,0), &XEXP (X,0), &XEXP (X,0), \ > POINTER_REGS, GET_MODE (X),GET_MODE (X) , 0, 0, \ > OPNUM, RELOAD_OTHER); \ > goto WIN; \ > } \ > > > The intent is to use POINTER class registers for INC/DEC so we have one more > register available than BASE_POINTER > > Has INC/DEC been handled already making this part redundant? > Are there any other solutions that this code skips? Really, I forgot why this part of L_R_A exists. Look at strange 'if (1&&'. I remember that once I have disabled it (add 0&&), but after some testing I have enablet it again. > if (GET_CODE (X) == PLUS \ > && REG_P (XEXP (X, 0)) \ > && GET_CODE (XEXP (X, 1)) == CONST_INT \ > && INTVAL (XEXP (X, 1)) >= 1) \ > { \ > int fit = INTVAL (XEXP (X, 1)) <= (64 - GET_MODE_SIZE (MODE)); \ > if (fit) \ > { \ > if (reg_equiv_address[REGNO (XEXP (X, 0))] != 0) \ > { \ > int regno = REGNO (XEXP (X, 0)); \ > rtx mem = make_memloc (X, regno); \ > push_reload (XEXP (mem,0), NULL, &XEXP (mem,0), NULL, \ > POINTER_REGS, Pmode, VOIDmode, 0, 0, \ > 1, ADDR_TYPE (TYPE)); \ > push_reload (mem, NULL_RTX, &XEXP (X, 0), NULL, \ > BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \ > OPNUM, TYPE); \ > goto WIN; \ > } > > Im struggling with this part. however, the POINTER class is an advantageous > in the first reloading the address from memory > - where we would not want to waste BASE POINTER and also create overlap > problem. Yes. > The implication of using this code is that without it we cannot catch the > inner reload POINTER oppertunity if we leave reload to decompose > BASE+offset. I think this is correct :-( > > > \ > push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \ > BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \ > OPNUM, TYPE); \ > goto WIN; > > This part is duplicating reload and should not be here (I have patch pending > with maintainer that removes this - for different bug) > > \ > } \ > else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \ > { \ > push_reload (X, NULL_RTX, &X, NULL, \ > POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \ > OPNUM, TYPE); \ > goto WIN; \ > } \ > } \ > > This case is where offset is out of range and we must reload not-the-frame_pointer. The frame_pointer can be handled by reload more optimal because we have Z register (Z+offset). > - so we allow POINTER class on the > basis that this is no worse than BASE POINTER. However, we leave > frame_pointer to reload. Because reload-pass can reload frame_pointer+big_offset because we have anower one pointer+offser register (Z+offset). Denis.