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]
Other format: [Raw text]

Re: [PATCH][RFC] Re-structure tree_ssa_useless_type_conversion_1 to work towards a middle-end type system


>   /* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
> !    useless type conversion, otherwise return false.
> !    This function implicitly defines the middle-end type system.  The
> !    following invariants shall be fulfilled:
> !
> !      1) tree_ssa_useless_type_conversion_1 is transitive.  If
> ! 	a < b and b < c then a < c.
> !
> !      2) tree_ssa_useless_type_conversion_1 is not communtative.
> ! 	From a < b does not follow a > b.
> !
> !      3) Conversions are useless only if with the resulting type
> ! 	can be used in a subset of the operations the original type
> ! 	can be applied to.  For example casts to void* are useless,
> ! 	casts from void* not.  Casts to const T* are useless, casts
> ! 	from const T* to T* not.

My understanding is that it's a relation, not an operation, so the proper term 
for 2 would be "symmetric".  For the sake of completeness, you could also add 
that it's reflexive: a < a holds.

Which would suggest to find a better symbol than '<' for it. :-)

-- 
Eric Botcazou


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