From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12462 invoked by alias); 13 Feb 2006 19:07:08 -0000 Received: (qmail 12318 invoked by uid 22791); 13 Feb 2006 19:07:07 -0000 X-Spam-Check-By: sourceware.org Received: from mail.overta.ru (HELO overta.ru) (217.65.208.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 13 Feb 2006 19:07:05 +0000 Received: from [217.65.213.202] (HELO localhost) by overta.ru (CommuniGate Pro SMTP 4.2.9) with ESMTP id 33758162; Mon, 13 Feb 2006 22:07:01 +0300 To: Eric Christopher Cc: Denis Chertykov , gcc@gcc.gnu.org Subject: Re: CAN_ELIMINATE question References: <93106CFF-7969-45F5-B56B-70CFBBBEAD83@apple.com> From: Denis Chertykov Date: Mon, 13 Feb 2006 19:07:00 -0000 In-Reply-To: <93106CFF-7969-45F5-B56B-70CFBBBEAD83@apple.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg00216.txt.bz2 Eric Christopher writes: > On Feb 13, 2006, at 7:43 AM, Denis Chertykov wrote: > > > Hi All. > > > > While I have debugging AVR target bug I found that something wrong in > > port code or in reload. > > > > Is it right to use of get_frame_size() inside CAN_ELIMINATE macro > > valid ? > > If yes then reload have a bug. > > If no then AVR and probably MIPS ports have invalid definitions of > > CAN_ELIMINATE. > > Can you point to where you think reload is getting this wrong? Yes. Code fragment from reload1.c: reload() ---------------------------------------------------- if (caller_save_needed) setup_save_areas (); /* If we allocated another stack slot, redo elimination bookkeeping. */ if (starting_frame_size != get_frame_size ()) continue; if (caller_save_needed) { save_call_clobbered_regs (); /* That might have allocated new insn_chain structures. */ reload_firstobj = obstack_alloc (&reload_obstack, 0); } calculate_needs_all_insns (global); ---------------------------------------------------- Call to setup_save_areas () can change frame size but only offsets on eliminable registers will be changed before call to calculate_needs_all_insns. calculate_needs_all_insns will calculate wrong needs for elimination. Example for AVR: avr target can eliminate fp -> sp only if get_frame_size () == 0. Before call to setup_save_areas() frame size was 0 (CAN_ELIMINATE (FP,SP) != 0) setup_save_areas() increase frame size. set_initial_elim_offsets() correct offsets but can_eliminate isn't changed. save_call_clobbered_regs () emit save insn (insn 659 161 162 16 (set (mem/c:HI (plus:HI (reg/f:HI 28 r28) # it's FP (const_int 1 [0x1])) [29 S2 A8]) (reg:HI 24 r24)) 12 {*movhi} (nil) (nil)) calculate_needs_all_insns() try to eliminate (reg/f:HI 28 r28) to SP. It's wrong because get_frame_size () != 0 and CAN_ELIMINATE (FP,SP) == 0 I think that better to call update_eliminables() somewhere after setup_save_areas() Denis.