reg-stack.c (subst_asm_stack_regs): Change to return the last new insn generated...
authorH.J. Lu <hjl@gnu.org>
Mon, 20 Apr 1998 00:01:15 +0000 (00:01 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 20 Apr 1998 00:01:15 +0000 (18:01 -0600)
* reg-stack.c (subst_asm_stack_regs): Change to return the last
new insn generated by this function.
(subst_stack_regs): Likewise.
(convert_regs): Record the last newly generated insn and use
it for change_stack () instead of INSN.

From-SVN: r19328

gcc/ChangeLog
gcc/reg-stack.c

index 319c572e3140031015f51ad2dc763c8c33ef9311..17eab4d5ba7f2172c63287fc76fdf4e9e7483380 100644 (file)
@@ -1,3 +1,11 @@
+Mon Apr 20 01:00:05 1998  H.J. Lu  (hjl@gnu.org)
+
+       * reg-stack.c (subst_asm_stack_regs): Change to return the last
+       new insn generated by this function.
+       (subst_stack_regs): Likewise.
+       (convert_regs): Record the last newly generated insn and use
+       it for change_stack () instead of INSN.
+
 Sun Apr 19 15:41:24 1998  Manfred Hollstein  <manfred@s-direktnet.de>
 
        * fix-header.c (enum special_file): Undefine enumerators if they
index 45a533edb8b3fe7b8c837ec127e088b0a61a20f5..d4ef06bd4a112ab8a86228102f10d9ad5a9459c2 100644 (file)
@@ -262,9 +262,9 @@ static void move_for_stack_reg              PROTO((rtx, stack, rtx));
 static void swap_rtx_condition         PROTO((rtx));
 static void compare_for_stack_reg      PROTO((rtx, stack, rtx));
 static void subst_stack_regs_pat       PROTO((rtx, stack, rtx));
-static void subst_asm_stack_regs       PROTO((rtx, stack, rtx *, rtx **,
+static rtx subst_asm_stack_regs                PROTO((rtx, stack, rtx *, rtx **,
                                               char **, int, int));
-static void subst_stack_regs           PROTO((rtx, stack));
+static rtx subst_stack_regs            PROTO((rtx, stack));
 static void change_stack               PROTO((rtx, stack, stack, rtx (*) ()));
 
 static void goto_block_pat             PROTO((rtx, stack, rtx));
@@ -2411,9 +2411,11 @@ subst_stack_regs_pat (insn, regstack, pat)
    stack-like regs in asm statements.  These rules are enforced by
    record_asm_stack_regs; see comments there for details.  Any
    asm_operands left in the RTL at this point may be assume to meet the
-   requirements, since record_asm_stack_regs removes any problem asm.  */
+   requirements, since record_asm_stack_regs removes any problem asm.
 
-static void
+   It returns the last new insn generated by this function. */
+
+static rtx
 subst_asm_stack_regs (insn, regstack, operands, operands_loc, constraints,
                      n_inputs, n_outputs)
      rtx insn;
@@ -2692,14 +2694,18 @@ subst_asm_stack_regs (insn, regstack, operands, operands_loc, constraints,
              break;
            }
       }
+
+  return insn;
 }
 \f
 /* Substitute stack hard reg numbers for stack virtual registers in
    INSN.  Non-stack register numbers are not changed.  REGSTACK is the
    current stack content.  Insns may be emitted as needed to arrange the
-   stack for the 387 based on the contents of the insn.  */
+   stack for the 387 based on the contents of the insn.
 
-static void
+   It returns the last new insn generated by this function. */
+
+static rtx
 subst_stack_regs (insn, regstack)
      rtx insn;
      stack regstack;
@@ -2755,9 +2761,9 @@ subst_stack_regs (insn, regstack)
          decode_asm_operands (body, operands, operands_loc,
                               constraints, NULL_PTR);
          get_asm_operand_lengths (body, n_operands, &n_inputs, &n_outputs);
-         subst_asm_stack_regs (insn, regstack, operands, operands_loc,
-                               constraints, n_inputs, n_outputs);
-         return;
+         return subst_asm_stack_regs (insn, regstack, operands,
+                                      operands_loc, constraints,
+                                      n_inputs, n_outputs);
        }
 
       if (GET_CODE (PATTERN (insn)) == PARALLEL)
@@ -2775,7 +2781,7 @@ subst_stack_regs (insn, regstack)
      REG_UNUSED will already have been dealt with, so just return.  */
 
   if (GET_CODE (insn) == NOTE)
-    return;
+    return insn;
 
   /* If there is a REG_UNUSED note on a stack register on this insn,
      the indicated reg must be popped.  The REG_UNUSED note is removed,
@@ -2791,6 +2797,8 @@ subst_stack_regs (insn, regstack)
       }
     else
       note_link = &XEXP (note, 1);
+
+  return insn;
 }
 \f
 /* Change the organization of the stack so that it fits a new basic
@@ -3031,7 +3039,7 @@ static void
 convert_regs ()
 {
   register int block, reg;
-  register rtx insn, next;
+  register rtx insn, next, new;
   struct stack_def regstack;
 
   for (block = 0; block < blocks; block++)
@@ -3057,6 +3065,7 @@ convert_regs ()
       do
        {
          insn = next;
+         new = insn;
          next = NEXT_INSN (insn);
 
          /* Don't bother processing unless there is a stack reg
@@ -3064,7 +3073,8 @@ convert_regs ()
             floating point values).  */
 
          if (GET_MODE (insn) == QImode || GET_CODE (insn) == CALL_INSN)
-           subst_stack_regs (insn, &regstack);
+           /* We may have generated some new instructions here. */
+           new = subst_stack_regs (insn, &regstack);
 
        } while (insn != block_end[block]);
 
@@ -3087,7 +3097,7 @@ convert_regs ()
       /* Likewise handle the case where we fall into the next block.  */
 
       if ((block < blocks - 1) && block_drops_in[block+1])
-       change_stack (insn, &regstack, &block_stack_in[block+1],
+       change_stack (new, &regstack, &block_stack_in[block+1],
                      emit_insn_after);
     }