From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25592 invoked by alias); 10 Oct 2003 16:59:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25575 invoked from network); 10 Oct 2003 16:59:05 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 10 Oct 2003 16:59:05 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h9AGwxM31511 for ; Fri, 10 Oct 2003 12:58:59 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h9AGwwD32656 for ; Fri, 10 Oct 2003 12:58:58 -0400 Received: from cygbert.vinschen.de (vpn50-15.rdu.redhat.com [172.16.50.15]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h9AGwki21834 for ; Fri, 10 Oct 2003 09:58:47 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 2068A58047; Fri, 10 Oct 2003 18:58:45 +0200 (CEST) Date: Fri, 10 Oct 2003 16:59:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFA] sh-tdep.c (sh_use_struct_convention): Restructure and fix Message-ID: <20031010165845.GM14344@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <20031004113939.GK11435@cygbert.vinschen.de> <16261.53197.951881.194874@localhost.redhat.com> <20031010072929.GF14344@cygbert.vinschen.de> <20031010150127.GK14344@cygbert.vinschen.de> <16262.57775.717281.437954@localhost.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16262.57775.717281.437954@localhost.redhat.com> User-Agent: Mutt/1.4.1i X-SW-Source: 2003-10/txt/msg00361.txt.bz2 On Fri, Oct 10, 2003 at 12:43:27PM -0400, Elena Zannoni wrote: > Corinna Vinschen writes: > > static int > > sh_use_struct_convention (int gcc_p, struct type *type) > > { > > int len = TYPE_LENGTH (type); > > int nelem = TYPE_NFIELDS (type); > > > > /* Non-power of 2 length types and types bigger than 8 bytes (which don't > > fit in two registers anyway) use struct convention. */ > > if (len != 1 && len != 2 && len != 4 && len != 8) > > return 1; > > > > /* Scalar types and aggregate types with exactly one field are aligned > > by definition. They are returned in registers. */ > > if (nelem <= 1) > > return 0; > > > > /* If the first field in the aggregate has the same length as the entire > > aggregate type, the type is returned in registers. */ > > if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == len) > > return 0; > > > > /* If the size of the aggregate is 8 bytes and the first field is > > of size 4 bytes its alignment is equal to long long's alignment, > > so it's returned in registers. */ > > if (len == 8 && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4) > > return 0; > > > > /* Otherwise use struct convention. */ > > return 1; > > } > > Much better, however, I would still like to know what the behavior is > for a struct of 2 chars. Probably this needs another test case. A struct of two chars is returned in memory. That's correct. Corinna -- Corinna Vinschen Cygwin Developer Red Hat, Inc.