ptx preliminary address space fixes [1/4]

Richard Biener richard.guenther@gmail.com
Fri Sep 12 11:49:00 GMT 2014


On Fri, Sep 12, 2014 at 1:15 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 09/11/2014 01:29 PM, Richard Biener wrote:
>>
>> +  if (TREE_CODE (type) == ARRAY_TYPE)
>> +    TREE_TYPE (type) = apply_as_to_type (TREE_TYPE (type), as);
>>
>> why is this necessary for ARRAY_TYPE but not for sth like
>> a RECORD_TYPE or a POINTER_TYPE?
>
>
> Still testing whether I actually strictly need it for ARRAY_TYPE nowadays
> (these patches are really old...). However, the TYPE_FIELDS of a RECORD_TYPE
> seem to be mostly ignored once the frontends are done, but it's very easy
> for other parts of the compiler to take the TREE_TYPE of an ARRAY_TYPE.
> Fixing that up is simple and seems like a good thing to do for consistency
> (I notice that maybe I should add VECTOR_TYPE).

Well, for an access a->b the COMPONENT_REF specifies the type
of the reference which uses the type of the FIELD_DECL...  IVOPTs
for example may produce

 ptr *p = &a->b;
 *p;

from that with ptr * built from TREE_TYPE of that expression.

Btw, a similar type as VECTOR_TYPE is COMPLEX_TYPE.

> For a POINTER_TYPE, it is correct not to modify the pointed-to type. We want
> to express that a variable of that pointer type lives in an address space,
> not that the pointed-to type is different.
>
>> The name apply_as_to_type looks odd to me - other address-space
>> related functions use addr_space - can you change it to that please?
>
>
> Will change, and update the other patches accordingly.

Thanks,
Richard.

>
> Bernd
>



More information about the Gcc-patches mailing list