From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32552 invoked by alias); 24 Apr 2003 17:32:29 -0000 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 Received: (qmail 32531 invoked from network); 24 Apr 2003 17:32:28 -0000 Received: from unknown (HELO egil.codesourcery.com) (66.92.14.122) by sources.redhat.com with SMTP; 24 Apr 2003 17:32:28 -0000 Received: from zack by egil.codesourcery.com with local (Exim 3.36 #1 (Debian)) id 198kZy-0001z9-00; Thu, 24 Apr 2003 10:32:14 -0700 To: Jason Merrill Cc: Geert Bosch , Alexandre Oliva , kenner@vlsi1.ultra.nyu.edu (Richard Kenner), gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org, Jakub Jelinek , Richard Henderson Subject: Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT From: Zack Weinberg Date: Thu, 24 Apr 2003 18:04:00 -0000 In-Reply-To: (Jason Merrill's message of "Thu, 24 Apr 2003 18:16:28 +0100") Message-ID: <87d6jbkdi9.fsf@egil.codesourcery.com> User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) References: <386D9560-7618-11D7-8766-00039344BF4A@gnat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-04/txt/msg01241.txt.bz2 Jason Merrill writes: > 1) For types, we want to be able to force a minimum alignment for > efficiency/correctness of access. > 2) For fields, we want to be able to force a minimum alignment. > 3) For fields, we want to be able to reduce alignment for packing efficiency. > 4) For objects, we want to be able to force a minimum alignment. > 5) For objects, we want to be able to force an exact alignment for building > up special sections (and for other reasons?). > > Anything else? > > 1 is handled by TYPE_ALIGN/TYPE_USER_ALIGN. > 2 and 4/5 are handled by DECL_ALIGN/DECL_USER_ALIGN. > 3 is handled by DECL_PACKED. I'm leery of bringing DECL_PACKED into this -- the "packed" concept has never really been nailed down as far as I know, and I worry that it might bring in a whole 'nother set of conflicting assumptions from the user community of __attribute__ ((packed)). My suggestion would be that we rip out all the existing ALIGN stuff in favor of two TYPE fields and two DECL fields named TYPE_MIN_ALIGN, TYPE_MAX_ALIGN, DECL_MIN_ALIGN, and DECL_MAX_ALIGN. The semantics are that *_MIN_ALIGN is the minimum alignment to enforce for a type or object, and *_MAX_ALIGN is the maximum alignment that can be assumed for a type or object. Then the front end gets to define whatever rules it likes for setting these fields and inheriting them from types to decls. Note that, unless I'm even more confused than I think, normally *_MIN_ALIGN >= *_MAX_ALIGN; possibly we want to give them different names. I think this covers all the cases but I could be wrong. zw