This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: new __builtin_choose_type (patch)
- To: Aldy Hernandez <aldyh at redhat dot com>
- Subject: Re: new __builtin_choose_type (patch)
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Wed, 3 Oct 2001 10:19:44 +0100 (BST)
- cc: <gcc at gcc dot gnu dot org>
On 2 Oct 2001, Aldy Hernandez wrote:
> btw, i can't get my builtin to return a given object (irregardless of
> it's type) because the way builtins work seems to force me to choose a
> return value type. i don't want a specific value type. i want
> something generic. see code documentation below.
That's why overloaded builtins need actual new mechanism in the compiler
(to do overload resolution for builtins sufficiently early), not simply
another builtin like this using existing mechanisms.
> + /* Strip off all NOPs. */
> + while (TREE_CODE (arg) == NOP_EXPR
> + || TREE_CODE (arg) == CONVERT_EXPR
> + || TREE_CODE (arg) == NON_LVALUE_EXPR
> + || TREE_CODE (arg) == INDIRECT_REF)
> + arg = TREE_OPERAND (arg, 0);
> +
> + /* Get <exp0> type. */
> + exp0_mode = TYPE_MODE (TREE_TYPE (arg));
This looks to me like one of the problems with the current approach -
since explicit casts should be preserved in computing the types, but
implicit conversions from the default argument promotions (which shouldn't
get applied with proper overloaded builtins, but would at present)
shouldn't be preserved.
--
Joseph S. Myers
jsm28@cam.ac.uk