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: [CRIS] Convert CRIS to constraints.md


> From: Anatoly Sokolov <aesok@post.ru>
> Date: Wed, 2 Nov 2011 20:37:12 +0100

>   Comments? OK to install?
> 
>         * config/cris/constraints.md: New file.

Whee!

>         * config/cris/cris.h (REG_CLASS_FROM_LETTER, CONSTRAINT_LEN,
>         CRIS_CONST_OK_FOR_LETTER_P, CONST_OK_FOR_CONSTRAINT_P,
>         CONST_DOUBLE_OK_FOR_LETTER_P, EXTRA_MEMORY_CONSTRAINT,
>         EXTRA_CONSTRAINT, EXTRA_CONSTRAINT_Q, EXTRA_CONSTRAINT_R,
>         EXTRA_CONSTRAINT_T, EXTRA_CONSTRAINT_S, EXTRA_CONSTRAINT_U): Remove.
>         * config/cris/cris.c: Incule "tm-constrs.h".
>         (cris_print_operand): Use satisfies_constraint_O.
>         (cris_normal_notice_update_cc, cris_rtx_costs): Use
>         satisfies_constraint_I.
>         (cris_address_cost): Use satisfies_constraint_L.
>         * config/cris/cris.md: Include "constraints.md".
>         (*mov_side<mode>, *mov_sidesisf, *mov_side<mode>_mem,
>         *mov_sidesisf_mem, *clear_side<mode>, *ext_sideqihi,
>         *ext_side<mode>si, *op_side<mode>, *op_swap_side<mode>,
>         *extopqihi_side, *extop<mode>si_side, *extopqihi_swap_side,
>         *extop<mode>si_swap_side): Use satisfies_constraint_N and
>         satisfies_constraint_J.
>         (moversideqi movemsideqi mover2side peephole2): Use
>         satisfies_constraint_N and satisfies_constraint_J.
>         (andu peephole2): Use satisfies_constraint_I and
>         satisfies_constraint_O.

Some utter nits:

> +(define_constraint "J"
> +  "ADDQ, SUBQ."
> +  (and (match_code "const_int")
> +       (match_test "IN_RANGE (ival, 0, 63)")))
> +
> +(define_constraint "L"
> +  "A 16-bit signed number."
> +  (and (match_code "const_int")
> +       (match_test "IN_RANGE (ival, -32768, 32767)")))

0. Please move Kc and Kp between J and L.

> +(define_constraint "T"
> +  "Memory three-address operand."
> +;; All are indirect-memory:
> +  (and (match_code "mem")
> +           ;; Double indirect: [[reg]] or [[reg+]]?
> +       (ior (and (match_code "mem" "0")
> +                (match_test "cris_base_or_autoincr_p (XEXP (XEXP (op, 0), 0),

1. Match the ";;" with the indentation of context to which the
   comment refers.
   (You have this right in *most* places.)

2. Match indentation for operands.
   (Ditto.)

3. Everywhere in the code you change, use TAB, not eight spaces
   at multiples-of-8 columns: fix modified regions in emacs with
   "M-x tabify".

Like so (except (3) is wrong here because I didn't adjust for
the mail-reply-quote and diff prefixes):

> +(define_constraint "T"
> +  "Memory three-address operand."
> +  ;; All are indirect-memory:
> +  (and (match_code "mem")
> +	  ;; Double indirect: [[reg]] or [[reg+]]?
> +	  (ior (and (match_code "mem" "0")
> +		    (match_test "cris_base_or_autoincr_p (XEXP (XEXP (op, 0), 0),

Hmm:

> +(define_constraint "S"
> +  "PIC-constructs for symbols."
> +  (and (match_test "flag_pic")
> +       (match_code "const")
> +       (match_test "cris_valid_pic_const (op, false)")))

Can you really have other than two operands to the RTL "and"
these days?  (I guess that's changed to "yes"; if not, the gen*
programs should have alerted.  Unless there's some bug.)

Ok with these nits fixed and the supposedly quick check with
tm-constrs.h (the latter unless you really know already).

Thanks!

brgds, H-P


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