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: [Patch] Teach genrecog/genoutput that scratch registers require write constraint modifiers


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.

Jeff


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