vax-protos.h (reg_was_0_p): New prototype.
authorJohn David Anglin <dave@hiauly1.hia.nrc.ca>
Fri, 16 Nov 2001 22:40:21 +0000 (22:40 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Fri, 16 Nov 2001 22:40:21 +0000 (22:40 +0000)
* vax-protos.h (reg_was_0_p): New prototype.
* vax.md (movsi, movhi, movqi): Use reg_was_0_p.
* vax.c (follows_p, reg_was_0_p): New functions.

From-SVN: r47110

gcc/ChangeLog
gcc/config/vax/vax-protos.h
gcc/config/vax/vax.c
gcc/config/vax/vax.md

index fc249e5..1bff544 100644 (file)
@@ -1,5 +1,11 @@
 2001-11-16  John David Anglin  <dave@hiauly1.hia.nrc.ca>
 
+       * vax-protos.h (reg_was_0_p): New prototype.
+       * vax.md (movsi, movhi, movqi): Use reg_was_0_p.
+       * vax.c (follows_p, reg_was_0_p): New functions.
+
+2001-11-16  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
        * vax.md (casesi): Swap arguments in "(plus:SI (pc) (mult))". Reformat.
        (casesi1): Likewise.  Define new pattern which arises by simplification
        when operand 1 is a constant int.  Correct pattern which arises by
index f836c1e..f3a239d 100644 (file)
@@ -25,6 +25,7 @@ extern void print_operand_address PARAMS ((FILE *, rtx));
 extern int vax_float_literal PARAMS ((rtx));
 extern int vax_address_cost PARAMS ((rtx));
 extern int vax_rtx_cost PARAMS ((rtx));
+extern int reg_was_0_p PARAMS ((rtx, rtx));
 #endif /* RTX_CODE */
 
 #ifdef REAL_VALUE_TYPE
index 9f0387c..df14f9e 100644 (file)
@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA.  */
 #include "target.h"
 #include "target-def.h"
 
+static int follows_p PARAMS ((rtx, rtx));
 static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 #if VMS_TARGET
 static void vms_asm_out_constructor PARAMS ((rtx, int));
@@ -946,3 +947,38 @@ not_qsort (array, count, size, compare)
   return;
 }
 #endif /* QSORT_WORKAROUND */
+
+/* Return 1 if insn A follows B.  */
+
+static int
+follows_p (a, b)
+     rtx a, b;
+{
+  register rtx p;
+
+  for (p = a; p != b; p = NEXT_INSN (p))
+    if (! p)
+      return 1;
+
+  return 0;
+}
+
+/* Returns 1 if we know operand OP was 0 before INSN.  */
+
+int
+reg_was_0_p (insn, op)
+     rtx insn, op;
+{
+  rtx link;
+
+  return ((link = find_reg_note (insn, REG_WAS_0, 0))
+         /* Make sure the insn that stored the 0 is still present
+            and doesn't follow INSN in the insn sequence.  */
+         && ! INSN_DELETED_P (XEXP (link, 0))
+         && GET_CODE (XEXP (link, 0)) != NOTE
+         && ! follows_p (XEXP (link, 0), insn)
+         /* Make sure cross jumping didn't happen here.  */
+         && no_labels_between_p (XEXP (link, 0), insn)
+         /* Make sure the reg hasn't been clobbered.  */
+         && ! reg_set_between_p (op, XEXP (link, 0), insn));
+}
index b985c5b..4280ac6 100644 (file)
   ""
   "*
 {
-  rtx link;
-  if (operands[1] == const1_rtx
-      && (link = find_reg_note (insn, REG_WAS_0, 0))
-      /* Make sure the insn that stored the 0 is still present.  */
-      && ! INSN_DELETED_P (XEXP (link, 0))
-      && GET_CODE (XEXP (link, 0)) != NOTE
-      /* Make sure cross jumping didn't happen here.  */
-      && no_labels_between_p (XEXP (link, 0), insn)
-      /* Make sure the reg hasn't been clobbered.  */
-      && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+  if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
     return \"incl %0\";
+
   if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
     {
       if (push_operand (operands[0], SImode))
   ""
   "*
 {
-  rtx link;
-  if (operands[1] == const1_rtx
-      && (link = find_reg_note (insn, REG_WAS_0, 0))
-      /* Make sure the insn that stored the 0 is still present.  */
-      && ! INSN_DELETED_P (XEXP (link, 0))
-      && GET_CODE (XEXP (link, 0)) != NOTE
-      /* Make sure cross jumping didn't happen here.  */
-      && no_labels_between_p (XEXP (link, 0), insn)
-      /* Make sure the reg hasn't been clobbered.  */
-      && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+  if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
     return \"incw %0\";
 
   if (GET_CODE (operands[1]) == CONST_INT)
   ""
   "*
 {
-  rtx link;
-  if (operands[1] == const1_rtx
-      && (link = find_reg_note (insn, REG_WAS_0, 0))
-      /* Make sure the insn that stored the 0 is still present.  */
-      && ! INSN_DELETED_P (XEXP (link, 0))
-      && GET_CODE (XEXP (link, 0)) != NOTE
-      /* Make sure cross jumping didn't happen here.  */
-      && no_labels_between_p (XEXP (link, 0), insn)
-      /* Make sure the reg hasn't been clobbered.  */
-      && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
+  if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
     return \"incb %0\";
 
   if (GET_CODE (operands[1]) == CONST_INT)