Patchwork RTL gensupport - fix warning when using a match_scratch predicate

login
register
mail settings
Submitter Graham Stott
Date April 24, 2013, 5:41 p.m.
Message ID <1366825269.37866.YahooMailNeo@web87402.mail.ir2.yahoo.com>
Download mbox | patch
Permalink /patch/239286/
State New
Headers show

Comments

Graham Stott - April 24, 2013, 5:41 p.m.
All
 
Currently using the match_scratch predicate on a destination operand will trigger the warning
 
                    "warning: destination operand 0 allows non-lvalue",
 
This happends because add_predicate_code()  will set the pred->allows_non_lvalue when
it encounters a SCRATCH rtx code which subsequently triggers the above genrecog warning/
 
Graham
                  
gcc/ChangeLog
    * gensupport.c:: (add_predicate_code) Also exclude SCRATCH from rtx codes which allow
     non-lvalues.
Jeff Law - April 24, 2013, 8:59 p.m.
On 04/24/2013 11:41 AM, Graham Stott wrote:
> All
>
> Currently using the match_scratch predicate on a destination operand will trigger the warning
>
>                      "warning: destination operand 0 allows non-lvalue",
>
> This happends because add_predicate_code()  will set the pred->allows_non_lvalue when
> it encounters a SCRATCH rtx code which subsequently triggers the above genrecog warning/
>
> Graham
>
> gcc/ChangeLog
>      * gensupport.c:: (add_predicate_code) Also exclude SCRATCH from rtx codes which allow
>       non-lvalues.
My question would be in what context does it make sense to use a SCRATCH 
as a destination?

Do you have a multi-output insn where you need to allocate a reg for one 
of the outputs, but you never use that output value?  Or is it something 
totally different?

SCRATCH as an rtx code is painfully under-documented.  Though I think 
treating it just like a REG in add_predicate_code probably makes sense.

Approved.  Graham, do you still have write access to the repo?

jeff

Patch

Index: gcc/gensupport.c
=========================================
--- gcc/gensupport.c    (revision 198200)
+++ gcc/gensupport.c    (working copy)
@@ -2732,7 +2732,8 @@ 
          && code != MEM
          && code != CONCAT
          && code != PARALLEL
-         && code != STRICT_LOW_PART)
+         && code != STRICT_LOW_PART
+         && code != SCRATCH)
        pred->allows_non_lvalue = true;
       if (pred->num_codes == 1)