diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2006-07-16 14:31:05 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2006-07-16 14:31:05 +0000 |
commit | 3e27aa84ef34539400456774ade5f2caaa20b5e9 (patch) | |
tree | 31b4477b0273cda78a13029da44c7a27c998faea /gcc/optabs.c | |
parent | c5ee132b4434507f7e970da1a987a237a59ce585 (diff) | |
download | gcc-3e27aa84ef34539400456774ade5f2caaa20b5e9.zip gcc-3e27aa84ef34539400456774ade5f2caaa20b5e9.tar.gz gcc-3e27aa84ef34539400456774ade5f2caaa20b5e9.tar.bz2 |
optabs.c (maybe_encapsulate_block): New function extracted from...
* optabs.c (maybe_encapsulate_block): New function extracted from...
(emit_libcall_block): ...here. Invoke it on the block of insns to
maybe emit REG_LIBCALL/REG_RETVAL notes around the block.
(emit_no_conflict_block): Likewise.
From-SVN: r115498
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index 5b50f9d..a961bd4 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3218,6 +3218,38 @@ no_conflict_move_test (rtx dest, rtx set, void *p0) p->must_stay = true; } +/* Encapsulate the block starting at FIRST and ending with LAST, which is + logically equivalent to EQUIV, so it gets manipulated as a unit if it + is possible to do so. */ + +static void +maybe_encapsulate_block (rtx first, rtx last, rtx equiv) +{ + if (!flag_non_call_exceptions || !may_trap_p (equiv)) + { + /* We can't attach the REG_LIBCALL and REG_RETVAL notes when the + encapsulated region would not be in one basic block, i.e. when + there is a control_flow_insn_p insn between FIRST and LAST. */ + bool attach_libcall_retval_notes = true; + rtx insn, next = NEXT_INSN (last); + + for (insn = first; insn != next; insn = NEXT_INSN (insn)) + if (control_flow_insn_p (insn)) + { + attach_libcall_retval_notes = false; + break; + } + + if (attach_libcall_retval_notes) + { + REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last, + REG_NOTES (first)); + REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, + REG_NOTES (last)); + } + } +} + /* Emit code to perform a series of operations on a multi-word quantity, one word at a time. @@ -3339,10 +3371,7 @@ emit_no_conflict_block (rtx insns, rtx target, rtx op0, rtx op1, rtx equiv) else first = NEXT_INSN (prev); - /* Encapsulate the block so it gets manipulated as a unit. */ - REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last, - REG_NOTES (first)); - REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, REG_NOTES (last)); + maybe_encapsulate_block (first, last, equiv); return last; } @@ -3496,30 +3525,7 @@ emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv) else first = NEXT_INSN (prev); - /* Encapsulate the block so it gets manipulated as a unit. */ - if (!flag_non_call_exceptions || !may_trap_p (equiv)) - { - /* We can't attach the REG_LIBCALL and REG_RETVAL notes - when the encapsulated region would not be in one basic block, - i.e. when there is a control_flow_insn_p insn between FIRST and LAST. - */ - bool attach_libcall_retval_notes = true; - next = NEXT_INSN (last); - for (insn = first; insn != next; insn = NEXT_INSN (insn)) - if (control_flow_insn_p (insn)) - { - attach_libcall_retval_notes = false; - break; - } - - if (attach_libcall_retval_notes) - { - REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last, - REG_NOTES (first)); - REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, - REG_NOTES (last)); - } - } + maybe_encapsulate_block (first, last, equiv); } /* Nonzero if we can perform a comparison of mode MODE straightforwardly. |