This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
`size_volatile' types (was: Time schedule?)
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: `size_volatile' types (was: Time schedule?)
- From: Peter Gerwinski <peter at gerwinski dot de>
- Date: Mon, 25 Oct 1999 05:47:05 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <9910242333.AA06380@vlsi1.ultra.nyu.edu>
Richard Kenner wrote:
>
> Ada has arrays that contains both bounds and data. The bounds are
> both the lower and upper bounds. So if you want to compute A(I), you
> need to subtract the lower bound of A. You get that by looking
> A.BOUNDS.LB0. So TYPE_MIN_VALUE of the the index type contains an
> expression that is a function of a COMPONENT_REF whose operand first
> operand is PLACEHOLDER_EXPR of the same type as A.
I think I got the picture. :)
Pascal has (arbitrary) "schema" types with one or more free
parameters, the "discriminants". For instance:
Type
Foo ( n: Integer ) = x: array [ 1..n ] of Integer;
(This can also be a record, a subrange, a set, or whatever, and
the `n' can appear anywhere in the type definition.)
Internally, a `Foo' variable is stored as a record (struct)
containing `n' and the array.
A pointer to such a type does not need to be discriminated:
Var
A: ^Foo; (* A points to a Foo; A^ is the value pointed to *)
Now we have:
TYPE_SIZE ( TREE_TYPE ( A^ ) )
= TYPE_SIZE ( TREE_TYPE ( A^.n ) ) + A^.n * TYPE_SIZE ( Integer )
In order to use PLACEHOLDER_EXPRs, I think that I will have to
replace each `A^.n' in the RHS with a PLACEHOLDER_EXPR. But
where do I have to fill in the `A^' which must finally replace
it? The backend cannot do everything alone; it must at least
know that it's a field `n' in the record in question.
Thanks,
Peter