[Patch] Teach genrecog/genoutput that scratch registers require write constraint modifiers

James Greenhalgh james.greenhalgh@arm.com
Fri Sep 19 10:40:00 GMT 2014


On Thu, Sep 18, 2014 at 09:45:59PM +0100, Jeff Law wrote:
> On 09/18/14 04:19, James Greenhalgh wrote:
> >
> > Hi,
> >
> > As discussed in https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01334.html
> > The construct
> >
> >    (clobber (match_scratch 0 "r"))
> >
> > is invalid - operand 0 must be marked either write or read/write.
> >
> > Likewise
> >
> >    (match_* 0 "&r")
> >
> > is invalid, marking an operand earlyclobber does not remove the need to
> > also mark it write or read/write.
> >
> > This patch adds checking for these two error conditions to the generator
> > programs and documents the restriction.
> >
> > Bootstrapped on x86, ARM and AArch64 with no new issues.
> >
> > Ok?
> >
> > Thanks,
> > James
> >
> > ---
> > 2014-09-17  James Greenhalgh  <james.greenhalgh@arm.com>
> >
> > 	* doc/md.texi (Modifiers): Consistently use "read/write"
> > 	nomenclature rather than "input/output".
> > 	* genrecog.c (constraints_supported_in_insn_p): New.
> > 	(validate_pattern): If needed, also check constraints on
> > 	MATCH_SCRATCH operands.
> > 	* genoutput.c (validate_insn_alternatives): Catch earlyclobber
> > 	operands with no '=' or '+' modifier.
> 
> +	    if (c == '=' || c == '+')
> +	      seen_inout = true;
> 
> Isn't "seen_input" poorly named here?  ISTM what we're checking for is 
> if we've seen an operand that will be written to.
> 
> Doesn't it make sense to use read/write nomenclature in the comments and 
> variable names too?
> 
> So with those nits fixed, this patch is OK.

Thanks Jeff,

In the end I committed the attached as revision 215388.

Cheers,
James

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Patch-Teach-genrecog-genoutput-that-scratch-register.patch
Type: text/x-diff
Size: 7842 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140919/fd72866a/attachment.bin>


More information about the Gcc-patches mailing list