This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add null identifiers to genmatch
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Mike Stump <mikestump at comcast dot net>
- Cc: Richard Sandiford <rdsandiford at gmail dot com>, Jeff Law <law at redhat dot com>, Pedro Alves <palves at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, richard dot sandiford at arm dot com
- Date: Tue, 17 Nov 2015 11:01:41 +0100
- Subject: Re: Add null identifiers to genmatch
- Authentication-results: sourceware.org; auth=none
- References: <87lhaaosh5 dot fsf at e105548-lin dot cambridge dot arm dot com> <563E0B2D dot 3080408 at redhat dot com> <563FD7F8 dot 1020503 at redhat dot com> <564A3957 dot 60102 at redhat dot com> <564A4122 dot 9010100 at redhat dot com> <87ziydy5lk dot fsf at googlemail dot com> <CD906D35-4679-4CE7-A203-97FB7B587B7E at comcast dot net>
On Tue, Nov 17, 2015 at 12:14 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Nov 16, 2015, at 1:52 PM, Richard Sandiford <rdsandiford@gmail.com> wrote:
>>
>> Yeah. Kenny was adamant that for wide-int we should have an UNSIGNED/SIGNED
>
> Yeah, you can blame me. I think (, UNSIGNED) conveys more than (,true) or (,false). The sad part is, this has always been true.
>
>> enum rather than a boolean flag. And I think that does make things clearer.
>> I always have to remind myself whether "true" means "unsigned" or "signed",
>> especially for RTL functions.
>
> Certainly any api that uses boolean for signed/unsigned, can be switched to signop (aka SIGNED, UNSIGNED). It was put in as a general feature disconnected from wide-int for a reason. :-)
>
> Here we shall salute the last of the hold outs:
>
> base_type_for_mode (machine_mode mode, bool unsignedp)
> convert_extracted_bit_field (rtx x, machine_mode mode, machine_mode tmode, bool unsignedp)
> gimple_signed_or_unsigned_type (bool unsignedp, tree type)
> avoid_expensive_constant (machine_mode mode, optab binoptab,
> int opn, rtx x, bool unsignedp)
> get_rtx_code (enum tree_code tcode, bool unsignedp)
> vector_compare_rtx (enum tree_code tcode, tree t_op0, tree t_op1,
> bool unsignedp, enum insn_code icode)
> create_expand_operand (struct expand_operand *op,
> enum expand_operand_type type,
> rtx value, machine_mode mode,
> bool unsigned_p)
> create_convert_operand_to (struct expand_operand *op, rtx value,
> machine_mode mode, bool unsigned_p)
> create_convert_operand_from (struct expand_operand *op, rtx value,
> machine_mode mode, bool unsigned_p)
Err, you miss a few '[un]signed unsigned[_]p' cases ;)
> but, it was designed with uses like:
>
> bool unsigned_p = false;
>
> in mind as well. I will note:
>
> bool signed_p;
>
> and:
>
> shorten_into_mode (struct rtx_iv *iv, machine_mode mode,
> enum rtx_code cond, bool signed_p, struct niter_desc *desc)
>
> are the odd man out. Their value is inverted from the value signop uses.
>
>> I certainly prefer the enum to separate functions though. They can get
>> messy if a new call site is added that needs a variable parameter.
>
> To me itâs a numbers game. When there are 200 simple calls and 5 complex ones, I prefer 200 simple calls without the extra parameters, and 5 with the horror that is the argument list.