From 5ca8e6f76b92f52c2a6faa4ff5801469a8868160 Mon Sep 17 00:00:00 2001 From: Philip Blundell Date: Fri, 27 Aug 1999 07:02:37 +0000 Subject: [PATCH] jump.c (duplicate_loop_exit_test): Call reg_scan_update after creating new registers. * jump.c (duplicate_loop_exit_test): Call reg_scan_update after creating new registers. From-SVN: r28920 --- gcc/ChangeLog | 5 ++ gcc/jump.c | 138 +++++++++++++++++++++++++++++--------------------- 2 files changed, 84 insertions(+), 59 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2a903859a38..066ed4192f0d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 27 01:01:51 1999 Philip Blundell + + * jump.c (duplicate_loop_exit_test): Call reg_scan_update after + creating new registers. + 1999-08-26 23:09 -0700 Zack Weinberg * i386.h: Declare ix86_cpu_string, ix86_arch_string, diff --git a/gcc/jump.c b/gcc/jump.c index 9a9e9b252bf2..7a4caaae13c1 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -2587,7 +2587,7 @@ duplicate_loop_exit_test (loop_start) rtx loop_start; { rtx insn, set, reg, p, link; - rtx copy = 0; + rtx copy = 0, first_copy = 0; int num_insns = 0; rtx exitcode = NEXT_INSN (JUMP_LABEL (next_nonnote_insn (loop_start))); rtx lastexit; @@ -2700,65 +2700,72 @@ duplicate_loop_exit_test (loop_start) /* Now copy each insn. */ for (insn = exitcode; insn != lastexit; insn = NEXT_INSN (insn)) - switch (GET_CODE (insn)) - { - case BARRIER: - copy = emit_barrier_before (loop_start); - break; - case NOTE: - /* Only copy line-number notes. */ - if (NOTE_LINE_NUMBER (insn) >= 0) - { - copy = emit_note_before (NOTE_LINE_NUMBER (insn), loop_start); - NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn); - } - break; - - case INSN: - copy = emit_insn_before (copy_rtx (PATTERN (insn)), loop_start); - if (reg_map) - replace_regs (PATTERN (copy), reg_map, max_reg, 1); - - mark_jump_label (PATTERN (copy), copy, 0); - - /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will - make them. */ - for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) - if (REG_NOTE_KIND (link) != REG_LABEL) - REG_NOTES (copy) - = copy_rtx (gen_rtx_EXPR_LIST (REG_NOTE_KIND (link), - XEXP (link, 0), - REG_NOTES (copy))); - if (reg_map && REG_NOTES (copy)) - replace_regs (REG_NOTES (copy), reg_map, max_reg, 1); - break; - - case JUMP_INSN: - copy = emit_jump_insn_before (copy_rtx (PATTERN (insn)), loop_start); - if (reg_map) - replace_regs (PATTERN (copy), reg_map, max_reg, 1); - mark_jump_label (PATTERN (copy), copy, 0); - if (REG_NOTES (insn)) - { - REG_NOTES (copy) = copy_rtx (REG_NOTES (insn)); - if (reg_map) - replace_regs (REG_NOTES (copy), reg_map, max_reg, 1); - } - - /* If this is a simple jump, add it to the jump chain. */ - - if (INSN_UID (copy) < max_jump_chain && JUMP_LABEL (copy) - && simplejump_p (copy)) - { - jump_chain[INSN_UID (copy)] - = jump_chain[INSN_UID (JUMP_LABEL (copy))]; - jump_chain[INSN_UID (JUMP_LABEL (copy))] = copy; - } - break; + { + switch (GET_CODE (insn)) + { + case BARRIER: + copy = emit_barrier_before (loop_start); + break; + case NOTE: + /* Only copy line-number notes. */ + if (NOTE_LINE_NUMBER (insn) >= 0) + { + copy = emit_note_before (NOTE_LINE_NUMBER (insn), loop_start); + NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn); + } + break; + + case INSN: + copy = emit_insn_before (copy_rtx (PATTERN (insn)), loop_start); + if (reg_map) + replace_regs (PATTERN (copy), reg_map, max_reg, 1); + + mark_jump_label (PATTERN (copy), copy, 0); + + /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will + make them. */ + for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) + if (REG_NOTE_KIND (link) != REG_LABEL) + REG_NOTES (copy) + = copy_rtx (gen_rtx_EXPR_LIST (REG_NOTE_KIND (link), + XEXP (link, 0), + REG_NOTES (copy))); + if (reg_map && REG_NOTES (copy)) + replace_regs (REG_NOTES (copy), reg_map, max_reg, 1); + break; + + case JUMP_INSN: + copy = emit_jump_insn_before (copy_rtx (PATTERN (insn)), loop_start); + if (reg_map) + replace_regs (PATTERN (copy), reg_map, max_reg, 1); + mark_jump_label (PATTERN (copy), copy, 0); + if (REG_NOTES (insn)) + { + REG_NOTES (copy) = copy_rtx (REG_NOTES (insn)); + if (reg_map) + replace_regs (REG_NOTES (copy), reg_map, max_reg, 1); + } + + /* If this is a simple jump, add it to the jump chain. */ + + if (INSN_UID (copy) < max_jump_chain && JUMP_LABEL (copy) + && simplejump_p (copy)) + { + jump_chain[INSN_UID (copy)] + = jump_chain[INSN_UID (JUMP_LABEL (copy))]; + jump_chain[INSN_UID (JUMP_LABEL (copy))] = copy; + } + break; + + default: + abort (); + } - default: - abort (); - } + /* Record the first insn we copied. We need it so that we can + scan the copied insns for new pseudo registers. */ + if (! first_copy) + first_copy = copy; + } /* Now clean up by emitting a jump to the end label and deleting the jump at the start of the loop. */ @@ -2766,6 +2773,14 @@ duplicate_loop_exit_test (loop_start) { copy = emit_jump_insn_before (gen_jump (get_label_after (insn)), loop_start); + + /* Record the first insn we copied. We need it so that we can + scan the copied insns for new pseudo registers. This may not + be strictly necessary since we should have copied at least one + insn above. But I am going to be safe. */ + if (! first_copy) + first_copy = copy; + mark_jump_label (PATTERN (copy), copy, 0); if (INSN_UID (copy) < max_jump_chain && INSN_UID (JUMP_LABEL (copy)) < max_jump_chain) @@ -2777,6 +2792,11 @@ duplicate_loop_exit_test (loop_start) emit_barrier_before (loop_start); } + /* Now scan from the first insn we copied to the last insn we copied + (copy) for new pseudo registers. Do this after the code to jump to + the end label since that might create a new pseudo too. */ + reg_scan_update (first_copy, copy, max_reg); + /* Mark the exit code as the virtual top of the converted loop. */ emit_note_before (NOTE_INSN_LOOP_VTOP, exitcode); -- 2.43.5