This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: PATCH: named address space support (1/2: target-independent parts)


On Thu, Aug 21, 2008 at 6:04 AM, Ben Elliston <bje@au1.ibm.com> wrote:
> Hi Richard
>
> I've applied your suggestions, thanks.
>
>> There are several new functions in the patch without a comment.
>
> You don't say which ones, but I think I've got them all.
>
>>   BOOL_BITFIELD saturating_p : 1;
>> +  /* Whether the declaration is in another address space.  */
>> +  unsigned char address_space;
>>  };
>>
>> "Whether" looks incorrect.
>
> Fixed.
>
>> @@ -2279,6 +2296,8 @@ struct tree_type GTY(())
>>   unsigned user_align : 1;
>>
>>   unsigned int align;
>> +  unsigned char address_space;
>> +
>>   tree pointer_to;
>>   tree reference_to;
>>   union tree_type_symtab {
>>
>> please re-order fields to not increase the size of tree_type too much.
>> Move the alias_set member next to the align member and add the
>> address_space member before align to allow packing with the
>> bitfields if we ever decide to allocate more of them.
>
> Fixed.
>
>> @@ -146,6 +146,7 @@ typedef struct mem_attrs GTY(())
>>   rtx offset;                  /* Offset from start of DECL, as CONST_INT.  */
>>   rtx size;                    /* Size in bytes, as a CONST_INT.  */
>>   unsigned int align;          /* Alignment of MEM in bits.  */
>> +  unsigned char addrspace;     /* Address space (0 for generic).  */
>>  } mem_attrs;
>>
>> likewise, please move the align member next to the alias_set member
>> while you are at it.
>
> Fixed.
>
>> @@ -1211,7 +1217,9 @@ useless_type_conversion_p (tree outer_ty
>>      recursing though.  */
>>   if (POINTER_TYPE_P (inner_type)
>>       && POINTER_TYPE_P (outer_type)
>> -      && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
>> +      && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE
>> +      && GENERIC_ADDR_SPACE_POINTER_TYPE_P (inner_type)
>> +      && GENERIC_ADDR_SPACE_POINTER_TYPE_P (outer_type))
>>     return true;
>>
>> in other places you simply replaced POINTER_TYPE_P with
>> GENERIC_ADDR_SPACE_POINTER_TYPE_P - why is this not
>> correct here?
>
> Because previously, useless_type_conversion_p would eliminate casts
> between a void * and a pointer to any type.  Such casts cannot be
> eliminated when casting (for example) between a pointer in another
> address space and a void * in the generic address space, as some
> computation must be done to translate the address.  Yes, this is a
> special case as far as useless_type_conversion_p is concerned.
>
> Happy to leave this alone?

The point was that POINTER_TYPE_P (inner_type) &&
GENERIC_ADDR_SPACE_POINTER_TYPE_P (inner_type) looks like
a redundannt test and you should just test
GENERIC_ADDR_SPACE_POINTER_TYPE_P (inner_type) like you
did in other places?  I understand why you added those, but why
not just exchange the POINTER_TYPE_P tests?

Richard.


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