Require '%' to be at the beginning of a constraint string

Jeff Law law@redhat.com
Tue May 27 17:41:00 GMT 2014


On 05/26/14 13:21, Richard Sandiford wrote:
>> If we're going to change it, then clearly the docs need to change and
>> ideally we'd statically check the port's constraints during the build
>> process to ensure they meet the tighter definition.
>
> OK, how does this look?  I built a cc1 for one target per config/
> directory to (try to) check that there were no remaining cases.
>
> This means that we will silently ignore '%'s that are embedded in the
> middle of an asm constraint string, but in a way that's already true for
> most places that check for commutativity.  An error seems a bit extreme
> when '%' is only a hint.  If we want a warning, what should the option
> be called?  And should it be under -Wall, -Wextra, or on by default?
>
> Tested on x86_64-linux-gnu.  OK to install?
OK.  My initial thought on adding a warning was to weed out bad 
constraints.  You've already done that for the in-tree ports.  I'm a lot 
less inclined to do much more here to help the out-of-tree ports, so 
upon further review, let's not worry about the warning unless you've 
already got it ready to go :-)


>
> Thanks,
> Richard
>
>
> gcc/
> 	* doc/md.texi: Document that the % constraint character must
> 	be at the beginning of the string.
> 	* genoutput.c (validate_insn_alternatives): Check that '=',
> 	'+' and '%' only appear at the beginning of a constraint.
> 	* ira.c (commutative_constraint_p): Delete.
> 	(ira_get_dup_out_num): Expect the '%' commutativity marker to be
> 	at the start of the string.
> 	* config/alpha/alpha.md (*movmemdi_1, *clrmemdi_1): Remove
> 	duplicate '='s.
> 	* config/arm/neon.md (bicdi3_neon): Likewise.
> 	* config/vax/vax.md (sbcdi3): Likewise.
> 	* config/h8300/h8300.md (*cmpstz): Remove duplicate '+'.
> 	* config/arc/arc.md (mulsi_600, mulsidi_600, umulsidi_600)
> 	(mul64): Move '%' to beginning of constraint.
> 	* config/arm/arm.md (*xordi3_insn): Likewise.
> 	* config/nds32/nds32.md (add<mode>3, mulsi3, andsi3, iorsi3)
> 	(xorsi3): Likewise.
Those ARC port bits are odd.  Why in the world would someone have the 
commutative modifier on the last (and only the last) alternative.  Strange.

Regardless, this is OK.  Thanks,

Jeff



More information about the Gcc-patches mailing list