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: Add null identifiers to genmatch


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)

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.

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