From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85071 invoked by alias); 19 May 2016 13:10:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 84978 invoked by uid 89); 19 May 2016 13:10:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1520 X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 19 May 2016 13:10:29 +0000 Received: from HNOCHT01.corp.atmel.com (10.161.30.161) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Thu, 19 May 2016 15:10:20 +0200 Received: from jaguar.atmel.com (10.161.30.18) by HNOCHT01.corp.atmel.com (10.161.30.161) with Microsoft SMTP Server (TLS) id 14.3.235.1; Thu, 19 May 2016 15:10:24 +0200 References: <87posq2dp1.fsf@atmel.com> User-agent: mu4e 0.9.17; emacs 24.5.1 From: Senthil Kumar Selvaraj To: , Denis Chertykov , "Eric Botcazou" CC: Sebastian Huber Subject: Re: [Patch, avr] Include INCOMING_FRAME_SP_OFFSET when printing stack usage In-Reply-To: <87posq2dp1.fsf@atmel.com> Date: Thu, 19 May 2016 13:10:00 -0000 Message-ID: <874m9u2ny7.fsf@atmel.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg01488.txt.bz2 Ping! Regards Senthil Senthil Kumar Selvaraj writes: > Hi, > > This trivial patch adds INCOMING_FRAME_SP_OFFSET to > current_function_static_stack_size, thus fixing the 2 (or 3, for > 3 byte PC devices) byte difference between reported and actual > values when using -fstack-usage. > > The patch came about because of this discussion > (https://gcc.gnu.org/ml/gcc/2016-05/msg00107.html). For AVRs, the > return address gets pushed into the stack as part of the call > instruction, and the number of bytes pushed varies by PC width. > This is already taken care of when defining INCOMING_FRAME_SP_OFFSET, > so I just add it to the previously computed value when setting > current_function_static_stack_size. > > If this is ok, could someone commit please? I don't have commit > access. > > Regards > Senthil > > gcc/ChangeLog > > 2016-05-13 Senthil Kumar Selvaraj > > * config/avr/avr.c (avr_expand_prologue): Add INCOMING_FRAME_SP_OFFSET > to computed stack_usage. > > > diff --git gcc/config/avr/avr.c gcc/config/avr/avr.c > index 8de39e0..ba5cd91 100644 > --- gcc/config/avr/avr.c > +++ gcc/config/avr/avr.c > @@ -1484,7 +1484,7 @@ avr_expand_prologue (void) > avr_prologue_setup_frame (size, set); > > if (flag_stack_usage_info) > - current_function_static_stack_size = cfun->machine->stack_usage; > + current_function_static_stack_size = cfun->machine->stack_usage + INCOMING_FRAME_SP_OFFSET; > } > >