This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: FUNCTION_BOUNDARY and FUNCTION_TYPE
- From: Geoff Keating <geoffk at geoffk dot org>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: gcc at gcc dot gnu dot org
- Date: 04 Mar 2004 21:48:03 -0800
- Subject: Re: FUNCTION_BOUNDARY and FUNCTION_TYPE
- References: <10403050335.AA22066@vlsi1.ultra.nyu.edu>
kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:
> We seem to use POINTER_SIZE*2 as the size for an object of
> FUNCTION_TYPE. This seems bizarre, but there really isn't a meaning
> for such a size. However, it seems clear that TYPE_ALIGN of such
> a type should be FUNCTION_BOUNDARY, but the existing code also
> sets it to POINTER_SIZE*2, which seems wrong.
>
> Is the following likely to be correct?
That looks plausible to me. Certainly it should be true that if 'x'
is a pointer to TYPE, and TYPE_ALIGN (TYPE) == y, then (int)x % y
should be 0.
> *** stor-layout.c 26 Feb 2004 23:41:34 -0000 1.178
> --- stor-layout.c 5 Mar 2004 03:29:47 -0000
> *************** layout_type (tree type)
> *** 1583,1589 ****
> case FUNCTION_TYPE:
> case METHOD_TYPE:
> ! TYPE_MODE (type) = mode_for_size (2 * POINTER_SIZE, MODE_INT, 0);
> ! TYPE_SIZE (type) = bitsize_int (2 * POINTER_SIZE);
> ! TYPE_SIZE_UNIT (type) = size_int ((2 * POINTER_SIZE) / BITS_PER_UNIT);
> break;
>
> --- 1583,1592 ----
> case FUNCTION_TYPE:
> case METHOD_TYPE:
> ! /* It's hard to see what the mode and size of a function ought to
> ! be, but we do know the alignment is FUNCTION_BOUNDARY, so
> ! make it consistent with that. */
> ! TYPE_MODE (type) = mode_for_size (FUNCTION_BOUNDARY, MODE_INT, 0);
> ! TYPE_SIZE (type) = bitsize_int (FUNCTION_BOUNDARY);
> ! TYPE_SIZE_UNIT (type) = size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
> break;
>
>
--
- Geoffrey Keating <geoffk@geoffk.org>