diff options
author | Richard Stallman <rms@gnu.org> | 1993-05-16 23:14:24 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-05-16 23:14:24 +0000 |
commit | 6bd4352429afca8da067b4fa3f52854ce80981a6 (patch) | |
tree | 2f78af2748784d1c2a7964ccca71f8f50bc3f8a5 /gcc/unroll.c | |
parent | 2dff5a062aaa8e6d326bcce2441adcf3c801fd23 (diff) | |
download | gcc-6bd4352429afca8da067b4fa3f52854ce80981a6.zip gcc-6bd4352429afca8da067b4fa3f52854ce80981a6.tar.gz gcc-6bd4352429afca8da067b4fa3f52854ce80981a6.tar.bz2 |
(initial_reg_note_copy, final_reg_note_copy): New functions.
(copy_loop_body): Use new function to copy REG_NOTES.
From-SVN: r4481
Diffstat (limited to 'gcc/unroll.c')
-rw-r--r-- | gcc/unroll.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c index 530babc1..71c26a0 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -1365,6 +1365,49 @@ calculate_giv_inc (pattern, src_insn, regno) return increment; } +/* Copy REG_NOTES, except for insn references, because not all insn_map + entries are valid yet. We do need to copy registers now though, because + the reg_map entries can change during copying. */ + +static rtx +initial_reg_note_copy (notes, map) + rtx notes; + struct inline_remap *map; +{ + rtx copy; + + if (notes == 0) + return 0; + + copy = rtx_alloc (GET_CODE (notes)); + PUT_MODE (copy, GET_MODE (notes)); + + if (GET_CODE (notes) == EXPR_LIST) + XEXP (copy, 0) = copy_rtx_and_substitute (XEXP (notes, 0), map); + else if (GET_CODE (notes) == INSN_LIST) + /* Don't substitute for these yet. */ + XEXP (copy, 0) = XEXP (notes, 0); + else + abort (); + + XEXP (copy, 1) = initial_reg_note_copy (XEXP (notes, 1), map); + + return copy; +} + +/* Fixup insn references in copied REG_NOTES. */ + +static void +final_reg_note_copy (notes, map) + rtx notes; + struct inline_remap *map; +{ + rtx note; + + for (note = notes; note; note = XEXP (note, 1)) + if (GET_CODE (note) == INSN_LIST) + XEXP (note, 0) = map->insn_map[INSN_UID (XEXP (note, 0))]; +} /* Copy each instruction in the loop, substituting from map as appropriate. This is very similar to a loop in expand_inline_function. */ @@ -1611,7 +1654,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, pattern = copy_rtx_and_substitute (pattern, map); copy = emit_insn (pattern); } - /* REG_NOTES will be copied later. */ + REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map); #ifdef HAVE_cc0 /* If this insn is setting CC0, it may need to look at @@ -1655,6 +1698,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, case JUMP_INSN: pattern = copy_rtx_and_substitute (PATTERN (insn), map); copy = emit_jump_insn (pattern); + REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map); if (JUMP_LABEL (insn) == start_label && insn == copy_end && ! last_iteration) @@ -1756,6 +1800,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, case CALL_INSN: pattern = copy_rtx_and_substitute (PATTERN (insn), map); copy = emit_call_insn (pattern); + REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map); #ifdef HAVE_cc0 if (cc0_insn) @@ -1806,7 +1851,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, } while (insn != copy_end); - /* Now copy the REG_NOTES. */ + /* Now finish coping the REG_NOTES. */ insn = copy_start; do { @@ -1814,8 +1859,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, if ((GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN || GET_CODE (insn) == CALL_INSN) && map->insn_map[INSN_UID (insn)]) - REG_NOTES (map->insn_map[INSN_UID (insn)]) - = copy_rtx_and_substitute (REG_NOTES (insn), map); + final_reg_note_copy (REG_NOTES (map->insn_map[INSN_UID (insn)]), map); } while (insn != copy_end); |