diff mbox

Teach genrecog/genoutput that scratch registers require write constraint modifiers

Message ID 1411143374-26536-1-git-send-email-james.greenhalgh@arm.com
State New
Headers show

Commit Message

James Greenhalgh Sept. 19, 2014, 4:16 p.m. UTC
On Fri, Sep 19, 2014 at 04:10:34PM +0100, Andreas Krebbel wrote:
> On 09/19/2014 02:59 PM, James Greenhalgh wrote:
> >
> > Hi,
> >
> > After https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01615.html we error
> > on the use of constraints in define_splits, define_expands and
> > define_peephole2s. These are never looked at by the compiler, and so
> > have no reason to be set.
> >
> > I expect there will be more fallout as Jan's auto-builder makes its way
> > through ports I haven't tested, I'll fix those up as they come up.
> >
> > These are build failures, and the fixes are "obvious", but I don't know
> > my way around these ports, so I'd like an explicit maintainer ack.
> >
> > For testing, I've just checked that the build error is resolved. In
> > principal, these are not functional changes as the constraints are
> > not looked at.
>
> S/390 bootstrap fails with:
> gcc/gcc/config/s390/s390.md:8397: operand 5 missing output reload
>
> For the branch on index instruction we have a define_insn_and_split with a
> single alternative forcing a split before reload. In this pattern to my
> understanding the constraints are not really required.

Yes, if that is the existing supported behaviour for MATCH_OPERANDs (it
must be or your pattern would have been failing before), I don't want to
make MATCH_SCRATCH more restrictive.

The fix is a one-liner. Jeff, I presume we still want to permit this?
The alternate fix would be to make this an error in both cases.

Ok?

Thanks,
James

---
2014-09-14  James Greenhalgh  <james.greenhalgh@arm.com>

	* genrecog.c (validate_pattern): Allow empty constraints in
	a match_scratch.

Comments

Jeff Law Sept. 19, 2014, 4:20 p.m. UTC | #1
On 09/19/14 10:16, James Greenhalgh wrote:
>
> On Fri, Sep 19, 2014 at 04:10:34PM +0100, Andreas Krebbel wrote:
>> On 09/19/2014 02:59 PM, James Greenhalgh wrote:
>>>
>>> Hi,
>>>
>>> After https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01615.html we error
>>> on the use of constraints in define_splits, define_expands and
>>> define_peephole2s. These are never looked at by the compiler, and so
>>> have no reason to be set.
>>>
>>> I expect there will be more fallout as Jan's auto-builder makes its way
>>> through ports I haven't tested, I'll fix those up as they come up.
>>>
>>> These are build failures, and the fixes are "obvious", but I don't know
>>> my way around these ports, so I'd like an explicit maintainer ack.
>>>
>>> For testing, I've just checked that the build error is resolved. In
>>> principal, these are not functional changes as the constraints are
>>> not looked at.
>>
>> S/390 bootstrap fails with:
>> gcc/gcc/config/s390/s390.md:8397: operand 5 missing output reload
>>
>> For the branch on index instruction we have a define_insn_and_split with a
>> single alternative forcing a split before reload. In this pattern to my
>> understanding the constraints are not really required.
>
> Yes, if that is the existing supported behaviour for MATCH_OPERANDs (it
> must be or your pattern would have been failing before), I don't want to
> make MATCH_SCRATCH more restrictive.
>
> The fix is a one-liner. Jeff, I presume we still want to permit this?
> The alternate fix would be to make this an error in both cases.
>
> Ok?
>
> Thanks,
> James
>
> ---
> 2014-09-14  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* genrecog.c (validate_pattern): Allow empty constraints in
> 	a match_scratch.
OK.  Yea, I think we want to permit -- I have vague recollections this 
is documented somewhere as "accept anything".

jeff
diff mbox

Patch

diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 0134585..c1dc8fa 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -461,6 +461,7 @@  validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
 	/* If a MATCH_SCRATCH is used in a context requiring an write-only
 	   or read/write register, validate that.  */
 	if (set_code == '='
+	    && constraints0
 	    && constraints0 != '='
 	    && constraints0 != '+')
 	  {