recog.c (insn_invalid_p): Add IN_GROUP parameter and use validate_change to add clobb...
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>
Tue, 24 Apr 2012 07:01:52 +0000 (07:01 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Tue, 24 Apr 2012 07:01:52 +0000 (07:01 +0000)
2012-04-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

* recog.c (insn_invalid_p): Add IN_GROUP parameter and use
validate_change to add clobbers if IN_GROUP is nonzero.
(verify_changes): Call insn_invalid_p with IN_GROUP set to true.
* recog.h (insn_invalid_p): Add IN_GROUP parameter to function
prototype.
* gcse.c (process_insert_insn): Call insn_invalid_p with IN_GROUP
set to false.
* config/s390/s390.c (insn_invalid_p): Likewise.

From-SVN: r186748

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/gcse.c
gcc/recog.c
gcc/recog.h

index 8dbaeffd78002bdcef3f53041c08f54944678e70..d37c609e701f1101ad3e28e4bffabb0924b35b2a 100644 (file)
@@ -1,3 +1,14 @@
+2012-04-24  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+       * recog.c (insn_invalid_p): Add IN_GROUP parameter and use
+       validate_change to add clobbers if IN_GROUP is nonzero.
+       (verify_changes): Call insn_invalid_p with IN_GROUP set to true.
+       * recog.h (insn_invalid_p): Add IN_GROUP parameter to function
+       prototype.
+       * gcse.c (process_insert_insn): Call insn_invalid_p with IN_GROUP
+       set to false.
+       * config/s390/s390.c (insn_invalid_p): Likewise.
+
 2012-04-24  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/53084
index d6e250fd5a8f332a06eeb15e2b973282e0809d42..5592674e85738a0e8b11b0ed67b213e64e6c62c6 100644 (file)
@@ -4413,7 +4413,7 @@ s390_expand_addcc (enum rtx_code cmp_code, rtx cmp_op0, rtx cmp_op1,
       insn = gen_rtx_SET (VOIDmode, gen_rtx_REG (cc_mode, CC_REGNUM),
                          gen_rtx_COMPARE (cc_mode, cmp_op0, cmp_op1));
       /* We use insn_invalid_p here to add clobbers if required.  */
-      ret = insn_invalid_p (emit_insn (insn));
+      ret = insn_invalid_p (emit_insn (insn), false);
       gcc_assert (!ret);
 
       /* Emit ALC instruction pattern.  */
@@ -4485,7 +4485,7 @@ s390_expand_addcc (enum rtx_code cmp_code, rtx cmp_op0, rtx cmp_op1,
       insn = gen_rtx_SET (VOIDmode, gen_rtx_REG (cc_mode, CC_REGNUM),
                          gen_rtx_COMPARE (cc_mode, cmp_op0, cmp_op1));
       /* We use insn_invalid_p here to add clobbers if required.  */
-      ret = insn_invalid_p (emit_insn (insn));
+      ret = insn_invalid_p (emit_insn (insn), false);
       gcc_assert (!ret);
 
       /* Emit SLB instruction pattern.  */
index 6f149bb402f8061ad36018b6a5fc2a9ff4cd8849..a050ff5ba6b23a3166c02e953c5241aa49f4bee3 100644 (file)
@@ -2087,7 +2087,7 @@ process_insert_insn (struct expr *expr)
     {
       rtx insn = emit_insn (gen_rtx_SET (VOIDmode, reg, exp));
 
-      if (insn_invalid_p (insn))
+      if (insn_invalid_p (insn, false))
        gcc_unreachable ();
     }
 
index 8f041799e62a65e951b1f79d14641c2833310a00..cb2bfd317015ac7087b8f7452c970d0e11f212d2 100644 (file)
@@ -309,10 +309,14 @@ canonicalize_change_group (rtx insn, rtx x)
 
 
 /* This subroutine of apply_change_group verifies whether the changes to INSN
-   were valid; i.e. whether INSN can still be recognized.  */
+   were valid; i.e. whether INSN can still be recognized.
+
+   If IN_GROUP is true clobbers which have to be added in order to
+   match the instructions will be added to the current change group.
+   Otherwise the changes will take effect immediately.  */
 
 int
-insn_invalid_p (rtx insn)
+insn_invalid_p (rtx insn, bool in_group)
 {
   rtx pat = PATTERN (insn);
   int num_clobbers = 0;
@@ -344,7 +348,10 @@ insn_invalid_p (rtx insn)
       newpat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (num_clobbers + 1));
       XVECEXP (newpat, 0, 0) = pat;
       add_clobbers (newpat, icode);
-      PATTERN (insn) = pat = newpat;
+      if (in_group)
+       validate_change (insn, &PATTERN (insn), newpat, 1);
+      else
+       PATTERN (insn) = pat = newpat;
     }
 
   /* After reload, verify that all constraints are satisfied.  */
@@ -413,7 +420,7 @@ verify_changes (int num)
        }
       else if (DEBUG_INSN_P (object))
        continue;
-      else if (insn_invalid_p (object))
+      else if (insn_invalid_p (object, true))
        {
          rtx pat = PATTERN (object);
 
index 71dfe2a68a94b494405f8c6d3d62857e30e505f1..9fb3443254a696b935f93e9a460eb69bb18a28ba 100644 (file)
@@ -79,7 +79,7 @@ extern int asm_operand_ok (rtx, const char *, const char **);
 extern bool validate_change (rtx, rtx *, rtx, bool);
 extern bool validate_unshare_change (rtx, rtx *, rtx, bool);
 extern bool canonicalize_change_group (rtx insn, rtx x);
-extern int insn_invalid_p (rtx);
+extern int insn_invalid_p (rtx, bool);
 extern int verify_changes (int);
 extern void confirm_change_group (void);
 extern int apply_change_group (void);