This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

`size_volatile' types (was: Time schedule?)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]