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][RFC] Step 1 to a middle-end type-system


On 6/22/07 5:46 AM, Richard Guenther wrote:

>   /* Return true if the conversion from INNER_TYPE to OUTER_TYPE is
> !    explicitly, otherwise return false.
> !    This function implicitly defines the middle-end type system.  The
> !    following invariants shall be fulfilled:

Need to specify what '<' and '>' mean in this context.

> !      3) Types define the available set of operations applicable to values.
> ! 	A type conversion is useless if the operations for the target type
> ! 	is a subset of the operations for the source type.  For example
> ! 	casts to void* are useless, casts from void* are not (void* can't
> ! 	be dereferenced or offsetted, but copied, hence its set of operations
> ! 	is a strict subset of that of all other data pointer types).  Casts
> ! 	to const T* are useless (can't be written to), casts from const T*
> ! 	to T* are not.

This is a bit confusing.  We are defining the GIMPLE type system in
terms of this predicate, but rule #3 seems to use front-end rules.  How
do we know in GIMPLE that "the target type is a subset of the operations
 for the source type"?  We have defined neither the types nor the valid
operations on types.


> ! 	return true;
> ! 
> !       /* Preserve booleaness.  Some code assumes an invariant that boolean

booleaness?

> + 
> +       /* Otherwise pointers/references are equivalent if their pointed
> + 	 to types are effectively the same.  This allows to strip conversions
> + 	 between pointer types with different type qualifiers.
> + 	 ???  We should recurse here with
> + 	 type_conversion_needed_p.  */
> +       return !lang_hooks.types_compatible_p (TREE_TYPE (inner_type),
> + 					    TREE_TYPE (outer_type));

This is the part that I'm not sure how we are going to remove.

> 
> 	* tree-ssa.c (type_conversion_needed_p): Add handling for
> 	scalar float and vector types.  Only call the types_compatible_p
> 	langhook for aggregate types as last resort.  Follow the
> 	rules more.
> 
> 	* testsuite/gcc.dg/pr29254.c: The warning is bogus.

You have to describe *what* you changed in the file.


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