Alpha -mtaso support, revised patch
Geoff Keating
geoffk@cygnus.com
Wed Mar 29 14:33:00 GMT 2000
> Date: Wed, 29 Mar 2000 17:09:47 -0500 (EST)
> From: Brad Lucier <lucier@math.purdue.edu>
> Cc: lucier@math.purdue.edu, ink@jurassic.park.msu.ru, feeley@iro.umontreal.ca,
> hosking@cs.purdue.edu, binutils@sourceware.cygnus.com
> *** c-typeck.c 2000/03/22 17:01:19 1.1
> --- c-typeck.c 2000/03/29 18:05:25
> ***************
> *** 3706,3712 ****
> if (TREE_CODE (type) == INTEGER_TYPE
> && TREE_CODE (otype) == POINTER_TYPE
> && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
> ! && !TREE_CONSTANT (value))
> warning ("cast from pointer to integer of different size");
>
> if (warn_bad_function_cast
> --- 3706,3720 ----
> if (TREE_CODE (type) == INTEGER_TYPE
> && TREE_CODE (otype) == POINTER_TYPE
> && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
> ! && !TREE_CONSTANT (value)
> ! #ifdef TARGET_TASO
> ! /* Do not warn about conversions from 64-bit pointer to
> ! 32-bit int if TARGET_TASO. */
> ! && !(TARGET_TASO
> ! && TYPE_PRECISION (type) == 32
> ! && TYPE_PRECISION (otype) == 64)
> ! #endif
> ! )
> warning ("cast from pointer to integer of different size");
It would be better to have a macro, perhaps named
POINTER_SIGNIFICANT_BITS or similar, which specifies that pointers
only contain 32 significant bits and so it doesn't matter that this
conversion happens.
That way, there isn't Alpha-specific code in the generic files.
Also, don't you want to do the same thing for C++?
> ===================================================================
> RCS file: RCS/varasm.c,v
> retrieving revision 1.1
> diff -c -r1.1 varasm.c
> *** varasm.c 2000/03/21 15:56:27 1.1
> --- varasm.c 2000/03/29 18:03:41
> ***************
> *** 4088,4093 ****
> --- 4088,4106 ----
> == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
> return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
>
> + #ifdef TARGET_TASO
> + /* Allow conversions to 32 bit ints from 64 bit ints that come from
> + &foo. */
> + if (TARGET_TASO
> + && INTEGRAL_TYPE_P (TREE_TYPE (value))
> + && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (value, 0)))
> + && TYPE_PRECISION (TREE_TYPE (value)) == 32
> + && TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))) == 64
> + && TREE_CODE (TREE_OPERAND (value, 0)) == CONVERT_EXPR
> + && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (value, 0), 0))))
> + return initializer_constant_valid_p (TREE_OPERAND (TREE_OPERAND (value, 0), 0), endtype);
> + #endif
> +
Here similarly, except that you want to have a macro that says `the
backend can output mode X as mode Y in constructors at assemble or
link time', and have X be Pmode and Y be SImode.
--
- Geoffrey Keating <geoffk@cygnus.com>
More information about the Gcc-patches
mailing list